# Tdd

> Execute a test-driven development workflow with mutation testing and coverage tracking. Ensures high-quality, well-tested code through Red-Green-Refactor cycles. Use when this capability is needed.

- Skill: `tomevault-io/tdd` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/tdd`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/tdd/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Productivity
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/tdd

---


# 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).

---
> Source: [gr1m0h/dot](https://github.com/gr1m0h/dot) — distributed by [TomeVault](https://tomevault.io).
<!-- tomevault:4.0:skill_md:2026-05-31 -->

