tdd · pymodel — Claude Code skill: what it does, how to install
A TDD rule guide for AI coding assistants that enforces the red-green-refactor workflow. Helps models write reliable unit tests before touching application code.
npx skills add PyModel/react-frontend-skills --skill tdd -a claude-codeWhat tdd does
The skill provides a structured guideline of 42 test-driven development rules grouped into 8 prioritized tiers. It forces the agent to follow the standard cycle: write a failing test, produce the minimum code necessary to pass, and clean up the result right away.
Every rule references a dedicated file under references/<rule-id>.md showing the underlying reason alongside bad versus good code patterns. The collection covers Arrange-Act-Assert structure, factory and builder patterns for data, external dependency stubs, and unit test execution speed without arbitrary sleep delays.
Framework-specific syntax for Vitest or network mocking with MSW is not part of this skill. PyModel delegates those topics to companion skills vitest and msw.
What it helps with
- enforce strict red-green-refactor steps in AI-generated code
- isolate unit tests from external dependencies and shared mutable state
- eliminate arbitrary sleep delays and flaky test logic
- organize test suites around user behavior instead of class methods
Example prompts for the agent
- Implement this payment processor feature using TDD, starting with a failing test
- Review existing unit tests against the rule design-avoid-logic-in-tests
- Refactor the test fixtures using factories instead of shared global state
How to install tdd
1Skills CLI (Vercel)
npx skills add PyModel/react-frontend-skills --skill tdd -a claude-code2Manually: put the files in place
~/.claude/skills/tdd/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/tdd/
1Skills CLI (Vercel)
npx skills add PyModel/react-frontend-skills --skill tdd -a codex2Manually: put the files in place
.agents/skills/tdd/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add PyModel/react-frontend-skills --skill tdd -a cursor2Manually: put the files in place
.cursor/skills/tdd/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install PyModel/react-frontend-skills tdd2Manually: put the files in place
.github/skills/tdd/SKILL.md1Skills CLI (Vercel)
npx skills add PyModel/react-frontend-skills --skill tdd -a gemini-cli2Platform CLI
gemini skills install https://github.com/PyModel/react-frontend-skills --path skills/tddManually: put the files in place
.devin/skills/tdd/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add PyModel/react-frontend-skills --skill tdd -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about tdd
How to install tdd in Claude Code?
Run npx skills add PyModel/react-frontend-skills --skill tdd -a claude-code in your terminal. The configuration file will be placed at ~/.claude/skills/tdd/SKILL.md.
What does the tdd skill do?
It gives your AI agent 42 rules spanning 8 priority tiers, enforcing test-first workflows and clean test design. The model learns to write minimal passing code and avoid test anti-patterns.
Does this skill handle Vitest or MSW mocks?
No, it focuses on general testing architecture and TDD principles. The repository author provides separate companion skills named vitest and msw for runner-specific syntax and API interception.
Source text
SKILL.md · MIT
--- name: tdd description: Test-driven development with red-green-refactor. --- # Community Test-Driven Development Best Practices Comprehensive guide to Test-Driven Development practices, designed for AI agents and LLMs. Contains 42 rules across 8 categories, prioritized by impact to guide test writing, refactoring, and code generation. ## When to Apply Reference these guidelines when: - Writing new tests using TDD workflow - Implementing the red-green-refactor cycle - Designing test structure and organization - Creating test data and fixtures - Reviewing or refactoring existing test suites ## TDD Workflow 1. **RED**: Write a failing test that defines desired behavior 2. **GREEN**: Write minimal code to make the test pass 3. **REFACTOR**: Clean up code while keeping tests green 4. Repeat for each new behavior ## Rule Categories by Priority | Priority | Category | Impact | Prefix | |----------|----------|--------|--------| | 1 | Red-Green-Refactor Cycle | CRITICAL | `cycle-` | | 2 | Test Design Principles | CRITICAL | `design-` | | 3 | Test Isolation & Dependencies | HIGH | `isolate-` | | 4 | Test Data Management | HIGH | `data-` | | 5 | Assertions & Verification | MEDIUM | `assert-` | | 6 | Test Organization & Structure | MEDIUM | `org-` | | 7 | Test Performance & Reliability | MEDIUM | `perf-` | | 8 | Test Pyramid & Strategy | LOW | `strat-` | ## Quick Reference ### 1. Red-Green-Refactor Cycle (CRITICAL) - `cycle-write-test-first` - Write the Test Before the Implementation - `cycle-minimal-code-to-pass` - Write Only Enough Code to Pass the Test - `cycle-refactor-after-green` - Refactor Immediately After Green - `cycle-verify-test-fails-first` - Verify the Test Fails Before Writing Code - `cycle-small-increments` - Take Small Incremental Steps - `cycle-maintain-test-list` - Maintain a Test List ### 2. Test Design Principles (CRITICAL) - `design-test-behavior-not-implementation` - Test Behavior Not Implementation - `design-one-assertion-per-test` - One Logical Assertion Per Test - `design-descriptive-test-names` - Use Descriptive Test Names - `design-aaa-pattern` - Follow the Arrange-Act-Assert Pattern - `design-test-edge-cases` - Test Edge Cases and Boundaries - `design-avoid-logic-in-tests` - Avoid Logic in Tests ### 3. Test Isolation & Dependencies (HIGH) - `isolate-mock-external-dependencies` - Mock External Dependencies - `isolate-no-shared-state` - Avoid Shared Mutable State Between Tests - `isolate-deterministic-tests` - Write Deterministic Tests - `isolate-prefer-stubs-over-mocks` - Prefer Stubs Over Mocks for Queries - `isolate-use-dependency-injection` - Use Dependency Injection for Testability ### 4. Test Data Management (HIGH) - `data-use-factories` - Use Factories for Test Data Creation - `data-minimal-setup` - Keep Test Setup Minimal - `data-avoid-mystery-guests` - Avoid Mystery Guests - `data-unique-identifiers` - Use Unique Identifiers Per Test - `data-builder-pattern` - Use Builder Pattern for Complex Objects ### 5. Assertions & Verification (MEDIUM) - `assert-specific-assertions` - Use Specific Assertions - `assert-error-messages` - Assert on Error Messages and Types - `assert-no-assertions-antipattern` - Every Test Must Have Assertions - `assert-custom-matchers` - Create Custom Matchers for Domain Assertions - `assert-snapshot-testing` - Use Snapshot Testing Judiciously ### 6. Test Organization & Structure (MEDIUM) - `org-group-by-behavior` - Group Tests by Behavior Not Method - `org-file-structure` - Follow Consistent Test File Structure - `org-setup-teardown` - Use Setup and Teardown Hooks Appropriately - `org-test-utilities` - Extract Reusable Test Utilities - `org-parameterized-tests` - Use Parameterized Tests for Variations ### 7. Test Performance & Reliability (MEDIUM) - `perf-fast-unit-tests` - Keep unit tests fast enough for continuous feedback - `perf-avoid-network-calls` - Eliminate Network Calls in Unit Tests - `perf-fix-flaky-tests` - Fix Flaky Tests Immediately - `perf-parallelize-tests` - Parallelize Independent Tests - `perf-avoid-sleep` - Avoid Arbitrary Sleep Calls ### 8. Test Pyramid & Strategy (LOW) - `strat-test-pyramid` - Follow the Test Pyramid - `strat-mutation-testing` - Use Mutation Testing to Validate Test Quality - `strat-coverage-targets` - Set Meaningful Coverage Targets - `strat-integration-boundaries` - Test Integration at Service Boundaries - `strat-e2e-critical-paths` - Limit E2E Tests to Critical User Paths ## How to Use Read `references/<rule-id>.md` for each rule above that matches the task: why it matters, then incorrect vs. correct code. ## Related Skills - For Vitest framework specifics, see `vitest` skill - For API mocking with MSW, see `msw` skill
© PyModel · MIT · PyModel/react-frontend-skills
Similar skills
All skills for Testing and QA →tdd by other authors comes first.