From xpowers
Diagnoses code smells, design traps, and risks with evidence; produces report deciding refactor vs rewrite and prioritizing targets.
How this skill is triggered — by the user, by Claude, or both
Slash command
/xpowers:refactoring-diagnosisThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
<skill_overview>
<skill_overview> Diagnose before refactoring: identify smells and traps with evidence, assess risk, and decide refactor vs rewrite before any code changes. </skill_overview>
<rigidity_level> MEDIUM FREEDOM - The required outputs and evidence standards are strict; the analysis depth and tools used can vary by codebase. </rigidity_level>
<quick_reference>
| Step | Action | Deliverable |
|---|---|---|
| 1 | Define scope and constraints | Scope statement |
| 2 | Gather evidence (code, tests, runtime behavior) | Evidence notes |
| 3 | Map evidence to smells/traps | Smell table |
| 4 | Assess risk and impact | Risk matrix |
| 5 | Decide refactor vs rewrite | Decision + rationale |
| 6 | Produce diagnosis report | Required report format |
| </quick_reference> |
<when_to_use>
<the_process>
State the specific module/component/system boundary you are diagnosing and what is out of scope.
Minimum evidence sources:
Use the catalogs in references:
references/smell-catalog.mdreferences/test-smells.mdreferences/concurrency-ipc-traps.mdFor each smell/trap, cite concrete evidence (file path, function, behavior).
Classify each smell by:
Rules of thumb:
Use this exact structure:
## Scope
- In scope:
- Out of scope:
- Constraints:
## Evidence
- Files reviewed:
- Entry points:
- Tests reviewed:
- Concurrency/IPC boundaries:
## Smells and Traps (Evidence-Backed)
| Smell/Trap | Evidence | Risk | Suggested Refactor Direction |
## Test Smells
| Test Smell | Evidence | Risk | Suggested Fix |
## Concurrency/IPC Traps
| Trap | Evidence | Risk | Suggested Fix |
## Risk Assessment
- Highest risk areas:
- Largest blast radius:
- Most likely regression vectors:
## Refactor vs Rewrite Decision
- Decision:
- Rationale:
## Top Refactor Targets (Prioritized)
1.
2.
3.
## Non-goals
-
## Open Questions
-
</the_process>
<common_rationalizations>
All of these mean: stop and complete diagnosis first.
<red_flags>
3plugins reuse this skill
First indexed Jul 15, 2026
npx claudepluginhub dpolishuk/xpowers --plugin xpowersIdentifies code smells, assesses refactoring risk, and builds incremental execution plans with rollback strategies. Activates on refactoring, code cleanup, tech debt, or duplication reduction requests.
Guides safe refactoring using Code Complete's fix-first-then-refactor discipline: decides between refactor, rewrite, and fix-first; enforces separate commits; applies small-change rigor.
Guides safe code refactoring: small steps, tests, preserving behavior. Covers Fowler's catalog, legacy code strategies, and code smells.