← Back to Skills Marketplace
Code Refactor
by
yuyonghao-123
· GitHub ↗
· v0.1.0
· MIT-0
146
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install yuyonghao-code-refactor
Description
Analyze code quality issues, detect code smells, and automatically apply refactoring suggestions with preview, apply, and rollback support.
Usage Guidance
This skill appears to do what it claims: analyze and propose/apply refactorings locally. Main cautions: 1) The validator runs 'npm test' (child_process) in the repository — that will execute whatever scripts are defined in package.json, which could run arbitrary code. 2) The applier writes changes to files and creates .backup files; although a rollback is provided, always inspect the generated diff before applying. Recommendations: run the skill in dry-run mode first, review the generated plan and diffs, run it on a copy/branch or in a sandbox, verify package.json test scripts before allowing non-dry-run operations, and keep version control so you can revert if needed.
Capability Analysis
Type: OpenClaw Skill
Name: yuyonghao-code-refactor
Version: 0.1.0
The skill bundle implements a code refactoring assistant that includes high-risk capabilities such as file system modification (src/applier.js) and arbitrary command execution (src/validator.js). Specifically, the `TestValidator` class uses `child_process.execSync` to run test commands, which is a potential vector for command injection if the command or environment is manipulated. While these behaviors are functionally aligned with the stated purpose of refactoring and validating code, they constitute significant security risks. No evidence of intentional malice, data exfiltration, or prompt injection was found.
Capability Assessment
Purpose & Capability
Name/description match the included code: analyzer, refactorer, applier, and validator. The files implement analysis, plan generation, dry-run/apply/rollback, and test validation — all expected for a refactoring tool. There are no unrelated environment variables, binaries, or config paths.
Instruction Scope
SKILL.md instructs local analysis/refactor/apply commands that align with the code. The validator runs 'npm test' via child_process; this is expected for test validation but means the skill will execute repository test scripts (arbitrary code in the project). The applier writes edits to files and creates backups. Review diffs and backups before applying changes.
Install Mechanism
No install spec is provided (instruction-only install), so nothing is downloaded or executed at install time. The skill bundles Node source files; execution uses local Node runtime. package.json declares engines >=18 but no external package installs are performed by the skill itself.
Credentials
The skill requests no environment variables, credentials, or unrelated config paths. It accesses only local files (fs) and runs local commands — appropriate for a code refactoring tool.
Persistence & Privilege
The skill does not request always:true and does not alter other skills. However, it can modify repository files (writes, backups, rollbacks) and execute 'npm test' in the working directory. Those capabilities are legitimate for refactoring but grant file-modification and code-execution privileges within the repo.
How to Use
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install yuyonghao-code-refactor - After installation, invoke the skill by name or use
/yuyonghao-code-refactor - Provide required inputs per the skill's parameter spec and get structured output
Version History
v0.1.0
- Initial release of Code Refactor Skill.
- Provides code quality analysis (detects code smells, calculates complexity, checks standards).
- Supports automated refactoring (extract functions, rename variables, simplify expressions, remove duplication, optimize imports).
- Includes change application with diff previews, dry-run, and rollback.
- Validates changes by running tests and checking coverage.
- CLI and configuration options available for flexibility.
Metadata
Frequently Asked Questions
What is Code Refactor?
Analyze code quality issues, detect code smells, and automatically apply refactoring suggestions with preview, apply, and rollback support. It is an AI Agent Skill for Claude Code / OpenClaw, with 146 downloads so far.
How do I install Code Refactor?
Run "/install yuyonghao-code-refactor" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is Code Refactor free?
Yes, Code Refactor is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does Code Refactor support?
Code Refactor is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created Code Refactor?
It is built and maintained by yuyonghao-123 (@yuyonghao-123); the current version is v0.1.0.
More Skills