Claude TDD Skill
Forces Claude Code to write a failing test before writing any implementation code.
Before & after
Same prompt, same agent — the only difference is the skill.
I can help you write a function to validate email addresses. Testing is definitely important, and I'd suggest using a testing framework like Jest or Vitest. You'll want to consider edge cases like special characters, domain validation, and RFC compliance. I can outline a general approach for you, and then we could implement the validation logic. Would you like me to start with some test cases, or would you prefer to begin with the implementation? I could also suggest some best practices for email validation if that would be helpful.
RED PHASE
1. Write failing test: validate('invalid.email') throws InvalidEmailError
- describe("Email Validator", () => { it("rejects addresses without domain", () => { expect(() => validate('invalid.email')).toThrow(InvalidEmailError); }); });
GREEN PHASE
2. Implement minimal code to pass: function validate(email) { if (!email.includes('@')) throw new InvalidEmailError(); return true; }
3. Add second failing test: validate('test@example') throws InvalidEmailError (missing TLD)
4. Expand implementation to check for TLD pattern
REFACTOR PHASE
5. Extract domain validation logic into separate helper
6. Consolidate regex patterns into constants
7. Add comment documenting RFC 5321 scope
TEST COVERAGE REPORT: 5 tests passing, 100% line coverage on validator.js. Diff preserved showing red-green-refactor transitions. Ready for production code review.About this skill
name: claude-tdd-skill description: Use when Forces Claude Code to write a failing test before writing any implementation code.
Claude TDD Skill
Claude TDD Skill implements the red-green-refactor cycle inside Claude Code, requiring a failing test to exist before implementation begins, which keeps AI-written code honest about what it is actually solving for.
What you get
- A structured test-first workflow: write test, watch it fail, implement, refactor.
Customize your output
- Adjust the testing framework or refactor checklist to match your stack.
Example output
A tested implementation with the failing-test history preserved in the diff.
Best for
Engineers who want AI-written code backed by real test coverage.
SKILL.md preview
---
name: claude-tdd-skill
description: Use when implementing new code in Claude Code and a failing test must exist before any implementation code is written, enforcing red-green-refactor.
version: 1.0.0
category: Development / Testing
author: AgentVolt
license: proprietary
tags:
- development
- testing
- standard
---
# Claude TDD Skill
Implements the red-green-refactor cycle inside Claude Code, requiring a failing test before any implementation code is written, keeping the code honest about what it solves for.
## When to use
… (sign up to view the full skill)More development skills
View all Development skills →Playwright
Gives Claude autonomous headless browser control — it spins up a browser, clicks through your UI, checks everything works, and fixes broken tests.
Playwright Expert
Use when writing E2E tests with Playwright, setting up test infrastructure, or debugging flaky browser tests.
Debugging Wizard
Parses error messages, traces execution flow through stack traces, correlates log entries to identify failure points, and applies systematic hypothesis-driven methodology to isolate and resolve bugs.
Test Master
Generates test files, designs mocking strategies and test architectures, analyzes coverage gaps, and produces test plans and defect reports across functional, performance.