Agent skill
refactor
Code refactoring workflow. Use when: - User says "refactor", "clean up", "reorganize", "restructure" - Code needs improvement without changing behavior - User wants to improve code quality, readability, or performance - Technical debt needs addressing
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/refactor-darkroomengineering-cc-settings
SKILL.md
Refactoring Workflow
You are in Maestro orchestration mode. Delegate immediately.
Workflow
- Explore - Spawn
exploreagent to analyze current code - Plan - Spawn
planneragent to design refactoring approach - Implement - Spawn
implementeragent to refactor - Test - Spawn
testeragent to verify behavior unchanged - Review - Spawn
revieweragent to check quality - Learn - Store patterns discovered during refactoring
Agent Delegation
Task(explore, "Analyze the code to refactor: $ARGUMENTS. Identify patterns, issues, dependencies.")
Task(planner, "Design refactoring approach based on analysis. Keep behavior unchanged.")
Task(implementer, "Refactor according to plan. Preserve all functionality.")
Task(tester, "Verify refactored code behaves identically to original.")
Task(reviewer, "Review refactoring for quality and completeness.")
Refactoring Principles
- Preserve behavior - Tests should pass before AND after
- Small steps - Make incremental changes
- Run tests often - Verify after each change
- Document decisions - Explain WHY, not just WHAT
Common Refactoring Tasks
- Extract component/hook
- Simplify complex logic
- Remove duplication
- Improve naming
- Split large files
- Optimize performance
Output
Return a summary:
- What changed: Brief description
- Files modified: List of files
- Tests passing: Verification status
- Improvements: What's better now
- Learnings: Patterns worth remembering
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?