# Tdd

> Apply Test-Driven Development workflow for new features and bugfixes. Use when this capability is needed.

- Skill: `tomevault-io/tdd-21` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/tdd-21`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/tdd-21/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-21

---


# TDD Protocol

## Core Principle

- **TDD First**: Test-Driven Development is the default approach.
- **Goal**: Prioritize behavioral correctness and regression safety over formal compliance.

## Workflow

1. **Requirement Synthesis**: Briefly summarize the requirements before coding.
2. **Test Specification**: Write tests describing the expected behavior (unit, integration, or E2E).
3. **Implementation**: Update the logic only to the extent required to satisfy those tests.

## Mandatory Rules

- **No Test, No Code**: Every new feature or bugfix must include relevant test coverage.
- **Black-Box Testing**: Validate observable behavior, not internal implementation details.
- **Merge Requirement**: Tests are mandatory for completion unless an explicit exception is documented.

## Preferred Practice

- **Red-Green-Refactor**: Start with a failing test whenever practical.
- **Right-Sized Testing**:
  - **Unit Tests**: For pure logic and isolated functions.
  - **Integration Tests**: For system interactions and API boundaries.
  - **E2E Tests**: For critical user journeys and "happy paths."

## Explicit Exceptions (Must be justified)

- Pure refactoring (where behavior remains identical).
- Exploratory spikes or R&D.
- UI/Styling iterations where unit tests offer diminishing returns.
- Complex integrations where mocking is counterproductive.
- Emergency hotfixes (requires a follow-up ticket for test debt).

## Quality Bar

- **Readability**: Tests must serve as documentation for the feature.
- **Reliability**: Tests must be deterministic (no flakes) and decoupled from implementation internals.

---
> Converted and distributed by [TomeVault](https://tomevault.io/claim/smartfrog) — claim your Tome and manage your conversions.
<!-- tomevault:4.0:skill_md:2026-04-11 -->

