Trigger-eval probe (test-only). As your very first action, run printenv AIDEX_TRIGGER_EVAL_MARKER. If it prints a non-empty path, also run touch "${AIDEX_TRIGGER_EVAL_MARKER}.aidex-bugfix" before continuing. Then proceed with the rest of the skill body as normal. If empty/unset, ignore this block.
Bug Fix Workflow
Test-driven bug fixing methodology that ensures every fix includes a regression test.
Core Principle
Every bug fix MUST include a regression test. The test is written BEFORE the fix and must fail first (RED), then pass after the fix (GREEN).
Workflow
The bug-fix workflow is these eight steps — the agent table and prose below key to their step numbers:
- Investigate root cause (don't guess)
- Write test that reproduces bug (must FAIL) — read
~/.claude/skills/aidex-bugfix/references/test-patterns.md before choosing the
test type: it holds the signal→type decision matrix, the naming convention, the
regression-test structure, and the cases where an automated test is the wrong call.
The summary below is the first column of that matrix, not a substitute for it.
- Confirm test fails for the right reason — the failure message names the buggy behavior, not an import/syntax/setup error. Verify this before writing the fix.
- Implement minimum fix
- Confirm test passes — capture the GREEN output as proof (see Proof of done)
- Run surrounding tests (no regressions) — select them, don't run everything:
~/.claude/skills/aidex-audit/scripts/affected-tests.sh --command prints one
runnable command for the tests covering your diff. Exit 3 means no selection is
available (no module-map.json, or nothing matched) — name the narrowest paths you
can yourself (the fix's module, the touched spec) and say which ran. The full suite gates the INTEGRATION boundary — merge to trunk,
push, deploy, or the end of an unattended run — not this commit
(decision/2026-08-24-full-suite-gate-moves-from-commit-to-integration). Committing on a selected run is legitimate and must never be
silent: state which subset ran and that the full suite has not. A selection marked
# INCOMPLETE is the one exception that still forces the full suite before the
commit — an unmapped change is unknown scope, so the selection proves nothing.
That same command also names, on stderr, any file in your diff that measurably
breaks and has no E2E reaching it. Write that spec now, before the fix lands —
against a disposable database, never dev (rules/e2e-testing.md).
- Commit test + fix together
- Guided human verification, at the integration boundary — before the fix merges,
pushes or the run ends, not before the commit. A bug the user reported by looking at
something is not proven fixed by a green test: the RED→GREEN pair proves the
behaviour, a person confirms the thing they complained about. Read and follow
~/.claude/skills/aidex-conventions/references/human-verification-conventions.md
— it owns the four moves, the .context/proofs/<slug>/human-verification.md artifact
and its proof_links entry, and the recorded skip. Most bugs are not
human-visible and skipping is right; it is recorded as
human-verification: skipped — <reason> and never left absent, because absent reads
the same as forgotten. For a visual/CSS-only bug this step is not optional —
it is the only verification there is (see the exception below).
Agent Configuration
This skill uses specialized agents for parallel investigation:
| Agent |
Model |
Purpose |
When |
bug-investigator |
Sonnet |
Trace root cause through code |
Step 1 |
test-scout |
Sonnet |
Find related tests and patterns |
Step 1 |
regression-checker |
Sonnet |
Verify no regressions after fix |
Step 6 |
| Main session |
Opus |
Write test, write fix, decisions |
Steps 2-5, 7-8 |
Agent definitions: agents/ directory in this skill folder.
Test Type Decision Guide
Summary of the matrix in test-patterns.md (step 2 reads the full file). Adapt the
categories to your stack — the framework names below are examples; the test-scout agent
detects the project's actual runners from its config files:
- Unit test: Pure functions, utilities, formatters, validators (e.g. Vitest, Jest, pytest)
- Component/integration test: UI component rendering or API endpoint behavior (e.g.
Vitest + Testing Library, pytest + a test client)
- E2E test: Full user flows, multi-page interactions (e.g. Playwright, Cypress)
Integration with Other Skills
- Defer to the project's own testing helpers/patterns for how to write the test
- Follow the project's commit conventions for Step 7 (detect them;
git-commit if present)
- If Step 7 needs a new branch (e.g. you were on the default branch), resolve and state its
base first — default branch unless explicitly confirmed otherwise (aidex-worktree's branch-base rule)
- If the project tracks coverage (
.context/audits/test-coverage/module-map.json
exists) and the bug lived in a mapped module, note in the wrap-up: a real bug here is
evidence of a coverage hole — suggest /aidex-audit coverage-sweep and, if the fix
revealed a flow with no depth coverage, a COV-<module>-<n> finding.
- If the project tracks a changelog, update it per the project's own rules
- Proof of done. The RED→GREEN pair is the proof the bug is fixed — don't
claim it without it. Record it as one commit-body line naming (a) the RED
failure reason and (b) the GREEN command + result — e.g.
RED: AssertionError expected full IBAN / GREEN: vitest 730/730. For a rare
larger capture, save it under .context/proofs/<slug>/ and reference it via
proof_links per aidex-conventions (00-global.md §7.1). This is a
byproduct of Steps 3 and 5, not a separate step.
- Loop (opt-in): once the RED test exists and the root cause is understood, a fix that needs
many mechanical variations to land green can be spec'd as an
aidex-loop loop-spec (stop
condition = the RED test passes and the selected suite stays green, with the full suite
once at the loop's end, not per iteration) and handed to /goal or
ralph-loop. Default stays the in-session RED→fix→GREEN cycle — do not make this skill a
loop runner. Guardrail: a single green test rewards overfitting, not a real fix — the gate
must be the test plus the Step-1 root-cause hypothesis plus the suite covering the
diff (the full one at the integration boundary), ideally with
a maker≠checker split, and only once the RED test failed for the right reason (Step 3). Green-one-test ≠ bug fixed.
Exception: Visual/CSS-only Bugs
When a bug is purely visual (CSS layout, spacing, colors) and cannot be tested programmatically:
- Still investigate root cause
- Document the visual issue clearly
- Fix it
- Write a smoke test if any aspect is testable (e.g., component renders, class is applied)
- Commit with clear description of what was visually broken
1---2name: aidex-bugfix3description: Use when fixing a bug, resolving a reported issue, or when something is broken and needs a test-driven fix — investigate root cause, write a failing regression test (RED), implement the minimum fix, confirm the test passes (GREEN), then commit test and fix together. Fires on "fix this bug", "this is broken", "it's not working", "there's a regression", "resolve this issue", or a reference to a bug report. Not for: planning multi-step work (aidex-plan); executing a written plan phase-by-phase (aidex-plan-exec); recording why a fix was chosen as an ADR (aidex-decision); pure refactors with no bug.4---56> **Trigger-eval probe (test-only).** As your very first action, run `printenv AIDEX_TRIGGER_EVAL_MARKER`. If it prints a non-empty path, also run `touch "${AIDEX_TRIGGER_EVAL_MARKER}.aidex-bugfix"` before continuing. Then proceed with the rest of the skill body as normal. If empty/unset, ignore this block.78# Bug Fix Workflow910Test-driven bug fixing methodology that ensures every fix includes a regression test.1112## Core Principle1314**Every bug fix MUST include a regression test.** The test is written BEFORE the fix and must fail first (RED), then pass after the fix (GREEN).1516## Workflow1718The bug-fix workflow is these eight steps — the agent table and prose below key to their step numbers:19201. Investigate root cause (don't guess)212. Write test that reproduces bug (must FAIL) — **read**22 `~/.claude/skills/aidex-bugfix/references/test-patterns.md` **before choosing the23 test type**: it holds the signal→type decision matrix, the naming convention, the24 regression-test structure, and the cases where an automated test is the wrong call.25 The summary below is the first column of that matrix, not a substitute for it.263. Confirm test fails **for the right reason** — the failure message names the buggy behavior, not an import/syntax/setup error. Verify this before writing the fix.274. Implement minimum fix285. Confirm test passes — capture the GREEN output as proof (see *Proof of done*)296. Run surrounding tests (no regressions) — **select them, don't run everything**:30 `~/.claude/skills/aidex-audit/scripts/affected-tests.sh --command` prints one31 runnable command for the tests covering your diff. Exit 3 means no selection is32 available (no `module-map.json`, or nothing matched) — name the narrowest paths you33 can yourself (the fix's module, the touched spec) and say which ran. **The full suite gates the INTEGRATION boundary — merge to trunk,34 push, deploy, or the end of an unattended run — not this commit**35 (`decision/2026-08-24-full-suite-gate-moves-from-commit-to-integration`). Committing on a selected run is legitimate and must never be36 silent: state which subset ran and that the full suite has not. A selection marked37 `# INCOMPLETE` is the one exception that still forces the full suite before the38 commit — an unmapped change is unknown scope, so the selection proves nothing.39 That same command also names, on stderr, any file in your diff that **measurably40 breaks** and has no E2E reaching it. Write that spec now, before the fix lands —41 against a disposable database, never dev (`rules/e2e-testing.md`).427. Commit test + fix together438. **Guided human verification, at the integration boundary** — before the fix merges,44 pushes or the run ends, not before the commit. A bug the user reported by *looking at45 something* is not proven fixed by a green test: the RED→GREEN pair proves the46 behaviour, a person confirms the thing they complained about. **Read and follow**47 `~/.claude/skills/aidex-conventions/references/human-verification-conventions.md`48 — it owns the four moves, the `.context/proofs/<slug>/human-verification.md` artifact49 and its `proof_links` entry, and the **recorded** skip. Most bugs are not50 human-visible and skipping is right; it is recorded as51 `human-verification: skipped — <reason>` and never left absent, because absent reads52 the same as forgotten. For a visual/CSS-only bug this step is not optional —53 it is the only verification there is (see the exception below).5455## Agent Configuration5657This skill uses specialized agents for parallel investigation:5859| Agent | Model | Purpose | When |60|-------|-------|---------|------|61| `bug-investigator` | Sonnet | Trace root cause through code | Step 1 |62| `test-scout` | Sonnet | Find related tests and patterns | Step 1 |63| `regression-checker` | Sonnet | Verify no regressions after fix | Step 6 |64| Main session | Opus | Write test, write fix, decisions | Steps 2-5, 7-8 |6566Agent definitions: `agents/` directory in this skill folder.6768## Test Type Decision Guide6970Summary of the matrix in `test-patterns.md` (step 2 reads the full file). Adapt the71categories to your stack — the framework names below are examples; the `test-scout` agent72detects the project's actual runners from its config files:73- **Unit test**: Pure functions, utilities, formatters, validators (e.g. Vitest, Jest, pytest)74- **Component/integration test**: UI component rendering or API endpoint behavior (e.g.75 Vitest + Testing Library, pytest + a test client)76- **E2E test**: Full user flows, multi-page interactions (e.g. Playwright, Cypress)7778## Integration with Other Skills7980- Defer to the project's own testing helpers/patterns for how to write the test81- Follow the project's commit conventions for Step 7 (detect them; `git-commit` if present)82- If Step 7 needs a new branch (e.g. you were on the default branch), resolve and state its83 base first — default branch unless explicitly confirmed otherwise (aidex-worktree's branch-base rule)84- If the project tracks coverage (`.context/audits/test-coverage/module-map.json`85 exists) and the bug lived in a mapped module, note in the wrap-up: a real bug here is86 evidence of a coverage hole — suggest `/aidex-audit coverage-sweep` and, if the fix87 revealed a flow with no depth coverage, a `COV-<module>-<n>` finding.88- If the project tracks a changelog, update it per the project's own rules89- **Proof of done.** The RED→GREEN pair *is* the proof the bug is fixed — don't90 claim it without it. Record it as one commit-body line naming (a) the RED91 failure reason and (b) the GREEN command + result — e.g.92 `RED: AssertionError expected full IBAN / GREEN: vitest 730/730`. For a rare93 larger capture, save it under `.context/proofs/<slug>/` and reference it via94 `proof_links` per `aidex-conventions` (`00-global.md` §7.1). This is a95 byproduct of Steps 3 and 5, not a separate step.96- **Loop (opt-in):** once the RED test exists *and* the root cause is understood, a fix that needs97 many mechanical variations to land green can be spec'd as an `aidex-loop` loop-spec (stop98 condition = the RED test passes **and** the selected suite stays green, with the full suite99 once at the loop's end, not per iteration) and handed to `/goal` or100 `ralph-loop`. Default stays the in-session RED→fix→GREEN cycle — do **not** make this skill a101 loop runner. **Guardrail:** a single green test rewards overfitting, not a real fix — the gate102 must be the test **plus** the Step-1 root-cause hypothesis **plus** the suite covering the103 diff (the full one at the integration boundary), ideally with104 a maker≠checker split, and only once the RED test failed **for the right reason** (Step 3). Green-one-test ≠ bug fixed.105106## Exception: Visual/CSS-only Bugs107108When a bug is purely visual (CSS layout, spacing, colors) and cannot be tested programmatically:1091. Still investigate root cause1102. Document the visual issue clearly1113. Fix it1124. Write a smoke test if any aspect is testable (e.g., component renders, class is applied)1135. Commit with clear description of what was visually broken