Test-Driven Development (TDD) Skill

SkillAI & models

RED-GREEN-REFACTOR cycle with strict phase gates for TDD.

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use the Test-Driven Development (TDD) Skill skill

What this skill tells your AI

The instructions your AI receives, as published by notque/vexjoy-agent in skills/testing/test-driven-development/SKILL.md and read by ahel’s review.

Enforce the RED-GREEN-REFACTOR cycle for all code changes. Tests are written before implementation code, verified to fail for the right reasons, and maintained through disciplined development cycles.

Reference Loading Table

SignalLoad These FilesWhy
errors, error handlingerror-handling.mdLoads detailed guidance from error-handling.md.
full RED-GREEN-REFACTOR walkthroughs in Go, Python, JavaScriptexamples.mdLoads detailed guidance from examples.md.
detailed phase steps, rationale, or language-specific test commandsphase-guidance.mdLoads detailed guidance from phase-guidance.md.

Instructions

Before starting any TDD cycle, read and follow repository CLAUDE.md files. Project instructions override default TDD behaviors because local conventions (test frameworks, directory layout, naming) vary across codebases.

Full phase guidance (steps, rationale, code examples, language commands) lives in references/phase-guidance.md. Load it when you need detailed instructions or examples. The sections below are the lean phase skeleton plus the mandatory gates.

Phase 1: Write a Failing Test (RED)

Write a test that describes the desired behavior before any implementation exists. Use specific assertions, descriptive names, Arrange-Act-Assert pattern, and one concept per test. Run the test and show full output. Details: references/phase-guidance.md.

RED Phase Gate

Proceed to the GREEN phase only after all of these are true:

  • Test file is created and saved
  • Test has been executed
  • Test output shows FAILURE (not syntax/import error)
  • Failure message indicates missing implementation

Phase 2: Verify Failure Reason (RED Verification)

The test must fail because the feature is not implemented, NOT because of syntax errors, import errors, wrong test setup, or unrelated failures. Expected patterns per language and recovery steps: references/phase-guidance.md.

Phase 3: Implement Minimum Code (GREEN)

Write ONLY enough code to make the failing test pass. No extra features. Hardcoded values are OK initially. Over-engineering and correct examples: references/phase-guidance.md.

Phase 4: Verify Test Passes (GREEN Verification)

Run the test and the full suite; show complete output. Never summarize. Debug guidance: references/phase-guidance.md.

GREEN Phase Gate

Proceed to the REFACTOR phase only after all of these are true:

  • Implementation code is written
  • New test has been executed and shows PASS
  • Full test suite has been executed
  • No other tests have been broken

Phase 5: Refactor (REFACTOR)

Improve code quality without changing behavior. Establish a green baseline first, refactor incrementally, run tests after every step. Test behavior, not internals. Decision criteria table and behavior-vs-internals examples: references/phase-guidance.md.

REFACTOR Phase Gate

Mark the task complete only after all of these are true:

  • All refactoring changes are saved
  • Full test suite has been executed
  • ALL tests pass (not just the new one)
  • Code quality has been evaluated against the criteria table above

Phase 6: Commit

Commit the test and implementation together as an atomic unit. Run the full suite, commit with a descriptive message, clean up temporary files. Report facts without self-congratulation.

Cycle Discipline

Each feature gets its own RED-GREEN-REFACTOR cycle. Do not batch multiple features into one cycle. Wrong-vs-correct cycle examples: references/phase-guidance.md.

Reference Material

  • references/phase-guidance.md — Full phase steps, rationale, code examples, Arrange-Act-Assert, optional techniques, language-specific testing commands
  • references/error-handling.md — Symptoms, causes, and solutions for stuck cycles (passes too early, wrong failure reason, green-but-broken, refactor breakage)
  • references/examples.md — Language-specific TDD examples (Go, Python, JavaScript)

Error Handling

Load references/error-handling.md when a cycle is stuck. It covers: test passes before implementation, test fails for wrong reason, tests pass but feature does not work, refactoring breaks tests.

Signals

GitHub stars
419
Forks
44
Last commit
Sep 2026
Advanced
Catalog kind
skill
Gateway key
test-driven-development-notque
Source
github.com/notque/vexjoy-agent