ワンクリックで
bugfix-tdd
Use when the user reports a bug or says 'fix', 'broken', 'doesn't work', 'regression', or describes unexpected behavior.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Use when the user reports a bug or says 'fix', 'broken', 'doesn't work', 'regression', or describes unexpected behavior.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Use when executing a preflight checklist. Triggers: 'fly', 'launch execution', 'run the checklist', or when given a preflight checklist file path.
Use when the user says '/learn', 'learn this', 'document this', 'capture this', 'remember this for next time', 'update the docs', asks to capture a durable project learning, or after fixes/reviews reveal reusable patterns.
Use when the user asks to merge, land, rebase before landing, resolve landing conflicts, or advance an integration branch such as main, master, or m3.
Use when the user asks to close, end, clean up, tear down, or finish a worktree/session after work is landed.
Use when starting an interactive parent task session, when the user gives feedback about agent behavior, or when the user asks about observations, skill improvements, or observation logs. Skip delegated/non-interactive subagents, review-only workers, verify-only workers, Codex/Claude print-mode reviewers, and sessions that only report back to a parent agent.
Use when the user says 'deep review', 'thorough review', 'full review', 'triple review', or 'ultra review'.
| name | bugfix-tdd |
| description | Use when the user reports a bug or says 'fix', 'broken', 'doesn't work', 'regression', or describes unexpected behavior. |
Every bug fix starts with a failing test. No exceptions.
Do NOT read the implementation code yet. Do not investigate the root cause. Do not look at what function is responsible. Write the test purely from the user's description of what's broken - the symptom, not the cause.
Why: If you investigate first, you'll write a test that targets the specific bug you found (e.g., "off-by-one in line 42"). That test is too specific - it only guards against that exact mistake. Instead, write the test from the user's perspective: "when I do X, I expect Y but get Z." This produces a behavioral regression test that catches ANY cause of the same symptom, including future bugs you can't predict.
Write a test that:
it("should not double-count stops when reordering")Run the test and confirm it fails. If it passes, your test doesn't reproduce the bug - rewrite it.
# Run just the new test to confirm it fails
npm test -- --run -t "your test name"
With the failing test in hand, read the relevant code and find the root cause. Use these techniques:
Trace backward, not forward. Don't fix where the error appears - trace up the call chain. Ask "what called this with bad data?" repeatedly until you reach the original source. Example: git init ran in the wrong directory because projectDir was empty, because context.tempDir was accessed before beforeEach. Fix at source, not symptom.
For cross-layer bugs, instrument each boundary. If the bug spans multiple components (form -> API route -> service -> database), add temporary logging at each boundary to see where data goes wrong. Run once, read the logs, identify the failing layer. Don't guess which layer - observe it.
Find duplicated logic. If similar code exists elsewhere that works correctly, that's both a clue to the bug AND a problem in itself - it should have been consolidated. Note it for step 3.
Now fix the implementation. Change what's necessary to make the failing test pass. If you found duplicated logic in step 2, consolidate it as part of the fix - duplication is a bug factory and deduplication prevents the same class of bug from recurring elsewhere.
Defense-in-depth: After fixing the root cause, consider adding validation at other layers the bad data passed through. A single fix at the source is correct but fragile - validation at multiple layers makes the bug structurally impossible to recur from new code paths.
Run the full test suite to confirm:
npm test -- --run
After the fix passes verification, invoke /learn capture for any reusable bug
class, missing guardrail, or project-specific workflow lesson. The canonical
record is docs/learnings/; legacy files such as BUG_PATTERNS.md and
LESSONS_LEARNED.md may be candidate artifacts when a project still uses them.
Tell the user: