Skip to content
Skills Library
Programming · Building & coding

test-driven-development

/test-driven-development

Use when implementing any feature or bugfix in code — guides the strict RED-GREEN-REFACTOR cycle: write one failing test, confirm it fails for the right reason, write the minimal code to pass, refactor while the context is fresh.

Repository
pxp_skill ↗
Licence
MIT
Last repository change
27.06.2026

Assessment and security

90/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content25 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 27.06.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Use when implementing any feature or bugfix in code — guides the strict RED-GREEN-REFACTOR cycle: write one failing test, confirm it fails for the right reason, write the minimal code to pass, refactor while the context is fresh.

Original author description

Use when implementing any feature or bugfix in code — guides the strict RED-GREEN-REFACTOR cycle: write one failing test, confirm it fails for the right reason, write the minimal code to pass, refactor while the context is fresh.

How it works

  1. The Iron Law
  2. The Cycle
  3. Common Rationalizations
  4. Red Flags — STOP
Original SKILL.md headings · 68 lines, 437 words
SKILL.md preview
---
name: test-driven-development
description: "Use when implementing any feature or bugfix in code — guides the strict RED-GREEN-REFACTOR cycle: write one failing test, confirm it fails for the right reason, write the minimal code to pass, refactor while the context is fresh."
---

# Test-Driven Development

A disciplined cycle for writing code one behavior at a time: red (failing test) → green (minimal code) → refactor.

## The Iron Law

**No production code without a failing test first.** Not even one line. Not even "I'll just sketch this out." Not even "the test is obvious — I'll add it after."

## The Cycle

### 1. Write the failing test

Write a single test for one behavior. The test should:

- Describe *what* you want, not *how* it's done.
- Fail in a meaningful way (assertion error — not syntax error, not missing import).
- Be small — favor one method's behavior over a whole class.

### 2. Confirm red

Run the test. Confirm it fails for the expected reason.

- Unexpected failure reason: diagnose first; don't paper over with implementation.
- Passes without any implementation: the behavior already exists, or the test isn't testing what you think. Investigate.

### 3. Write the minimal implementation

Write the simplest code that makes the test pass. Resist the urge to add more.

- No "while I'm here" additions.
- No defensive code for cases not yet tested.
- No abstractions for hypothetical future tests.

### 4. Confirm green

Run the test. Confirm it passes. Run the full suite to check for regressions.

### 5. Refactor

Look at the code you just wrote and the code around it:

- Is there duplication to extract?
- Are names clear and intention-revealing?
- Is the code as simple as it can be while remaining clear?
- Any code smells?

If you see an improvement, make it. Re-run tests. If nothing needs refactoring, say so out loud and move on.

## Common Rationalizations

| Excuse | Reality |
|---|---|
| "Test is trivial, I'll skip it" | Trivial tests catch real regressions later. Write it. |
| "I already manually tested it" | Manual tests don't run in CI. Write the automated test. |
| "I'll write the test after" | Tests-after asks "what does this do?" Tests-first asks "what should this do?" Different exercises. |
| "Refactor isn't needed here" | Say so explicitly. Don't silently skip Step 5. |
| "I'll batch the refactor at the end" | Refactor with context fresh, not after you've moved on. |

## Red Flags — STOP

- Code before test.
- "I'll just sketch this out and add the test later."
- Test added after the code already passed manually.
- Implementing more than one behavior per cycle.
- Skipping Step 5 without saying so.

All of these mean: stop, delete the unprotected code, start the cycle properly.

Versions

RepositoryScoreLicence
This page · infews/pxp_skill90MIT
GanyuanRan/Aegis100MIT
lucasouzadev/agent-kit-skill100MIT
zeative/satgas100AGPL-3.0
nikospavlopoulos/devops-mutant-powers100MIT
JohnStrunk/CommonCast100LGPL
Sanit-mann/The-Insectoids100MIT
mastro993/fstack100MIT
jelvodev/yaap100MIT

Database snapshot: 13.11.2026 · package version 7ae84fc5c67d (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100tdd
    Test-driven development with red-green-refactor loop. Use when user wants to build features or fix bugs using TDD, mentions "red-green-refactor", wants integration tests, or asks for test-first development.
  • 100tdd
    Test-driven development with red-green-refactor loop. Use when user wants to build features or fix bugs using TDD, mentions "red-green-refactor", wants integration tests, or asks for test-first development.
  • 100tdd
    Test-driven development with red-green-refactor loop. Use when user wants to build features or fix bugs using TDD, mentions "red-green-refactor", wants integration tests, or asks for test-first development.
  • 100tdd
    Test-driven development with red-green-refactor loop. Use when user wants to build features or fix bugs using TDD, mentions "red-green-refactor", wants integration tests, or asks for test-first development.
  • 95argentos-test-driven-development
    Use when implementing any feature or bugfix, before writing implementation code. Enforces RED-GREEN-REFACTOR cycle with test-first approach.
  • 100tdd
    Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.