tdd-bug-fix
Fix bugs using red-green-refactor — reproduce the bug as a failing test first, then fix it. Use when fixing bugs to ensure they never regress.
npx skills add rshankras/claude-code-apple-skills --skill tdd-bug-fix --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# 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 outp
- When This Skill Activates
- Why TDD for Bug Fixes
- Process
- Phase 1: Understand the Bug
- Phase 2: RED — Write the Failing Test
- Phase 3: GREEN — Fix the Bug
- Phase 4: REFACTOR (Optional)
- Phase 5: Verify Completeness
- Multiple Related Bugs
- Output Format
- Common Pitfalls
- References
xcodebuild test -scheme YourApp \ Run the bug fix test Run ALL tests to check for regressions xcodebuild test -scheme YourApp
What does the tdd-bug-fix skill do?
Fix bugs using red-green-refactor — reproduce the bug as a failing test first, then fix it. Use when fixing bugs to ensure they never regress.
How do I install it?
Run `npx skills add rshankras/claude-code-apple-skills --skill tdd-bug-fix --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From rshankras/claude-code-apple-skills, a repository with 589 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
