Skip to content
Back to skills

Test Driven Development

ASecurity

Use for testable behavior changes and bug fixes where a failing test can guide implementation. Do not require a test-first ceremony for documentation, generated code, or changes without meaningful automated coverage.

  • 7 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 2, 2026
developmenttestingdebuggingdocumentation

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned November 29, 2026

npx -y skills add yishan-io/yishan-mono --skill test-driven-development --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Test Driven Development?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Test Driven Development
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/yishan-io-test-driven-development/badge)](https://www.skillsdirectory.com/skills/yishan-io-test-driven-development)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: test-driven-development
description: Use for testable behavior changes and bug fixes where a failing test can guide implementation. Do not require a test-first ceremony for documentation, generated code, or changes without meaningful automated coverage.
---

# Test-Driven Development

For testable behavior, prefer a failing test before the production change. Use the test to demonstrate the missing behavior and protect against regressions.

## Red, Green, Refactor

1. Write a focused test for the next behavior or bug reproduction.
2. Run it and confirm that it fails for the expected reason, not broken test setup. Keep the command and the key line of the failure output as evidence.
3. Make the smallest production change that passes the test.
4. Run the focused test again.
5. Refactor only where useful, keeping the test green.

Run relevant surrounding tests after the coherent behavior change is green. Run broader checks at integration or completion, not after every assertion or tiny edit. After a refactor, rerun the affected tests.

If the test passes before the fix, examine whether it exercises the failure. Do not add an artificial failure just to complete the sequence.

## Local Autonomy

The implementing agent owns test cases and local red/green iterations inside the files in scope. A frozen controller brief is not required for each cycle.

If the same test is still red after 3 fix attempts, stop guessing and switch to `systematic-debugging`. Do not edit the test to make it pass unless you can state why the test, not the code, was wrong. Editing a source file outside the agreed scope to get a test green is a scope change: ask first.

## When Test-First Is Not Useful

Documentation, generated files, mechanical configuration edits, and throwaway prototypes usually do not need this workflow. Use the relevant validation instead.

If a meaningful automated test requires disproportionate infrastructure or unavailable dependencies, explain the limitation and use an appropriate check. Do not add production-only test hooks to satisfy the workflow.

If implementation already exists, add or strengthen coverage where needed. State that tests were added afterward. Do not restart correct work merely to claim TDD.

## Test Quality

Test observable behavior. Use mocks only where isolation requires them. Read `testing-anti-patterns.md` before introducing complex doubles or test-only hooks.

For a bug fix, prefer a regression test that fails on the old implementation and passes on the fix. Report what was tested, the exact commands and results (the red result and the green result), and any gaps. For tracked work, put the red and green results in the task notes at the verification moment, not per cycle.

Review correctness and regression coverage. Missing test-first evidence alone is not a blocking code defect.

Files in this skill

  • SKILL.md4.2 KB
  • testing-anti-patterns.md2.9 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.