tdd-bug-fix

tdd-bug-fix is a skill for Claude Code from rshankras/claude-code-apple-skills. It costs 38 tokens per session (1,796 once invoked), scanned A, original, MIT.

A test-first bug-fixing workflow that reproduces a reported problem as a failing test, fixes the code, and confirms that the test passes.

In plain words
What is it for?
It helps reproduce bugs, verify the fix, and preserve a permanent check for the behavior that was previously broken.
Why use it?
A fix can appear to work without actually covering the original failure, and the same bug may return later. Keeping the new test prevents that regression.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: names the AskUserQuestion tool; positional $N argument.

Part of the apple-skills plugin — 182 skills shipped together , and of apple-skills

Good fit It helps reproduce bugs, verify the fix, and preserve a permanent check for the behavior that was previously broken.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/rshankras/claude-code-apple-skills/tdd-bug-fix
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.

Any agent
npx skills add rshankras/claude-code-apple-skills --skill tdd-bug-fix
Clone the repo
git clone --depth 1 https://github.com/rshankras/claude-code-apple-skills

Made for: Claude Code.

Or install apple-skills, the plugin that ships this one along with the rest of its 182 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for tdd-bug-fix

README.md
[![agentmods](https://agentmods.dev/badge/skills/rshankras/claude-code-apple-skills/tdd-bug-fix/github.svg)](https://agentmods.dev/skills/rshankras/claude-code-apple-skills/tdd-bug-fix)
Your own site
<a href="https://agentmods.dev/skills/rshankras/claude-code-apple-skills/tdd-bug-fix"><img src="https://agentmods.dev/badge/skills/rshankras/claude-code-apple-skills/tdd-bug-fix/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for tdd-bug-fix

Your own site · 80×15
<a href="https://agentmods.dev/skills/rshankras/claude-code-apple-skills/tdd-bug-fix"><img src="https://agentmods.dev/badge/skills/rshankras/claude-code-apple-skills/tdd-bug-fix.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 38 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,796 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00038 $0.01796
Opus 5.5 $0.00015 $0.00718
Sonnet 5.5 $0.00008 $0.00359
Haiku 4.5 $0.00004 $0.00180

Measured 1mo ago against content hash 607b13c4fc0c, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

tdd-bug-fix 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 1mo 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.

skills/testing/tdd-bug-fix/SKILL.md · 264 lines

How it starts

The opening of the file, as written. The whole thing — 264 lines — stays where its author put it; the contents beside it link to each section on GitHub.

TDD Bug Fix

Fix bugs the right way: reproduce first, fix second, verify always. Especially critical when using AI to generate fixes — the test ensures the AI actually solved the problem.

When This Skill Activates

Use this skill when the user:

  • Reports a bug and wants it fixed
  • Says "this is broken" or "this doesn't work"
  • Asks to "fix and add a test" or "fix with TDD"
  • Wants to ensure a bug doesn't come back
  • Is skeptical of AI-generated fixes ("how do I know it's actually fixed?")

Why TDD for Bug Fixes

Without TDD:           With TDD:
Bug reported           Bug reported
  → AI generates fix     → Write failing test (RED)
  → Deploy               → AI generates fix (GREEN)
  → Hope it works        → Test passes — confirmed fixed
  → Bug returns later    → Test prevents regression forever

Process

Phase 1: Understand the Bug

Gather information:

  1. What's the expected behavior?
  2. What's the actual behavior?
  3. Steps to reproduce?
  4. Which code is involved?
Grep: "[relevant keyword]" to find the source
Read: the suspected file(s)

Identify:

  • The function/method where the bug lives
  • The input that triggers the bug
  • The incorrect output/behavior
  • The correct expected output/behavior

Phase 2: RED — Write the Failing Test

Write a test that fails because of the bug. This proves the bug exists.

Template: Logic Bug
import Testing
@testable import YourApp

@Suite("Bug Fix: [Brief description]")
struct BugFix_DescriptionTests {

    @Test("should [expected behavior] — was [actual behavior]")
    func reproduceBug() {
        // Arrange — set up the conditions that trigger the bug
        let calculator = PriceCalculator()

        // Act — perform the operation that's broken
        let result = calculator.applyDiscount(price: 100, percent: 50)

        // Assert — what it SHOULD return (this will FAIL now)
        #expect(result == 50.0)  // Currently returns 0.5 (bug: divides by 100 twice)
    }
}

Read the full file on GitHub · 264 lines

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. 1mo ago First seen · 264 lines · 38 tokens per session scan A 607b13c4fc0c

Subscribe to this mod's changes

tdd-bug-fix is a skill published in the GitHub repository rshankras/claude-code-apple-skills (927 stars, last pushed 26d ago), licensed MIT. It adds 38 tokens to every session and 1,796 once invoked, about $0.0002 per session on Opus 5.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-11-05.

Related

tdd-bug-fix compared with skills from other repositories

tdd-bug-fix next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
tdd-bug-fixrshankras/claude-code-apple-skillsSkill92726d agoMITA38Claude Code
kotlin-testingaffaan-m/ECCSkill317k3d agoMITA38Claude Code, Kiro
cpp-testingaffaan-m/ECCSkill317k3d agoMITA34Claude Code, Kiro
image-crop-rotateinstavm/coderunnerSkill903yesterdayApache-2.0A50Claude Code, Codex
triage-issuesoftspark/ai-toolkitSkill1802d agoApache-2.0A39Claude Code
tddsoftspark/ai-toolkitSkill1802d agoApache-2.0A33Claude Code
tdd-workflowFlorianBruniaux/claude-code-ultimate-guideSkill7.6k2d agoCC-BY-SA-4.0A44Claude Code