donaldfilimon/abi / .agents/skills/refactor
refactor
VerifiedPlan, execute, and validate a codebase modernization or refactor with clean-slate thinking while preserving semantics. Use when the user asks how to approach a rewrite vs incremental change or what the risk is (strategy), is ready to apply a refactor plan safely (implementation), or asks whether a refactor broke anything or is complete (validation).
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 4.7 KB |
| references/implementation-playbook.md | markdown | 3.0 KB |
| references/strategy-guide.md | markdown | 1.3 KB |
| references/validation-checklist.md | markdown | 912 B |
references/strategy-guide.md
View on GitHub# Refactor Strategy Guide
## Strategy Selection Matrix
| Situation | Recommended Strategy | Rationale |
|-----------------------------|--------------------------|---------|
| Small isolated module, good tests | Direct clean rewrite | Low risk, high payoff |
| Core domain with many dependents | Phased (Strangler Fig) | Preserve behavior for consumers |
| Legacy with poor tests | Analysis first + parallel implementation | Reduce risk |
| Performance critical path | Measure → target design → incremental migration | Protect invariants |
## Clean Slate Questions
For any module ask:
1. What is the single responsibility in modern terms?
2. What are the ideal error and success paths?
3. Which current types/structures are historical accidents?
4. How would I test this if writing it fresh?
5. What modern language features remove the need for previous workarounds?
## Example Phased Plan Outline
1. **Discovery** (1-2 days)
- Extract contracts
- Identify modernization targets
2. **Parallel Modern Impl** (core module)
- Write new version beside old
- 100% parity test suite
3. **Strangler Introduction**
- Route 5% traffic / calls
- Monitor + expand
4. **Cutover + Deletion**
- Remove old after confidence gates
See the main SKILL.md for the high-level process.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirements | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |