$npx skillfedfor your agent

bug-fix-tdd

Bug Fix TDD guides you through test-driven bug resolution: write a failing test that reproduces the issue, then apply the minimum fix to make it pass. The skill covers test placement, mock patterns, and the complete red-green-refactor cycle for both standard fixes and fallback code-analysis approaches when reproduction isn't possible.

Bug Fix TDD reproduces bugs with failing tests, then applies minimal fixes using red-green-refactor workflow.

AI-generated summary based on this skill's SKILL.md

158 22 Apache-2.0updated by stacklok

Decision gist · record as of 2026-07-27

Bug Fix TDD reproduces bugs with failing tests, then applies minimal fixes using red-green-refactor workflow. Bug Fix TDD guides you through test-driven bug resolution: write a failing test that reproduces the issue, then apply the minimum fix to make it pass. The skill covers test placement, mock patterns, and the complete red-green-refactor cycle for both standard fixes and fallback code-analysis approaches when reproduction isn't possible.

manual: git clone https://github.com/stacklok/toolhive-studio → cp -r toolhive-studio/.claude/skills/bug-fix-tdd ~/.claude/skills/bug-fix-tdd
.claude/skills/bug-fix-tdd/SKILL.md · version 90d18c8a

Use it when

  • Bug Fix TDD's red-green-refactor workflow has three phases: Red (write a test that fails because the bug exists).
  • Bug Fix TDD guides you to write a failing test that captures the buggy behavior before touching production code.

Verify before relying

Read SKILL.md below before installing (1 file). Open directory: indexed for reading, not audited.

Same gist for agents: .md · .json

Install

stacklok/toolhive-studio/bug-fix-tdd · repository language: TypeScript

Open directory. Skills are indexed for reading, not audited. Review a skill's body before installing it.

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

How do I fix bugs with test-driven development?

Bug Fix TDD teaches you to start by writing a failing test that reproduces the bug, then apply minimal code changes to make it pass. This red-green-refactor cycle ensures your fix is targeted and regression-proof. The skill covers test placement, mock setup, and verification strategies for both unit and integration scenarios.

What's the TDD bug fix workflow red green refactor cycle?

Bug Fix TDD's red-green-refactor workflow has three phases: Red (write a test that fails because the bug exists), Green (apply the smallest code change to pass that test), and Refactor (clean up while keeping tests passing). This approach prevents over-engineering and keeps fixes minimal and focused on the actual problem.

How do I reproduce a bug with a unit test first?

Bug Fix TDD guides you to write a failing test that captures the buggy behavior before touching production code. You set up mocks and assertions that expose the issue, then verify the test fails. Once the test confirms the bug, you apply your fix and watch it turn green—proving the bug is resolved.

Can Bug Fix TDD automate bug fixing in CI pipelines?

Yes. Bug Fix TDD covers integrating test-first bug fixes into CI workflows so that regression tests run automatically on every commit. The skill teaches how to structure tests and minimal fixes that CI systems can validate, catching regressions early and ensuring fixes stay stable across deployments.

What if I can't easily reproduce the bug in a test?

Bug Fix TDD includes fallback code-analysis approaches when direct reproduction isn't possible. The skill teaches mock patterns and test design strategies to isolate hard-to-reproduce issues, plus techniques for analyzing logs and state to construct a test that validates your fix without needing the exact original conditions.

SKILL.md

Rendered from the published skill. Quoted content, verbatim.

Bug Fix TDD

Reproduce bugs with a failing test, then apply the minimum fix. This skill is used by the automated bug-fix agent in CI but can also be invoked manually.

TDD Workflow

Phase 1 — Analysis & Failing Test (Red)
  1. Parse the bug report: extract description, steps to reproduce, expected vs actual behavior
  2. Find relevant code: use Grep/Glob to locate the component, hook, or route mentioned in the bug
  3. Write a unit test that reproduces the bug — the test MUST FAIL
  4. Run the test: pnpm run test:nonInteractive -- <test-file-path>
  5. Verify failure reason: the test must fail because of the bug, not because of import errors or unrelated issues
  6. Retry if needed: if the test passes (bug not reproduced), try a different approach (max 3 attempts)
  7. Write bug-analysis.md with findings (see format below)

Constraints: Do NOT modify source files in Phase 1. Only create/edit

(truncated - see the full file via the links below)

File tree — 1 file
.claude/skills/bug-fix-tdd/SKILL.md

Let your AI agent find skills like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 56,283 agent skills by what they can do, searchable in plain language.

wish › “Fix bugs using test-driven development workflow”

Give your agent the search over MCP, or paste the wish link into any chat. No install? Search from any chat →

Related skills

React Testing Patterns
by hieutrtr · hieutrtr/ai1-skills

Master Testing Library and Vitest patterns for React components, custom hooks, and async workflows. This skill covers behavior-driven testing with userEvent, MSW for API mocking, renderHook for custom logic, and jest-axe for accessibility audits—everything except E2E tests and TDD enforcement.

no license declared → metadata onlyupdated Feb 2026
★ 8repo stars
testing-strategy
by cacr92 · cacr92/WeReply

Testing Strategy provides comprehensive testing patterns for Tauri applications spanning Rust backend and React frontend. It covers unit and integration tests, test fixtures, command mocking, and test coverage strategies to support quality assurance and TDD workflows.

MITfor claude-code, codex, cursorupdated Jan 2026
★ 4repo stars
react-testing
by affaan-m · affaan-m/ECC

Master unit testing for React components by querying the DOM as users do, not by inspecting implementation details. This skill covers React Testing Library patterns, userEvent interactions, network mocking with MSW, custom hook testing, and accessibility checks with axe. Learn when to reach for Vitest, Jest, or browser-based runners, and how to structure provider-wrapped tests that mirror production.

MITupdated Jul 2026
★ 234,207repo stars
tanstack-query
by bobmatnyc · bobmatnyc/claude-mpm-skills

TanStack Query handles server-state fetching and caching in React applications, automating data synchronization and eliminating manual boilerplate. It provides built-in background refetching, optimistic mutations, intelligent cache invalidation, and pagination support for complex data workflows.

MITupdated Jul 2026
★ 62repo stars
tanstack-query
by tanstack-skills · tanstack-skills/tanstack-skills

TanStack Query provides asynchronous state management for server data across React, Vue, Solid, Svelte, and Angular. It handles caching, background synchronization, pagination, infinite scrolling, and optimistic updates automatically. Use queries for data fetching and mutations for server modifications, with lifecycle hooks for managing side effects and rollback scenarios.

MITupdated Jan 2026
★ 30repo stars
test-driven-development
by ShaftHQ · ShaftHQ/SHAFT_ENGINE

This skill teaches the red-green-refactor cycle: write a failing test, verify it fails for the right reason, implement just enough code to pass, then refactor. Follow the iron law—no production code without a failing test first—and use this approach for all features, bug fixes, and refactoring work.

MITfor claude-codeupdated Jul 2026
★ 404repo stars

More skills Test Driven Development (unlicensed) · team-frontend-debug (MIT) · Investigate (NOASSERTION)

Tags
test-first-debuggingregression-testingred-green-refactorautomated-bug-repairci-integrationmock-patternstest-placementminimal-fixesbug-reproduction