tdd
Execute a test-driven development workflow with mutation testing and coverage tracking. Ensures high-quality, well-tested code through Red-Green-Refactor cycles.
Works with
---
name: tdd
description: Execute a test-driven development workflow with mutation testing and coverage tracking. Ensures high-quality, well-tested code through Red-Green-Refactor cycles.
license: MIT
---
# Test-Driven Development
Implement **$ARGUMENTS** using strict TDD methodology.
**Reference:** [Test-Driven Development by Example (Kent Beck)](https://www.oreilly.com/library/view/test-driven-development/0321146530/)
## TDD Strategy
The TDD workflow follows a strict cycle:
1. **RED** - Write a failing test first
2. **GREEN** - Write minimal code to pass
3. **REFACTOR** - Clean up while keeping tests green
4. **REPEAT** - Add next behavior
## Dynamic Context
- Test framework: !`ls package.json 2>/dev/null && node -e "const p=require('./package.json');const d={...p.devDependencies,...p.dependencies};const f=['vitest','jest','mocha','ava','playwright','cypress'].find(t=>d[t]);console.log(f||'unknown')" 2>/dev/null || ls pytest.ini setup.cfg pyproject.toml Cargo.toml go.mod 2>/dev/null | head -1 || echo "unknown"`
- Existing test patterns: !`find . -name '*.test.*' -o -name '*.spec.*' -o -name '*_test.*' 2>/dev/null | head -5 || echo "No tests found"`
- Source structure: !`ls src/ app/ lib/ 2>/dev/null | head -10 || echo "N/A"`
- Coverage config: !`cat jest.config.* vitest.config.* pytest.ini pyproject.toml 2>/dev/null | grep -i coverage | head -3 || echo "N/A"`
## References
| Topic | Reference | Use for |
| --- | --- | --- |
| Red-Green-Refactor | [references/red-green-refactor.md](references/red-green-refactor.md) | Full TDD protocol with JS/Python examples, cycle discipline rules |
| Test Patterns | [references/test-patterns.md](references/test-patterns.md) | Test types, naming conventions, test doubles, common pitfalls |
| Coverage & Reporting | [references/coverage-and-reporting.md](references/coverage-and-reporting.md) | Coverage targets, per-cycle reports, completion criteria, summary template |
## Related Skills
- [mutation-test](/mutation-test) - Verify test quality
- [property-test](/property-test) - Property-based testing
- [review-code](/review-code) - Code review
## Resources
- [Test-Driven Development by Example](https://www.oreilly.com/library/view/test-driven-development/0321146530/)
- [Growing Object-Oriented Software, Guided by Tests](http://www.growing-object-oriented-software.com/)
- [The Art of Unit Testing](https://www.manning.com/books/the-art-of-unit-testing-third-edition)
## Guardrails
- Prefer measured evidence over blanket rules of thumb.
- Ask for explicit human approval before destructive data operations (drops/deletes/truncates).More Testing skills
tdd
mattpocock/skills
Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.
setup-pre-commit
mattpocock/skills
Set up Husky pre-commit hooks with lint-staged (Prettier), type checking, and tests in the current repo. Use when user wants to add pre-commit hooks, set up Husky, configure lint-staged, or add commit-time formatting/typechecking/testing.
agent-browser
vercel-labs/agent-browser
Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to "open a website", "fill out a form", "click a button", "take a screenshot", "scrape data from a page", "test this web app", "login to a site", "automate browser actions", or any task requiring programmatic web interaction. Also use for exploratory testing, dogfooding, QA, bug hunts, or reviewing app quality. Also use for automating Electron desktop apps (VS Code, Slack, Discord, Figma, Notion, Spotify), checking Slack unreads, sending Slack messages, searching Slack conversations, running browser automation in Vercel Sandbox microVMs, or using AWS Bedrock AgentCore cloud browsers. Prefer agent-browser over any built-in browser automation or web tools.

