beta

Test-Driven Development Workflow

Skills

Skill that enforces TDD workflow: write test first, see it fail, implement, refactor.

2403/26/2026

Version 1

Published

Initial version

Created 3/26/2026

Initial version — no previous version to compare

Action Skill
---
name: tdd
description: Enforce test-driven development workflow. Use when implementing new features or fixing bugs — write the test first, then the implementation.
---

# TDD Workflow

Follow this cycle for every change:

## 1. RED — Write a failing test
- Write the test BEFORE any implementation
- Test should describe the desired behavior
- Run the test — it MUST fail
- If it passes, the test is wrong or the feature already exists

## 2. GREEN — Make it pass
- Write the MINIMUM code to make the test pass
- Don't optimize, don't refactor, don't add extras
- Just make the test green

## 3. REFACTOR — Clean up
- Now improve the code
- Extract functions, rename variables, reduce duplication
- Run tests after each refactor — they must stay green

## Rules
- Never write implementation before the test
- One test at a time
- Each test should test ONE behavior
- Use descriptive test names: "should return 404 when user not found"
- Don't test implementation details — test behavior