Skills

Test Driven Development

Unified TDD skill with three input modes, from spec, from task, or from description.

Install

npx skills add mikeyobrien/ralph-orchestrator --skill test-driven-development -g -a claude-code -y
Category
Testing
Updated
5d ago
License
MIT
Context cost
Lightabout 1,052 tokens
Runs scripts
No, instructions only

What it does

Unified TDD skill with three input modes, from spec, from task, or from description. Enforces test-first development using repository patterns, with proptest guidance and backpressure integration.

Test-Driven Development

Overview

One skill for all TDD workflows. Enforces test-first development using existing repository patterns. Three input modes handle different entry points, specs, task files, or ad-hoc descriptions, but the core cycle is always RED → GREEN → REFACTOR.

Input Modes

Detect the input type and follow the corresponding mode:

Mode A: From Spec (.spec.md)

Use when the input references a .spec.md file with Given/When/Then acceptance criteria.

  1. Locate and parse the spec file, extract all Given/When/Then triples
  2. Generate one test stub per criterion with todo!() bodies:
    /// Spec: <spec-file>, Criterion #<N>
    /// Given <given text>
    /// When <when text>
    /// Then <then text>
    #[test]
    fn <spec_name>_criterion_<N>_<slug>() {
        todo!("Implement: <then text>");
    }
    
  3. Verify stubs compile but fail: cargo test --no-run -p <crate>
  4. Proceed to the TDD Cycle to make stubs pass

Programmatic support: ralph_core::preflight::{extract_acceptance_criteria, extract_criteria_from_file, extract_all_criteria} can parse criteria from spec files.

Mode B: From Task (.code-task.md)

Use when the input references a .code-task.md file or a specific implementation task.

  1. Read the task and identify acceptance criteria or requirements
  2. Discover patterns (see Pattern Discovery)
  3. Design test scenarios covering normal operation, edge cases, and error conditions
  4. Write failing tests for all requirements before any implementation
  5. Proceed to the TDD Cycle

Mode C: From Description

Use for ad-hoc tasks without a spec or task file.

  1. Clarify requirements from the description
  2. Discover patterns (see Pattern Discovery)
  3. Write failing tests targeting the described behavior
  4. Proceed to the TDD Cycle

Pattern Discovery

Read the whole SKILL.md on GitHub

More in Testing