{"slug":"focused-fix","title":"focused-fix","summary":"Use when a whole feature or module is broken and needs fixing end to end ('make X work', 'the Y module is broken'). Maps every file and dependency of the area before changing anything. Single quick bug fixes do not need it.","platform":"Claude","tags":[],"authorName":"LLM Mart","authorSlug":"llm-mart","score":0,"source":"github","price":null,"verified":false,"createdAt":"2026-12-02T16:53:15.197648Z","repo":{"url":"https://github.com/beginwithu/agent-skills","stars":11,"forks":2,"license":"MIT","updatedAt":"2026-12-02T16:37:11Z"},"bodyHtml":"<hr>\n<h2>name: focused-fix\ndescription: \"Use when a whole feature or module is broken and needs fixing end to end ('make X work', 'the Y module is broken'). Maps every file and dependency of the area before changing anything. Single quick bug fixes do not need it.\"</h2>\n<h1>Focused Fix — Deep-Dive Feature Repair</h1>\n<h2>When to Use</h2>\n<p>Activate when the user asks to fix, debug, or make a specific feature/module/area work. Key triggers:</p>\n<ul>\n<li>\"make X work\"</li>\n<li>\"fix the Y feature\"</li>\n<li>\"the Z module is broken\"</li>\n<li>\"focus on [area]\"</li>\n<li>\"this feature needs to work properly\"</li>\n</ul>\n<p>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.</p>\n<pre><code>digraph when_to_use {\n    \"User reports feature broken\" [shape=diamond];\n    \"Single bug or symptom?\" [shape=diamond];\n    \"Use systematic-debugging\" [shape=box];\n    \"Entire feature/module needs repair?\" [shape=diamond];\n    \"Use focused-fix\" [shape=box];\n    \"Something else\" [shape=box];\n\n    \"User reports feature broken\" -&gt; \"Single bug or symptom?\";\n    \"Single bug or symptom?\" -&gt; \"Use systematic-debugging\" [label=\"yes\"];\n    \"Single bug or symptom?\" -&gt; \"Entire feature/module needs repair?\" [label=\"no\"];\n    \"Entire feature/module needs repair?\" -&gt; \"Use focused-fix\" [label=\"yes\"];\n    \"Entire feature/module needs repair?\" -&gt; \"Something else\" [label=\"no\"];\n}\n</code></pre>\n<h2>The Iron Law</h2>\n<pre><code>NO FIXES WITHOUT COMPLETING SCOPE → TRACE → DIAGNOSE FIRST\n</code></pre>\n<p>If you haven't finished Phase 3, you cannot propose fixes. Period.</p>\n<p><strong>Violating the letter of these phases is violating the spirit of focused repair.</strong></p>\n<h2>Protocol — STRICTLY follow these 5 phases IN ORDER</h2>\n<pre><code>digraph phases {\n    rankdir=LR;\n    SCOPE [shape=box, label=\"Phase 1\\nSCOPE\"];\n    TRACE [shape=box, label=\"Phase 2\\nTRACE\"];\n    DIAGNOSE [shape=box, label=\"Phase 3\\nDIAGNOSE\"];\n    FIX [shape=box, label=\"Phase 4\\nFIX\"];\n    VERIFY [shape=box, label=\"Phase 5\\nVERIFY\"];\n\n    SCOPE -&gt; TRACE -&gt; DIAGNOSE -&gt; FIX -&gt; VERIFY;\n    FIX -&gt; DIAGNOSE [label=\"fix broke\\nsomething else\"];\n    FIX -&gt; ESCALATE [label=\"3+ fixes\\ncreate new issues\"];\n    ESCALATE [shape=doubleoctagon, label=\"STOP\\nQuestion Architecture\\nDiscuss with User\"];\n}\n</code></pre>\n<h3>Phase 1: SCOPE — Map the Feature Boundary</h3>\n<p>Before touching any code, understand the full scope of the feature.</p>\n<ol>\n<li>Ask the user: \"Which feature/folder should I focus on?\" if not already clear</li>\n<li>Identify the PRIMARY folder/files for this feature</li>\n<li>Map EVERY file in that folder — read each one, understand its purpose</li>\n<li>Create a feature manifest:</li>\n</ol>\n<pre><code>FEATURE SCOPE:\n  Primary path: src/features/auth/\n  Entry points: [files that are imported by other parts of the app]\n  Internal files: [files only used within this feature]\n  Total files: N\n  Total lines: N\n</code></pre>\n<h3>Phase 2: TRACE — Map All Dependencies (Inside AND Outside)</h3>\n<p>Trace every connection this feature has to the rest of the codebase.</p>\n<p><strong>INBOUND (what this feature imports):</strong></p>\n<ol>\n<li>For every import statement in every file in the feature folder:\n<ul>\n<li>Trace it to its source</li>\n<li>Verify the source file exists</li>\n<li>Verify the imported entity (function, type, component) exists and is exported</li>\n<li>Check if the types/signatures match what the feature expects</li>\n</ul>\n</li>\n<li>Check for:\n<ul>\n<li>Environment variables used (grep for process.env, import.meta.env, os.environ, etc.)</li>\n<li>Config files referenced</li>\n<li>Database models/schemas used</li>\n<li>API endpoints called</li>\n<li>Third-party packages imported</li>\n</ul>\n</li>\n</ol>\n<p><strong>OUTBOUND (what imports this feature):</strong></p>\n<ol>\n<li>Search the entire codebase for imports from this feature folder</li>\n<li>For each consumer:\n<ul>\n<li>Verify they're importing entities that actually exist</li>\n<li>Check if they're using the correct API/interface</li>\n<li>Note if any consumers are using deprecated patterns</li>\n</ul>\n</li>\n</ol>\n<p>Output format:</p>\n<pre><code>DEPENDENCY MAP:\n  Inbound (this feature depends on):\n    src/lib/db.ts → used in auth/repository.ts (getUserById, createUser)\n    src/lib/jwt.ts → used in auth/service.ts (signToken, verifyToken)\n    @prisma/client → used in auth/repository.ts\n    process.env.JWT_SECRET → used in auth/service.ts\n    process.env.DATABASE_URL → used via prisma\n\n  Outbound (depends on this feature):\n    src/app/api/login/route.ts → imports { login } from auth/service\n    src/app/api/register/route.ts → imports { register } from auth/service\n    src/middleware.ts → imports { verifyToken } from auth/service\n\n  Env vars required: JWT_SECRET, DATABASE_URL\n  Config files: prisma/schema.prisma (User model)\n</code></pre>\n<h3>Phase 3: DIAGNOSE — Find Every Issue</h3>\n<p>Systematically check for problems. Run ALL of these checks:</p>\n<p><strong>CODE QUALITY:</strong></p>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Every import resolves to a real file/export</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> No circular dependencies within the feature</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Types are consistent across boundaries (no <code>any</code> at interfaces)</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Error handling exists for all async operations</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> No TODO/FIXME/HACK comments indicating known issues</li>\n</ul>\n<p><strong>RUNTIME:</strong></p>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> All required environment variables are set (check .env)</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Database migrations are up to date (if applicable)</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> API endpoints return expected shapes</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> No hardcoded values that should be configurable</li>\n</ul>\n<p><strong>TESTS:</strong></p>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Run ALL tests related to this feature: find them by searching for imports from the feature folder</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Record every failure with full error output</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Check test coverage — are there untested code paths?</li>\n</ul>\n<p><strong>LOGS &amp; ERRORS:</strong></p>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Search for any log files, error reports, or Sentry-style error tracking</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Check git log for recent changes to this feature: <code>git log --oneline -20 -- &lt;feature-path&gt;</code></li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Check if any recent commits might have broken something: <code>git log --oneline -5 --all -- &lt;files that this feature depends on&gt;</code></li>\n</ul>\n<p><strong>CONFIGURATION:</strong></p>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Verify all config files this feature depends on are valid</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Check for mismatches between development and production configs</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Verify third-party service credentials are valid (if testable)</li>\n</ul>\n<p><strong>ROOT-CAUSE CONFIRMATION:</strong>\nFor each CRITICAL issue found, confirm root cause before adding it to the fix list:</p>\n<ul>\n<li>State clearly: \"I think X is the root cause because Y\"</li>\n<li>Trace the data/control flow backward to verify — don't trust surface-level symptoms</li>\n<li>If the issue spans multiple components, add diagnostic logging at each boundary to identify which layer fails</li>\n<li>For complex bugs, run a root-cause investigation before proceeding: reproduce the failure reliably, read the full error and stack trace, check what changed recently (<code>git log</code>, <code>git diff</code>), and form one hypothesis at a time that you test with the smallest possible change. Do not add a bug to the fix list until a hypothesis survives its test.</li>\n</ul>\n<p><strong>RISK LABELING:</strong>\nAssign each issue a risk label:</p>\n<table>\n<thead>\n<tr>\n<th>Risk</th>\n<th>Criteria</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>HIGH</td>\n<td>Public API surface / breaking interface contract / DB schema / auth or security logic / widely imported module (&gt;3 callers) / git hotspot</td>\n</tr>\n<tr>\n<td>MED</td>\n<td>Internal module with tests / shared utility / config with runtime impact / internal callers of changed functions</td>\n</tr>\n<tr>\n<td>LOW</td>\n<td>Leaf module / isolated file / test-only change / single-purpose helper with no callers</td>\n</tr>\n</tbody>\n</table>\n<p>Output format:</p>\n<pre><code>DIAGNOSIS REPORT:\n  Issues found: N\n\n  CRITICAL:\n    1. [HIGH] [file:line] — description of issue. Root cause: [confirmed explanation]\n    2. [HIGH] [file:line] — description of issue. Root cause: [confirmed explanation]\n\n  WARNINGS:\n    1. [MED] [file:line] — description of issue\n    2. [LOW] [file:line] — description of issue\n\n  TESTS:\n    Ran: N tests\n    Passed: N\n    Failed: N\n    [list each failure with one-line summary]\n</code></pre>\n<h3>Phase 4: FIX — Repair Everything Systematically</h3>\n<p>Fix issues in this EXACT order:</p>\n<ol>\n<li><strong>DEPENDENCIES FIRST</strong> — fix broken imports, missing packages, wrong versions</li>\n<li><strong>TYPES SECOND</strong> — fix type mismatches at feature boundaries</li>\n<li><strong>LOGIC THIRD</strong> — fix actual business logic bugs</li>\n<li><strong>TESTS FOURTH</strong> — fix or create tests for each fix</li>\n<li><strong>INTEGRATION LAST</strong> — verify the feature works end-to-end with its consumers</li>\n</ol>\n<p>Rules:</p>\n<ul>\n<li>Fix ONE issue at a time</li>\n<li>After each fix, run the related test to confirm it works</li>\n<li>If a fix breaks something else, STOP and re-evaluate (go back to DIAGNOSE)</li>\n<li>Keep a running log of every change made</li>\n<li>Never change code outside the feature folder without explicitly stating why</li>\n<li>Fix HIGH-risk issues before MED, MED before LOW</li>\n</ul>\n<p><strong>ESCALATION RULE — 3-Strike Architecture Check:</strong>\nIf 3+ fixes in this phase create NEW issues (not pre-existing ones), STOP immediately.</p>\n<p>This pattern indicates an architectural problem, not a bug collection:</p>\n<ul>\n<li>Each fix reveals new shared state / coupling / problem in a different place</li>\n<li>Fixes require \"massive refactoring\" to implement</li>\n<li>Each fix creates new symptoms elsewhere</li>\n</ul>\n<p><strong>Action:</strong> 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?\"</p>\n<p>Do NOT attempt fix #4 without this discussion.</p>\n<p>Output after each fix:</p>\n<pre><code>FIX #1:\n  File: auth/service.ts:45\n  Issue: signToken called with wrong argument order\n  Change: swapped (expiresIn, payload) to (payload, expiresIn)\n  Test: auth.test.ts → PASSES\n</code></pre>\n<h3>Phase 5: VERIFY — Confirm Everything Works</h3>\n<p>After all fixes are applied:</p>\n<ol>\n<li>Run ALL tests in the feature folder — every single one must pass</li>\n<li>Run ALL tests in files that IMPORT from this feature — must pass</li>\n<li>Run the full test suite if available — check for regressions</li>\n<li>If the feature has a UI, describe how to manually verify it</li>\n<li>Summarize all changes made</li>\n</ol>\n<p>Final output:</p>\n<pre><code>FOCUSED FIX COMPLETE:\n  Feature: auth\n  Files changed: 4\n  Total fixes: 7\n  Tests: 23/23 passing\n  Regressions: 0\n\n  Changes:\n    1. auth/service.ts — fixed token signing argument order\n    2. auth/repository.ts — added null check for user lookup\n    3. auth/middleware.ts — fixed async error handling\n    4. auth/types.ts — aligned UserResponse type with actual DB schema\n\n  Consumers verified:\n    - src/app/api/login/route.ts ✅\n    - src/app/api/register/route.ts ✅\n    - src/middleware.ts ✅\n</code></pre>\n<h2>Red Flags — STOP and Return to Current Phase</h2>\n<p>If you catch yourself thinking any of these, you are skipping phases:</p>\n<ul>\n<li>\"I can see the bug, let me just fix it\" → STOP. You haven't traced dependencies yet.</li>\n<li>\"Scoping is overkill, it's obviously just this file\" → STOP. That's always wrong for feature-level fixes.</li>\n<li>\"I'll map dependencies after I fix the obvious stuff\" → STOP. You'll miss root causes.</li>\n<li>\"The user said fix X, so I only need to look at X\" → STOP. Features have dependencies.</li>\n<li>\"Tests are passing so I'm done\" → STOP. Did you run consumer tests too?</li>\n<li>\"I don't need to check env vars for this\" → STOP. Config issues masquerade as code bugs.</li>\n<li>\"One more fix should do it\" (after 2+ cascading failures) → STOP. Escalate.</li>\n<li>\"I'll skip the diagnosis report, the fixes are obvious\" → STOP. Write it down.</li>\n</ul>\n<p><strong>ALL of these mean: Return to the phase you're supposed to be in.</strong></p>\n<h2>Common Rationalizations</h2>\n<table>\n<thead>\n<tr>\n<th>Excuse</th>\n<th>Reality</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>\"The feature is small, I don't need all 5 phases\"</td>\n<td>Small features have dependencies too. Phases 1-2 take minutes for small features — do them.</td>\n</tr>\n<tr>\n<td>\"I already know this codebase\"</td>\n<td>Knowledge decays. Trace the actual imports, don't rely on memory.</td>\n</tr>\n<tr>\n<td>\"The user wants speed, not process\"</td>\n<td>Skipping phases causes rework. Systematic is faster than thrashing.</td>\n</tr>\n<tr>\n<td>\"Only one file is broken\"</td>\n<td>If only one file were broken, the user would say \"fix this bug\", not \"make the feature work.\"</td>\n</tr>\n<tr>\n<td>\"I fixed the tests, so it works\"</td>\n<td>Tests can pass while consumers are broken. Verify Phase 5 fully.</td>\n</tr>\n<tr>\n<td>\"The dependency map is too big to trace\"</td>\n<td>Then the feature is too big to fix without tracing. That's exactly why you need it.</td>\n</tr>\n<tr>\n<td>\"Root cause is obvious, I don't need to confirm\"</td>\n<td>\"Obvious\" root causes are wrong 40% of the time. Confirm with evidence.</td>\n</tr>\n<tr>\n<td>\"3 cascading failures is normal for a big fix\"</td>\n<td>3 cascading failures means you're patching symptoms of an architectural problem.</td>\n</tr>\n</tbody>\n</table>\n<h2>Anti-Patterns — NEVER do these</h2>\n<table>\n<thead>\n<tr>\n<th>Anti-Pattern</th>\n<th>Why It's Wrong</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Starting to fix code before mapping all dependencies</td>\n<td>You'll miss root causes and create whack-a-mole fixes</td>\n</tr>\n<tr>\n<td>Fixing only the file the user mentioned</td>\n<td>Related files likely have issues too</td>\n</tr>\n<tr>\n<td>Ignoring environment variables and configuration</td>\n<td>Many \"code bugs\" are actually config issues</td>\n</tr>\n<tr>\n<td>Skipping the test run phase</td>\n<td>You can't verify fixes without running tests</td>\n</tr>\n<tr>\n<td>Making changes outside the feature folder without explaining why</td>\n<td>Unexpected side effects confuse the user</td>\n</tr>\n<tr>\n<td>Fixing symptoms in consumer files instead of root cause in feature</td>\n<td>Band-aids that break when the next consumer appears</td>\n</tr>\n<tr>\n<td>Declaring \"done\" without running verification tests</td>\n<td>Untested fixes are unverified fixes</td>\n</tr>\n<tr>\n<td>Changing the public API without updating all consumers</td>\n<td>Breaks everything that depends on the feature</td>\n</tr>\n</tbody>\n</table>\n<h2>Related Skills</h2>\n<ul>\n<li><strong><code>self-eval</code></strong> (this repo, <code>engineering/skills/self-eval</code>) — Use after Phase 5 to score the fix honestly before reporting it done</li>\n<li><strong><code>incident-commander</code></strong> (this repo, <code>engineering-team/skills/incident-commander</code>, separate plugin) — Use instead when the broken feature is a live production incident, not a local repair</li>\n<li><strong>Optional, if installed:</strong> the third-party <code>superpowers</code> plugin's <code>systematic-debugging</code> and <code>verification-before-completion</code> skills cover the same ground as the root-cause step in Phase 3 and the checks in Phase 5. This skill does not require them; the steps above are self-contained.</li>\n</ul>\n<h2>Quick Reference</h2>\n<table>\n<thead>\n<tr>\n<th>Phase</th>\n<th>Key Action</th>\n<th>Output</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>SCOPE</td>\n<td>Read every file, map entry points</td>\n<td>Feature manifest</td>\n</tr>\n<tr>\n<td>TRACE</td>\n<td>Map inbound + outbound dependencies</td>\n<td>Dependency map</td>\n</tr>\n<tr>\n<td>DIAGNOSE</td>\n<td>Check code, runtime, tests, logs, config</td>\n<td>Diagnosis report</td>\n</tr>\n<tr>\n<td>FIX</td>\n<td>Fix in order: deps → types → logic → tests → integration</td>\n<td>Fix log per issue</td>\n</tr>\n<tr>\n<td>VERIFY</td>\n<td>Run all tests, check consumers, summarize</td>\n<td>Completion report</td>\n</tr>\n</tbody>\n</table>\n","files":[{"path":"LICENSE","sizeBytes":1072,"isText":false},{"path":"SKILL.md","sizeBytes":14163,"isText":true}],"reviewScore":null,"reviewSummary":null,"trust":{"provenance":"trusted-source-unreviewed","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow.","bodySource":null},"bodyLocked":false,"purchaseUrl":null,"sourceUrl":null,"report":{"provenance":"trusted-source-unreviewed","screen":{"ran":true,"outcome":"notes-only","suspicious":0,"notes":2,"hiddenCharacters":false},"virusScan":{"engine":"clamav","status":"clean","scannedAt":"2026-12-02T16:54:40.272044Z","sha256":"77A9716DB2154D493F3ED833F17E796A751AF748DD0B2121A4B5E7973048FCC3","sizeBytes":6779},"review":null,"source":{"repositoryUrl":"https://github.com/beginwithu/agent-skills","path":"skills/focused-fix","license":"MIT","commit":"a960304c52212f2e845067047f5cefc0c594d787","subtreeSha":"5FCA243D7E6DE880D50EF78059C5D8157660F9A7D54D87DDD83E6D82ACA64488","lastSyncedAt":"2026-12-02T16:52:59.20206Z"},"reviewedAt":"2026-12-02T16:57:14.673949Z","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow."},"install":[{"target":"skills-cli","command":"npx skills add https://github.com/beginwithu/agent-skills/tree/main/skills/focused-fix"},{"target":"claude-code","command":"claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install beginwithu-agent-skills@llmmart"},{"target":"git","command":"git clone https://github.com/beginwithu/agent-skills.git"}]}