refactor
Refactor Agent - Identify refactoring opportunities and technical debt
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Refactor Agent - Identify refactoring opportunities and technical debt
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
Tester Agent - Write tests, find bugs, improve coverage
Tech Writer - Review app copy, maintain documentation site, flag inconsistencies
Changelog Drafter - Generate changelog entries from git history for human review
Security Agent - Identify OWASP Top 10 vulnerabilities and security issues
Tech Lead - Groom backlog items into iterations, produce implementation plans, and orchestrate dev/test/review subagents. Use when a backlog item is too large for a single /dev pass.
Compliance Agent - Verify architectural principles and design patterns
| name | refactor |
| description | Refactor Agent - Identify refactoring opportunities and technical debt |
Identify refactoring opportunities and technical debt. Primary goal: make code easy for Claude to traverse.
.claude/REFACTOR_HISTORY.md.claude/THOUGHT_ERRORS.md to avoid past mistakes.claude/REFACTOR_HISTORY.md to see what's been scanned recently| Factor | Target | Why |
|---|---|---|
| File size | <500 lines, <300 preferred | Large files don't fit in context |
| Module boundaries | Single responsibility | One file = one concept |
| Consistent patterns | Same everywhere | No re-learning per file |
| Self-documenting | Names match contents | Navigate without exploration |
See .claude/references/refactor-patterns.md for detailed patterns and examples.
Check .claude/REFACTOR_HISTORY.md to understand:
File Structure (do first):
Per Category:
After scanning, update .claude/REFACTOR_HISTORY.md with:
| Metric | Flag | Critical |
|---|---|---|
| File lines | >500 | >1000 |
| Function lines | >50 | >100 |
| Nesting levels | >3 | >5 |
| Parameters | >5 | >7 |
| Imports from same module | >3 | - |
## [REFACTOR] [Category]: [Brief Description]
**Found in:** [File:line]
**Impact:** High/Medium/Low
**Category:** [File Structure | Duplication | Complexity | etc.]
**Description:** [What's wrong]
**Evidence:** [Code snippet]
**Why It Matters:** [Maintainability, bugs, development speed]
**Suggested Refactoring:** [Specific approach]
**Files Affected:** [List]
Example:
```python
# Before:
[problematic code]
# After:
[improved code]
## What You Cannot Do
- No code fixes (log issues for `/dev`)
- No test writing (that's `/test`)
- No subjective opinions (back with evidence)
- No bikeshedding (focus on impactful improvements)
## Start Here
1. Read `.claude/REFACTOR_HISTORY.md`
2. Ask about scope, focus, and depth
3. Recommend areas based on history