tdd-workflow
Test-Driven Development workflow principles. RED-GREEN-REFACTOR cycle.
TDD Workflow
Write tests first, code second.
1. The TDD Cycle
🔴 RED → Write failing test
↓
🟢 GREEN → Write minimal code to pass
↓
🔵 REFACTOR → Improve code quality
↓
Repeat...
2. The Three Laws of TDD
- Write production code only to make a failing test pass
- Write only enough test to demonstrate failure
- Write only enough code to make the test pass
3. RED Phase Principles
What to Write
| Focus | Example |
|---|---|
| Behavior | "should add two numbers" |
| Edge cases | "should handle empty input" |
| Error states | "should throw for invalid data" |
RED Phase Rules
- Test must fail first
- Test name describes expected behavior
- One assertion per test (ideally)
4. GREEN Phase Principles
Minimum Code
| Principle | Meaning |
|---|---|
| YAGNI | You Aren't Gonna Need It |
| Simplest thing | Write the minimum to pass |
| No optimization | Just make it work |
GREEN Phase Rules
- Don't write unneeded code
- Don't optimize yet
- Pass the test, nothing more
5. REFACTOR Phase Principles
What to Improve
| Area | Action |
|---|---|
| Duplication | Extract common code |
| Naming | Make intent clear |
| Structure | Improve organization |
| Complexity | Simplify logic |
REFACTOR Rules
- All tests must stay green
- Small incremental
Subscribers only
The full skill, its 1 bundled files and every download is included with every paid Complete AI plan.
Details
| Source | community |
|---|---|
| License | — |
| Risk label | critical ("critical" means the skill may run commands or touch files — read before use) |
| Files | SKILL.md |
| Added | 2026-02-27 |
Related skills
ab-testing
When the user wants to plan, design, or implement an A/B test or experiment, or build a growth experimentation program.
agent-qa-authoring
Create, edit, validate, and run Agent QA tests, suites, and hooks through MCP or CLI while preserving canonical IDs and schema contracts.
agent-qa-debug-fix
Debug, patch, and verify failed Agent QA runs from MCP evidence, artifacts, logs, and local code without hiding product or infrastructure defects.
agent-qa-result-triage
Triage failed Agent QA runs with MCP evidence, artifacts, logs, fixed failure categories, confidence, and actionable next steps.
android-ui-journey-testing
XML-specified Android UI journey testing, interactive step execution, assertion verification, and JSON outcome reporting.
bats-testing-patterns
Master Bash Automated Testing System (Bats) for comprehensive shell script testing. Use when writing tests for shell scripts, CI/CD pipelines, or requiring test-driven development of shell utilities.
