tdd-test-generation
About
This Claude Skill provides comprehensive TDD guidance using the RGRC cycle and Baby Steps methodology. It offers systematic test design techniques including equivalence partitioning, boundary value analysis, and decision tables for generating test cases. Use it when implementing TDD workflows, discussing test generation strategies, or building test-generator agents.
Documentation
TDD Test Generation - Comprehensive Test-Driven Development Guide
Overview
This skill provides systematic guidance for Test-Driven Development (TDD) combining:
- RGRC Cycle - Red-Green-Refactor-Commit workflow inspired by t_wada
- Baby Steps - Incremental development with 2-minute cycles
- Systematic Test Design - Equivalence partitioning, boundary value analysis, decision tables
- Test Generation - From SOW test plans to executable test cases
When to Use This Skill
Automatic Triggers
Keywords that activate this skill:
- TDD, Test-Driven Development, テスト駆動開発
- RGRC, Red-Green-Refactor, Baby Steps
- Test generation, test design, test cases
- Equivalence partitioning, boundary value, decision table
- Coverage, test first, unit test
Explicit Invocation
For guaranteed activation:
- "Apply TDD skill"
- "Use TDD test generation skill"
- "Follow RGRC cycle"
Common Scenarios
- Implementing features with
/codecommand - Generating tests with
test-generatoragent - Planning test coverage strategies
- Refactoring with test safety nets
- Reviewing test design quality
Core Concepts
1. Baby Steps - The Foundation
"Make the smallest possible change at each step" - t_wada
Why it matters:
- Immediate error localization (bug is in last 2-minute change)
- Continuous working state (always seconds from green)
- Rapid feedback loop
- Confidence through small successes
2-Minute Cycle:
- Write smallest failing test (30s)
- Make it pass minimally (1min)
- Run tests (10s)
- Tiny refactor (30s)
- Commit if green (20s)
2. RGRC Cycle
Goal: "Clean code that works" (動作するきれいなコード) - Ron Jeffries
Red Phase
Write failing test → Verify correct failure reason
Green Phase
Minimal code to pass → "You can sin" (quick/dirty OK)
Refactor Phase
Apply SOLID/DRY → Improve structure → Keep tests green
Commit Phase
All checks pass → Save stable state
3. Systematic Test Design
Quality > Quantity - Fewer well-designed tests catch more bugs
Equivalence Partitioning
Group inputs with same behavior, test one from each:
// Age validation: <18 (invalid), 18-120 (valid), >120 (invalid)
test('partition 1: rejects 17', () => ...)
test('partition 2: accepts 30', () => ...)
test('partition 3: rejects 121', () => ...)
Boundary Value Analysis
Test edges [min-1, min, max, max+1]:
test('boundary: rejects 17 (18-1)', () => ...)
test('boundary: accepts 18 (min)', () => ...)
test('boundary: accepts 120 (max)', () => ...)
test('boundary: rejects 121 (120+1)', () => ...)
Decision Table Testing
Complex logic with multiple conditions:
// isLoggedIn × isPremium × isActive → canAccess
// Use decision table to cover all combinations systematically
Detailed Knowledge Base
Reference Documents
- [@./references/tdd-rgrc.md] - Complete RGRC cycle guide with t_wada's methodology
- [@./references/test-design.md] - Systematic test design techniques, coverage goals (C0: 80%, C1: 70%), framework-agnostic patterns
Integration Points
With Agents
- test-generator - Generates tests from SOW using this skill's principles
- testability-reviewer - Evaluates test design quality
With Commands
- /code - Applies TDD during implementation
- /test - Validates coverage and quality
Integration Method
# In agent YAML frontmatter
dependencies: [tdd-test-generation]
Or explicit reference:
[@~/.claude/skills/tdd-test-generation/SKILL.md]
Quick Start
New Feature
- Red - Write failing test
- Green - Minimal code
- Refactor - Clean up
- Commit - Save
- Repeat
From SOW
- Read SOW test plan
- Apply equivalence partitioning
- Add boundary values
- Generate test cases
- Verify coverage
Refactoring
- Ensure comprehensive tests
- Verify green
- Refactor incrementally
- Run frequently
- Commit when green
Best Practices
Do's ✅
- Write test before code
- Keep steps small (Baby Steps)
- Run tests frequently
- Commit when green
- Use systematic test design
- Apply SOLID/DRY in Refactor, not before
Don'ts ❌
- Skip Red phase
- Write multiple tests before any pass
- Refactor without green tests
- Commit with failing tests
- Random test selection
- Complex architecture in Green phase
Coverage Goals
Industry-recommended targets:
- C0 (Statement): 80% minimum
- C1 (Branch): 70% minimum
Why: Cost-benefit balance, focus on critical paths
When NOT to Use TDD
Skip for:
- Prototypes (throwaway code)
- External API integration (use mocks)
- Simple one-off scripts
- UI experiments (visual iteration first)
Success Metrics
TDD is working when:
- Tests written before code (100%)
- Cycles complete in <5 min
- Refactoring feels safe
- Coverage meets targets
- Velocity increases over time
Resources
references/
Comprehensive documentation loaded as needed:
tdd-rgrc.md- Detailed RGRC cycle implementationtest-design.md- Complete test design techniques guide
scripts/
Currently empty - no automation scripts needed (knowledge-only skill)
assets/
Currently empty - no template files needed (knowledge-only skill)
Quick Install
/plugin add https://github.com/thkt/claude-config/tree/main/tdd-test-generationCopy and paste this command in Claude Code to install this skill
GitHub 仓库
Related Skills
evaluating-llms-harness
TestingThis Claude Skill runs the lm-evaluation-harness to benchmark LLMs across 60+ standardized academic tasks like MMLU and GSM8K. It's designed for developers to compare model quality, track training progress, or report academic results. The tool supports various backends including HuggingFace and vLLM models.
langchain
MetaLangChain is a framework for building LLM applications using agents, chains, and RAG pipelines. It supports multiple LLM providers, offers 500+ integrations, and includes features like tool calling and memory management. Use it for rapid prototyping and deploying production systems like chatbots, autonomous agents, and question-answering services.
webapp-testing
TestingThis Claude Skill provides a Playwright-based toolkit for testing local web applications through Python scripts. It enables frontend verification, UI debugging, screenshot capture, and log viewing while managing server lifecycles. Use it for browser automation tasks but run scripts directly rather than reading their source code to avoid context pollution.
business-rule-documentation
MetaThis skill provides standardized templates for systematically documenting business logic and domain knowledge following Domain-Driven Design principles. It helps developers capture business rules, process flows, decision trees, and terminology glossaries to maintain consistency between requirements and implementation. Use it when documenting domain models, creating business rule repositories, or bridging communication between business and technical teams.
