Skip to content
HUIAHUB

mattpocock/skills/skills/engineering/tdd

Test-driven development

Test-driven development for building features or fixing bugs test-first, used when someone mentions red-green-refactor or wants integration tests.

Agent skillAgent skillsMIT

What Test-driven development does

The tdd skill is a reference for the red-green loop: the agent writes one failing test, then only enough code to make it pass, then moves on to the next behavior. You can type /tdd, or the agent can load it when a task fits. Its SKILL.md asks the agent to consult every section before and during each cycle.

Before any test exists, the agent proposes the seams it wants to test at (public interfaces where behavior is visible without reaching inside) and asks you to confirm them, with a one-line note on what each seam catches and misses. No test goes at an unconfirmed seam. While exploring the code it reads GLOSSARY.md, if one exists, so test names match the project's terms, and it respects ADRs in the area it touches. If the shape of the interface is in doubt, it calls the separate codebase-design skill for vocabulary.

Two supporting files hold the detail. tests.md contrasts tests that check behavior through public interfaces with tests tied to internals or ones that recompute the expected value. mocking.md limits mocks to system boundaries such as external APIs, time and randomness, and shows dependency injection as the way to make those boundaries easy to mock. The skill names three anti-patterns to avoid: implementation-coupled tests, tautological assertions and writing all tests before any code. Refactoring sits outside the loop and belongs to the code-review skill.

Install

npx skills@latest add mattpocock/skills -a <agent>

Read the security check below before you run it. The repository's own instructions win if they differ.

Security check

What the skill's files do, from reading them. A flag that nobody has checked yet says "Not checked", never "No".

Runs scripts
No
Uses the network
No
Installs hooks
No
Asks for secrets
No

A file-by-file scan of the tdd folder at commit 4ae2317ddb22 found no scripts, no network calls, no hook definitions and no secret variables. The folder holds three Markdown files and an agents/openai.yaml display config. The TypeScript samples in tests.md and mocking.md are examples inside Markdown, and the skill does not run them. In use, the agent writes tests and code in your project and runs your test command through its own tools, under whatever permissions you have set. Read the Markdown files, and the codebase-design skill it calls, before installing.

Scan details: No scripts, hook definitions, network calls or secret variables were found in the skill folder. Checked at commit 4ae2317ddb22.

Use cases

  • Build a feature with defined inputs and outputs one vertical slice at a time
  • Fix a bug test-first, starting from a failing test
  • Agree which public interfaces to test before any test code is written
  • Keep mocks at external boundaries such as payment APIs and the clock

Limitations

  • Has no refactor step despite the description; refactoring is left to the code-review skill.
  • Calls the separate codebase-design skill, which the repository's docs list as a prerequisite.
  • Does not judge whether a change is worth the loop at all; the docs track this as open issue #746.
  • The docs note agents sometimes write code before the test, and the skill cannot force the order.

Sources