Skip to content
Skillpedia
Testing15k · #10999

tdd

What it does

The skill guides a bug fix that starts with a focused regression test. It is for developers who want proof that a bug is fixed and will not come back.

When to use it

  • ✓When you ask for test-driven development or a regression test.
  • ✓When a bug has a simple, cheap test that can show the broken behavior.
  • ✓When you want a fix that a test proves will not return.

Skill link

https://github.com/cursor/plugins/blob/main/harness/pstack/claude-code/skills/tdd/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/cursor/plugins/blob/main/harness/pstack/claude-code/skills/tdd/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

Example of what to ask your AI

“Fix the login bug, but write a failing test first so we know it is really fixed.”

5 new skills a week. 1 minute to read.

How it works

The agent describes the bug, writes a small test that should fail, runs it to confirm the failure, and then makes the smallest code change that makes it pass. If a cheap test is not practical, it uses another check.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

TDD Bug Fix

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

  1. Understand the bug. Identify the intended behavior, current behavior, affected path, and smallest observable reproduction.
  2. 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.
  3. 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.
  4. 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.
  5. Fix the bug. Make the smallest production change that satisfies the intended behavior while preserving nearby contracts.
  6. Rerun the regression test. Confirm the test now passes.

If a Failing Test Is Impractical

Use the closest executable regression check instead: 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 one that mostly tests mocks, encodes current implementation details, depends on timing or unrelated global state, needs expensive infrastructure for a small fix, or would be deleted immediately after proving the fix.

Guardrails

  • Do not change tests merely to match a wrong implementation.
  • Do not weaken existing assertions unless the expected behavior has genuinely changed and the reason is clear.
  • Keep the regression test focused on the bug. Avoid broad fixture churn or unrelated coverage expansion.
  • If the bug is flaky, make the test deterministic where possible and document the signal being locked down.
  • If the bug exposes a broader class of failures, first land the focused regression path, then consider additional sibling coverage.

Final Response

Report the evidence, not just the outcome:

  • Name the failing-before test or executable check and the failure it produced.
  • Name the passing-after test run and any nearby validation performed.
  • If failing-before evidence could not be demonstrated, state why and describe the closest regression check used instead.
FAQ

What if no test is practical?

The skill does not force one. It uses the closest useful check instead.

Does the test have to fail first?

Yes. The new test runs before the fix to confirm it fails for the right reason.

Why write the test before the fix?

It shows the bug exists first, and it later shows when the bug is fixed.

Details

Original description by the author

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.

repo: cursor/plugins

Popularity

GitHub stars
15k
Ranking position
#10999
License
—
Updated
10/31/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills