Agent skill

Recursive TDD

by try-works in try-works/recursive-mode

A skill your agent uses when implementing any code in recursive-mode Phase 3.

Apache-2.0Auto-check passedTesting & QA

Install Recursive TDD

skills CLI
$ npx skills add try-works/recursive-mode --skill recursive-tdd -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install try-works/recursive-mode recursive-tdd --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/try-works/recursive-mode.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/recursive-tdd .claude/skills/recursive-tdd && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
recursive-tdd
GitHub stars
136
Token cost
~2.8k tokens
SKILL.md length
761 words
Files
2
Skills in repo
9
Repo updated
First seen
Licence
Apache-2.0

At a glance

A skill your agent uses when implementing any code in recursive-mode Phase 3.

  • Works in 3 steps: Artifact TDD Section → Coverage Gate Addition → Approval Gate Addition
  • Implementing any code in recursive-mode Phase 3
  • SKILL.md covers Overview, Trigger examples, When to Use and RED-GREEN-REFACTOR Cycle, plus 7 more sections
  • Calls npm

What it does

Recursive TDD is an agent skill from try-works/recursive-mode. Use when implementing any code in recursive-mode Phase 3. Enforces strict RED-GREEN-REFACTOR discipline with The Iron Law - no production code without a failing test first. Trigger phrases: "implement this", "add feature", "fix bug", "write a failing test", "TDD".

Its SKILL.md is about 2.8k tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files (for example `agents/openai.yaml`).

It sits in Testing & QA, covering Test-driven development. The repository describes itself as: Recursive workflow for agentic engineering. Like Factory Missions but properly recursive, free and open source. The licence is Apache-2.0.

When your agent uses it

  • Implementing any code in recursive-mode Phase 3
  • Phrases: implement this
  • Write a failing test

Example prompts

  • “implement this”
  • “add feature”
  • “fix bug”
  • “/recursive-tdd”

Workflow steps

3 steps, taken from the step headings in SKILL.md.

  1. Artifact TDD Section
  2. Coverage Gate Addition
  3. Approval Gate Addition

What it can do on your machine

Read from SKILL.md and the folder at commit ff75bc7. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • npm

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use npm, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Recursive TDD loads about 2.8k tokens when it runs. Until then it costs about 70 tokens; SKILL.md has 761 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~70
When it runs · the whole SKILL.md, loaded when a task matches
~2.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from try-works/recursive-mode at commit ff75bc7, republished under its Apache-2.0 licence (© try-works). 761 words, ~2,752 tokens.

Download SKILL.mdSave it as .claude/skills/recursive-tdd/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
recursive-tdd
description
Use when implementing any code in recursive-mode Phase 3. Enforces strict RED-GREEN-REFACTOR discipline with The Iron Law - no production code without a failing test first. Trigger phrases: "implement this", "add feature", "fix bug", "write a failing test", "TDD".

recursive-tdd

Overview

Test-Driven Development is mandatory for all recursive-mode implementation work. This skill ensures test-first discipline is followed rigorously and recorded in a way recursive-mode tooling can verify.

Core Principle: If you didn't watch the test fail, you don't know if it tests the right thing.

The Iron Law for recursive-mode:

NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST

Trigger examples

  • Implement Phase 3 for run '<run-id>'
  • Add a failing regression test first, then fix the bug
  • I already wrote the code; now add tests (should trigger TDD reset guidance)
  • Follow RED-GREEN-REFACTOR for this change

When to Use

Always in Phase 3 (Implementation):

  • New features
  • Bug fixes
  • Refactoring
  • Behavior changes

Default rule:

  • Not for "simple" changes
  • Not when "under pressure"
  • Not because "tests after achieve same goals"

Explicit exception path only:

  • If strict RED-first flow is genuinely infeasible, declare TDD Mode: pragmatic in the Phase 3 artifact
  • Record a concrete exception reason
  • Record compensating validation evidence under /.recursive/run/<run-id>/evidence/
  • Treat this as an explicit deviation, not a silent shortcut

RED-GREEN-REFACTOR Cycle

dot
digraph tdd_cycle {
    rankdir=LR;
    red [label="RED\nWrite failing test", shape=box, style=filled, fillcolor="#ffcccc"];
    verify_red [label="Verify fails\ncorrectly", shape=diamond];
    green [label="GREEN\nMinimal code", shape=box, style=filled, fillcolor="#ccffcc"];
    verify_green [label="Verify passes\nAll green", shape=diamond];
    refactor [label="REFACTOR\nClean up", shape=box, style=filled, fillcolor="#ccccff"];
    record [label="Record in\nPhase 3 artifact", shape=box];

    red -> verify_red;
    verify_red -> green [label="yes"];
    verify_red -> red [label="wrong\nfailure"];
    green -> verify_green;
    verify_green -> refactor [label="yes"];
    verify_green -> green [label="no"];
    refactor -> verify_green [label="stay\ngreen"];
    verify_green -> record;
}
RED - Write Failing Test

Write one minimal test showing what should happen.

Requirements:

  • One behavior per test
  • Clear, descriptive name
  • Test real code (no mocks unless unavoidable)
  • Clear assertion showing expected outcome
<Good>
```typescript
test('rejects empty email with clear error message', async () => {
  const result = await submitForm({ email: '' });
  expect(result.error).toBe('Email is required');
});
```
</Good>
<Bad>
```typescript
test('email validation works', async () => {
  const mock = jest.fn().mockResolvedValue({ valid: true });
  const result = await validateEmail(mock);
  expect(mock).toHaveBeenCalled();
});
```
</Bad>
Verify RED - Watch It Fail

MANDATORY. Never skip.

bash
npm test path/to/test.test.ts

Confirm:

  • Test fails (not errors)
  • Failure message is expected
  • Fails because feature missing (not typos)

Record in Phase 3 artifact:

markdown
### TDD Cycle for R3 (Email Validation)

TDD Mode: strict

RED Evidence:
- `/.recursive/run/<run-id>/evidence/logs/red/<file>.log`

GREEN Evidence:
- `/.recursive/run/<run-id>/evidence/logs/green/<file>.log`

**RED Phase:**
- Test: `rejects empty email with clear error message`
- Command: `npm test src/forms/email.test.ts`
- Expected failure: "Email is required" not found
- Actual failure: [paste output]
- RED verified: PASS
GREEN - Minimal Code

Write simplest code to pass the test.

Rules:

  • Just enough to pass
  • No additional features
  • No "while I'm here" improvements
  • No refactoring yet
<Good>
```typescript
function submitForm(data: FormData) {
  if (!data.email?.trim()) {
    return { error: 'Email is required' };
  }
  // ... rest of form handling
}
```
</Good>
<Bad>
```typescript
function submitForm(
  data: FormData,
  options?: {
    strictMode?: boolean;
    customValidators?: Validator[];
    onValidationError?: (err: Error) => void;
  }
) {
  // YAGNI - over-engineered
}
```
</Bad>

Record in Phase 3 artifact:

markdown
**GREEN Phase:**
- Implementation: Added null check for email field
- Command: `npm test src/forms/email.test.ts`
- Result: PASS
- GREEN verified: PASS
REFACTOR - Clean Up

After green only:

  • Remove duplication
  • Improve names
  • Extract helpers
  • Keep tests green

Never add behavior during refactor.

Record in Phase 3 artifact:

markdown
**REFACTOR Phase:**
- Extracted `validateRequired(field, name)` helper
- Renamed `submitForm` to `processFormSubmission` for clarity
- All tests still passing: PASS

Common Process Shortcuts (STOP)

ExcuseReality
"This is just a simple fix, no test needed"Simple code breaks. Test takes 30 seconds.
"I'll test after confirming the fix works"Tests passing immediately prove nothing. You never saw it catch the bug.
"Tests after achieve same goals"Tests-after = "what does this do?" Tests-first = "what should this do?"
"I already manually tested it"Ad-hoc != systematic. No record, can't re-run, no regression protection.
"Deleting working code is wasteful"Sunk cost fallacy. Keeping unverified code is technical debt.
"TDD is dogmatic, I'm being pragmatic"TDD IS pragmatic. Finds bugs before commit, enables refactoring.
"I'll keep the code as reference"You'll adapt it. That's testing after. Delete means delete.
"Test hard = design unclear"Listen to the test. Hard to test = hard to use. Simplify design.
"I need to explore first"Fine. Throw away exploration, start TDD fresh.
"This is different because..."It's not. The rules don't have exceptions.
Show full SKILL.md (322 more words)Show less

Red Flags - STOP and Start Over

If you encounter any of these, DELETE CODE and restart with TDD:

  • Code written before test
  • Test passes immediately (not testing what you think)
  • "I'll add tests later"
  • "This is too simple to test"
  • "I know what I'm doing, I don't need the ritual"
  • Can't explain why test failed (or didn't fail)
  • Test testing mock behavior, not real behavior
  • Multiple behaviors in one test ("and" in test name)

Integration with recursive-mode Phase 3

Routing Awareness

If TDD execution uses delegated review, test audit, or bounded routed implementation help, re-read:

  • /.recursive/config/recursive-router.json
  • /.recursive/config/recursive-router-discovered.json

immediately before choosing the delegated CLI/model, and use the routed policy or explicit fallback rather than ad hoc model selection.

Phase 3 Artifact TDD Section

Every Phase 3 artifact must include:

markdown
## TODO

- [ ] Replace every placeholder with concrete TDD evidence for the current implementation phase.

## Audit Context

Audit Execution Mode: self-audit / subagent
Subagent Availability: available / unavailable
Subagent Capability Probe: [what proved availability or unavailability]
Delegation Decision Basis: [why self-audit or delegation was chosen]

## TDD Compliance Log

TDD Mode: strict

RED Evidence:
- `/.recursive/run/<run-id>/evidence/logs/red/<file>.log`

GREEN Evidence:
- `/.recursive/run/<run-id>/evidence/logs/green/<file>.log`

### Requirement R1 (Feature X)

**Test:** `test/features/x.test.ts` - "should do Y when Z"
- RED: [timestamp] - Failed as expected: [output]
- GREEN: [timestamp] - Minimal implementation: [description]
- REFACTOR: [timestamp] - Cleanups: [description]
- Final state: PASS - all tests passing

### Requirement R2 (Bug Fix)

**Regression Test:** `test/bugs/issue-123.test.ts` - "reproduces crash on empty input"
- RED: [timestamp] - Confirmed bug: [output]
- GREEN: [timestamp] - Fix applied: [description]
- REFACTOR: [timestamp] - N/A (minimal fix)
- Final state: PASS - test passes, bug fixed

## Requirement Completion Status

- `R1` | `implemented` | Changed Files: `path/to/file`
- `R1` | `verified` | Evidence: `/.recursive/run/<run-id>/evidence/logs/green/<file>.log`

If strict mode cannot be followed, the artifact must include:

markdown
## Pragmatic TDD Exception

Exception reason: [specific reason strict RED-first flow was not feasible]
Compensating validation:
- [extra tests, targeted manual verification, diff review, etc.]
- `/.recursive/run/<run-id>/evidence/<supporting-file>`
Phase 3 Coverage Gate Addition
markdown
## Coverage Gate

- [ ] Every new function has a corresponding test
- [ ] Every bug fix has a regression test that fails before fix
- [ ] All RED phases documented with failure output
- [ ] All GREEN phases documented with minimal implementation
- [ ] All tests passing (no skipped tests)
- [ ] No production code written before failing test

TDD Compliance: PASS / FAIL
Phase 3 Approval Gate Addition
markdown
## Approval Gate

- [ ] TDD Compliance: PASS
- [ ] Implementation matches Phase 3 plan
- [ ] No code without preceding failing test
- [ ] All tests documented in TDD Compliance Log

Approval: PASS / FAIL

Bug Fix TDD Procedure

  1. Add Regression Test First

    • Write test that reproduces the bug
    • Run test, confirm it fails with expected error
    • Document failure in Phase 3 artifact
  2. Implement Minimal Fix

    • Fix only what's needed to make test pass
    • Run test, confirm it passes
    • Document fix in Phase 3 artifact
  3. Verify No Regressions

    • Run full test suite
    • Confirm nothing else broke
    • Document in Phase 3 artifact
  4. Lock Phase 3

    • TDD Mode is declared
    • TDD Compliance: PASS
    • Approval: PASS
    • Status: LOCKED

Example: Complete Phase 3 TDD Section

markdown
## TDD Compliance Log

### R1: Add email validation

**Test:** `test/forms/validation.test.ts`

RED Phase (2026-02-21T10:15:00Z):
```bash
$ npm test test/forms/validation.test.ts
FAIL: Expected 'Email is required', got undefined

RED verified: PASS

GREEN Phase (2026-02-21T10:18:00Z):

  • Added null check in submitForm() function
  • Test passes GREEN verified: PASS

REFACTOR Phase (2026-02-21T10:22:00Z):

  • Extracted validateRequired() helper
  • All tests still passing REFACTOR complete: PASS
R2: Fix crash on empty array

Regression Test: test/utils/array.test.ts

RED Phase (2026-02-21T10:25:00Z):

bash
$ npm test test/utils/array.test.ts
FAIL: TypeError: Cannot read property 'map' of undefined

RED verified: Bug reproduced PASS

GREEN Phase (2026-02-21T10:27:00Z):

  • Added guard clause in processItems()
  • Test passes GREEN verified: PASS

REFACTOR: N/A (minimal 2-line fix)

Verification

Full suite run: npm test Result: 47 passing, 0 failing


## References

- **REQUIRED:** Follow this skill for all Phase 3 implementation work

© try-works, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file in skills/recursive-tdd of try-works/recursive-mode.

  • SKILL.md
  • agents/openai.yaml

Open the folder on GitHubat commit ff75bc7

Used in 1 other repository

We found 2 copies of this SKILL.md (exact, near-identical or edited) in other folders. This page covers the copy in try-works/recursive-mode, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Recursive TDD next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Recursive TDD compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Recursive TDD this skilltry-works/recursive-mode136—~2.8kAutomated safety check: PassApache-2.0
TDDfossasia/eventyay-interpretation1.6k28 repos~1.1kAutomated safety check: PassApache-2.0
TDD WorkflowhellangleZ/burn-in-cceverywhere-ralph11211 repos~2.4kAutomated safety check: PassNone
TDDsanity-io/sanity6.4k20 repos~1kAutomated safety check: PassMIT
Test Driven Developmentfarm-fe/farm5.6k49 repos~2.5kAutomated safety check: PassMIT
Tapd Story PipelineTencentBlueKing/bk-bcs840—~2.6kAutomated safety check: PassCustom licence

Similar skills

  • TDD

    fossasia/eventyay-interpretation

    Test-driven development. An agent skill from fossasia/eventyay-interpretation.

    1.6k GitHub starsUsed in 28 repos~1.1k tokens
    Testing & QAAuto-check passed
  • TDD Workflow

    hellangleZ/burn-in-cceverywhere-ralph

    A skill your agent uses when writing new features, fixing bugs, or refactoring code.

    112 GitHub starsUsed in 11 repos~2.4k tokens
    Testing & QAAuto-check passed
  • TDD

    sanity-io/sanity

    Official

    Test-driven development with red-green-refactor loop. An agent skill from sanity-io/sanity.

    6.4k GitHub starsUsed in 20 repos~1k tokens
    Testing & QAAuto-check passed
  • A skill your agent uses when implementing any feature or bugfix, before writing implementation code

    5.6k GitHub starsUsed in 49 repos~2.5k tokens
    Testing & QAAuto-check passed
  • Tapd Story Pipeline

    TencentBlueKing/bk-bcs

    单需求实现流水线——把一个 TAPD 需求从零推进到代码提交。自动串联技术澄清、 开发计划、任务拆分、TDD 实现、架构/安全校验、代码提交六个阶段。

    840 GitHub stars~2.6k tokensUpdated 13 days ago
    Testing & QAAuto-check passed
  • Absolute Init

    maddhruv/absolute

    One-time setup for absolute: interview how you want it to behave (output style, autonomy, TDD strictness, spec dir, families) + detect the stack once, then write .absolute.config.json (project…

    218 GitHub starsUsed in 1 repo~3k tokens
    Testing & QAAuto-check passed

More from try-works/recursive-mode

All 9 skills in this repo
  • Recursive Mode

    try-works/recursive-mode

    Repository workflow orchestration skill for staged implementation, locked artifacts, late-phase receipts, and durable memory maintenance.

    136 GitHub stars~3.4k tokensUpdated 2 mo ago
    Auto-check passed
  • Recursive Debugging

    try-works/recursive-mode

    A skill your agent uses when a recursive-mode requirement involves debugging a bug, test failure, or unexpected behavior.

    136 GitHub stars~3.4k tokensUpdated 2 mo ago
    Auto-check passed
  • Recursive Review Bundle

    try-works/recursive-mode

    A skill your agent uses when recursive-mode work needs a canonical delegated-review or audit handoff.

    136 GitHub stars~873 tokensUpdated 2 mo ago
    Auto-check passed
  • Recursive Subagent

    try-works/recursive-mode

    A skill your agent uses when recursive-mode work may benefit from delegated audit, review, or bounded implementation support.

    136 GitHub stars~3k tokensUpdated 2 mo ago
    Auto-check passed
  • Recursive Worktree

    try-works/recursive-mode

    A skill your agent uses when starting any recursive-mode requirement to set up an isolated git worktree.

    136 GitHub stars~1.2k tokensUpdated 2 mo ago
    Auto-check passed
  • Recursive Spec

    try-works/recursive-mode

    Approval-gated, repo-aware requirements/spec authoring for new recursive-mode runs.

    136 GitHub stars~1.4k tokensUpdated 2 mo ago
    Auto-check passed

Categories

Questions about Recursive TDD

What does Recursive TDD do?

A skill your agent uses when implementing any code in recursive-mode Phase 3. Recursive TDD is an agent skill from try-works/recursive-mode. Use when implementing any code in recursive-mode Phase 3.

When should I use Recursive TDD?

Recursive TDD fits situations like: implementing any code in recursive-mode Phase 3; phrases: implement this; write a failing test.

How do I install Recursive TDD in Claude Code?

Run `npx skills add try-works/recursive-mode --skill recursive-tdd -a claude-code`. Or copy the skill folder (skills/recursive-tdd in try-works/recursive-mode) into .claude/skills/recursive-tdd in your project. Claude Code loads it when a task matches its description.

How do I install Recursive TDD in Codex?

Run `npx skills add try-works/recursive-mode --skill recursive-tdd -a codex`. Or copy the skill folder (skills/recursive-tdd in try-works/recursive-mode) into .agents/skills/recursive-tdd in your project. Codex loads it when a task matches its description.

Can I use Recursive TDD in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add try-works/recursive-mode --skill recursive-tdd -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/recursive-tdd, .gemini/skills/recursive-tdd, .github/skills/recursive-tdd and .opencode/skills/recursive-tdd in your project.

What does Recursive TDD need to run?

Going by SKILL.md and its folder, Recursive TDD needs the command-line tools its instructions call (npm).

Does Recursive TDD access the network?

SKILL.md contains no URLs. Its commands use npm, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Recursive TDD safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Recursive TDD use?

Recursive TDD is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Recursive TDD use?

About 2.8k tokens (SKILL.md is roughly 11k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Recursive TDD?

Skills that share tags, products or a category with Recursive TDD: TDD (fossasia/eventyay-interpretation, 1.6k stars), TDD Workflow (hellangleZ/burn-in-cceverywhere-ralph, 112 stars), TDD (sanity-io/sanity, 6.4k stars) and Test Driven Development (farm-fe/farm, 5.6k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Recursive TDD?

try-works (a GitHub user) maintains it in try-works/recursive-mode, which has 136 GitHub stars. The repository holds 9 skills in this directory. The repository was last updated on July 24, 2026.

Source: try-works/recursive-mode on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.