Skip to content
Back to skills

Tdd

ASecurity

Build or fix code test-first, red then green, with tests at the public seams that survive refactors. Use on "implémente", "corrige ce bug", "TDD", "red-green", when delivering a ticket's acceptance criteria, and for a refactor that must not change behaviour.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 2, 2026
developmentexpresstestingapidatabase

Works with

  • api

Security analysis

A100/100

Scanned December 2, 2026

npx -y skills add Sycatle/senior-mode --skill tdd --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Tdd?

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

Security grade badge for Tdd
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/sycatle-tdd-faa9f1ed/badge)](https://www.skillsdirectory.com/skills/sycatle-tdd-faa9f1ed)

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: tdd
description: Build or fix code test-first, red then green, with tests at the public seams that survive refactors. Use on "implémente", "corrige ce bug", "TDD", "red-green", when delivering a ticket's acceptance criteria, and for a refactor that must not change behaviour.
invocation: explicit
---

# Test-driven delivery

A test written after the code tends to check what the code does. A test written first checks what it
should do, and seeing it fail proves it can catch the bug it is there for. That failure is the point:
a test you never saw red proves nothing.

## Tests worth keeping

- **At the seams.** Test through the public interface the spec names (a function, an endpoint, a command,
  a page), never internals. Code behind a seam can change entirely; its tests should not have to.
- **Behaviour, not implementation.** The tell of a bad test: it breaks on a refactor that changed no
  behaviour. Mocking your own collaborators, testing private functions and checking the database behind
  the interface's back all do that. Mock only what you do not own (the network, the clock, a payment API).
- **Not tautological.** An assertion that recomputes the expected value the way the code does
  (`expect(add(a, b)).toBe(a + b)`) passes whatever the code does. Write the expected value out.
- **Named after the behaviour** ("rejects an expired coupon"), so a failure reads like a broken promise.

## The loop

1. Pick one acceptance criterion and agree on its seam when it is not obvious. Done when you can name the
   test before writing it.
2. **Red:** the smallest test that expresses it. Run it and watch it fail for the reason you expect: a
   failure for another reason (a typo, a missing import) is not red yet.
3. **Green:** the simplest code that passes. Nothing speculative: the next criterion gets its own test.
4. Clean up with the tests green: names, duplication, structure, no behaviour change.
5. Next criterion. Done when every criterion of the ticket has a test you saw fail, then pass.

One slice at a time. Writing all the tests first, then all the code, tests the shape you imagined rather
than the behaviour you build.

## By kind of change

- **A bug:** no fix without a root cause. Reproduce it with a failing test first; the test that catches
  this bug is the one that stops it coming back. The `debug` skill helps when the cause is not obvious.
- **A refactor with no behaviour change:** pin the current behaviour first with characterization tests
  through the seams, see them pass, then change the structure under them.
- **UI and glue** (pages, wiring, configuration): one end-to-end or integration scenario per criterion;
  unit tests only where logic hides.
- **A spike:** explore freely, then throw it away or cover it as above before it is merged.

Red is a step of the loop, not a commit: commit once green, the tests with the code they cover, so every
commit builds (see `commit`).

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.