Activate when the user asks to fix, debug, or make a specific feature/module/area work. Key triggers:
This is NOT for quick single-bug fixes (use systematic-debugging for that). This is for when an entire feature or module needs systematic repair — tracing every dependency, reading logs, checking tests, mapping the full dependency graph.
digraph when_to_use {
"User reports feature broken" [shape=diamond];
"Single bug or symptom?" [shape=diamond];
"Use systematic-debugging" [shape=box];
"Entire feature/module needs repair?" [shape=diamond];
"Use focused-fix" [shape=box];
"Something else" [shape=box];
"User reports feature broken" -> "Single bug or symptom?";
"Single bug or symptom?" -> "Use systematic-debugging" [label="yes"];
"Single bug or symptom?" -> "Entire feature/module needs repair?" [label="no"];
"Entire feature/module needs repair?" -> "Use focused-fix" [label="yes"];
"Entire feature/module needs repair?" -> "Something else" [label="no"];
}
NO FIXES WITHOUT COMPLETING SCOPE → TRACE → DIAGNOSE FIRST
If you haven't finished Phase 3, you cannot propose fixes. Period.
Violating the letter of these phases is violating the spirit of focused repair.
digraph phases {
rankdir=LR;
SCOPE [shape=box, label="Phase 1\nSCOPE"];
TRACE [shape=box, label="Phase 2\nTRACE"];
DIAGNOSE [shape=box, label="Phase 3\nDIAGNOSE"];
FIX [shape=box, label="Phase 4\nFIX"];
VERIFY [shape=box, label="Phase 5\nVERIFY"];
SCOPE -> TRACE -> DIAGNOSE -> FIX -> VERIFY;
FIX -> DIAGNOSE [label="fix broke\nsomething else"];
FIX -> ESCALATE [label="3+ fixes\ncreate new issues"];
ESCALATE [shape=doubleoctagon, label="STOP\nQuestion Architecture\nDiscuss with User"];
}
Before touching any code, understand the full scope of the feature.
FEATURE SCOPE:
Primary path: src/features/auth/
Entry points: [files that are imported by other parts of the app]
Internal files: [files only used within this feature]
Total files: N
Total lines: N
Trace every connection this feature has to the rest of the codebase.
INBOUND (what this feature imports):
OUTBOUND (what imports this feature):
Output format:
DEPENDENCY MAP:
Inbound (this feature depends on):
src/lib/db.ts → used in auth/repository.ts (getUserById, createUser)
src/lib/jwt.ts → used in auth/service.ts (signToken, verifyToken)
@prisma/client → used in auth/repository.ts
process.env.JWT_SECRET → used in auth/service.ts
process.env.DATABASE_URL → used via prisma
Outbound (depends on this feature):
src/app/api/login/route.ts → imports { login } from auth/service
src/app/api/register/route.ts → imports { register } from auth/service
src/middleware.ts → imports { verifyToken } from auth/service
Env vars required: JWT_SECRET, DATABASE_URL
Config files: prisma/schema.prisma (User model)
Systematically check for problems. Run ALL of these checks:
CODE QUALITY:
any at interfaces)RUNTIME:
TESTS:
LOGS & ERRORS:
git log --oneline -20 -- <feature-path>
git log --oneline -5 --all -- <files that this feature depends on>
CONFIGURATION:
ROOT-CAUSE CONFIRMATION: For each CRITICAL issue found, confirm root cause before adding it to the fix list:
superpowers:systematic-debugging Phase 1 (Root Cause Investigation) to confirm before proceedingRISK LABELING: Assign each issue a risk label:
| Risk | Criteria |
|---|---|
| HIGH | Public API surface / breaking interface contract / DB schema / auth or security logic / widely imported module (>3 callers) / git hotspot |
| MED | Internal module with tests / shared utility / config with runtime impact / internal callers of changed functions |
| LOW | Leaf module / isolated file / test-only change / single-purpose helper with no callers |
Output format:
DIAGNOSIS REPORT:
Issues found: N
CRITICAL:
1. [HIGH] [file:line] — description of issue. Root cause: [confirmed explanation]
2. [HIGH] [file:line] — description of issue. Root cause: [confirmed explanation]
WARNINGS:
1. [MED] [file:line] — description of issue
2. [LOW] [file:line] — description of issue
TESTS:
Ran: N tests
Passed: N
Failed: N
[list each failure with one-line summary]
Fix issues in this EXACT order:
Rules:
ESCALATION RULE — 3-Strike Architecture Check: If 3+ fixes in this phase create NEW issues (not pre-existing ones), STOP immediately.
This pattern indicates an architectural problem, not a bug collection:
Action: Stop fixing. Tell the user: "3+ fixes have cascaded into new issues. This suggests the feature's architecture may need rethinking, not patching. Here's what I've found: [summary]. Should we continue fixing symptoms or discuss restructuring?"
Do NOT attempt fix #4 without this discussion.
Output after each fix:
FIX #1:
File: auth/service.ts:45
Issue: signToken called with wrong argument order
Change: swapped (expiresIn, payload) to (payload, expiresIn)
Test: auth.test.ts → PASSES
After all fixes are applied:
Final output:
FOCUSED FIX COMPLETE:
Feature: auth
Files changed: 4
Total fixes: 7
Tests: 23/23 passing
Regressions: 0
Changes:
1. auth/service.ts — fixed token signing argument order
2. auth/repository.ts — added null check for user lookup
3. auth/middleware.ts — fixed async error handling
4. auth/types.ts — aligned UserResponse type with actual DB schema
Consumers verified:
- src/app/api/login/route.ts ✅
- src/app/api/register/route.ts ✅
- src/middleware.ts ✅
If you catch yourself thinking any of these, you are skipping phases:
ALL of these mean: Return to the phase you're supposed to be in.
| Excuse | Reality |
|---|---|
| "The feature is small, I don't need all 5 phases" | Small features have dependencies too. Phases 1-2 take minutes for small features — do them. |
| "I already know this codebase" | Knowledge decays. Trace the actual imports, don't rely on memory. |
| "The user wants speed, not process" | Skipping phases causes rework. Systematic is faster than thrashing. |
| "Only one file is broken" | If only one file were broken, the user would say "fix this bug", not "make the feature work." |
| "I fixed the tests, so it works" | Tests can pass while consumers are broken. Verify Phase 5 fully. |
| "The dependency map is too big to trace" | Then the feature is too big to fix without tracing. That's exactly why you need it. |
| "Root cause is obvious, I don't need to confirm" | "Obvious" root causes are wrong 40% of the time. Confirm with evidence. |
| "3 cascading failures is normal for a big fix" | 3 cascading failures means you're patching symptoms of an architectural problem. |
| Anti-Pattern | Why It's Wrong |
|---|---|
| Starting to fix code before mapping all dependencies | You'll miss root causes and create whack-a-mole fixes |
| Fixing only the file the user mentioned | Related files likely have issues too |
| Ignoring environment variables and configuration | Many "code bugs" are actually config issues |
| Skipping the test run phase | You can't verify fixes without running tests |
| Making changes outside the feature folder without explaining why | Unexpected side effects confuse the user |
| Fixing symptoms in consumer files instead of root cause in feature | Band-aids that break when the next consumer appears |
| Declaring "done" without running verification tests | Untested fixes are unverified fixes |
| Changing the public API without updating all consumers | Breaks everything that depends on the feature |
superpowers:systematic-debugging — Use within Phase 3 for root-cause tracing of individual complex bugssuperpowers:verification-before-completion — Use within Phase 5 before claiming the feature is fixedscope — If you need to understand blast radius before starting, run scope first then focused-fix| Phase | Key Action | Output |
|---|---|---|
| SCOPE | Read every file, map entry points | Feature manifest |
| TRACE | Map inbound + outbound dependencies | Dependency map |
| DIAGNOSE | Check code, runtime, tests, logs, config | Diagnosis report |
| FIX | Fix in order: deps → types → logic → tests → integration | Fix log per issue |
| VERIFY | Run all tests, check consumers, summarize | Completion report |