-
Notifications
You must be signed in to change notification settings - Fork 0
SpecifyEncodeFulfillTDDLoop
title: Specify-Encode-Fulfill TDD Loop type: technique created: 2026-06-23 last_updated: 2026-06-23 related: ["LLM TDD Loop", "Building Skills for Claude", "Unit Testing Principles", "Verified Spec-Driven Development"] sources: ["https://www.saturnci.com/my-agent-skill-for-test-driven-development.html"] radar_quadrant: Techniques radar_ring: Assess radar_position: inner
A structured TDD workflow pattern for AI coding agents that replaces the traditional red-green-refactor cycle with a three-phase loop: Specify, Encode, Fulfill (SEF). Developed by Jason Swett and documented as a Claude Code agent skill, the pattern addresses the tendency of agents to write vague, overcomplicated, or semantically meaningless tests.
The pattern runs in three repeating phases:
| Phase | Action |
|---|---|
| Specify | Define what needs to be built as a concrete specification list |
| Encode | Translate each specification item into an automated test |
| Fulfill | Write the minimum code to make the test pass without speculative additions |
The agent is instructed to follow Kent Beck's Canon TDD discipline: one test at a time, minimal implementation, no premature generalisation, and refactoring kept separate from behaviour changes.
The pattern pairs with two review sub-skills that spawn separate agents:
- Test Design Review -- checks each written test against named test design principles (meaningful assertions, isolation, absence of implementation coupling)
- Software Design Review -- evaluates the implementation against general design principles (meaningful naming, single responsibility, minimal public surface)
Review agents run as separate spawned instances to avoid context contamination with the implementation agent.
A key heuristic: when the agent finds test writing difficult, this is treated as an architectural signal rather than a test-writing problem. The recommended response is to pause implementation and resolve the design issue first -- summarised in the skill as "clean the kitchen before making dinner." Difficulty writing tests indicates the code under test lacks clear interfaces or has entangled responsibilities.
The LLM TDD Loop automates the test-run-fix cycle via a shell script. The SEF loop operates at a higher level of abstraction: it governs how the agent decides what to test, how to write the test, and how to implement fulfillment, rather than just mechanically retrying failures. The two patterns are composable -- SEF governs the agent's reasoning; the shell loop governs execution automation.
Specify-Encode-Fulfill TDD Loop sits in the Assess ring of the Techniques quadrant, at inner position. First studied via the SaturnCI blog on 2026-06-23; no personal production use to date. The SEF loop is a concrete, actionable pattern with clear steps -- inner position reflects high confidence in the approach's structure even without first-person trial. The primary open question is whether the companion review sub-skills, as defined, reduce agent test quality issues enough to justify their added round-trips in practice.