TDD Workflow

VerifiedSafe

Executes the TDD loop (test-first) for tasks in tasks/todo.md, with user checkpoints between each step.

Sby Skills Guide Bot
TestingIntermediate
8/29/2026
Claude CodeCursorWindsurfCopilotCodex
#tdd#test-first#red-green-refactor#workflow#test-driven-development

Recommended for

Automated summary

Runs a red-green-refactor TDD loop over the tasks listed in tasks/todo.md, pausing for user confirmation between each task.

Strengths

  • Enforces failing-test-first with an iron law, mandatory deletion of pre-test code, and an explicit list of red flags
  • Structured loop with verifiable steps: write the test, confirm the expected failure, minimal implementation, confirm the pass, refactor
  • Ties into an existing plan (tasks/todo.md, specs/) and ticks off each completed item
  • Includes practical guardrails against common excuses (rationalization table) and clear done criteria (full suite, lint, type checks)

Limitations

  • Cannot start without a populated tasks/todo.md, so /plan must have been run first
  • Not autonomous: it stops after every task to ask whether to continue
  • Gives no language- or framework-specific test tooling advice; actually running the tests depends on the agent
When to use it

Use it when you already have a planned task list and want disciplined, test-first implementation with explicit checkpoints.

When not to use it

Avoid it for exploratory prototyping or legacy code without a test harness, where characterization tests or a spike are needed first.

Security analysis

Safe
Quality score85/100

The skill is a pure instruction document describing a TDD workflow. It declares no allowed-tools and contains no shell commands, network calls, credential handling, or obfuscated payloads. The only 'delete' instruction is a procedural rule about discarding production code written before its test — a coding-discipline guideline, not a filesystem destructive command. All file interactions (tasks/todo.md, specs/, tests) are ordinary project-local reads/writes.

No concerns found

How this analysis is made

Examples

Run the TDD loop
/tdd — go through the next unchecked task in tasks/todo.md using the test-first loop.
Resume after a plan
I've finished /plan and tasks/todo.md is populated. Start the TDD workflow on the first task and check in with me after each one.
Enforce the failing test
Use the tdd skill to implement the email validation task in tasks/todo.md, but make sure the test fails for the right reason before writing any implementation.

name: tdd description: Execute TDD loop for tasks in tasks/todo.md with user checkpoints between steps. disable-model-invocation: false harness: universal

/tdd — TDD Workflow

Execute the TDD loop for tasks in tasks/todo.md.

The Iron Law

NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST

Write code before the test? Delete it. Start over.

No exceptions:

  • Don't keep it as "reference"
  • Don't "adapt" it while writing tests
  • Don't look at it
  • Delete means delete

Implement fresh from tests. Period.

Pre-Flight Checks

  1. Verify tasks/todo.md exists and has a populated plan
    • If not: run /plan first
  2. Read the spec in specs/ if available
  3. Identify the next unchecked [ ] item
  4. Read the relevant source files to understand existing code

TDD Loop (repeat for each task)

For each [ ] TDD: [Test Name] -> [Impl Detail]:

Step 1 — Write the Failing Test

  • Place the test in the correct test directory
  • The test must be specific: it tests exactly the behavior described in the task
  • Do not write the implementation yet

Step 2 — Show the Failure

  • Run the test
  • Confirm it fails with the expected error (not a setup error or import error)
  • If it passes immediately: the test is wrong, or the behavior already exists — investigate before proceeding

Step 3 — Write Minimal Implementation

  • Write the minimum code to make the test pass
  • No extra features, no optimizations, no "while I'm here" changes

Step 4 — Show the Pass

  • Run the test again
  • Confirm it passes
  • If it fails: fix only the specific issue; don't restructure

Step 5 — Refactor

Apply Clean Code principles without changing behavior:

  • Functions ≤20 LOC, ≤3 parameters
  • Meaningful names
  • Single abstraction level
  • Remove any duplication
  • Re-run tests to confirm still passing

Step 6 — Mark Complete

  • Change [ ] to [x] in tasks/todo.md
  • Report: "✓ [Test Name] — [one-line description of what was implemented]"

Step 7 — Check In

  • Ask: "Ready for the next task? (y/n)"
  • Wait for user confirmation before proceeding

Red Flags — STOP and Start Over

These signals mean TDD is being violated. Stop immediately and start over with a failing test.

  • Code written before test
  • Test written after implementation
  • Test passes immediately without implementation
  • Can't explain why test failed
  • Tests added "later"
  • Rationalizing "just this once"
  • "I already manually tested it"
  • "Keep as reference" or "adapt existing code"

All of these mean: Delete code. Start over with TDD.

Common Rationalizations

| Excuse | Reality | |--------|---------| | "Too simple to test" | Simple code breaks. Test takes 30 seconds. | | "I'll test after" | Tests passing immediately prove nothing. | | "Need to explore first" | Fine. Throw away exploration, start with TDD. | | "Test hard = design unclear" | Listen to the test. Hard to test = hard to use. | | "TDD will slow me down" | TDD is faster than debugging. | | "Manual test faster" | Manual doesn't prove edge cases. | | "Existing code has no tests" | You're improving it. Add tests. | | "Just this once" | That's rationalization. | | "It's about spirit not ritual" | Tests-after ≠ TDD. You get coverage, lose proof. | | "Deleting X hours is wasteful" | Sunk cost fallacy. Keeping unverified code is debt. |

When Stuck

| Problem | Solution | |---------|---------| | Don't know how to test | Write the wished-for API. Write the assertion first. Ask the user. | | Test too complicated | Design too complicated. Simplify the interface. | | Must mock everything | Code too coupled. Use dependency injection. | | Test setup is huge | Extract helpers. Still complex? Simplify the design. |

Testing Anti-Patterns

See testing-anti-patterns.md in this directory for common pitfalls with mocks and test utilities.

Done Criteria

All tasks complete when:

  • All [ ] items in tasks/todo.md are [x]
  • All tests pass (run the full suite)
  • No linting or type errors
  • Coverage ≥80% on new code
  • Quality gate from CLAUDE.md satisfied

After Completion

Run /wrap-up-session or at minimum:

  • Run /learn to capture any session insights
  • Commit with a clear message

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/tdd-workflow-mte1lgpk/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/tdd-workflow-mte1lgpk' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/tdd-workflow-mte1lgpk/download' --output '.skill-downloads/tdd-workflow-mte1lgpk/SKILL.md.part' && mv '.skill-downloads/tdd-workflow-mte1lgpk/SKILL.md.part' '.skill-downloads/tdd-workflow-mte1lgpk/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/tdd-workflow-mte1lgpk/SKILL.md' && test -s '.skill-downloads/tdd-workflow-mte1lgpk/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/tdd' && cp -R '.skill-downloads/tdd-workflow-mte1lgpk' '.claude/skills/tdd'

Cursor
test -f '.skill-downloads/tdd-workflow-mte1lgpk/SKILL.md' && test -s '.skill-downloads/tdd-workflow-mte1lgpk/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/tdd' && cp -R '.skill-downloads/tdd-workflow-mte1lgpk' '.cursor/skills/tdd'

Codex
test -f '.skill-downloads/tdd-workflow-mte1lgpk/SKILL.md' && test -s '.skill-downloads/tdd-workflow-mte1lgpk/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/tdd' && cp -R '.skill-downloads/tdd-workflow-mte1lgpk' '.agents/skills/tdd'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/tdd-workflow-mte1lgpk'

openskills read 'tdd-workflow-mte1lgpk'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/tdd-workflow-mte1lgpk/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills