Agent skill

Test Driven Development

by bobmatnyc in bobmatnyc/claude-mpm

Comprehensive TDD patterns and practices for all programming languages, eliminating redundant testing guidance per agent.

Apache-2.0Auto-check passedTesting & QA

Install Test Driven Development

skills CLI
$ npx skills add bobmatnyc/claude-mpm --skill test-driven-development -a claude-code

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

GitHub CLI
$ gh skill install bobmatnyc/claude-mpm test-driven-development --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/bobmatnyc/claude-mpm.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugin/skills/universal-testing-test-driven-development .claude/skills/test-driven-development && 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
test-driven-development
GitHub stars
155
Token cost
~2.5k tokens
SKILL.md length
383 words
Files
9 (incl. references)
Skills in repo
52
Repo updated
First seen
Licence
Apache-2.0

At a glance

Comprehensive TDD patterns and practices for all programming languages, eliminating redundant testing guidance per agent.

  • Works in 7 steps: Red Phase: Write Failing Test → Green Phase: Make It Pass → Refactor Phase: Improve Code → …
  • Tasks that involve Test-driven development
  • SKILL.md covers When to Use, TDD Workflow…, Test Structure Patterns and Test Naming Conventions, plus 5 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Test Driven Development is an agent skill from bobmatnyc/claude-mpm. Comprehensive TDD patterns and practices for all programming languages, eliminating redundant testing guidance per agent.

Its SKILL.md is about 2.5k tokens, which your agent loads only when the skill is triggered. The skill folder holds 9 other files, including reference files (for example `.etag_cache.json`, `metadata.json` and `references/.etag_cache.json`). Compatibility notes: claude-code

It sits in Testing & QA, covering Test-driven development and Unit testing. The repository describes itself as: Claude Multi-Agent Project Manager — multi-channel orchestration, GitHub-first SDK mode, and plugin system for Claude. The licence is Apache-2.0.

When your agent uses it

  • Tasks that involve Test-driven development
  • Tasks that involve Unit testing

Example prompts

  • “/test-driven-development”

Requirements

  • Python 3
  • Compatibility (from SKILL.md): claude-code

Workflow steps

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

  1. Red Phase: Write Failing Test
  2. Green Phase: Make It Pass
  3. Refactor Phase: Improve Code
  4. One Assertion Per Test (When Possible)
  5. Test Independence
  6. Descriptive Test Failures
  7. Test Data Builders

What it can do on your machine

Read from SKILL.md and the folder at commit 25203d3. 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 (its code samples are python, javascript and go).

    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.

  • Compatibility

    claude-code

    From compatibility in the SKILL.md frontmatter.

Context cost

Test Driven Development loads about 2.5k tokens when it runs, and up to ~20k if it reads all its reference files. Until then it costs about 36 tokens; SKILL.md has 383 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~36
When it runs · the whole SKILL.md, loaded when a task matches
~2.5k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~20k

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 bobmatnyc/claude-mpm at commit 25203d3, republished under its Apache-2.0 licence (© bobmatnyc). 383 words, ~2,471 tokens.

Download SKILL.mdSave it as .claude/skills/test-driven-development/SKILL.md (or your agent's skills folder). This skill also uses 8 other files; get the full folder from GitHub.
name
test-driven-development
description
Comprehensive TDD patterns and practices for all programming languages, eliminating redundant testing guidance per agent.
compatibility
claude-code
license
Apache-2.0
metadata.updated_at
2025-10-30T17:00:00Z
tags
testing, tdd, best-practices, quality-assurance
progressive_disclosure.references
anti-patterns.md, examples.md, integration.md, philosophy.md, workflow.md

Test-Driven Development (TDD)

Comprehensive TDD patterns and practices for all programming languages. This skill eliminates ~500-800 lines of redundant testing guidance per agent.

When to Use

Apply TDD for:

  • New feature implementation
  • Bug fixes (test the bug first)
  • Code refactoring (tests ensure behavior preservation)
  • API development (test contracts)
  • Complex business logic

TDD Workflow (Red-Green-Refactor)

1. Red Phase: Write Failing Test
Write a test that:
- Describes the desired behavior
- Fails for the right reason (not due to syntax errors)
- Is focused on a single behavior
2. Green Phase: Make It Pass
Write the minimum code to:
- Pass the test
- Not introduce regressions
- Follow existing patterns
3. Refactor Phase: Improve Code
While keeping tests green:
- Remove duplication
- Improve naming
- Simplify logic
- Extract functions/classes

Test Structure Patterns

Arrange-Act-Assert (AAA)
// Arrange: Set up test data and conditions
const user = createTestUser({ role: 'admin' });

// Act: Perform the action being tested
const result = await authenticateUser(user);

// Assert: Verify the outcome
expect(result.isAuthenticated).toBe(true);
expect(result.permissions).toContain('admin');
Given-When-Then (BDD Style)
Given: A user with admin privileges
When: They attempt to access protected resource
Then: Access is granted with appropriate permissions

Test Naming Conventions

Pattern: test_should_<expected_behavior>_when_<condition>

Examples:

  • test_should_return_user_when_id_exists()
  • test_should_raise_error_when_user_not_found()
  • test_should_validate_email_format_when_creating_account()
Language-Specific Conventions

Python (pytest):

python
def test_should_calculate_total_when_items_added():
    # Arrange
    cart = ShoppingCart()
    cart.add_item(Item("Book", 10.00))
    cart.add_item(Item("Pen", 1.50))

    # Act
    total = cart.calculate_total()

    # Assert
    assert total == 11.50

JavaScript (Jest):

javascript
describe('ShoppingCart', () => {
  test('should calculate total when items added', () => {
    const cart = new ShoppingCart();
    cart.addItem({ name: 'Book', price: 10.00 });
    cart.addItem({ name: 'Pen', price: 1.50 });

    const total = cart.calculateTotal();

    expect(total).toBe(11.50);
  });
});

Go:

go
func TestShouldCalculateTotalWhenItemsAdded(t *testing.T) {
    // Arrange
    cart := NewShoppingCart()
    cart.AddItem(Item{Name: "Book", Price: 10.00})
    cart.AddItem(Item{Name: "Pen", Price: 1.50})

    // Act
    total := cart.CalculateTotal()

    // Assert
    if total != 11.50 {
        t.Errorf("Expected 11.50, got %f", total)
    }
}

Test Types and Scope

Unit Tests
  • Scope: Single function/method
  • Dependencies: Mocked
  • Speed: Fast (< 10ms per test)
  • Coverage: 80%+ of code paths
Integration Tests
  • Scope: Multiple components
  • Dependencies: Real or test doubles
  • Speed: Moderate (< 1s per test)
  • Coverage: Critical paths and interfaces
End-to-End Tests
  • Scope: Full user workflows
  • Dependencies: Real (in test environment)
  • Speed: Slow (seconds to minutes)
  • Coverage: Core user journeys

Mocking and Test Doubles

When to Mock
  • External APIs and services
  • Database operations (for unit tests)
  • File system operations
  • Time-dependent operations
  • Random number generation
Mock Types

Stub: Returns predefined data

python
def get_user_stub(user_id):
    return User(id=user_id, name="Test User")

Mock: Verifies interactions

python
mock_service = Mock()
service.process_payment(payment_data)
mock_service.process_payment.assert_called_once_with(payment_data)

Fake: Working implementation (simplified)

python
class FakeDatabase:
    def __init__(self):
        self.data = {}

    def save(self, key, value):
        self.data[key] = value

    def get(self, key):
        return self.data.get(key)

Test Coverage Guidelines

Target Coverage Levels
  • Critical paths: 100%
  • Business logic: 95%+
  • Overall project: 80%+
  • UI components: 70%+
What to Test
  • ✅ Business logic and algorithms
  • ✅ Edge cases and boundary conditions
  • ✅ Error handling and validation
  • ✅ State transitions
  • ✅ Public APIs and interfaces
Show full SKILL.md (150 more words)Show less
What NOT to Test
  • ❌ Framework internals
  • ❌ Third-party libraries
  • ❌ Trivial getters/setters
  • ❌ Generated code
  • ❌ Configuration files

Testing Best Practices

1. One Assertion Per Test (When Possible)
python
# Good: Focused test
def test_should_validate_email_format():
    assert is_valid_email("user@example.com") is True

# Avoid: Multiple unrelated assertions
def test_validation():
    assert is_valid_email("user@example.com") is True
    assert is_valid_phone("123-456-7890") is True  # Different concept
2. Test Independence
python
# Good: Each test is self-contained
def test_user_creation():
    user = create_user("test@example.com")
    assert user.email == "test@example.com"

# Avoid: Tests depending on execution order
shared_user = None

def test_create_user():
    global shared_user
    shared_user = create_user("test@example.com")

def test_update_user():  # Depends on previous test
    shared_user.name = "Updated"
3. Descriptive Test Failures
python
# Good: Clear failure message
assert result.status == 200, f"Expected 200, got {result.status}: {result.body}"

# Avoid: Unclear failure
assert result.status == 200
4. Test Data Builders
python
# Good: Reusable test data creation
def create_test_user(**overrides):
    defaults = {
        'email': 'test@example.com',
        'name': 'Test User',
        'role': 'user'
    }
    return User(**{**defaults, **overrides})

# Usage
admin = create_test_user(role='admin')
guest = create_test_user(email='guest@example.com')

Testing Anti-Patterns to Avoid

❌ Testing Implementation Details
python
# Bad: Tests internal structure
def test_user_storage():
    user = User("test@example.com")
    assert user._internal_cache is not None  # Implementation detail
❌ Fragile Tests
python
# Bad: Breaks with harmless changes
assert user.to_json() == '{"name":"John","email":"john@example.com"}'

# Good: Tests behavior, not format
data = json.loads(user.to_json())
assert data['name'] == "John"
assert data['email'] == "john@example.com"
❌ Slow Tests in Unit Test Suite
python
# Bad: Real HTTP calls in unit tests
def test_api_integration():
    response = requests.get("https://api.example.com/users")  # Slow!
    assert response.status_code == 200
❌ Testing Everything Through UI
python
# Bad: Testing business logic through UI
def test_calculation():
    browser.click("#input1")
    browser.type("5")
    browser.click("#input2")
    browser.type("3")
    browser.click("#calculate")
    assert browser.find("#result").text == "8"

# Good: Test logic directly
def test_calculation():
    assert calculate(5, 3) == 8

Quick Reference by Language

Python (pytest)
python
# Setup/Teardown
@pytest.fixture
def database():
    db = create_test_database()
    yield db
    db.cleanup()

# Parametrized tests
@pytest.mark.parametrize("input,expected", [
    ("user@example.com", True),
    ("invalid-email", False),
])
def test_email_validation(input, expected):
    assert is_valid_email(input) == expected
JavaScript (Jest)
javascript
// Setup/Teardown
beforeEach(() => {
  database = createTestDatabase();
});

afterEach(() => {
  database.cleanup();
});

// Async tests
test('should fetch user data', async () => {
  const user = await fetchUser(1);
  expect(user.name).toBe('John');
});
Go
go
// Table-driven tests
func TestEmailValidation(t *testing.T) {
    tests := []struct {
        input    string
        expected bool
    }{
        {"user@example.com", true},
        {"invalid-email", false},
    }

    for _, tt := range tests {
        result := IsValidEmail(tt.input)
        if result != tt.expected {
            t.Errorf("IsValidEmail(%s) = %v, want %v",
                tt.input, result, tt.expected)
        }
    }
}

TDD Benefits Realized

  • Design Improvement: Tests drive better API design
  • Documentation: Tests serve as executable documentation
  • Confidence: Refactoring becomes safe
  • Debugging: Tests isolate issues quickly
  • Coverage: Ensures comprehensive test coverage
  • Regression Prevention: Catches bugs before deployment

When using Test Driven Development, these skills enhance your workflow:

  • systematic-debugging: Debug-first methodology when tests fail unexpectedly
  • react: Testing React components, hooks, and context
  • django: Testing Django models, views, and forms
  • fastapi-local-dev: Testing FastAPI endpoints and dependency injection

[Full documentation available in these skills if deployed in your bundle]

© bobmatnyc, 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 8 other files (references) in plugin/skills/universal-testing-test-driven-development of bobmatnyc/claude-mpm.

  • SKILL.md
  • .etag_cache.json
  • metadata.json
  • references/.etag_cache.json
  • references/anti-patterns.md
  • references/examples.md
  • references/integration.md
  • references/philosophy.md
  • references/workflow.md

Open the folder on GitHubat commit 25203d3

Compare with similar skills

Test Driven Development 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.

Test Driven Development compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Test Driven Development this skillbobmatnyc/claude-mpm155—~2.5kAutomated safety check: PassApache-2.0
TDD WorkflowhellangleZ/burn-in-cceverywhere-ralph11211 repos~2.4kAutomated safety check: PassNone
TDD Workflowaffaan-m/ECC275k3 repos~2kAutomated safety check: PassMIT
TDD Workflowaffaan-m/ECC275k2 repos~2kAutomated safety check: PassMIT
TDD Workflowaffaan-m/ECC275k2 repos~2.1kAutomated safety check: PassMIT
TDD Workflowaffaan-m/ECC275k1 repos~2.6kAutomated safety check: PassMIT

Similar skills

  • 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 Workflow

    affaan-m/ECC

    在编写新功能、修复错误或重构代码时使用此技能。强制执行测试驱动开发,确保单元测试、集成测试和端到端测试的覆盖率超过80%。

    275k GitHub starsUsed in 3 repos~2k tokens
    Testing & QAAuto-check passed
  • TDD Workflow

    affaan-m/ECC

    新機能の作成、バグ修正、コードのリファクタリング時にこのスキルを使用します。ユニット、統合、E2Eテストを含む80%以上のカバレッジでテスト駆動開発を強制します。

    275k GitHub starsUsed in 2 repos~2k tokens
    Testing & QAAuto-check passed
  • TDD Workflow

    affaan-m/ECC

    새 기능 작성, 버그 수정 또는 코드 리팩터링 시 이 스킬을 사용하세요. An agent skill from affaan-m/ECC.

    275k GitHub starsUsed in 2 repos~2.1k tokens
    Testing & QAAuto-check passed
  • TDD Workflow

    affaan-m/ECC

    Yeni özellikler yazarken, hata düzeltirken veya kod refactor ederken bu skill'i kullanın.

    275k GitHub starsUsed in 1 repo~2.6k tokens
    Testing & QAAuto-check passed
  • Test Writer

    hamzafarooq/claude-code-starter

    Write unit tests for any function — happy path, edge cases, and error cases.

    145 GitHub stars~345 tokensUpdated 24 days ago
    Testing & QAAuto-check passed

More from bobmatnyc/claude-mpm

All 52 skills in this repo
  • Build MCP Server

    bobmatnyc/claude-mpm

    Create high-quality MCP servers that enable LLMs to effectively interact with external services.

    155 GitHub stars~2k tokensUpdated 1 mo ago
    Auto-check passed
  • Env Manager

    bobmatnyc/claude-mpm

    Environment variable validation, synchronization, and management across local development, CI/CD, and deployment platforms

    155 GitHub stars~2k tokensUpdated 1 mo ago
    Auto-check: notes
  • Session Analyzer

    bobmatnyc/claude-mpm

    Debug and teach agentic coding: a deterministic-first session timeline + cost report, with optional narrative polish and a standalone JSX visualiser.

    155 GitHub stars~2.2k tokensUpdated 1 mo ago
    Auto-check passed
  • Software Patterns

    bobmatnyc/claude-mpm

    Decision framework for architectural patterns including DI, SOA, Repository, Domain Events, Circuit Breaker, and Anti-Corruption Layer.

    155 GitHub stars~1.8k tokensUpdated 1 mo ago
    Auto-check passed
  • Verification Before Completion

    bobmatnyc/claude-mpm

    Run verification commands and confirm output before claiming success

    155 GitHub starsUsed in 2 repos~1k tokens
    Auto-check passed
  • Dependency Audit

    bobmatnyc/claude-mpm

    Dependency audit and cleanup workflow for maintaining healthy project dependencies.

    155 GitHub stars~3.5k tokensUpdated 1 mo ago
    Auto-check passed

Categories

Questions about Test Driven Development

What does Test Driven Development do?

Comprehensive TDD patterns and practices for all programming languages, eliminating redundant testing guidance per agent. Test Driven Development is an agent skill from bobmatnyc/claude-mpm. Comprehensive TDD patterns and practices for all programming languages, eliminating redundant testing guidance per agent.

When should I use Test Driven Development?

Test Driven Development fits situations like: tasks that involve Test-driven development; tasks that involve Unit testing.

How do I install Test Driven Development in Claude Code?

Run `npx skills add bobmatnyc/claude-mpm --skill test-driven-development -a claude-code`. Or copy the skill folder (plugin/skills/universal-testing-test-driven-development in bobmatnyc/claude-mpm) into .claude/skills/test-driven-development in your project. Claude Code loads it when a task matches its description.

How do I install Test Driven Development in Codex?

Run `npx skills add bobmatnyc/claude-mpm --skill test-driven-development -a codex`. Or copy the skill folder (plugin/skills/universal-testing-test-driven-development in bobmatnyc/claude-mpm) into .agents/skills/test-driven-development in your project. Codex loads it when a task matches its description.

Can I use Test Driven Development 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 bobmatnyc/claude-mpm --skill test-driven-development -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/test-driven-development, .gemini/skills/test-driven-development, .github/skills/test-driven-development and .opencode/skills/test-driven-development in your project.

What does Test Driven Development need to run?

SKILL.md names no scripts, command-line tools or credentials: Test Driven Development is instructions for the agent only. Our summary lists: Python 3. Compatibility (from SKILL.md): claude-code.

Does Test Driven Development 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 Test Driven Development 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 Test Driven Development use?

Test Driven Development is published under the Apache-2.0 licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Test Driven Development use?

About 2.5k tokens (SKILL.md is roughly 9.9k 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 17k tokens, read only when the agent opens those files.

What are the alternatives to Test Driven Development?

Skills that share tags, products or a category with Test Driven Development: TDD Workflow (hellangleZ/burn-in-cceverywhere-ralph, 112 stars), TDD Workflow (affaan-m/ECC, 275k stars), TDD Workflow (affaan-m/ECC, 275k stars) and TDD Workflow (affaan-m/ECC, 275k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Test Driven Development?

bobmatnyc (a GitHub user) maintains it in bobmatnyc/claude-mpm, which has 155 GitHub stars. The repository holds 52 skills in this directory. The repository was last updated on August 31, 2026.

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