tdd
Use only when the user explicitly asks for TDD, a failing test, or a regression test, OR when the bug has an obvious cheap local test target. Skip when the…
от jeremybrasher★ 41 звезда на GitHub
Установить tdd в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
TDD Bug Fix
When to use
User explicitly asks for TDD / failing / regression test, OR the bug has an obvious cheap local test target.
Do not use when:
- Test path unclear, expensive, integration-heavy, or not requested
- Only manual/scripted verification is practical
- Feature work with no failing behavior named
Intake — before you proceed
You need all of the following. If any is missing, stop.
- Named bug or intended-vs-actual behavior
- A candidate cheap executable check path, or an explicit skip reason
- Authority to edit tests and production code
If any is missing, stop. Say what is missing and what you need. Do not invent inputs to keep moving.
HOLD — stop and return this, not a polished guess
When you cannot proceed, return the gap.
| Condition | What is missing | What it needs | Return instead |
|---|---|---|---|
| Bug unnamed | Intended and current behavior | One sentence each | I need the behavior delta. Holding. |
| No cheap test path and user insisted on TDD | A practical executable check | Narrower target or alternate verification | State why a failing test is impractical. Do not invent a bad test. |
| Failing-before not demonstrated | Red evidence | Fix the test/repro first | Do not edit production code yet. |
| Would weaken assertions to match wrong code | Correct expected behavior | Product confirmation of behavior change | Holding. Will not weaken the test. |
A HOLD is a return value, not a delay before you guess.
Defaults: cut first
This operation defaults to less, not more.
- Smallest focused regression test
- Prefer no new test over a bad test
- Smallest production change
- No broad fixture churn
- Expansion needs evidence from the request or the observed system — not from a habit of completeness.
Will not produce
- Tests that mostly assert mocks
- Changing tests to match a wrong implementation
- Silent skip of the regression step
- Expensive harness for a small fix when not requested
Before you return
Run this check. If any item fails, fix or HOLD — do not hand over a guess.
- Failing-before evidence named, or explicit impracticality + alternate check
- Passing-after evidence named
- Nearby validation mentioned when risk is broader
What this process changes
The recipe is not a neutral mirror. It changes the work:
- The first cheap test target can become the whole bug story
- Requiring red-green can delay a verified one-line fix
- Sibling coverage expansion can balloon the PR
What still needs a human: Whether the cheap local target is the right object, and whether to skip TDD for cost.
Method card — same family every run
A later agent runs this from this file alone.
- Understand bug -> choose narrow check -> red -> fix -> green -> nearby validation -> report evidence.
Domain recipe
The following is the domain behavior to keep. Alignment sections above constrain intake, pauses, cuts, and refusals; they do not replace this recipe.
When fixing a bug with a clear, cheap test path, make the broken behavior executable before changing production code. The goal is a focused regression test that fails before the fix and passes after it.
Do not force a test when it would be impractical. If the available test would require broad harness setup, brittle mocks, slow end-to-end infrastructure, production-only state, vague reproduction steps, or large unrelated fixture churn, skip adding a new test and use the closest useful verification instead.
Workflow
- Understand the bug. Identify the intended behavior, current behavior, affected path, and smallest observable reproduction.
- Choose the narrowest executable check. Prefer the closest unit, component, integration, or regression test already used for that codepath. If no practical test path is obvious, do not create one from scratch just to satisfy the workflow.
- Write the failing test first. Add the smallest focused test that would have caught the bug. The test should encode intended behavior, not mirror the current implementation.
- Run the new test before fixing. Confirm it fails for the intended reason. If it passes or fails for an unrelated reason, correct the test or reproduction before editing the implementation.
- Fix the bug. Make the smallest production change that satisfies the intended behavior while preserving nearby contracts.
- Rerun the regression test. Confirm the test now passes.
- Run nearby validation. Run relevant adjacent tests, type checks, lint, or scenario checks when the change has broader risk.
If a Failing Test Is Impractical
Do not silently skip the regression step. Before fixing, explicitly explain why a failing test is impossible or not worth the cost, then choose the closest executable regression check available. Examples include a targeted script, manual reproduction command, browser automation, snapshot comparison, log assertion, or focused integration check.
Prefer no new test over a bad test. A bad test is
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- SCORE.json
- SOURCE.md
FAQ
Что делает скилл tdd?
Use only when the user explicitly asks for TDD, a failing test, or a regression test, OR when the bug has an obvious cheap local test target. Skip when the test path is unclear, expensive, integration-heavy, or not requested. Observe required inputs first; HOLD when they are missing rather than guessing.
Как установить скилл tdd?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл tdd запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…