Dev bug review

From google/capsem · View interactive version

Dev bug review is an AI agent skill from the GitHub repository google/capsem. Work a queue of bug reports one by one: confirm, push back, fix only after agreement, commit each. Use when handed several bugs to triage; for a single ad-hoc bug use dev-debugging.

How to use this skill

Skill file

Bug Review

A disciplined workflow for working a queue of bug reports. One bug at a time. No skipping steps. No batching.

The contract

For every incoming bug report, execute these five phases in order. Do not proceed to the next phase without the previous one's output.

  1. Confirm the finding -- reproduce or evidence the bug before believing it
  2. Validate the solution or push back -- evaluate the proposed fix; disagree with reasoning if warranted
  3. Get agreement -- wait for the user to agree before touching code
  4. Implement -- apply the fix, add tests, verify
  5. Summarize, commit, changelog -- one commit per bug, changelog entry included

If there are N bugs, you run this loop N times. Do not try to land all bugs in one commit unless the user explicitly says so.

Phase 1: Confirm the finding

Before writing any code, prove the bug is real and that you understand it.

Output for this phase is a short statement: what the bug is, where it lives, and the evidence. Do not proceed silently.

Phase 2: Validate the solution or push back

The report usually arrives with a proposed fix. Treat it as a hypothesis, not an order (see memory: "Push back on proposed fixes").

Evaluate the proposed fix against:

If the proposed fix is wrong or incomplete, push back with reasoning. State what you'd do instead and why. Do not silently "improve" the fix -- name the disagreement so the user can weigh in.

If the proposed fix is correct, say so plainly. Do not pad with fake alternatives.

Phase 3: Get agreement

Stop and wait. Do not start editing code until the user confirms the plan for this specific bug. A single "sounds good" covers this one bug, not the whole queue.

Auto mode does not override this. Agreement gates on the fix plan are a feature, not an interruption -- the user explicitly asked for a review workflow.

Phase 4: Implement (TDD)

Fixes land test-first. No exceptions.

  1. Write the test first, watch it fail. Before editing implementation code, write a test that captures the bug and fails for the right reason. "Fails for the right reason" matters -- a test that fails because of a missing import tells you nothing. Run the test and see the red.
  1. Apply the fix. Watch the test go green. Minimum code needed -- no opportunistic refactors beyond what the test extraction required (see CLAUDE.md "Minimize code").
  2. If the pattern is systemic, fix all instances in this pass. Do not defer siblings to "a future cleanup". The audit from Phase 2 defines the scope.
  3. While fixing, surface any additional issues you uncover. If the code you're touching has an adjacent bug (zombie children, duplicated branches, wrong error handling), flag it in your summary. Fold small ones into the same fix; call out larger ones for a separate bug review pass.
  4. Opportunistic cleanup -- do it, but name it. When your diagnosis reveals that the buggy code reinvents a wheel the project already has (hand-rolled retry when capsem_core::poll::poll_until exists, hand-rolled 0o600 when pty_log::open_append exists, a vec![...] a clippy-lint away, a patient: bool where an enum self-documents), fix it in the same commit. Do NOT ship a minimal diff on top of a bug that was caused by the duplication -- that's how the same bug class reappears in a new location. Rules: (a) touch only code the fix itself motivates, (b) check existing primitives first (grep for poll_until, capsem_core::, shared helpers) before hand-rolling anything, (c) call out each cleanup in the summary so it's explicit, not silent. "Also fixed while I was here: X, Y, Z." If the cleanup is large enough that it'd dominate the diff or obscure the bug fix, split it into a sibling commit in the same review.
  5. Run the relevant gates:

check_session.py --db only on a quiesced preserved copy

Phase 5: Summarize, commit, changelog

Write a summary back to the user before committing:

Then commit per project rules (CLAUDE.md "Commits"):

Then move to the next bug in the queue and repeat from Phase 1.

Anti-patterns

Relationship to other skills

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.