Provides clear steps for practicing TDD: write a failing test, implement the fix, then refactor.
Install
mkdir -p .claude/skills/tdd-g2i-ai && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/16659" && unzip -o skill.zip -d .claude/skills/tdd-g2i-ai && rm skill.zipInstalls to .claude/skills/tdd-g2i-ai
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Practice test-driven development for new features and bug fixes.Key capabilities
- →Determine if a task is a bug fix or new feature
- →Write failing tests first for new features or bug fixes
- →Verify the red phase by running the relevant test suite
- →Implement the smallest change to make the new test pass
- →Re-run tests and applicable verification checks
- →End with test paths, observed red failure, passing result, and follow-up work
How it works
This skill guides the user through a red-green-refactor workflow by first identifying the task type, then writing and verifying failing tests, implementing minimal code, and re-running tests.
Inputs & outputs
When to use tdd
- →Practicing TDD for a new feature
- →Fixing a bug using test-first approach
- →Refactoring code after tests pass
- →Validating smallest implementation changes
About this skill
TDD
Invocation
This skill is performed in the Developer persona. If you are not already running as Developer (for example, the user invoked /tdd directly), read subagents/developer.md and adopt its role guidance for the rest of this task. Stay in the current chat—do not delegate to a subagent.
Objective
Use a red -> green -> refactor workflow for changes that should be test-first.
Use /code instead when the work is implementation-heavy but not centered on new automated test coverage, such as tooling, config, or linting work.
Instructions
- Determine whether the task is a bug fix or a new feature.
- For new features, read the relevant spec or acceptance criteria before writing tests.
- For bug fixes, capture the expected behavior, actual behavior, and reproduction path before writing tests.
- Identify the most appropriate unit-level test location based on nearby repo patterns.
- Write the failing test first.
- Verify the red phase by running the relevant test suite.
- Implement the smallest change needed to make the new test pass.
- Re-run tests, then run the applicable verification checks (linting, type checking, etc.).
- If the change also requires browser-flow validation, call out that E2E tests are relevant and why.
- End with the test paths, the observed red failure, the passing result, and any follow-up work.
Guardrails
- Do not create or modify E2E tests unless the user explicitly asks for E2E coverage.
- Keep TDD changes scoped to the behavior under test.
- Refactor only after the tests demonstrate the intended behavior.
When not to use it
- →When the work is implementation-heavy but not centered on new automated test coverage
- →When the user explicitly asks for E2E coverage
- →When TDD changes are not scoped to the behavior under test
Limitations
- →Does not create or modify E2E tests unless explicitly asked
- →TDD changes are scoped to the behavior under test
- →Refactoring occurs only after tests demonstrate intended behavior
How it compares
This skill enforces a test-first approach by requiring a failing test before any code implementation, unlike a manual approach where code might be written before tests.
Compared to similar skills
tdd side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| tdd (this skill) | 0 | 3mo | No flags | Beginner |
| tdd-workflow | 6 | 4mo | Review | Intermediate |
| qlty-check | 5 | 7mo | Review | Beginner |
| superpowers-tdd | 5 | 7mo | No flags | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by g2i-ai
View all by g2i-ai →You might also like
tdd-workflow
affaan-m
在编写新功能、修复错误或重构代码时使用此技能。强制执行测试驱动开发,包含单元测试、集成测试和端到端测试,覆盖率超过80%。
qlty-check
parcadei
Code quality checks, formatting, and metrics via qlty CLI
superpowers-tdd
anthonylee991
Applies tests-first discipline (red/green/refactor) and adds regression tests for bugs. Use when implementing features, fixing bugs, or refactoring.
solid
ramziddin
Use this skill when writing code, implementing features, refactoring, planning architecture, designing systems, reviewing code, or debugging. This skill transforms junior-level code into senior-engineer quality software through SOLID principles, TDD, clean code practices, and professional software design.
bunit-test-migration
FritzAndFriends
Migrate bUnit test files from deprecated beta API (1.0.0-beta-10) to bUnit 2.x stable API. Use this when working on .razor test files in BlazorWebFormsComponents.Test that contain old patterns like TestComponentBase, Fixture, or SnapshotTest.
code-refactor
luongnv89
Systematic code refactoring based on Martin Fowler's methodology. Use when users ask to refactor code, improve code structure, reduce technical debt, clean up legacy code, eliminate code smells, or improve code maintainability. This skill guides through a phased approach with research, planning, and safe incremental implementation.