Test-Driven Development

VerifiedSafe

Practice test-driven development with a red-green-refactor workflow for new features and bug fixes.

Sby Skills Guide Bot
TestingIntermediate
8/11/2026
Claude Code
#tdd#red-green-refactor#unit-tests#test-first#bug-fixes

Recommended for

Automated summary

This skill runs a red-green-refactor loop for new features and bug fixes: write the failing test first, then the smallest change that makes it pass.

Strengths

  • Requires writing the failing test first and verifying the red phase by running the relevant test suite
  • Explicitly branches between bug fix and new feature, reading specs or capturing expected vs. actual behavior plus a reproduction path
  • Keeps changes scoped to the behavior under test and only refactors once tests demonstrate the intended behavior
  • Closes with a concrete report: test paths, the observed red failure, the passing result, and follow-up work

Limitations

  • Assumes an existing unit-test setup and repo conventions you must inspect to pick the right test location
  • Does not create or modify E2E tests unless explicitly asked, and only flags when browser-flow coverage is relevant
  • Depends on the Developer persona guidance in `subagents/developer.md` and defers tooling, config, or linting work to `/code`
When to use it

Use it when a feature or bug fix should be driven by new automated test coverage at the unit level.

When not to use it

Avoid it for tooling, configuration, or linting changes, or when the main goal is end-to-end browser coverage.

Security analysis

Safe
Quality score85/100

The skill contains only process guidance for test-driven development. It declares no tools, runs no commands, accesses no secrets, and has no destructive or exfiltration behavior.

No concerns found

How this analysis is made

Examples

New feature, test-first
/tdd Add a `retry` option to our HTTP client that retries failed requests up to 3 times — write it test-first.
Bug fix with reproduction
Use /tdd to fix the pagination bug that skips the last page when the total count is an exact multiple of the page size.
Implement then refactor
Implement the discount calculation described in specs/checkout.md with /tdd, and refactor once the tests pass.

name: tdd description: Practice test-driven development for new features and bug fixes.

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.

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/test-driven-development-mso6xg05/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/test-driven-development-mso6xg05' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/test-driven-development-mso6xg05/download' --output '.skill-downloads/test-driven-development-mso6xg05/SKILL.md.part' && mv '.skill-downloads/test-driven-development-mso6xg05/SKILL.md.part' '.skill-downloads/test-driven-development-mso6xg05/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/test-driven-development-mso6xg05/SKILL.md' && test -s '.skill-downloads/test-driven-development-mso6xg05/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/tdd' && cp -R '.skill-downloads/test-driven-development-mso6xg05' '.claude/skills/tdd'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/test-driven-development-mso6xg05'

openskills read 'test-driven-development-mso6xg05'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/test-driven-development-mso6xg05/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills