From planning-suite
Refactor code for improved quality and structure. Dispatches to code-refactor agent for large multi-file refactoring operations. AUTOMATICALLY INVOKE when: - "refactor this", "clean up", "reduce duplication", "DRY this up" - "simplify", "modernize", "restructure" - When detecting code duplication or technical debt NOT for: Bug fixes (fix the bug directly), feature additions (use superpowers:executing-plans)
How this skill is triggered — by the user, by Claude, or both
Slash command
/planning-suite:refactorThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Improve code quality and structure without changing behavior. Supports targeted
Improve code quality and structure without changing behavior. Supports targeted single-file cleanup and large multi-file restructuring.
From the invocation args, extract:
naming — improve variable/function namesduplication — extract shared logic, DRY upstructure — reorganize modules, improve cohesionmodernize — update to current language idiomsall — comprehensive refactoring (default)If no target specified, ask what to refactor.
Fast path (inline refactoring):
Agent path (dispatch):
When taking the agent path, create a tracking task:
TaskCreate({
subject: "Refactor [target] — [focus]",
description: "Multi-file refactoring via code-refactor agent. Focus: [focus].",
activeForm: "Refactoring [target]"
})
Mark in_progress on dispatch, completed when agent returns and tests pass.
Use the Agent tool:
subagent_type: "code-refactor"
prompt: "Refactor [target_files] with focus on [focus].
Preserve all existing behavior. Run tests after each change.
[If --dry-run: report proposed changes without applying.]"
After refactoring:
Provides a checklist for code reviews covering functionality, security, performance, maintainability, tests, and quality. Use for pull requests, audits, team standards, and developer training.
npx claudepluginhub whichguy/claude-craft --plugin planning-suite