Agent skill
refactor
Refactor code with code-simplifier
Stars
163
Forks
31
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/refactor-fradser-dotclaude
SKILL.md
Refactor Command
Execute automated refactoring for $ARGUMENTS using refactor:code-simplifier agent.
Phase 1: Determine Target Scope
Goal: Identify files to refactor based on arguments or session context.
Actions:
- If arguments provided: verify as file/directory paths using Glob
- If paths exist: use them directly as refactoring scope
- If paths don't exist: treat arguments as semantic query, search codebase with Grep
- If no arguments: run
git diff --name-onlyto find recently modified code files - If no recent changes found: inform user and exit without refactoring
See references/scope-determination.md for search strategies and edge cases.
Phase 2: Launch Refactoring Agent
Goal: Execute refactor:code-simplifier agent with aggressive mode enabled.
Actions:
- Launch
refactor:code-simplifieragent with target scope and aggressive mode flag - Pass scope determination method (paths, semantic query, or session context)
- Agent auto-loads
refactor:best-practicesskill and applies language-specific patterns
See references/agent-configuration.md for detailed Task parameters.
Phase 3: Summary
Goal: Report comprehensive summary of changes.
Actions:
- Report total files refactored and changes categorized by improvement type
- List best practices applied and legacy code removed
- Suggest tests to run and provide rollback command:
git checkout -- <files>
See references/output-requirements.md for detailed summary format.
Requirements
- Execute immediately without user confirmation
- Refactor ALL matching files when semantic search returns multiple results
- Direct users to
/refactor-projectfor project-wide scope
Didn't find tool you were looking for?