Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Is that skill safe to install?
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
Are you the author of Tdd?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/facta-dev-tdd-b787c1f1)
---
name: "tdd"
description: "Drives an <app> change test-first through the red, green, refactor loop, one seam at a time, with integration tests at the boundaries."
division: testing
---
# <app> TDD skill
> Reusable workflow for building `<app>` features and fixes test-first.
> An agent invokes this skill; the agent supplies the domain knowledge, the
> skill supplies the loop discipline.
## When to Activate
Activate this skill when a change to `<app>` is driven test-first. Typical
triggers:
- The request is to build a feature or fix a bug test-first, or mentions
red, green, refactor.
- The request asks for integration tests, or for the boundary between unit
tests and integration tests in `<app>`.
- A change is being made where a regression test must land at the right
seam.
Do NOT activate this skill when the change is documentation-only, a
mechanical rename, or a configuration edit with no behaviour to pin down.
## Core Principles
- **Red before green.** Write the failing test first, then only the
minimum code to make it pass. Do not anticipate future tests.
- **Test behaviour through public interfaces.** The implementation may
change entirely; the test should not. A good test reads like a
specification ("the user can check out with a valid cart") and survives
refactors because it does not care about internal structure.
- **Tests live at seams.** A seam is the public boundary where behaviour
is observed without reaching inside. Agree the seams up front, then test
only there.
- **One vertical slice at a time.** One test, one minimal implementation,
repeat. Each test is a tracer bullet that responds to what the previous
cycle taught.
- **Refactoring belongs to the review stage**, not to the red-green
implementation cycle.
- **Use the project's own vocabulary.** Test names and interfaces match the
domain language recorded in the glossary and the decisions recorded in
the ADRs for the area being touched.
## Rules
- **No horizontal slicing.** Writing all the tests first and then all the
implementation produces tests that verify imagined behaviour and go
insensitive to real changes.
- **No tautological assertions.** The expected value must come from an
independent source of truth (a known-good literal, a worked example, the
spec). An assertion that recomputes the expected value the way the code
does passes by construction and can never disagree with the code.
- **No implementation-coupled tests.** Mocking internal collaborators,
testing private methods, or verifying through a side channel (querying
the store instead of calling the interface) makes the test break on
refactors while behaviour is unchanged.
- **Agree the seams before writing tests.** State the public interfaces
under test and confirm them with the requester; give each seam a
one-line note on what it catches and what it misses. No test is written
at an unconfirmed seam.
- **Integration tests exercise the real boundary.** In `<app>` that means
the use case over a fake port, the model over a fake adapter, or the
wired composition root, with fakes that are explicit about which layer
they stand in for.
- **One package per test command.** SwiftPM has no workspace: the suite is
run from inside the package that owns it, and the gate reports what it
actually ran.
- **No fabricated results:** never claim a test passes without running it,
and never assert on a behaviour the test does not actually exercise.
- Leave the suite green at the end of every slice: a red test in the tree
is a broken contract, not a to-do.
## Research References
| Claim | Source | Year | Link |
|-------|--------|------|------|
| Red-green loop, seam agreement, anti-patterns (implementation-coupled, tautological, horizontal slicing) | `skills/engineering/tdd/SKILL.md` (upstream, MIT) | 2026 | `skills/engineering/tdd/SKILL.md` |
| The `<app>` test tiers, the per-package command and the fakes | `docs/12-testing-and-ci.md` | - | `docs/12-testing-and-ci.md` |
| The acceptance criteria a test is written against | `PLAYBOOK_TESTS.md` | - | `../PLAYBOOK_TESTS.md` |
## Output Format
Raw structured prose, not a code fence:
```
### <app> tdd, <change in one line>
Seams under test (agreed): <seam> -> catches <x>, misses <y>
Slice 1: test <file>:<name> -> red: <failure> -> green: <implementation> -> <command run>: <result>
Slice 2: test <file>:<name> -> red: <failure> -> green: <implementation> -> <command run>: <result>
Integration coverage: <what runs against the real boundary>
Suite state: <command> -> <result>
```