Skip to content
Skillpedia
Testing48k · #4319

tdd-workflow

Makes your agent follow test-driven development principles. It focuses on the cycle of writing tests, making code pass, and refactoring.

What it does

This skill helps you write code in an organized and reliable way. It guides you through a cycle where you first write a failing test, then the minimal code to make it pass, and finally improve the code's quality.

When to use it

  • ✓When starting a new feature.
  • ✓When fixing a bug.
  • ✓When working with complex logic.

Example of what to ask your AI

“Help me apply the TDD cycle to create a function that adds two numbers.”

Want more? Open the sections below.

How to use

The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.

Skill link

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/tdd-workflow/SKILL.md

Ready-to-paste message

Use this skill to help me: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/tdd-workflow/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
How it works

The AI follows a cycle: first, you describe what the code should do and the AI writes a failing test. Then, the AI writes the simplest code to make the test pass. Finally, the AI reviews and improves the code without breaking the tests.

Installation

Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.

In the terminal (Claude Code, Codex, Cursor), in your project folder:

npx skills add sickn33/agentic-awesome-skills --skill tdd-workflow

Or download just the file:

curl -L https://raw.githubusercontent.com/sickn33/agentic-awesome-skills/main/plugins/agentic-awesome-skills-claude/skills/tdd-workflow/SKILL.md -o SKILL.md
Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

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

  1. Write production code only to make a failing test pass
  2. Write only enough test to demonstrate failure
  3. 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 changes
  • Commit after each refactor

6. AAA Pattern

Every test follows:

Step Purpose
Arrange Set up test data
Act Execute code under test
Assert Verify expected outcome

7. When to Use TDD

Scenario TDD Value
New feature High
Bug fix High (write test first)
Complex logic High
Exploratory Low (spike, then TDD)
UI layout Low

8. Test Prioritization

Priority Test Type
1 Happy path
2 Error cases
3 Edge cases
4 Performance

9. Anti-Patterns

❌ Don't ✅ Do
Skip the RED phase Watch test fail first
Write tests after Write tests before
Over-engineer initial Keep it simple
Multiple asserts One behavior per test
Test implementation Test behavior

10. AI-Augmented TDD

Multi-Agent Pattern

Agent Role
Agent A Write failing tests (RED)
Agent B Implement to pass (GREEN)
Agent C Optimize (REFACTOR)

Remember: The test is the specification. If you can't write a test, you don't understand the requirement.

When to Use

This skill is applicable to execute the workflow or actions described in the overview.

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
FAQ

What do 'RED', 'GREEN', 'REFACTOR' mean?

'RED' is when the test fails. 'GREEN' is when the code makes the test pass. 'REFACTOR' is when you improve the code while keeping everything working.

Why write the test before the code?

Writing the test first ensures you know exactly what the code needs to do and helps avoid unnecessary code.

What is 'YAGNI'?

YAGNI stands for 'You Aren't Gonna Need It'. It's a principle to write only the code that is strictly necessary at the moment.

Details

Original description by the author

Test-Driven Development workflow principles. RED-GREEN-REFACTOR cycle.

repo: sickn33/agentic-awesome-skills

Popularity

GitHub stars
48k
Ranking position
#4319
License
MIT
Updated
10/15/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills