graph-fix-bugs
Structured bug fix workflow using Root Cause Analysis (5 Whys), Reproduce-Fix-Verify cycle, TDD for bugs, and regression prevention
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Structured bug fix workflow using Root Cause Analysis (5 Whys), Reproduce-Fix-Verify cycle, TDD for bugs, and regression prevention
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | graph-fix-bugs |
| description | Structured bug fix workflow using Root Cause Analysis (5 Whys), Reproduce-Fix-Verify cycle, TDD for bugs, and regression prevention |
| triggers | ["graph-fix-bugs"] |
| version | 2.0.0 |
| author | Diego Nogueira |
| date | "2026-06-21T00:00:00.000Z" |
💡 The
agfCLI is the whole interface — zero MCP. The lifecycle isagf start→ TDD →agf done <id>(pipeline), oragf next→agf context <id>→ TDD →agf check <id>→agf node status <id> done(granular).
Structured bug fix workflow using Root Cause Analysis (5 Whys), Reproduce-Fix-Verify cycle, TDD for bugs, and regression prevention. Every bug fix follows a disciplined process that prevents recurrence.
See also: [[effective-debugging]], [[feathers-legacy-code]]
select bug → start_task → reproduce (RED) → 5 Whys → impact analysis → fix (GREEN) → regression suite → verify → prevent → finish_task → write_memory
agf query --type bug --status backlog --limit 20 --select data.nodes # what is open
agf risk triage # unconfirmed risks first
agf node status <bug_node_id> in_progress # WIP=1: claim exactly one
No node, no fix. If the bug you are about to fix has no node, open it: agf node add --type bug.
Write a test that reproduces the bug. The test MUST fail. If it passes, the bug description is wrong or already fixed.
npx vitest run src/tests/bug-fix-<description>.test.ts
Each "why" must be falsifiable — you must be able to verify it before moving to the next. Never assume; confirm.
| Level | Question | Evidence Required |
|---|---|---|
| Why 1 | Why does X fail? | Log, error message, or test output |
| Why 2 | Why does Y cause X? | Code path trace or debugger confirmation |
| Why 3 | Why does Z produce Y? | Reproducer that isolates Z alone |
| Why 4 | Why does W trigger Z? | Specific input/state that triggers W |
| Why 5 | What is the root structural cause? | Design/code decision that made this possible |
Rule: if you cannot produce evidence for a "why", it is a hypothesis — mark it as such and design an experiment to confirm it (see [[effective-debugging]] — Scientific Method, Item 1).
Document the verified chain in the bug node description.
agf code impact <file> <affected_symbol> # blast radius before you touch anything
agf code affected <file> # which test files already cover it
Determine: how many modules depend on the buggy code, whether the fix will break callers, and whether the same pattern exists at other call sites.
Write the minimal fix to make the failing test pass.
npx vitest run src/tests/bug-fix-<description>.test.ts
npm test
Zero regressions allowed. If any test breaks, the fix is too broad — narrow it down.
"Tests pass" is necessary but not sufficient. Verify all four:
agf verify-ac <bug_node_id> # is the AC actually satisfied by the code now on disk?
agf check <bug_node_id> # Definition of Done + TDD adherence
1. Write failing test → npx vitest run <bug-test> # RED confirmed
2. Make minimal fix
3. Run bug test → npx vitest run <bug-test> # GREEN confirmed
4. Run full suite → npm test # No regressions
5. Verify AC → agf check <id>
6. Add test to CI → test file committed with fix
The test must be committed alongside the fix so the CI pipeline catches any future regression.
| Bug Category | Test Type to Add | Coverage Target |
|---|---|---|
| Logic error (wrong condition, off-by-one) | Unit test with boundary inputs | 100% branch for that function |
| Timing / async (race condition, stale state) | Integration test with concurrency probe | At least one concurrent execution scenario |
| Configuration / environment | Smoke test with config variations | All required env vars validated at startup |
| Data shape (null, missing field, wrong type) | Unit test with null/empty/malformed inputs | Each shape variant tested |
| Integration contract (API changed, schema drift) | Integration test against real contract | Contract snapshot in CI |
| UI state (wrong render, stale prop) | Component test asserting state transitions | Full user interaction sequence |
Document the bug pattern:
agf memory write pheromone-fix-<slug> --content "<root cause + fix + the gotcha>"
Include: root cause (5 Whys chain), symptoms, fix approach, prevention strategy. Write the gotcha, not just the fix — the next hunt reads this to skip the dead end you already walked.
npm run test:blast # mandatory gate before done
agf done <bug_node_id> # DoD, epic promotion, pheromone deposit
Economia de tokens. Os levers compartilhados por todas as skills —
--select,agf retrieve-command,agf exec chain, reuso antes de criação — vivem em_shared.md→ Token Economy. Fonte única: um parágrafo repetido em trinta arquivos é o trigésimo primeiro que envelhece sozinho.
Não precisa de flags. CLI gerencia compressão automaticamente com --ai ativo.
Consulte comandos com agf retrieve-command "<intenção>".
Ver _agf-rag.md para detalhes.
Accessibility compliance audit using WCAG 2.2 AA standards, ARIA validation, screen reader testing, keyboard navigation, color contrast analysis, and i18n readiness
Execute the ANALYZE phase of the lifecycle via the `agf` CLI — PRD creation, requirements, Definition of Ready (7 checks), cross-project learning
API governance and design audit using OpenAPI/Swagger spec generation, REST maturity model, contract validation, and breaking change detection
Architecture governance using C4 Model, ADR lifecycle, Architecture Fitness Functions, layer boundary enforcement, and drift detection
Human-in-the-loop PLANNING skill — investigates the project (graph + git + harness/gaps) and runs the whole ANALYZE→DESIGN→PLAN chain in one faceted loop to produce a COMPLETE PRD injected as graph backlog (epics, tasks, testable AC) for a separate agent to implement. Applies the project's planning methodologies — Impact Mapping + OKR per epic, JTBD, MoSCoW, WSJF/Cost-of-Delay, User Story Mapping, Example Mapping (Rules/Examples → Given-When-Then AC), SPIDR splitting, INVEST, Definition of Ready, Risk Matrix; the full catalogue lives in the skill body. Stops for the human after each complete PRD and iterates the next cycle from the project's own findings (dogfood). Does NOT implement. Triggers — graph-backlog-generation, gerar backlog, criar PRD, planejar feature, detalhar épico, novo ciclo, "plan the next thing", "what should we build next".
Automated bug discovery through static analysis, LSP diagnostics, pattern detection, regression hotspot analysis, and error catalog mining