mcpbeat Sign in

Test Driven Development Skill for Claude

(TDD) Use when implementing any feature or bugfix. Apply the Logic Gate to identify what needs tests, then use the Iron Rule for strict test-first development on logic.

1k tokens
context cost
the whole folder, loaded on every use
1
files
instructions only
0
copies elsewhere
how many repositories repackaged it
118
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/ravila4/claude-adhd-skills --skill test-driven-development

The instruction itself

15 sections, as written by the author

Test-Driven Development (TDD)

The Two Gates

Before writing any code, pass it through two gates:

  • The Logic Gate — Triage. Does this piece contain logic?
  • The Iron Rule — For everything that passes the Logic Gate, strict TDD applies.
flowchart TD
    A[New code to write] --> B[Decompose into pieces]
    B --> C{{"Logic Gate: Does this piece contain logic?"}}
    C -->|"Conditionals, transformations, validation, state changes, error handling"| D["Iron Rule: TDD"]
    C -->|"Dataclasses, config, thin wrappers, type aliases, formatting"| E[Write directly]
    D --> F["RED: Write failing test"]
    F --> G["GREEN: Minimal implementation"]
    G --> H["REFACTOR: Clean up"]
    H --> I{More pieces?}
    E --> I
    I -->|Yes| C
    I -->|No| J[Done]

Gate 1: The Logic Gate

Decompose the work into its constituent pieces. For each piece, ask: does this contain logic?

Passes the Logic Gate (requires TDD):

  • Conditionals and branching
  • Data transformations and computations
  • Validation and parsing
  • State management and transitions
  • Error handling with recovery logic
  • Business rules and domain logic
  • Algorithm implementations

Does NOT pass the Logic Gate (write directly):

  • Dataclasses, NamedTuples, TypedDicts (pure data declarations)
  • Type aliases and protocol definitions
  • Configuration and constants
  • Thin wrappers that only delegate (no branching, no transformation)
  • Plot formatting and visual styling
  • Boilerplate (__init__.py, module-level setup)
  • String templates and static content

When in doubt: If you can't point to a conditional, transformation, or state change, it probably doesn't pass the Logic Gate.

Triage Output

Before writing code, briefly identify what passes and what doesn't:

  • "These pieces contain logic and need TDD: X, Y"
  • "These are declarations/glue and can be written directly: Z"

Gate 2: The Iron Rule

For code that passes the Logic Gate: never write logic without a preceding failing test.

If logic is written before its test:

  • Stop — the test you write now can only describe what you already wrote, not verify intended behavior
  • Delete the logic and restart test-first
  • This applies to logic specifically, not declarations

Red-Green-Refactor Cycle

RED: Write a Failing Test

Write a single minimal test demonstrating intended behavior:

  • Clear, descriptive name
  • Test actual functionality (not mocks unless necessary)
  • Focus on one behavior
  • If test name contains "and", split into separate tests

Verify RED: Confirm Failure

Run tests and confirm:

  • Test fails for the expected reason (missing feature)
  • Not failing due to syntax errors
  • This verification is non-negotiable

GREEN: Minimal Implementation

Write the simplest possible code satisfying the test:

  • Avoid feature creep
  • Don't refactor unrelated code
  • Don't over-engineer

Verify GREEN: Confirm Pass

Confirm:

  • The new test passes
  • No existing tests break

REFACTOR: Clean Up

Improve code quality while maintaining green status:

  • Eliminate duplication
  • Improve naming
  • Simplify logic
  • Run tests after each change

Quality Test Attributes

Minimal: Single responsibility per test

Clear: Descriptive name revealing behavior

Realistic: Demonstrate intended API usage

Focused: One assertion per test (generally)

Common Rationalizations to Reject

"I'll test afterward"

  • Tests written post-implementation pass immediately
  • Proves nothing about validation capability

"Manual testing covered edge cases"

  • Lacks systematic documentation
  • Not reproducible

"Tests-after achieve identical goals"

  • Tests-first answer: "What should happen?"
  • Tests-after answer: "What does this do?"
  • Fundamentally different approaches

Verification Checklist

Before considering work complete:

  • [ ] Logic Gate triage was performed
  • [ ] Every piece containing logic has corresponding tests
  • [ ] Each test for logic failed before implementation
  • [ ] Failures occurred for expected reasons
  • [ ] Code written is minimal
  • [ ] All tests pass without errors or warnings
  • [ ] Real code tested (mocks only when necessary)
  • [ ] Edge cases and error conditions covered for logic

Debugging Integration

Bug found? Write failing test reproducing it. Follow TDD cycle. Test proves fix and prevents regression.

Never fix bugs without a test.

Other skills for the same job

different authors, same section of the catalogue
Webapp Testing
by anthropics
vendor ×12

Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.

6k tokens scripts
Finishing A Development Branch
by ZhanlinCui
×7

Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for merge, PR, or cleanup

1k tokens
Test Driven Development
by w95
×7

Use when implementing any feature or bugfix, before writing implementation code

2k tokens
Systematic Debugging
by ratacat
×7

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes

10k tokens scripts
Verification Before Completion
by ZhanlinCui
×6

Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always

1k tokens
Backtest Expert
by BaggaT236
×3

Expert guidance for systematic backtesting of trading strategies. Use when developing, testing, stress-testing, or validating quantitative trading strategies. Covers "beating ideas to death" methodology, parameter robustness testing, slippage modeling, bias prevention, and interpreting backtest results. Applicable when user asks about backtesting, strategy validation, robustness testing, avoiding overfitting, or systematic trading development.

15k tokens scripts
Adaptyv
by christophacham
×3

Cloud laboratory platform for automated protein testing and validation. Use when designing proteins and needing experimental validation including binding assays, expression testing, thermostability measurements, enzyme activity assays, or protein sequence optimization. Also use for submitting experiments via API, tracking experiment status, downloading results, optimizing protein sequences for better expression using computational tools (NetSolP, SoluProt, SolubleMPNN, ESM), or managing protein design workflows with wet-lab validation.

16k tokens
Aeon
by christophacham
×3

This skill should be used for time series machine learning tasks including classification, regression, clustering, forecasting, anomaly detection, segmentation, and similarity search. Use when working with temporal data, sequential patterns, or time-indexed observations requiring specialized algorithms beyond standard ML approaches. Particularly suited for univariate and multivariate time series analysis with scikit-learn compatible APIs.

19k tokens

How to use it

Copy the folder

Take ravila4/test-driven-development from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.