Provides clear steps for practicing TDD: write a failing test, implement the fix, then refactor.

Install

mkdir -p .claude/skills/tdd-g2i-ai && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/16659" && unzip -o skill.zip -d .claude/skills/tdd-g2i-ai && rm skill.zip

Installs to .claude/skills/tdd-g2i-ai

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Practice test-driven development for new features and bug fixes.
64 charsno explicit “when” trigger
Beginner

Key capabilities

  • Determine if a task is a bug fix or new feature
  • Write failing tests first for new features or bug fixes
  • Verify the red phase by running the relevant test suite
  • Implement the smallest change to make the new test pass
  • Re-run tests and applicable verification checks
  • End with test paths, observed red failure, passing result, and follow-up work

How it works

This skill guides the user through a red-green-refactor workflow by first identifying the task type, then writing and verifying failing tests, implementing minimal code, and re-running tests.

Inputs & outputs

You give it
A task for a new feature or bug fix
You get back
Test paths, observed red failure, passing result, and follow-up work

When to use tdd

  • Practicing TDD for a new feature
  • Fixing a bug using test-first approach
  • Refactoring code after tests pass
  • Validating smallest implementation changes

About this skill

TDD

Invocation

This skill is performed in the Developer persona. If you are not already running as Developer (for example, the user invoked /tdd directly), read subagents/developer.md and adopt its role guidance for the rest of this task. Stay in the current chat—do not delegate to a subagent.

Objective

Use a red -> green -> refactor workflow for changes that should be test-first.

Use /code instead when the work is implementation-heavy but not centered on new automated test coverage, such as tooling, config, or linting work.

Instructions

  1. Determine whether the task is a bug fix or a new feature.
  2. For new features, read the relevant spec or acceptance criteria before writing tests.
  3. For bug fixes, capture the expected behavior, actual behavior, and reproduction path before writing tests.
  4. Identify the most appropriate unit-level test location based on nearby repo patterns.
  5. Write the failing test first.
  6. Verify the red phase by running the relevant test suite.
  7. Implement the smallest change needed to make the new test pass.
  8. Re-run tests, then run the applicable verification checks (linting, type checking, etc.).
  9. If the change also requires browser-flow validation, call out that E2E tests are relevant and why.
  10. End with the test paths, the observed red failure, the passing result, and any follow-up work.

Guardrails

  • Do not create or modify E2E tests unless the user explicitly asks for E2E coverage.
  • Keep TDD changes scoped to the behavior under test.
  • Refactor only after the tests demonstrate the intended behavior.

When not to use it

  • When the work is implementation-heavy but not centered on new automated test coverage
  • When the user explicitly asks for E2E coverage
  • When TDD changes are not scoped to the behavior under test

Limitations

  • Does not create or modify E2E tests unless explicitly asked
  • TDD changes are scoped to the behavior under test
  • Refactoring occurs only after tests demonstrate intended behavior

How it compares

This skill enforces a test-first approach by requiring a failing test before any code implementation, unlike a manual approach where code might be written before tests.

Compared to similar skills

tdd side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
tdd (this skill)03moNo flagsBeginner
tdd-workflow64moReviewIntermediate
qlty-check57moReviewBeginner
superpowers-tdd57moNo flagsIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry