bug-fixing

A test-first guide for fixing software bugs. Test-first means writing or improving a test that demonstrates the broken behavior before changing the code.

In plain words
What is it for?
Use it to choose a unit or end-to-end test, reproduce a defect, assert the visible result, implement the smallest fix, and verify the focused tests pass.
Why use it?
It keeps fixes focused and proves that the reported behavior is corrected without relying on weak checks or changing unrelated parts of the system.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/nerds-odd-e/doughnut/bug-fixing
Any agent
npx skills add nerds-odd-e/doughnut --skill bug-fixing
Clone the repo
git clone --depth 1 https://github.com/nerds-odd-e/doughnut

Made for: Claude Code, Codex.

Per session 51 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,007 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00051 $0.01007
Opus 5 $0.00026 $0.00504
Sonnet 5 $0.00010 $0.00201
Haiku 4.5 $0.00005 $0.00101

Measured 3d ago against content hash 29daf49b3a88, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

bug-fixing scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/skills/bug-fixing/SKILL.md · 115 lines

What it actually says

Purpose: Observable-behavior fixes with minimal scope and educational failure messages.

Output: Passing focused tests + short summary ending with ## BUG FIX COMPLETE.

Test level choice:

  • Bug matches an existing E2E scenario (same feature, same user interaction) → extend or add an E2E test.
  • Otherwise → a unit test in the "small test" style per unit-testing.mdc (stable-boundary JUnit/Vitest/…): drive a stable boundary (controller, mounted component, CLI run/runInteractive), cover lower layers with crafted data/makeMe, mock only externals.

Before commit: run post-change-refactor (.agents/skills/post-change-refactor/SKILL.md) on the full uncommitted change.

  • Assert observable output — HTTP response, DOM text, terminal output, exit code — not internal state.
  • Prefer expected-vs-actual (expect(actual).toEqual(expected), not expect(condition).toBe(true)). The diff should tell the reader what went wrong.
  • Guard against false positives — the assertion must fail only when the bug is present. Tighten weak assertions.
  • Prefer updating over adding — if the bug contradicts or overlaps an existing test, update that test instead of creating a new one.

<success_criteria>

  • Failing test reproduced the bug for the right reason before the fix
  • Smallest fix makes the new test and related tests pass
  • No dead/debug code left in the change
  • post-change-refactor run before commit (or delegated to caller wrap-up)
  • Final output includes ## BUG FIX COMPLETE </success_criteria>
  1. Bug location and test level chosen (E2E vs unit test).
  2. Test file(s) added or updated.
  3. Fix summary (what changed).
  4. Related tests run and confirmed passing.
## BUG FIX COMPLETE

<out_of_scope>

  • Do not run the full E2E suite unless explicitly requested.
  • Do not add tests that only exercise internal helpers when a stable boundary entry point is available (see unit-testing.mdc).
  • Do not skip the failing-test confirmation step. </out_of_scope>
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 115 lines · 51 tokens per session scan A 29daf49b3a88

Subscribe to this mod's changes

bug-fixing is a skill published in the GitHub repository nerds-odd-e/doughnut (49 stars, last pushed 3d ago), licensed MIT. It adds 51 tokens to every session and 1,007 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

agent-integration

Run all three agent integration phases sequentially: research, write-tests, and implement using E2E-first TDD (unit tests written last). For individual phases, use /agent-integration:research, /agent-integration:write-tests, or /agent-integration:implement. Use when the user says "integrate agent", "add agent…

entireio/cli · 89 tokens

engram-testing-coverage

TDD and coverage standards for Engram. Trigger: When implementing behavior changes in any package.

Gentleman-Programming/engram · 25 tokens

code-assist

Guides implementation of code tasks using test-driven development in an Explore, Plan, Code, Commit workflow. Acts as a Technical Implementation Partner and TDD Coach — following existing patterns, avoiding over-engineering, and producing idiomatic, modern code.

mikeyobrien/ralph-orchestrator · 53 tokens

tdd

Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.

GreyDGL/PentestGPT · 33 tokens

css-design-tdd

Test-driven CSS design system modifications. Run checks before/after CSS changes to verify token usage, variable definitions, fallbacks, and consistency. Use when modifying CSS tokens, fixing design inconsistencies, or auditing CSS architecture.

xiaolai/vmark · 49 tokens

mobiai-mobile-tdd

You MUST use this before writing any implementation code for a mobile feature, bug fix, refactor, or behavior change. Tests come before implementation — no exceptions.

ArisGuimera/MobiAI-Core · 38 tokens