Debug and fix a reported defect, such as a failing build or tests, runtime or console errors, regressions, merge conflicts, red PR checks. Triggers "fix", "broken", "not working", "merge conflict", "fix CI".
56 stars
0 votes
0 copies
17 views
Added February 7, 2026
toolsgobashrailsgitsecuritydocumentation
Works with
cli
Security analysis
A92/100
mediumInstalls packages at runtime which could introduce malicious dependencies
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Fix?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/darkroomengineering-fix)
---
name: fix
description: Debug and fix a reported defect, such as a failing build or tests, runtime or console errors, regressions, merge conflicts, red PR checks. Triggers "fix", "broken", "not working", "merge conflict", "fix CI".
context: fork
---
# Bug Fix Workflow
## Standalone Codex
Follow the [native agent workflow](../README.md#native-agent-workflow) and [Codex documentation lookup](../README.md#documentation-lookup).
Run `git branch --show-current`, `git log --oneline -5`, and `git status --porcelain` explicitly.
Wait for the explorer before starting the test writer, then wait for the test
writer before implementing.
You are in **Maestro orchestration mode**. Delegate immediately to specialized agents.
## Current State
- Branch: !`git branch --show-current 2>/dev/null || echo "unknown"`
- Recent commits: !`git log --oneline -5 2>/dev/null || echo "no commits"`
- Uncommitted changes: !`git status --porcelain 2>/dev/null | head -10`
## Workflow
0. **Clarify** - If the report admits more than one reading (which surface, which environment, what "fixed" looks like), run clarifying rounds through the host's question tool until no fork is left, before exploring; a report that names the file, the symptom, and the expected behaviour skips this. When a round runs and the user named no Linear issue, add one question: create one now (recommended: yes)? Create it per the `land` skill's "Linear issue" step and put its ID in the branch name. Never open a round only for this: `/land` creates the issue anyway
1. **Explore** - Spawn `explore` agent to understand the affected codebase area
2. **Reproduce** - Spawn `tester` agent to create a failing test if possible
- For browser defects, retry from a known starting state before collecting final evidence. Capture one screenshot for a static defect and annotate the affected control when helpful. For interaction defects, link numbered reproduction steps to captures of the setup, action, and result. Record a short clip when timing or motion is part of the symptom.
3. **Diagnose** - Analyze findings to identify root cause. Commits named in the bug report are hypotheses, not conclusions — blame the actually-affected file's history before fixing; regressions often ride in earlier on the same branch as the change that got blamed. Before blaming, fetch the team-knowledge index and read any note whose title matches the error's nouns; the fetch command is in docs/knowledge-system.md (fail-open — skip if `gh` is unavailable)
- No hypothesis before a signal: a reproducer that checks the exact reported symptom (not "it didn't crash"), returns the same verdict on every run, and finishes unattended in seconds. A flaky failure gets a measured rate instead: failures out of N runs, with the command and seed policy recorded. Without a signal, report what you tried and what would produce one.
- A prediction must name something not yet looked at (another code path, an observable the first hypothesis did not touch). One that restates the symptom or only re-reads the suspect line is rejected.
- The user's own uncommitted edits are hypothesis 1. Test them: `git stash push -u -m <unique-tag>`, rerun the reproducer, then restore only the entry this run created: find its `stash@{n}` by the tag in `git stash list`, `git stash apply --index stash@{n}` so staged state comes back too, and `git stash drop stash@{n}` only after the apply succeeds. Never pop other entries. If the push reports nothing to save, restore nothing.
- No fix until the causal chain from trigger to symptom is complete, with file:line evidence at each link. "Somehow X leads to Y" is a gap.
- When two fixes resting on one premise fail the same check, write the premise as one sentence and test it directly, with an observation that would come out differently if it were false, before a third fix. A refuted premise puts the cause elsewhere: revert everything it motivated.
- Tag every temporary debug probe (log line, print, scratch harness) with one unique marker, such as `[DEBUG-a4f2]`. Before reporting, `git grep -n --untracked '\[DEBUG-a4f2\]'` prints nothing.
4. **Implement** - Spawn `implementer` agent to fix the issue, only once the root cause grades Confirmed (see Output)
5. **Verify** - Spawn `tester` agent to confirm the fix
6. **Learn** - If this was a non-obvious fix, the auto-memory system in `~/.claude/CLAUDE.md` captures it; for team-wide gotchas use `/share-learning` to post to the team-knowledge repo
## Scope Rules
Follow the AGENTS.md guardrails (Bug Fix Scope, 2-Iteration Limit, Name the Cause, Verify After Every Fix). Only modify files directly related to the bug.
**Autonomous fix-verify loop**: once the reproducer exists, set
`/goal the reproducer test passes and the full suite is green, or stop after 5 attempts`
to keep iterating without re-prompting. Keep the 2-iteration scope rule in mind when
choosing the stop clause.
## Agent Delegation
Spawn explore and tester first — these accept thin prompts because they
discover what they need from the codebase:
```
Agent(explore, "Investigate the bug: $ARGUMENTS. Find relevant files, trace the issue.")
Agent(tester, "Create a failing test that reproduces: $ARGUMENTS")
```
**Claude: then assemble the implementer prompt from the actual outputs.** The
Claude implementer runs in an isolated worktree with no access to prior agent results, so paste
real content — not placeholders, not references:
- The user's original ask (`$ARGUMENTS`) verbatim
- The exact file paths + line ranges `explore` reported (copy them in)
- The recommended fix `explore` identified, quoted line-by-line — **not** "based on findings"
- The build/test command the tester wrote (or repro steps)
- Scope: "only the files listed above; do not refactor adjacent code"
Now spawn:
```
Agent(implementer, "<the assembled briefing above — all five items inline>")
Agent(reviewer, "Quick review of the fix for quality and edge cases")
```
**Standalone Codex branch:** follow the lifecycle and serialization rules at
the top. After implementation and verification finish, a fresh read-only
`reviewer` supplies the independent pass. Skip the Claude bridge branch below.
Any fix that produced a diff gets a cross-model review in parallel with the
reviewer, when the Codex bridge is available — a non-Claude family is the
cheapest insurance against a logic error you just wrote:
```
Agent(codex-verifier, "Cross-model review of the fix diff. Focus on correctness and security. Report findings by severity.")
```
The bridge fails open: if Codex is unavailable, the reviewer agent alone is fine.
If the `codex-verifier` spawn fails, or it reports that Bash was stripped (forked skill contexts), run `bun "$HOME/.claude/src/scripts/codex-run.ts" review` directly instead — never skip the cross-model pass.
Skip the implementer step if `explore` reports the bug is non-reproducible or
already fixed in current HEAD.
## Output
Return a concise summary:
- **Root cause**: What was wrong, with one grade:
- Confirmed: reproduced on the symptom's own surface, a one-variable probe flipped the outcome as predicted, and the cause maps to `file:line`
- Supported: a real record (trace, bisect result, CI log) points at it and nothing contradicts it, but no probe flipped it
- Inferred: reasoned from the code or the timeline, never run
- Unknown: nothing found; list what was searched
Only a Confirmed cause may be committed as a fix (AGENTS.md "Name the Cause"). Any lower grade means gather more evidence and report what is missing; it never ships a fix.
- **Fix applied**: What changed, with one verdict: VERIFIED (the reproducer failed before and passes after on the same surface; a flaky failure passes every run of a count chosen before the first run), NOT VERIFIED (the symptom remains, or the check could not run), or INCONCLUSIVE (wrong surface, noise larger than the effect, or a check that did not test the claim). INCONCLUSIVE is never a pass.
- **Files modified**: List of files
- **Verification**: How it was tested
- **Learning stored**: If applicable
## Remember
- On an OS, device, vendor, or network blocker, apply the AGENTS.md stop-loss: about 20 minutes or 30 tool calls, then a written diagnosis (ruled out with evidence, likely cause, ranked next options) instead of another attempt
---
## Variant: Merge Conflicts
If the failure is unresolved git merge conflicts (not a code bug), skip the explore/tester loop:
1. Detect conflicts: `git diff --name-only --diff-filter=U` lists conflicted paths.
2. Resolve each conflict with minimal, correctness-first edits. Prefer preserving both sides when safe; otherwise choose the variant that compiles and keeps public behavior stable.
3. Regenerate lockfiles with the package manager (`bun install`, `npm install`, etc.) rather than hand-editing.
4. Run compile, lint, and relevant tests.
5. Stage resolved files and summarize key decisions in the commit message.
Guardrails:
- Avoid broad refactors while resolving conflicts — separate PR for cleanup.
## Variant: Failing PR CI
If the failure is on a pushed branch with an open PR (not a local bug), use `gh pr checks` as the source of truth — it covers all PR-attached checks, not just GitHub Actions:
1. Resolve the PR: `gh pr view --json number,url,headRefName`.
2. Inspect attached checks: `gh pr checks --json name,bucket,state,workflow,link`.
3. For each failed check, fetch logs:
- GitHub Actions: `gh run view RUN_ID --log-failed`.
- External services: follow the check `link` to the provider.
4. Extract the first actionable error. Apply the smallest safe fix.
5. Push and re-check. The check set can change between runs — re-read `gh pr checks` after every push. To wait for the result, use the `land` skill's Step 9 watch; do not write a polling loop.
Guardrails:
- Fix one actionable failure at a time.
- If the failure is clearly unrelated to the PR and already fixed on main, merge main into the branch instead of bloating the PR with unrelated fixes.
- For flaky checks, retry once and report flake evidence rather than chasing a phantom fix.