Agent skill

Bug Fix TDD

by stacklok in stacklok/toolhive-studio

Reproduce and fix bugs using TDD. An agent skill from stacklok/toolhive-studio.

Apache-2.0Auto-check: notesTesting & QA

Install Bug Fix TDD

skills CLI
$ npx skills add stacklok/toolhive-studio --skill bug-fix-tdd -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install stacklok/toolhive-studio bug-fix-tdd --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/stacklok/toolhive-studio.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.codex/skills/bug-fix-tdd .claude/skills/bug-fix-tdd && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
bug-fix-tdd
GitHub stars
170
Token cost
~1.7k tokens
SKILL.md length
492 words
Files
1
Skills in repo
9
Repo updated
First seen
Licence
Apache-2.0

At a glance

Reproduce and fix bugs using TDD. An agent skill from stacklok/toolhive-studio.

  • Works in 2 steps: Analysis & Failing Test (Red) → Fix (Green)
  • Analyzing a bug report
  • SKILL.md covers TDD Workflow, Test Placement Rules, Test Patterns and bug-analysis.md Format, plus 3 more sections
  • Calls pnpm

What it does

Bug Fix TDD is an agent skill from stacklok/toolhive-studio. Reproduce and fix bugs using TDD. Use when analyzing a bug report, writing a regression test, or applying a minimal fix. Covers test placement, mock patterns, and the red-green-refactor workflow for automated bug fixing.

Its SKILL.md is about 1.7k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Testing & QA, covering Debugging and Test-driven development. It works with Model Context Protocol and pnpm. The repository describes itself as: ToolHive is an application that allows you to install, manage and run MCP servers and connect them to AI agents. The licence is Apache-2.0.

When your agent uses it

  • Analyzing a bug report
  • Writing a regression test
  • Applying a minimal fix

Example prompts

  • “/bug-fix-tdd”

Workflow steps

2 steps, taken from the step headings in SKILL.md.

  1. Analysis & Failing Test (Red)
  2. Fix (Green)

What it can do on your machine

Read from SKILL.md and the folder at commit 87f7a55. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • pnpm

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use pnpm, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Bug Fix TDD loads about 1.7k tokens when it runs. Until then it costs about 58 tokens; SKILL.md has 492 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~58
When it runs · the whole SKILL.md, loaded when a task matches
~1.7k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NoteMentions a .env fileSKILL.md:34
    traints**: Do NOT run git, gh, or modify .env files.
  • NoteMentions a .env fileSKILL.md:48
    s Phase 2. Do NOT run git, gh, or modify .env files.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from stacklok/toolhive-studio at commit 87f7a55, republished under its Apache-2.0 licence (© stacklok). 492 words, ~1,654 tokens.

Download SKILL.mdSave it as .claude/skills/bug-fix-tdd/SKILL.md (or your agent's skills folder).
name
bug-fix-tdd
description
Reproduce and fix bugs using TDD. Use when analyzing a bug report, writing a regression test, or applying a minimal fix. Covers test placement, mock patterns, and the red-green-refactor workflow for automated bug fixing.

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 test files and bug-analysis.md.

Phase 2 — Fix (Green)
  1. Read the failing test and bug-analysis.md
  2. Apply the MINIMUM fix to make the test pass — do not over-engineer
  3. Run the single test: pnpm run test:nonInteractive -- <test-file-path>
  4. Run the full suite: pnpm run test:nonInteractive
  5. Run static checks: pnpm run lint and pnpm run type-check
  6. Retry if needed: if any check fails, adjust the fix (max 5 attempts)
  7. Write pr-body.md and fix-title.txt

Constraints: Do NOT run git, gh, or modify .env files.

Phase 2b — Direct Fix (Fallback)

If Phase 1 cannot reproduce the bug in a test (test passes after 3 attempts), Phase 2b runs instead of Phase 2.

  1. Read bug-analysis.md and issue-body.md for context
  2. Apply the MINIMUM fix based on code analysis alone
  3. If you CAN write a regression test, do so — but it is not required
  4. Run the full suite: pnpm run test:nonInteractive
  5. Run static checks: pnpm run lint and pnpm run type-check
  6. Retry if needed: if any check fails, adjust the fix (max 5 attempts)
  7. Write pr-body.md and fix-title.txt — note in the PR body that no regression test was possible

Constraints: Same as Phase 2. Do NOT run git, gh, or modify .env files.

Show full SKILL.md (137 more words)Show less

Test Placement Rules

  • Tests go in __tests__/ directories colocated with the source file
  • If a test file already exists for the component, add a new describe('Bug #N', ...) block instead of creating a new file
  • Naming: <component-name>.test.tsx or <hook-name>.test.ts
  • Example: source at renderer/src/features/skills/components/card-skill.tsx → test at renderer/src/features/skills/components/__tests__/card-skill.test.tsx

Test Patterns

Component test (simplest)
typescript
import { render, screen, waitFor } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'

const queryClient = new QueryClient({
  defaultOptions: { queries: { retry: false } },
})

render(
  <QueryClientProvider client={queryClient}>
    <MyComponent prop="value" />
  </QueryClientProvider>
)

await userEvent.click(screen.getByRole('button', { name: /save/i }))
await waitFor(() => {
  expect(screen.getByText('Saved')).toBeVisible()
})
Route-level component test
typescript
import { createTestRouter } from '@/common/test/create-test-router'
import { renderRoute } from '@/common/test/render-route'

const router = createTestRouter(MyPage, '/my-page')
renderRoute(router, { permissions: { canManageClients: true } })

await waitFor(() => {
  expect(screen.getByRole('heading', { name: /my page/i })).toBeVisible()
})
Hook test
typescript
import { renderHook, waitFor } from '@testing-library/react'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'

const queryClient = new QueryClient({
  defaultOptions: { queries: { retry: false } },
})
const Wrapper = ({ children }) =>
  <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>

const { result } = renderHook(() => useMyHook(), { wrapper: Wrapper })

await waitFor(() => expect(result.current.isLoading).toBe(false))
expect(result.current.data).toEqual({ ... })
API mock override (return different data)
typescript
import { mockedGetApiV1BetaWorkloads } from '@mocks/fixtures/workloads/get'

mockedGetApiV1BetaWorkloads.override((data) => ({
  ...data,
  workloads: [], // Force empty state
}))
API mock error response
typescript
import { HttpResponse } from 'msw'

mockedGetApiV1BetaWorkloads.overrideHandler(() =>
  HttpResponse.json({ error: 'Server error' }, { status: 500 })
)
Request recording (for mutations)
typescript
import { recordRequests } from '@/common/mocks/node'

const rec = recordRequests()
// ... trigger action ...
const request = rec.recordedRequests.find(
  (r) => r.method === 'POST' && r.pathname === '/api/v1beta/workloads'
)
expect(request?.payload).toMatchObject({ name: 'my-server' })

bug-analysis.md Format

markdown
## Bug Summary

<1-2 sentences describing the bug>

## Root Cause

<Technical explanation of why the bug occurs>

## Relevant Files

- `path/to/source.tsx` — <what it does>
- `path/to/related.ts` — <why it's relevant>

Test file: path/to/\_\_tests\_\_/component.test.tsx

## Proposed Fix

<Description of the minimum change needed>

## Files to Modify

- `path/to/file.tsx` — <what to change>

Important: The Test file: line must be on its own line starting with exactly Test file: followed by the path. This is parsed by the CI workflow.

pr-body.md Format

markdown
## Summary

Fixes #<issue-number>.

- <1-2 bullet points describing the fix>

## Test

- Added regression test in `<test-file-path>`
- Test reproduces the bug (fails before fix, passes after)

---

_Automated fix by Claude Code TDD Agent_

fix-title.txt Format

Single line, conventional commit format:

fix(<scope>): <description> (#<issue-number>)

Example: fix(skills): prevent crash when metadata is undefined (#423)

  • testing-with-api-mocks — Auto-generated MSW fixtures and mock basics
  • testing-api-assertions — Verifying mutations with recordRequests()
  • testing-api-overrides — Conditional mock responses for testing filters/params

© stacklok, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .codex/skills/bug-fix-tdd of stacklok/toolhive-studio.

Open the folder on GitHubat commit 87f7a55

Compare with similar skills

Bug Fix TDD next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Bug Fix TDD compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Bug Fix TDD this skillstacklok/toolhive-studio170—~1.7kAutomated safety check: NotesApache-2.0
OpenWork Desktop CDP Driverdifferent-ai/openwork24k—~465Automated safety check: PassCustom licence
Ue Test AuthoringJasonMa0012/MooaToon749—~2.1kAutomated safety check: NotesCustom licence
Foreman DebugVisionForge-OU/foreman444—~1.1kAutomated safety check: PassCustom licence
Fix Bugtddworks/ClaudeBar1.5k—~2.2kAutomated safety check: PassApache-2.0
Deck Reproasheshgoplani/agent-deck1k—~1.3kAutomated safety check: PassMIT

Similar skills

  • OpenWork Desktop CDP Driver

    different-ai/openwork

    Drives a running OpenWork desktop window over CDP from the shell to evaluate JS, take screenshots, start sessions and send prompts for hand checks.

    24k GitHub stars~465 tokensUpdated today
    Testing & QAAuto-check passed
  • Ue Test Authoring

    JasonMa0012/MooaToon

    A skill your agent uses when writing or modifying UE automated tests (Automation, CQTest, Functional, Gauntlet, LowLevel) with Rider MCP available.

    749 GitHub stars~2.1k tokensUpdated 19 days ago
    Testing & QAAuto-check: notes
  • Foreman Debug

    VisionForge-OU/foreman

    Headless root-cause debugging loop for a Foreman worker whose tests, build, or acceptance check are failing — especially on a retry.

    444 GitHub stars~1.1k tokensUpdated 3 mo ago
    Testing & QAAuto-check passed
  • Fix Bug

    tddworks/ClaudeBar

    Guide for fixing bugs in ClaudeBar following Chicago School TDD and rich domain design.

    1.5k GitHub stars~2.2k tokensUpdated today
    Testing & QAAuto-check passed
  • Deck Repro

    asheshgoplani/agent-deck

    Reproduce agent-deck bugs from an issue, transcript excerpt, or description in an isolated environment, and prove fixes with the same reproduction and a regression test.

    1k GitHub stars~1.3k tokensUpdated yesterday
    Testing & QAAuto-check passed
  • TDD Py4vasp

    vasp-dev/py4vasp

    Carry out ONE chunk of a py4vasp change test-first: RED (watch the test fail for the right reason) → GREEN → refactor → one local commit.

    100 GitHub stars~2k tokensUpdated today
    Testing & QAAuto-check passed

More from stacklok/toolhive-studio

All 9 skills in this repo
  • Deep Links

    stacklok/toolhive-studio

    Deep links in ToolHive Studio. An agent skill from stacklok/toolhive-studio.

    170 GitHub stars~1.6k tokensUpdated today
    Auto-check: notes
  • Devcontainer Dev

    stacklok/toolhive-studio

    Spin up and interact with ToolHive Studio's containerized dev environment (Xvfb + noVNC + DinD).

    170 GitHub stars~3.8k tokensUpdated today
    Auto-check: notes
  • Security Vuln Remediation

    stacklok/toolhive-studio

    Remediate security vulnerabilities found by Grype or pnpm audit.

    170 GitHub stars~2.3k tokensUpdated today
    Auto-check: notes
  • Skill Creator

    stacklok/toolhive-studio

    Create new AI agent skills for Claude Code, Codex, and Cursor.

    170 GitHub stars~677 tokensUpdated today
    Auto-check passed
  • Testing API Assertions

    stacklok/toolhive-studio

    Verify API requests in tests. An agent skill from stacklok/toolhive-studio.

    170 GitHub stars~993 tokensUpdated today
    Auto-check passed
  • Testing API Overrides

    stacklok/toolhive-studio

    Test that components send correct query parameters or request arguments.

    170 GitHub stars~1.6k tokensUpdated today
    Auto-check passed

Questions about Bug Fix TDD

What does Bug Fix TDD do?

Reproduce and fix bugs using TDD. An agent skill from stacklok/toolhive-studio. Bug Fix TDD is an agent skill from stacklok/toolhive-studio. Reproduce and fix bugs using TDD.

When should I use Bug Fix TDD?

Bug Fix TDD fits situations like: analyzing a bug report; writing a regression test; applying a minimal fix.

How do I install Bug Fix TDD in Claude Code?

Run `npx skills add stacklok/toolhive-studio --skill bug-fix-tdd -a claude-code`. Or copy the skill folder (.codex/skills/bug-fix-tdd in stacklok/toolhive-studio) into .claude/skills/bug-fix-tdd in your project. Claude Code loads it when a task matches its description.

How do I install Bug Fix TDD in Codex?

Run `npx skills add stacklok/toolhive-studio --skill bug-fix-tdd -a codex`. Or copy the skill folder (.codex/skills/bug-fix-tdd in stacklok/toolhive-studio) into .agents/skills/bug-fix-tdd in your project. Codex loads it when a task matches its description.

Can I use Bug Fix TDD in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add stacklok/toolhive-studio --skill bug-fix-tdd -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/bug-fix-tdd, .gemini/skills/bug-fix-tdd, .github/skills/bug-fix-tdd and .opencode/skills/bug-fix-tdd in your project.

What does Bug Fix TDD need to run?

Going by SKILL.md and its folder, Bug Fix TDD needs the command-line tools its instructions call (pnpm).

Does Bug Fix TDD access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Bug Fix TDD safe to install?

Our automated static check of SKILL.md found notes only (mentions a .env file), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Bug Fix TDD use?

Bug Fix TDD is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Bug Fix TDD use?

About 1.7k tokens (SKILL.md is roughly 6.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Bug Fix TDD?

Skills that share tags, products or a category with Bug Fix TDD: OpenWork Desktop CDP Driver (different-ai/openwork, 24k stars), Ue Test Authoring (JasonMa0012/MooaToon, 749 stars), Foreman Debug (VisionForge-OU/foreman, 444 stars) and Fix Bug (tddworks/ClaudeBar, 1.5k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Bug Fix TDD?

stacklok (a GitHub organization) maintains it in stacklok/toolhive-studio, which has 170 GitHub stars. The repository holds 9 skills in this directory. The repository was last updated on October 7, 2026.

Source: stacklok/toolhive-studio on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.