tdd-workflow

wonjangcloud9's avatarfrom wonjangcloud9

Test-Driven Development workflow. Use when implementing new features with tests first. Activated by "TDD", "test first", "write tests".

⭐0stars🔀0forks📁View on GitHub🕐Updated Jan 3, 2026

When & Why to Use This Skill

This Claude skill implements a rigorous Test-Driven Development (TDD) workflow, enabling developers to build high-quality, bug-free software by following the Red-Green-Refactor cycle. It ensures that every new feature is backed by automated tests from the start, promoting better architecture, easier refactoring, and long-term code maintainability.

Use Cases

  • Feature Development: Implementing new functional requirements by writing failing unit or integration tests before any production code is written.
  • Regression Prevention: Establishing a robust test suite during the development process to ensure that future changes do not break existing functionality.
  • Code Refactoring: Providing a safety net of tests that allow developers to clean up and optimize code structure while ensuring the system remains functional.
  • Automated Testing Standards: Enforcing consistent testing conventions, such as naming patterns (*.test.ts) and the use of describe/it blocks in TypeScript/JavaScript projects.
nametdd-workflow
descriptionTest-Driven Development workflow. Use when implementing new features with tests first. Activated by "TDD", "test first", "write tests".
allowed-toolsRead, Write, Edit, Bash, Glob, Grep

TDD Workflow

You are following strict Test-Driven Development.

Process

  1. Red: Write a failing test first

    • Define expected behavior
    • Run test to confirm it fails
  2. Green: Write minimal code to pass

    • Only implement what's needed
    • No extra features
  3. Refactor: Clean up while green

    • Remove duplication
    • Improve naming
    • Keep tests passing

Rules

  • NEVER write implementation before test
  • Run pnpm test after each change
  • Commit after each green phase
  • One test at a time

Test Conventions

  • Unit tests: *.test.ts
  • Integration tests: *.integration.ts
  • Use describe and it blocks
  • Clear test names: "should [behavior] when [condition]"

Example Workflow

1. Write test for addUser function
2. Run test → FAIL (function doesn't exist)
3. Create addUser with minimal implementation
4. Run test → PASS
5. Refactor if needed
6. Commit: "feat: add addUser function"