tdd

Implement features using Test-Driven Development (TDD) with Red-Green-Refactor cycle.

141 stars

Best use case

tdd is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Implement features using Test-Driven Development (TDD) with Red-Green-Refactor cycle.

Teams using tdd should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/tdd/SKILL.md --create-dirs "https://raw.githubusercontent.com/DeL-TaiseiOzaki/claude-code-orchestra/main/.claude/skills/tdd/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/tdd/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How tdd Compares

Feature / AgenttddStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Implement features using Test-Driven Development (TDD) with Red-Green-Refactor cycle.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Test-Driven Development

Implement $ARGUMENTS using Test-Driven Development (TDD).

## TDD Cycle

```
Repeat: Red → Green → Refactor

1. Red:    Write a failing test
2. Green:  Write minimal code to pass the test
3. Refactor: Clean up code (tests still pass)
```

## Implementation Steps

### Phase 1: Test Design

1. **Confirm Requirements**
   - What is the input
   - What is the output
   - What are the edge cases

2. **List Test Cases**
   ```
   - [ ] Happy path: Basic functionality
   - [ ] Happy path: Boundary values
   - [ ] Error case: Invalid input
   - [ ] Error case: Error handling
   ```

### Phase 2: Red-Green-Refactor

#### Step 1: Write First Test (Red)

```python
# tests/test_{module}.py
def test_{function}_basic():
    """Test the most basic case"""
    result = function(input)
    assert result == expected
```

Run test and **confirm failure**:
```bash
uv run pytest tests/test_{module}.py -v
```

#### Step 2: Implementation (Green)

Write **minimal** code to pass the test:
- Don't aim for perfection
- Hardcoding is OK
- Just make the test pass

Run test and **confirm success**:
```bash
uv run pytest tests/test_{module}.py -v
```

#### Step 3: Refactoring (Refactor)

Improve while tests still pass:
- Remove duplication
- Improve naming
- Clean up structure

```bash
uv run pytest tests/test_{module}.py -v  # Confirm still passes
```

#### Step 4: Next Test

Return to Step 1 with next test case from the list.

### Phase 3: Completion Check

```bash
# Run all tests
uv run pytest -v

# Check coverage (target 80%+)
uv run pytest --cov={module} --cov-report=term-missing
```

## Report Format

```markdown
## TDD Complete: {Feature Name}

### Test Cases
- [x] {test1}: {description}
- [x] {test2}: {description}
...

### Coverage
{Coverage report}

### Implementation Files
- `src/{module}.py`: {description}
- `tests/test_{module}.py`: {N} tests
```

## Notes

- Write tests **first** (not after)
- Keep each cycle **small**
- Refactor **after** tests pass
- Prioritize **working code** over perfection

Related Skills

context-loader

141
from DeL-TaiseiOzaki/claude-code-orchestra

ALWAYS activate this skill at the start of every task. Load project context from .claude/ directory including coding rules, design decisions, and documentation before executing any task.

update-lib-docs

141
from DeL-TaiseiOzaki/claude-code-orchestra

Update library documentation in .claude/docs/libraries/ with latest information from web search.

update-design

141
from DeL-TaiseiOzaki/claude-code-orchestra

Explicitly update DESIGN.md with decisions from the current conversation. Use when you want to force a design document update.

troubleshoot

141
from DeL-TaiseiOzaki/claude-code-orchestra

Diagnose and plan fixes for errors/bugs with Codex-first multi-agent collaboration (Codex + Opus 4.6 + Agent Teams). Codex CLI is consulted in EVERY phase for deep code reasoning, hypothesis evaluation, and fix validation. Phase 1: Error reproduction & context gathering (Opus subagent 1M context + Codex initial analysis + Claude user interaction). Phase 2: Parallel diagnosis (Agent Teams: Root Cause Analyst [Codex-driven] + Impact Investigator [Opus + Codex risk analysis]). Phase 3: Fix plan synthesis, Codex validation & user approval. Fix implementation is handled separately by /team-implement.

team-review

141
from DeL-TaiseiOzaki/claude-code-orchestra

Parallel code review using Agent Teams. Spawns specialized reviewers (security, quality, test coverage) to review implementation from different perspectives simultaneously. Run after implementation.

team-implement

141
from DeL-TaiseiOzaki/claude-code-orchestra

Parallel implementation using Agent Teams. Spawns teammates per module/layer, each owning separate files to avoid conflicts. Uses shared task list with dependencies for autonomous coordination. Run after /start-feature plan approval.

start-feature

141
from DeL-TaiseiOzaki/claude-code-orchestra

Start a new feature with multi-agent collaboration (Opus 4.6 + Agent Teams). Phase 1: Codebase understanding (Opus subagent 1M context + Claude user interaction). Phase 2: Parallel research & design (Agent Teams: Researcher + Architect). Phase 3: Plan synthesis & user approval. Implementation is handled separately by /team-implement.

spike

141
from DeL-TaiseiOzaki/claude-code-orchestra

Time-boxed technical investigation/feasibility study with Codex-first multi-agent collaboration (Codex + Opus 4.6 + Agent Teams). Codex CLI is consulted in EVERY phase for question framing, feasibility analysis, and final evaluation. Phase 1: Frame the investigation question & constraints (Claude user interaction + Codex question decomposition). Phase 2: Parallel investigation (Agent Teams: Researcher [Opus external research] + Feasibility Analyst [Codex deep analysis] + optional prototype). Phase 3: Codex synthesis into go/no-go recommendation & research report. Produces a DECISION DOCUMENT, NOT an implementation plan. Use /add-feature or /start-feature after a GO decision.

simplify

141
from DeL-TaiseiOzaki/claude-code-orchestra

Simplify and refactor code while preserving functionality and library constraints.

research-lib

141
from DeL-TaiseiOzaki/claude-code-orchestra

Research a library and create comprehensive documentation in .claude/docs/libraries/.

plan

141
from DeL-TaiseiOzaki/claude-code-orchestra

Create a detailed implementation plan for a feature or task. Use when user wants to plan before coding.

init

141
from DeL-TaiseiOzaki/claude-code-orchestra

Analyze project structure and populate the "Repository Identity" section of CLAUDE.md (Zone B) plus AGENTS.md.