mcpbeat Sign in

Test Driven Development Agent Skill

Enforces TDD discipline with RED-GREEN-REFACTOR cycle. Use when writing new features, fixing bugs, or refactoring code. Ensures tests genuinely verify behavior.

753 tokens
context cost
the whole folder, loaded on every use
1
files
instructions only
0
copies elsewhere
how many repositories repackaged it
242
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/majiayu000/spellbook --skill test-driven-development

The instruction itself

12 sections, as written by the author

Test-Driven Development (TDD)

> From obra/superpowers

Core Principle

Write tests before implementation. Watch them fail. Write minimal code to pass.

THE IRON LAW: NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST

When to Apply TDD

  • New features
  • Bug fixes
  • Refactoring
  • Any behavior changes

The Red-Green-Refactor Cycle

RED: Write a Failing Test

  • Write ONE minimal test demonstrating desired behavior
  • Use clear, descriptive test names
  • Use real code, avoid unnecessary mocks
  • Test should fail for the RIGHT reason
# Verify RED
- Run the test
- Confirm it fails
- Confirm failure is NOT due to syntax errors
- Confirm you're not testing existing functionality

GREEN: Make It Pass

  • Write the SIMPLEST code that makes the test pass
  • Don't add extra features
  • Don't optimize yet
  • Just make it work
# Verify GREEN
- Run all tests
- Confirm new test passes
- Confirm no other tests broke

REFACTOR: Clean Up

  • Improve code quality while keeping tests green
  • Remove duplication
  • Improve naming
  • Extract helpers if needed
  • Run tests after each change

Why This Order Matters

Tests written AFTER implementation:

  • Pass immediately (proves nothing)
  • You never see them fail
  • Cannot verify they test what matters
  • Manual testing is NOT a substitute

Common Rationalizations to REJECT

| Excuse | Reality |

|--------|---------|

| "Too simple to test" | Simple code still breaks |

| "I'll write tests after" | Post-implementation tests pass immediately |

| "Already manually tested" | Manual testing lacks systematic rigor |

| "Deleting work is wasteful" | Unverified code is technical debt |

| "Keep as reference" | You'll adapt it; that's testing-after |

Red Flags Requiring RESTART

If any of these occur, DELETE the code and start over:

  • Writing code before tests
  • Tests passing immediately on first run
  • Rationalizing "just this once"
  • Planning to "test later"
  • Keeping pre-written code "as reference"

Example Workflow

# 1. RED - Write failing test
def test_user_can_login_with_valid_credentials():
    user = create_user(email="[email protected]", password="secret")
    result = login(email="[email protected]", password="secret")
    assert result.success == True
    assert result.user == user

# 2. Run test - MUST FAIL
# 3. GREEN - Implement minimal code
def login(email, password):
    user = User.find_by_email(email)
    if user and user.check_password(password):
        return LoginResult(success=True, user=user)
    return LoginResult(success=False, user=None)

# 4. Run test - MUST PASS
# 5. REFACTOR - Clean up if needed

Summary

  • Write test first
  • Watch it fail
  • Write minimal code to pass
  • Refactor while green
  • Repeat

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 majiayu000/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.