Focused Fix — Deep-Dive Feature Repair
Use when the user asks to fix, debug, or make a specific feature/module/area work end-to-end.
How to use it
Claude Code
- Run the line below. It pulls the whole folder into
~/.claude/skills/focused-fix. - Describe your job in plain words. Claude Code follows the skill from there.
npx degit alirezarezvani/claude-skills/engineering/skills/focused-fix#main ~/.claude/skills/focused-fixFor one project only, change the path to .claude/skills/focused-fix.
Claude (web or desktop app)
- On this page open ⋯ → Download .md.
- Save it as SKILL.md in a folder, zip the folder, then Customize → Skills → + → Create skill → Upload a skill.
- Pick the file and Save. Claude shows the name and description and runs a security scan.
- Check the skill is switched on.
- Start a new chat and describe your job in plain words. The AI follows the skill from there.
ChatGPT or another app
- ChatGPT: make a Project and paste it into Instructions.
- Neither? Paste it at the top of a new chat — it works for that chat.
Not working?
- Check which app you pasted it into — the steps above name the right one.
- Some skills need the paid tier of Claude or ChatGPT.
Paste into Claude, ChatGPT or Cursor.
Source of Focused Fix — Deep-Dive Feature Repair
Show the full text319 lines
| name | description |
|---|---|
| focused-fix | Use when the user asks to fix, debug, or make a specific feature/module/area work end-to-end. Triggers: 'make X work', 'fix the Y feature', 'the Z module is broken', 'focus on [area]'. Not for quick single-bug fixes — this is for systematic deep-dive repair across all files and dependencies. |
Focused Fix — Deep-Dive Feature Repair
When to Use
Activate when the user asks to fix, debug, or make a specific feature/module/area work. Key triggers:
- "make X work"
- "fix the Y feature"
- "the Z module is broken"
- "focus on [area]"
- "this feature needs to work properly"
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"];
}
The Iron Law
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.
Protocol — STRICTLY follow these 5 phases IN ORDER
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"];
}
Phase 1: SCOPE — Map the Feature Boundary
Before touching any code, understand the full scope of the feature.
- Ask the user: "Which feature/folder should I focus on?" if not already clear
- Identify the PRIMARY folder/files for this feature
- Map EVERY file in that folder — read each one, understand its purpose
- Create a feature manifest:
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
Phase 2: TRACE — Map All Dependencies (Inside AND Outside)
Trace every connection this feature has to the rest of the codebase.
INBOUND (what this feature imports):
- For every import statement in every file in the feature folder:
- Trace it to its source
- Verify the source file exists
- Verify the imported entity (function, type, component) exists and is exported
- Check if the types/signatures match what the feature expects
- Check for:
- Environment variables used (grep for process.env, import.meta.env, os.environ, etc.)
- Config files referenced
- Database models/schemas used
- API endpoints called
- Third-party packages imported
OUTBOUND (what imports this feature):
- Search the entire codebase for imports from this feature folder
- For each consumer:
- Verify they're importing entities that actually exist
- Check if they're using the correct API/interface
- Note if any consumers are using deprecated patterns
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)
Phase 3: DIAGNOSE — Find Every Issue
Systematically check for problems. Run ALL of these checks:
CODE QUALITY:
- Every import resolves to a real file/export
- No circular dependencies within the feature
- Types are consistent across boundaries (no
anyat interfaces) - Error handling exists for all async operations
- No TODO/FIXME/HACK comments indicating known issues
RUNTIME:
- All required environment variables are set (check .env)
- Database migrations are up to date (if applicable)
- API endpoints return expected shapes
- No hardcoded values that should be configurable
TESTS:
- Run ALL tests related to this feature: find them by searching for imports from the feature folder
- Record every failure with full error output
- Check test coverage — are there untested code paths?
LOGS & ERRORS:
- Search for any log files, error reports, or Sentry-style error tracking
- Check git log for recent changes to this feature:
git log --oneline -20 -- <feature-path> - Check if any recent commits might have broken something:
git log --oneline -5 --all -- <files that this feature depends on>
CONFIGURATION:
- Verify all config files this feature depends on are valid
- Check for mismatches between development and production configs
- Verify third-party service credentials are valid (if testable)
ROOT-CAUSE CONFIRMATION: For each CRITICAL issue found, confirm root cause before adding it to the fix list:
- State clearly: "I think X is the root cause because Y"
- Trace the data/control flow backward to verify — don't trust surface-level symptoms
- If the issue spans multiple components, add diagnostic logging at each boundary to identify which layer fails
- REQUIRED SUB-SKILL: For complex bugs found during diagnosis, apply
superpowers:systematic-debuggingPhase 1 (Root Cause Investigation) to confirm before proceeding
RISK 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]
Phase 4: FIX — Repair Everything Systematically
Fix issues in this EXACT order:
- DEPENDENCIES FIRST — fix broken imports, missing packages, wrong versions
- TYPES SECOND — fix type mismatches at feature boundaries
- LOGIC THIRD — fix actual business logic bugs
- TESTS FOURTH — fix or create tests for each fix
- INTEGRATION LAST — verify the feature works end-to-end with its consumers
Rules:
- Fix ONE issue at a time
- After each fix, run the related test to confirm it works
- If a fix breaks something else, STOP and re-evaluate (go back to DIAGNOSE)
- Keep a running log of every change made
- Never change code outside the feature folder without explicitly stating why
- Fix HIGH-risk issues before MED, MED before LOW
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:
- Each fix reveals new shared state / coupling / problem in a different place
- Fixes require "massive refactoring" to implement
- Each fix creates new symptoms elsewhere
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
Phase 5: VERIFY — Confirm Everything Works
After all fixes are applied:
- Run ALL tests in the feature folder — every single one must pass
- Run ALL tests in files that IMPORT from this feature — must pass
- Run the full test suite if available — check for regressions
- If the feature has a UI, describe how to manually verify it
- Summarize all changes made
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 ✅
Red Flags — STOP and Return to Current Phase
If you catch yourself thinking any of these, you are skipping phases:
- "I can see the bug, let me just fix it" → STOP. You haven't traced dependencies yet.
- "Scoping is overkill, it's obviously just this file" → STOP. That's always wrong for feature-level fixes.
- "I'll map dependencies after I fix the obvious stuff" → STOP. You'll miss root causes.
- "The user said fix X, so I only need to look at X" → STOP. Features have dependencies.
- "Tests are passing so I'm done" → STOP. Did you run consumer tests too?
- "I don't need to check env vars for this" → STOP. Config issues masquerade as code bugs.
- "One more fix should do it" (after 2+ cascading failures) → STOP. Escalate.
- "I'll skip the diagnosis report, the fixes are obvious" → STOP. Write it down.
ALL of these mean: Return to the phase you're supposed to be in.
Common Rationalizations
| 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-Patterns — NEVER do these
| 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 |
Related Skills
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
Quick Reference
| 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 |
| 1 | |
| 2 | name "focused-fix" |
| 3 | description "Use when the user asks to fix, debug, or make a specific feature/module/area work end-to-end. Triggers: 'make X work', 'fix the Y feature', 'the Z module is broken', 'focus on [area]'. Not for quick single-bug fixes — this is for systematic deep-dive repair across all files and dependencies." |
| 4 | |
| 5 | |
| 6 | # Focused Fix — Deep-Dive Feature Repair |
| 7 | |
| 8 | ## When to Use |
| 9 | |
| 10 | Activate when the user asks to fix, debug, or make a specific feature/module/area work. Key triggers: |
| 11 | "make X work" |
| 12 | "fix the Y feature" |
| 13 | "the Z module is broken" |
| 14 | "focus on [area]" |
| 15 | "this feature needs to work properly" |
| 16 | |
| 17 | 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. |
| 18 | |
| 19 | |
| 20 | digraph when_to_use { |
| 21 | "User reports feature broken" [shape=diamond]; |
| 22 | "Single bug or symptom?" [shape=diamond]; |
| 23 | "Use systematic-debugging" [shape=box]; |
| 24 | "Entire feature/module needs repair?" [shape=diamond]; |
| 25 | "Use focused-fix" [shape=box]; |
| 26 | "Something else" [shape=box]; |
| 27 | |
| 28 | "User reports feature broken" -> "Single bug or symptom?"; |
| 29 | "Single bug or symptom?" -> "Use systematic-debugging" [label="yes"]; |
| 30 | "Single bug or symptom?" -> "Entire feature/module needs repair?" [label="no"]; |
| 31 | "Entire feature/module needs repair?" -> "Use focused-fix" [label="yes"]; |
| 32 | "Entire feature/module needs repair?" -> "Something else" [label="no"]; |
| 33 | } |
| 34 | |
| 35 | |
| 36 | ## The Iron Law |
| 37 | |
| 38 | |
| 39 | NO FIXES WITHOUT COMPLETING SCOPE → TRACE → DIAGNOSE FIRST |
| 40 | |
| 41 | |
| 42 | If you haven't finished Phase 3, you cannot propose fixes. Period. |
| 43 | |
| 44 | **Violating the letter of these phases is violating the spirit of focused repair.** |
| 45 | |
| 46 | ## Protocol — STRICTLY follow these 5 phases IN ORDER |
| 47 | |
| 48 | |
| 49 | digraph phases { |
| 50 | rankdir=LR; |
| 51 | SCOPE [shape=box, label="Phase 1\nSCOPE"]; |
| 52 | TRACE [shape=box, label="Phase 2\nTRACE"]; |
| 53 | DIAGNOSE [shape=box, label="Phase 3\nDIAGNOSE"]; |
| 54 | FIX [shape=box, label="Phase 4\nFIX"]; |
| 55 | VERIFY [shape=box, label="Phase 5\nVERIFY"]; |
| 56 | |
| 57 | SCOPE -> TRACE -> DIAGNOSE -> FIX -> VERIFY; |
| 58 | FIX -> DIAGNOSE [label="fix broke\nsomething else"]; |
| 59 | FIX -> ESCALATE [label="3+ fixes\ncreate new issues"]; |
| 60 | ESCALATE [shape=doubleoctagon, label="STOP\nQuestion Architecture\nDiscuss with User"]; |
| 61 | } |
| 62 | |
| 63 | |
| 64 | ### Phase 1: SCOPE — Map the Feature Boundary |
| 65 | |
| 66 | Before touching any code, understand the full scope of the feature. |
| 67 | |
| 68 | Ask the user: "Which feature/folder should I focus on?" if not already clear |
| 69 | Identify the PRIMARY folder/files for this feature |
| 70 | Map EVERY file in that folder — read each one, understand its purpose |
| 71 | Create a feature manifest: |
| 72 | |
| 73 | |
| 74 | FEATURE SCOPE: |
| 75 | Primary path: src/features/auth/ |
| 76 | Entry points: [files that are imported by other parts of the app] |
| 77 | Internal files: [files only used within this feature] |
| 78 | Total files: N |
| 79 | Total lines: N |
| 80 | |
| 81 | |
| 82 | ### Phase 2: TRACE — Map All Dependencies (Inside AND Outside) |
| 83 | |
| 84 | Trace every connection this feature has to the rest of the codebase. |
| 85 | |
| 86 | **INBOUND (what this feature imports):** |
| 87 | For every import statement in every file in the feature folder: |
| 88 | Trace it to its source |
| 89 | Verify the source file exists |
| 90 | Verify the imported entity (function, type, component) exists and is exported |
| 91 | Check if the types/signatures match what the feature expects |
| 92 | Check for: |
| 93 | Environment variables used (grep for process.env, import.meta.env, os.environ, etc.) |
| 94 | Config files referenced |
| 95 | Database models/schemas used |
| 96 | API endpoints called |
| 97 | Third-party packages imported |
| 98 | |
| 99 | **OUTBOUND (what imports this feature):** |
| 100 | Search the entire codebase for imports from this feature folder |
| 101 | For each consumer: |
| 102 | Verify they're importing entities that actually exist |
| 103 | Check if they're using the correct API/interface |
| 104 | Note if any consumers are using deprecated patterns |
| 105 | |
| 106 | Output format: |
| 107 | |
| 108 | DEPENDENCY MAP: |
| 109 | Inbound (this feature depends on): |
| 110 | src/lib/db.ts → used in auth/repository.ts (getUserById, createUser) |
| 111 | src/lib/jwt.ts → used in auth/service.ts (signToken, verifyToken) |
| 112 | @prisma/client → used in auth/repository.ts |
| 113 | process.env.JWT_SECRET → used in auth/service.ts |
| 114 | process.env.DATABASE_URL → used via prisma |
| 115 | |
| 116 | Outbound (depends on this feature): |
| 117 | src/app/api/login/route.ts → imports { login } from auth/service |
| 118 | src/app/api/register/route.ts → imports { register } from auth/service |
| 119 | src/middleware.ts → imports { verifyToken } from auth/service |
| 120 | |
| 121 | Env vars required: JWT_SECRET, DATABASE_URL |
| 122 | Config files: prisma/schema.prisma (User model) |
| 123 | |
| 124 | |
| 125 | ### Phase 3: DIAGNOSE — Find Every Issue |
| 126 | |
| 127 | Systematically check for problems. Run ALL of these checks: |
| 128 | |
| 129 | **CODE QUALITY:** |
| 130 | [ ] Every import resolves to a real file/export |
| 131 | [ ] No circular dependencies within the feature |
| 132 | [ ] Types are consistent across boundaries (no `any` at interfaces) |
| 133 | [ ] Error handling exists for all async operations |
| 134 | [ ] No TODO/FIXME/HACK comments indicating known issues |
| 135 | |
| 136 | **RUNTIME:** |
| 137 | [ ] All required environment variables are set (check .env) |
| 138 | [ ] Database migrations are up to date (if applicable) |
| 139 | [ ] API endpoints return expected shapes |
| 140 | [ ] No hardcoded values that should be configurable |
| 141 | |
| 142 | **TESTS:** |
| 143 | [ ] Run ALL tests related to this feature: find them by searching for imports from the feature folder |
| 144 | [ ] Record every failure with full error output |
| 145 | [ ] Check test coverage — are there untested code paths? |
| 146 | |
| 147 | **LOGS & ERRORS:** |
| 148 | [ ] Search for any log files, error reports, or Sentry-style error tracking |
| 149 | [ ] Check git log for recent changes to this feature: `git log --oneline -20 -- <feature-path>` |
| 150 | [ ] Check if any recent commits might have broken something: `git log --oneline -5 --all -- <files that this feature depends on>` |
| 151 | |
| 152 | **CONFIGURATION:** |
| 153 | [ ] Verify all config files this feature depends on are valid |
| 154 | [ ] Check for mismatches between development and production configs |
| 155 | [ ] Verify third-party service credentials are valid (if testable) |
| 156 | |
| 157 | **ROOT-CAUSE CONFIRMATION:** |
| 158 | For each CRITICAL issue found, confirm root cause before adding it to the fix list: |
| 159 | State clearly: "I think X is the root cause because Y" |
| 160 | Trace the data/control flow backward to verify — don't trust surface-level symptoms |
| 161 | If the issue spans multiple components, add diagnostic logging at each boundary to identify which layer fails |
| 162 | **REQUIRED SUB-SKILL:** For complex bugs found during diagnosis, apply `superpowers:systematic-debugging` Phase 1 (Root Cause Investigation) to confirm before proceeding |
| 163 | |
| 164 | **RISK LABELING:** |
| 165 | Assign each issue a risk label: |
| 166 | |
| 167 | | Risk | Criteria | |
| 168 | |---|---| |
| 169 | | HIGH | Public API surface / breaking interface contract / DB schema / auth or security logic / widely imported module (>3 callers) / git hotspot | |
| 170 | | MED | Internal module with tests / shared utility / config with runtime impact / internal callers of changed functions | |
| 171 | | LOW | Leaf module / isolated file / test-only change / single-purpose helper with no callers | |
| 172 | |
| 173 | Output format: |
| 174 | |
| 175 | DIAGNOSIS REPORT: |
| 176 | Issues found: N |
| 177 | |
| 178 | CRITICAL: |
| 179 | 1. [HIGH] [file:line] — description of issue. Root cause: [confirmed explanation] |
| 180 | 2. [HIGH] [file:line] — description of issue. Root cause: [confirmed explanation] |
| 181 | |
| 182 | WARNINGS: |
| 183 | 1. [MED] [file:line] — description of issue |
| 184 | 2. [LOW] [file:line] — description of issue |
| 185 | |
| 186 | TESTS: |
| 187 | Ran: N tests |
| 188 | Passed: N |
| 189 | Failed: N |
| 190 | [list each failure with one-line summary] |
| 191 | |
| 192 | |
| 193 | ### Phase 4: FIX — Repair Everything Systematically |
| 194 | |
| 195 | Fix issues in this EXACT order: |
| 196 | |
| 197 | **DEPENDENCIES FIRST** — fix broken imports, missing packages, wrong versions |
| 198 | **TYPES SECOND** — fix type mismatches at feature boundaries |
| 199 | **LOGIC THIRD** — fix actual business logic bugs |
| 200 | **TESTS FOURTH** — fix or create tests for each fix |
| 201 | **INTEGRATION LAST** — verify the feature works end-to-end with its consumers |
| 202 | |
| 203 | Rules: |
| 204 | Fix ONE issue at a time |
| 205 | After each fix, run the related test to confirm it works |
| 206 | If a fix breaks something else, STOP and re-evaluate (go back to DIAGNOSE) |
| 207 | Keep a running log of every change made |
| 208 | Never change code outside the feature folder without explicitly stating why |
| 209 | Fix HIGH-risk issues before MED, MED before LOW |
| 210 | |
| 211 | **ESCALATION RULE — 3-Strike Architecture Check:** |
| 212 | If 3+ fixes in this phase create NEW issues (not pre-existing ones), STOP immediately. |
| 213 | |
| 214 | This pattern indicates an architectural problem, not a bug collection: |
| 215 | Each fix reveals new shared state / coupling / problem in a different place |
| 216 | Fixes require "massive refactoring" to implement |
| 217 | Each fix creates new symptoms elsewhere |
| 218 | |
| 219 | **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?" |
| 220 | |
| 221 | Do NOT attempt fix #4 without this discussion. |
| 222 | |
| 223 | Output after each fix: |
| 224 | |
| 225 | FIX #1: |
| 226 | File: auth/service.ts:45 |
| 227 | Issue: signToken called with wrong argument order |
| 228 | Change: swapped (expiresIn, payload) to (payload, expiresIn) |
| 229 | Test: auth.test.ts → PASSES |
| 230 | |
| 231 | |
| 232 | ### Phase 5: VERIFY — Confirm Everything Works |
| 233 | |
| 234 | After all fixes are applied: |
| 235 | |
| 236 | Run ALL tests in the feature folder — every single one must pass |
| 237 | Run ALL tests in files that IMPORT from this feature — must pass |
| 238 | Run the full test suite if available — check for regressions |
| 239 | If the feature has a UI, describe how to manually verify it |
| 240 | Summarize all changes made |
| 241 | |
| 242 | Final output: |
| 243 | |
| 244 | FOCUSED FIX COMPLETE: |
| 245 | Feature: auth |
| 246 | Files changed: 4 |
| 247 | Total fixes: 7 |
| 248 | Tests: 23/23 passing |
| 249 | Regressions: 0 |
| 250 | |
| 251 | Changes: |
| 252 | 1. auth/service.ts — fixed token signing argument order |
| 253 | 2. auth/repository.ts — added null check for user lookup |
| 254 | 3. auth/middleware.ts — fixed async error handling |
| 255 | 4. auth/types.ts — aligned UserResponse type with actual DB schema |
| 256 | |
| 257 | Consumers verified: |
| 258 | - src/app/api/login/route.ts ✅ |
| 259 | - src/app/api/register/route.ts ✅ |
| 260 | - src/middleware.ts ✅ |
| 261 | |
| 262 | |
| 263 | ## Red Flags — STOP and Return to Current Phase |
| 264 | |
| 265 | If you catch yourself thinking any of these, you are skipping phases: |
| 266 | |
| 267 | "I can see the bug, let me just fix it" → STOP. You haven't traced dependencies yet. |
| 268 | "Scoping is overkill, it's obviously just this file" → STOP. That's always wrong for feature-level fixes. |
| 269 | "I'll map dependencies after I fix the obvious stuff" → STOP. You'll miss root causes. |
| 270 | "The user said fix X, so I only need to look at X" → STOP. Features have dependencies. |
| 271 | "Tests are passing so I'm done" → STOP. Did you run consumer tests too? |
| 272 | "I don't need to check env vars for this" → STOP. Config issues masquerade as code bugs. |
| 273 | "One more fix should do it" (after 2+ cascading failures) → STOP. Escalate. |
| 274 | "I'll skip the diagnosis report, the fixes are obvious" → STOP. Write it down. |
| 275 | |
| 276 | **ALL of these mean: Return to the phase you're supposed to be in.** |
| 277 | |
| 278 | ## Common Rationalizations |
| 279 | |
| 280 | | Excuse | Reality | |
| 281 | |---|---| |
| 282 | | "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. | |
| 283 | | "I already know this codebase" | Knowledge decays. Trace the actual imports, don't rely on memory. | |
| 284 | | "The user wants speed, not process" | Skipping phases causes rework. Systematic is faster than thrashing. | |
| 285 | | "Only one file is broken" | If only one file were broken, the user would say "fix this bug", not "make the feature work." | |
| 286 | | "I fixed the tests, so it works" | Tests can pass while consumers are broken. Verify Phase 5 fully. | |
| 287 | | "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. | |
| 288 | | "Root cause is obvious, I don't need to confirm" | "Obvious" root causes are wrong 40% of the time. Confirm with evidence. | |
| 289 | | "3 cascading failures is normal for a big fix" | 3 cascading failures means you're patching symptoms of an architectural problem. | |
| 290 | |
| 291 | ## Anti-Patterns — NEVER do these |
| 292 | |
| 293 | | Anti-Pattern | Why It's Wrong | |
| 294 | |---|---| |
| 295 | | Starting to fix code before mapping all dependencies | You'll miss root causes and create whack-a-mole fixes | |
| 296 | | Fixing only the file the user mentioned | Related files likely have issues too | |
| 297 | | Ignoring environment variables and configuration | Many "code bugs" are actually config issues | |
| 298 | | Skipping the test run phase | You can't verify fixes without running tests | |
| 299 | | Making changes outside the feature folder without explaining why | Unexpected side effects confuse the user | |
| 300 | | Fixing symptoms in consumer files instead of root cause in feature | Band-aids that break when the next consumer appears | |
| 301 | | Declaring "done" without running verification tests | Untested fixes are unverified fixes | |
| 302 | | Changing the public API without updating all consumers | Breaks everything that depends on the feature | |
| 303 | |
| 304 | ## Related Skills |
| 305 | |
| 306 | **`superpowers:systematic-debugging`** — Use within Phase 3 for root-cause tracing of individual complex bugs |
| 307 | **`superpowers:verification-before-completion`** — Use within Phase 5 before claiming the feature is fixed |
| 308 | **`scope`** — If you need to understand blast radius before starting, run scope first then focused-fix |
| 309 | |
| 310 | ## Quick Reference |
| 311 | |
| 312 | | Phase | Key Action | Output | |
| 313 | |---|---|---| |
| 314 | | SCOPE | Read every file, map entry points | Feature manifest | |
| 315 | | TRACE | Map inbound + outbound dependencies | Dependency map | |
| 316 | | DIAGNOSE | Check code, runtime, tests, logs, config | Diagnosis report | |
| 317 | | FIX | Fix in order: deps → types → logic → tests → integration | Fix log per issue | |
| 318 | | VERIFY | Run all tests, check consumers, summarize | Completion report | |
| 319 |
Discussion
Browse more free Claude skills or everything in Product.