| diataxis_type | how-to |
|---|---|
| diataxis_goal | Run targeted refactoring with --focus to constrain analysis to specific disciplines |
The --focus flag constrains a refactoring run to specific disciplines, spawning only the agents needed for that analysis. This reduces overhead and speeds up targeted reviews.
- Refactor plugin installed and working (see Tutorial)
- Familiarity with the agent roles (see Agent Reference)
| Value | Agents spawned | Scores produced |
|---|---|---|
security |
refactor-test, refactor-code, code-reviewer | Security Posture |
architecture |
refactor-test, refactor-code, architect | Clean Code, Architecture |
simplification |
refactor-test, refactor-code, simplifier | Simplification |
code |
refactor-test, refactor-code, architect, code-reviewer | Clean Code, Architecture, Security Posture |
discovery |
refactor-test, refactor-code, code-explorer | (Discovery only — codebase map) |
| (none) | all 6 | Clean Code, Architecture, Security Posture |
The refactor-test and refactor-code agents always spawn regardless of focus. They provide the safety net (tests must pass) and fix capability (resolve failures).
/refactor --focus=security src/auth/Only the code-reviewer agent analyzes your code (quality + security). The run defaults to 1 iteration. The final report includes a Security Posture Score.
/refactor --focus=architecture src/api/The architect agent reviews structure and the refactor-code agent implements the top 3 optimizations. Produces Clean Code and Architecture scores.
/refactor --focus=simplification src/utils/The simplifier agent operates directly on the scope (no architect plan). Focuses on naming clarity, control flow, redundancy, and style. Produces a Simplification Score.
/refactor --focus=code src/models/Equivalent to --focus=architecture — the architect provides the optimization plan, the code agent implements it. No security review or simplification pass.
/refactor --focus=security,architecture src/Multiple values are comma-separated. The agent set is the union of each focus area's agents. This example spawns: refactor-test, refactor-code, architect, and code-reviewer (4 of 6 agents).
Focused runs default to 1 iteration. Override with --iterations:
/refactor --focus=security --iterations=3 src/auth/| Scenario | Recommended focus |
|---|---|
| Security audit before release | --focus=security |
| Design review for architecture discussion | --focus=architecture |
| Quick cleanup of messy code | --focus=simplification |
| Full refactor with code improvements | --focus=code or no flag |
| Pre-merge security + architecture check | --focus=security,architecture |
- Agent Reference — agent specifications and focus mode activation
- Quality Score Reference — scoring rubrics for each focus mode
- How to Scope Refactoring Effectively — complementary to focus narrowing
- Troubleshooting — common focus mode issues