pablo-tdd
Skill2 starsChanged 7 days agoMITView on GitHub
Test-driven development: the red-green loop, where tests go, test anti-patterns, mocking at boundaries. Use when writing or planning tests for a code change. [DO NOT] use for reviewing tests (use pablo-test-review).
In this repository12 other files it gives its agents.
- code-review-checklistSkill
- evaluating-agent-skillsSkill
- human-like-writingSkill
- pablo-code-philosophySkill
- pablo-code-planningSkill
- pablo-code-reviewSkill
- pablo-code-simplifySkill
- pablo-goal-discoverySkill
- pablo-test-reviewSkill
- qa-adversarySkill
- refactor-identificationSkill
- writing-agent-skillsSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 1 is distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 13
Tests are part of the deliverable: Every change to existing code and every new piece of code ships with a unit-test plan.
- Very specific: line 42
KISS: write the simplest test that covers the case.
- Very specific: line 44
YAGNI: do not test speculation; every test answers for a behavior that exists today.
- Very specific: line 45
FP: prefer pure functions: they test without state mocks, typed errors assert failure modes, immutability reduces setup.
- Distinctive: line 51
Red before green: Write the failing test first, then only enough code to pass it.
- Very specific: line 58
When exploring the codebase, read CONTEXT.md (if it exists) so test names and interface vocabulary match the project's domain language.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
<!-- Attribution: adapted from mattpocock/skills -->Test-Driven Development
TDD is the red → green loop. Apply it so tests are worth keeping: know what a good test is, where tests go, the anti-patterns, how Pablo's principles apply to tests, and the rules of the loop. Every section applies on every cycle; consult them before and during the loop, not after.
Tests are part of the deliverable. Every change to existing code and every new piece of code ships with a unit-test plan; see the bullet of the same name in the pablo-code-philosophy skill.
Exception: bare snippet request. A bare snippet request with no repo/change context → Surgical Changes wins, no test plan. When the user asks for a standalone snippet with no repository and no change context to test against, [DO NOT] invent a test plan; follow the pablo-code-philosophy Surgical Changes contract and deliver the snippet.
What a good test is
A good test verifies behavior through public interfaces, not implementation details, so it reads like a specification and survives refactors.
A good test also encodes WHY the behavior matters, not just WHAT it does. If a test can't fail when the business logic it covers changes, the test is wrong - it's asserting shape, not intent.
The operational checklist and code examples live in references/tests.md; mocking guidelines in references/mocking.md.
Seams: where tests go
A seam is the public boundary where tests observe behavior without reaching inside. Tests live at seams, never against internals.
[ALWAYS] test only at pre-agreed seams. Before writing any test, write down the seams under test and confirm them with the user. When a plan proposes the seams (per pablo-code-planning), confirm those seams with the user before implementing - the plan proposes, the user confirms, tests follow. [DO NOT] write a test at an unconfirmed seam. Ask: "What's the public interface, and which seams should we test?" Not everything can be tested; agreeing the seams up front is how testing effort lands on critical paths and complex logic instead of every edge case outside those seams.
Anti-patterns
- Implementation-coupled: tests internal structure, mocks internal collaborators, calls private methods, asserts call counts or call order, or names the test for HOW instead of WHAT. The tell: the test breaks on refactor while behavior is unchanged.
- Tautological: the assertion recomputes the expected value the way the code does (
expect(add(a, b)).toBe(a + b)), so it passes by construction and can never disagree with the code. Expected values [MUST] come from an independent source of truth: a known-good literal, a worked example, the spec. - Horizontal slicing: all tests written first, then all implementation. Bulk tests verify imagined behavior: they test the shape of things rather than user-facing behavior, go insensitive to real changes, and commit to test structure before the implementation is understood. [ALWAYS] work in vertical slices: one test → one implementation → repeat, each test a tracer bullet that responds to what the last cycle taught.
- Bypassing the interface: verifies through a side channel, such as querying the database directly, instead of using the public interface the caller would use. The offense is in verification, not setup: mocking or seeding the database at the system boundary is legitimate (see references/mocking.md); the test must still assert through the public interface.
Pablo's principles, applied to tests
How the pablo-code-philosophy principles apply to test writing. The theory lives in that skill; only the application is stated here.
- KISS: write the simplest test that covers the case; one test per behavior; no abstraction hierarchies inside tests. (theory: KISS in
pablo-code-philosophy) - DRY: apply the 3-strikes rule to test setup: repeated setup becomes a helper or a parameterized test; KISS wins when the helper obscures the test. (theory: DRY in
pablo-code-philosophy) - YAGNI: do not test speculation; every test answers for a behavior that exists today. (theory: YAGNI in
pablo-code-philosophy) - FP: prefer pure functions: they test without state mocks, typed errors assert failure modes, immutability reduces setup. (theory: FP in
pablo-code-philosophy) - GoF: fixture builders and factories only when the tests justify them, never for decoration. (theory: GoF in
pablo-code-philosophy) - UNX: fail loud: the test fails with actionable information, what was expected, what was found, where. (theory: UNX in
pablo-code-philosophy)
Rules of the loop
- Red before green. Write the failing test first, then only enough code to pass it. [DO NOT] anticipate future tests or add speculative features.
- One slice at a time. One seam, one test, one minimal implementation per cycle.
- Refactoring is not part of the loop. It belongs to the review stage (see the
code-review-checklistskill), not the red → green implementation cycle. - [MUST] stop and ask the user for confirmation before proceeding with the next seam.
Context and decisions
When exploring the codebase, read CONTEXT.md (if it exists) so test names and interface vocabulary match the project's domain language. Respect ADRs in the area being touched.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

