Agent skill

TDD

by lexler in lexler/skill-factory

Test-driven development (TDD) process used when writing code.

Apache-2.0Auto-check: warningsTesting & QA

Install TDD

The automated check flagged lines worth reading first. See the safety section below.

skills CLI
$ npx skills add lexler/skill-factory --skill tdd -a claude-code

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

GitHub CLI
$ gh skill install lexler/skill-factory 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/lexler/skill-factory.git skills-src && mkdir -p .claude/skills && cp -r skills-src/output_skills/testing/tdd .claude/skills/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
tdd
GitHub stars
239
Token cost
~1.3k tokens
SKILL.md length
727 words
Files
3 (incl. references)
Skills in repo
25
Repo updated
First seen
Licence
Apache-2.0

At a glance

Test-driven development (TDD) process used when writing code.

  • Works in 10 steps: ALL code changes follow TDD - Feature… → Write only one test at a time - focus on… → Predict failures - State what we expect… → …
  • You are adding any new code
  • SKILL.md covers Core Rules, Test Planning, Implementation Phase and Final Evaluation
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

TDD is an agent skill from lexler/skill-factory. Test-driven development (TDD) process used when writing code. Use whenever you are adding any new code, unless the user explicitly asks to skip TDD or the code is exploratory/spike.

Its SKILL.md is about 1.3k tokens, which your agent loads only when the skill is triggered. The skill folder holds 4 other files, including reference files (for example `evals/evals.json` and `references/zombies.md`).

It sits in Testing & QA, covering Test-driven development. The licence is Apache-2.0.

When your agent uses it

  • You are adding any new code
  • Unless the user explicitly asks to skip TDD
  • The code is exploratory/spike

Example prompts

  • “/tdd”

Workflow steps

10 steps, taken from the first numbered list in SKILL.md.

  1. ALL code changes follow TDD - Feature requests mid-stream are NOT exceptions. Write test first, then code.
  2. Write only one test at a time - focus on the simplest, lowest-hanging fruit test
  3. Predict failures - State what we expect to fail before running tests
  4. Two-step red phase
  5. Minimal code to pass - Just enough to make the test green. If no test requires it, don't write it.
  6. No comments in production code - Keep it clean unless specifically asked
  7. Run all tests every time - Not just the one you're working on
  8. Refactor at the first opportunity when the tests are green
  9. Test behavior, not implementation - check responses or state, not method calls
  10. Push back when something seems wrong or unclear

What it can do on your machine

Read from SKILL.md and the folder at commit 8017333. 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

    No scripts in the folder and no shell commands in SKILL.md.

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

  • Network

    No URLs in SKILL.md.

    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

TDD loads about 1.3k tokens when it runs, and up to ~1.8k if it reads all its reference files. Until then it costs about 46 tokens; SKILL.md has 727 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~46
When it runs · the whole SKILL.md, loaded when a task matches
~1.3k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~1.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: warnings

The automated check found patterns that need a careful read before installing.

  • WarningTells the agent its actions are pre-authorized / not to stop for confirmationSKILL.md:13
    - auto: DO NOT ask for confirmation or approval. Proceed through all steps without stopping.

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 lexler/skill-factory at commit 8017333, republished under its Apache-2.0 licence (© lexler). 727 words, ~1,263 tokens.

Download SKILL.mdSave it as .claude/skills/tdd/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
tdd
description
Test-driven development (TDD) process used when writing code. Use whenever you are adding any new code, unless the user explicitly asks to skip TDD or the code is exploratory/spike.

Test-Driven Development Process

TDD is a design technique that uses tests as a tool. Design emerges from usage, not speculation. Short feedback loops let you course-correct immediately. The resulting architecture is testable by design, not retrofitted. We are not trying to rush towards a feature completion, it's important that the code is correct and well-designed, it's crucial to be thorough and only add what tests demand.

When starting, announce: "Using TDD skill in mode: [auto|human]"

MODE (user specifies, default: auto)

  • auto: DO NOT ask for confirmation or approval. Proceed through all steps without stopping.
  • human: wait for confirmation at key points

STARTER_CHARACTER = 🔴 for red test, 🌱 for green, 🌀 when refactoring, always followed by a space

Core Rules

  1. ALL code changes follow TDD - Feature requests mid-stream are NOT exceptions. Write test first, then code.
  2. Write only one test at a time - focus on the simplest, lowest-hanging fruit test
  3. Predict failures - State what we expect to fail before running tests
  4. Two-step red phase:
    • First: Make it fail to compile (class/method doesn't exist)
    • Second: Make it compile but fail the assertion (return wrong value)
  5. Minimal code to pass - Just enough to make the test green. If no test requires it, don't write it.
  6. No comments in production code - Keep it clean unless specifically asked
  7. Run all tests every time - Not just the one you're working on
  8. Refactor at the first opportunity when the tests are green
  9. Test behavior, not implementation - check responses or state, not method calls
  10. Push back when something seems wrong or unclear

Test Planning

  1. Think about what the code you want to write should do
  2. Plan tests as single-line [TEST] comments. Example:
    [TEST] Zero plus a number is equal to that number
    [TEST] Add two positive numbers
    [TEST] Add two negative numbers
    [TEST] Adds a negative and a positive number
    [TEST] Division by zero is not allowed
    ...
  3. Check completeness - walk through ZOMBIES explicitly:
    • Zero/empty cases covered?
    • One item cases covered?
    • Many items cases covered?
    • Boundary transitions covered?
    • Interface clarity verified?
    • Exceptions/errors covered?
  4. If MODE is human, wait for confirmation after test planning
Show full SKILL.md (407 more words)Show less

Implementation Phase

  1. Replace the next [TEST] comment directly with a failing test. No intermediate markers.
  2. Test should be in format given-when-then (do not add as comments), with empty line separating them
  3. Think through the expected value BEFORE writing the assertion. Trace the logic step by step.
  4. Predict what will fail
  5. Run tests, see compilation error (if testing something new)
  6. Add minimal code to compile — empty method bodies, placeholder returns, missing classes. Do not implement logic yet.
  7. Predict assertion failure
  8. Run tests, see assertion failure
  9. Add minimal code to pass
  10. Predict whether the tests will pass and why. Run tests, see green
  11. If the test passed without ever being red, pause. Identify which earlier step added the code this test is exercising for free. Call it out (e.g., "This passed immediately because I added X at step N before a test required it"). Tighten discipline on remaining tests.
  12. Simplify. For each line/expression you just added, ask: "Does a failing test require this?"
    • If no test requires it, delete it or if it's necessary, add a test comment to write that test
    • Run tests after each simplification
    • Repeat until every line is justified by a test
  13. Refactor.
    • Reflect on the domain: Is there a missing concept that would make the code more expressive? An object waiting to be extracted? A better way to model the problem?
    • You may introduce domain concepts (new abstractions) as long as you add NO new behavior. Tests must still pass, and there should be no new code added that doesn't have tests.
    • Think about improvements to expressiveness, clarity, simplicity
    • Say 🧹 Starting refactoring stage and list planned refactorings
    • Implement one at a time, run tests after each
    • When done (or if none needed), say "🧹 Refactoring complete"
  14. Go to step 1 for the next [TEST] comment. Repeat until all planned tests are passing.

Final Evaluation

  1. Analyze the code written and think about the tests that we might have missed.
  2. If there are any gaps in the tests, start the process for the missing tests from the beginning, starting from test comments then following the process flow until done
  3. Is anything still hardcoded in the code that shouldn't be? Fix it, analyze test gaps and go back to previous stages if needed.
  4. Analyze code expressiveness and quality. If there's anything you can see to improve, go to refactoring phase.

© lexler, 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 2 other files (references) in output_skills/testing/tdd of lexler/skill-factory.

  • SKILL.md
  • evals/evals.json
  • references/zombies.md

Open the folder on GitHubat commit 8017333

Compare with similar skills

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.

TDD compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
TDD this skilllexler/skill-factory239—~1.3kAutomated safety check: WarnApache-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 lexler/skill-factory

All 25 skills in this repo
  • C4 Architecture Diagrams

    lexler/skill-factory

    Creates C4 model diagrams at every zoom level, from system landscape to code, in ASCII, Mermaid or Structurizr, for designing or documenting software architecture.

    239 GitHub stars~2.3k tokensUpdated 1 mo ago
    Auto-check passed
  • Launching Agent Teams

    lexler/skill-factory

    Plans and launches Claude Code agent teams with distinct roles, right-sized tasks and detailed spawn prompts, and says when subagents or worktrees fit better.

    239 GitHub stars~1.3k tokensUpdated 1 mo ago
    Auto-check passed
  • Claude Code Statusline Writer

    lexler/skill-factory

    Guides writing and debugging Claude Code status line scripts that read session JSON from stdin and print one line of text.

    239 GitHub stars~872 tokensUpdated 1 mo ago
    Auto-check passed
  • Catalog of obstacles, anti-patterns and patterns for working with AI coding agents, covering context management and reliability, from a published patterns collection.

    239 GitHub stars~1.5k tokensUpdated 1 mo ago
    Auto-check passed
  • Approval Testing Toolkit

    lexler/skill-factory

    Writes snapshot-style approval tests in Python, JavaScript, TypeScript or Java, comparing output against an approved file instead of writing individual assertions.

    239 GitHub stars~1.2k tokensUpdated 1 mo ago
    Auto-check passed
  • Hotspots

    lexler/skill-factory

    Find where a codebase actually costs time by mining its git history (Tornhill hotspot analysis).

    239 GitHub stars~1.2k tokensUpdated 1 mo ago
    Auto-check passed

Categories

Questions about TDD

What does TDD do?

Test-driven development (TDD) process used when writing code. TDD is an agent skill from lexler/skill-factory. Test-driven development (TDD) process used when writing code.

When should I use TDD?

TDD fits situations like: you are adding any new code; unless the user explicitly asks to skip TDD; the code is exploratory/spike.

How do I install TDD in Claude Code?

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

How do I install TDD in Codex?

Run `npx skills add lexler/skill-factory --skill tdd -a codex`. Or copy the skill folder (output_skills/testing/tdd in lexler/skill-factory) into .agents/skills/tdd in your project. Codex loads it when a task matches its description.

Can I use 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 lexler/skill-factory --skill 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/tdd, .gemini/skills/tdd, .github/skills/tdd and .opencode/skills/tdd in your project.

What does TDD need to run?

SKILL.md names no scripts, command-line tools or credentials: TDD is instructions for the agent only.

Does TDD access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is TDD safe to install?

Our automated static check of SKILL.md flagged 1 warning(s): tells the agent its actions are pre-authorized / not to stop for confirmation. Read the flagged lines before installing; the check is not a guarantee either way.

What licence does TDD use?

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 TDD use?

About 1.3k tokens (SKILL.md is roughly 5.1k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 522 tokens, read only when the agent opens those files.

What are the alternatives to TDD?

Skills that share tags, products or a category with 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 TDD?

lexler (a GitHub user) maintains it in lexler/skill-factory, which has 239 GitHub stars. The repository holds 25 skills in this directory. The repository was last updated on August 26, 2026.

Source: lexler/skill-factory on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.