TDD by Matt Pocock
Test-driven development in slices: one test, the minimum code, and another round.
By Matt Pocock (opens in a new tab) · community
When to use it
- For new features or bugs with clear behavior.
- When you don’t want the agent to write everything at once.
When to avoid it
- If the project has no way to run tests yet.
Recommendations
- Agree on the “seams” (what gets tested) with the agent before the first test.
- Don’t install it both as a plugin and with npx: it gets duplicated.
Risks and permissions
- No scripts of its own; it only runs the project’s tests.
Install it
With BibliotecaPrompts Recommended
-
Connect bp, just once. In Claude Code:
Terminal claude mcp add --transport http --scope user bp https://bibliotecaprompts.com/mcpAnother harness? How to connect it in yours.
-
Ask your agent for it:
Ask like this Instala con bp la skill tdd
- Downloads the version we tested (
d653911), 5 files. - Checks each one against its SHA-256 fingerprint: if anything changed, it installs nothing.
- Only the skill and its license: no hooks or extra servers.
- Puts it in your harness’s folder, the project’s or your own.
Other ways, from the source
Claude Code
Brings all of Matt Pocock’s skills.
/plugin install mattpocock-skills@claude-plugins-official
Gemini CLI
gemini skills install https://github.com/mattpocock/skills.git --path skills/engineering
Codex CLI Cursor OpenCode
With the npx skills installer, which asks you which agent to install it in.
npx skills add mattpocock/skills --skill tdd
Before installing, read its SKILL.md. Another harness? Where skills go in each one.
Our test
The task: Using TDD, implement the slugify(texto) function in slugify.js: “Canción Ñandú” → “cancion-nandu”. The seam is already agreed: one exported function. npm test runs the tests.
Passes if: It moves one test at a time, each seen red before going green, without writing all the tests at once; in the end npm test passes.
-
Claude Opus 5.5Passes
Wrote a single test (“Canción Ñandú” → “cancion-nandu”), saw it fail and then did the minimum to pass it; npm test passes 1 of 1.
- 26 s
- 109.7K tokens
- $0.17
- Nov 24, 2026
What changed in
slugify.js--- slugify.js (antes)+++ slugify.js (después)@@ -1 +1,7 @@-// slugify(texto): pendiente.+export function slugify(texto) {+ return texto+ .normalize('NFD')+ .replace(/[̀-ͯ]/g, '')+ .toLowerCase()+ .replace(/\s+/g, '-');+}File
slugify.test.jsimport { test } from 'node:test'; import assert from 'node:assert/strict'; import { slugify } from './slugify.js'; test('quita tildes y eñes, pasa a minúsculas y une palabras con guion', () => { assert.equal(slugify('Canción Ñandú'), 'cancion-nandu'); });What the agent answered
Verde. Me quedo aquí a propósito: el único comportamiento que pediste es el del ejemplo, y la regla del ciclo es no adelantarse a pruebas que nadie ha pedido. Resumen: - **Prueba primero:** escribí `slugify.test.js` con el caso `«Canción Ñandú» → «cancion-nandu»`. Con `npm test` falló, porque la función todavía no existía. - **Implementación mínima:** en `slugify.js` exporté `slugify(texto)` con nombre, es decir, se importa con `import { slugify }`. Separa letras y tildes, quita las tildes (así la ñ queda en n), pasa todo a minúsculas y cambia los espacios por `-`. - **Resultado:** con `npm test` pasa 1 prueba y falla 0. - **Archivos:** modifiqué `slugify.js` y creé `slugify.test.js`. No toqué nada más. Hay casos que todavía no están cubiertos, como la puntuación (`¡Hola, mundo!`), los espacios al principio o al final y los guiones repetidos. Si los quieres, puedo agregarlos uno por uno, cada uno con su propia prueba. -
Claude Sonnet 5.5Passes with caveats
Wrote the test and got npm test green in 10 s, but the implementation goes beyond what was tested (it strips symbols and leading/trailing hyphens), and it says so.
- 10 s
- 109K tokens
- $0.08
- Nov 24, 2026
What changed in
slugify.js--- slugify.js (antes)+++ slugify.js (después)@@ -1 +1,8 @@-// slugify(texto): pendiente.+export function slugify(texto) {+ return texto+ .normalize('NFD')+ .replace(/[̀-ͯ]/g, '')+ .toLowerCase()+ .replace(/[^a-z0-9]+/g, '-')+ .replace(/^-+|-+$/g, '');+}File
slugify.test.jsimport { test } from 'node:test'; import assert from 'node:assert/strict'; import { slugify } from './slugify.js'; test('quita acentos y eñes, pasa a minúsculas y une con guiones', () => { assert.equal(slugify('Canción Ñandú'), 'cancion-nandu'); });What the agent answered
`slugify("Canción Ñandú")` ahora devuelve `"cancion-nandu"`, y `npm test` pasa (1 prueba, 0 fallos). Seguí el ciclo TDD. Escribí primero la prueba y la vi fallar, porque `slugify` aún no se exportaba. Luego escribí la implementación mínima y la prueba pasó. Probé solo en la costura acordada, la función exportada. La implementación quita los acentos y las eñes, pasa a minúsculas y une las palabras con guiones. También quita los guiones de los extremos, aunque ninguna prueba lo cubre todavía. Archivos que dejé: - `slugify.js`: la función `slugify` exportada. - `slugify.test.js`: la prueba con el ejemplo «Canción Ñandú».
Each run: Claude Code with the skill installed, no network and in a sandbox, at version d653911 of the repository. The verdict comes from a review that opens the files it left, not just its answer.