tdd

Introduces commands for test-driven development, common anti-patterns and skills for testing using subagents.

View on GitHub
Author Vlad Goncharov
Namespace @NeoLabHQ/context-engineering-kit
Category development
Version 1.1.0
Stars 354
Downloads 2
self.md verified
Table of content

Introduces commands for test-driven development, common anti-patterns and skills for testing using subagents.

Installation

npx claude-plugins install @NeoLabHQ/context-engineering-kit/tdd

Contents

Folders: commands, skills

Files: README.md

Documentation

A disciplined approach to software development that ensures every line of production code is validated by tests written first. Introduces TDD methodology, anti-pattern detection, and orchestrated test coverage using specialized agents.

Focused on:

Plugin Target

Overview

The TDD plugin implements Kent Beck’s Test-Driven Development methodology, proven over two decades to produce higher-quality, more maintainable software. The core principle is simple but transformative: write the test first, watch it fail, then write minimal code to pass.

The plugin is based on foundational works including Kent Beck’s Test-Driven Development: By Example and the extensive research on TDD effectiveness.

Quick Start

# Install the plugin
/plugin install tdd@NeoLabHQ/context-engineering-kit

> claude "Use TDD skill to implement email validation for user registration"

# Manually make some changes that cause test failures

# Fix failing tests
> /tdd:fix-tests

After Implementation

If you implemented a new feature but have not written tests, you can use the write-tests command to cover it.

> claude "implement email validation for user registration"

# Write tests after you made changes
> /tdd:write-tests

Usage Examples

Commands Overview

/tdd:write-tests - Cover Local Changes with Tests

Systematically add test coverage for all local code changes using specialized review and development agents.

/tdd:write-tests ["focus area or modules"]

Arguments

Optional focus area specification. Defaults to all uncommitted changes. If everything is committed, covers the latest commit.

How It Works

  1. Preparation Phase

    • Discovers test infrastructure (test commands, coverage tools)
    • Runs full test suite to establish baseline
    • Reads project conventions and patterns
  2. Analysis Phase (parallel)

    • Verifies single test execution capability
    • Analyzes local changes via git status or latest commit
    • Filters non-code files and identifies logic changes
    • Assesses complexity to determine workflow path
  3. Test Writing Phase

    • Simple changes (single file, straightforward logic): Writes tests directly
    • Complex changes (multiple files or complex logic): Orchestrates specialized agents
      • Coverage reviewer agents analyze each file for test needs
      • Developer agents write comprehensive tests in parallel
      • Verification agents confirm coverage completeness
  4. Verification Phase

    • Runs full test suite
    • Generates coverage report if available
    • Iterates on gaps until all critical logic is covered

Complexity Decision:

Usage Examples

# Cover all uncommitted changes
> /tdd:write-tests

# Focus on specific module
> /tdd:write-tests Focus on payment processing edge cases

# Cover authentication changes
> /tdd:write-tests authentication module

# Focus on error handling
> /tdd:write-tests Focus on error paths and validations

Best practices

/tdd:fix-tests - Fix Failing Tests

Systematically fix all failing tests after business logic changes or refactoring using orchestrated agents.

/tdd:fix-tests ["focus area or modules"]

Arguments

Optional specification of which tests or modules to focus on. Defaults to all failing tests.

How It Works

  1. Discovery Phase
    • Reads test infrastructure configuration
    • Runs full

…(truncated)

Included Skills

This plugin includes 1 skill definition:

test-driven-development

Use when implementing any feature or bugfix, before writing implementation code - write the test first, watch it fail, write minimal code to pass; ensures tests actually verify behavior by requiring failure first

View skill definition

Test-Driven Development (TDD)

Overview

Write the test first. Watch it fail. Write minimal code to pass.

Core principle: If you didn’t watch the test fail, you don’t know if it tests the right thing.

Violating the letter of the rules is violating the spirit of the rules.

When to Use

Always:

Exceptions (ask your human partner):

Thinking “skip TDD just this once”? Stop. That’s rationalization.

The Iron Law

NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST

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

No exceptions:

Implement fresh from tests. Period.

Red-Green-Refactor

digraph tdd_cycle {
    rankdir=LR;
    red [label="RED\nWrite failing test", shape=box, style=filled, fillcolor="#ffcccc"];
    verify_red [label="Verify fails\ncorrectly", shape=diamond];
    green [label="GREEN\nMinimal code", shape=box, style=filled, fillcolor="#ccffcc"];
    verify_green [label="Verify passes\nAll green", shape=diamond];
    refactor [label="REFACTOR\nClean up", shape=box, style=filled, fillcolor="#ccccff"];
    next [label="Next", shape=ellipse];

    red -> verify_red;
    verify_red -> green [label="yes"];
    verify_red -> red [label="wrong\nfailure"];
    green -> verify_green;
    verify_g

...(truncated)

</details>

## Source

[View on GitHub](https://github.com/NeoLabHQ/context-engineering-kit)