# Build Software with Test-Driven Development

Feature work often produces fragile tests that mirror implementation details. This skill guides focused red-green-refactor cycles around observable behavior and public interfaces.

## Install

```bash
npx skillstore add brianlovin/tdd
```

## Metadata

- Status: approved
- Slug: brianlovin-tdd
- Skillstore revision: r1
- Version status: missing
- Tree hash: fcd9cf64de7cf340a20b3cc65d96617a37f674560d7f189446b64e3f3c28a561
- Author: brianlovin
- GitHub username: brianlovin
- License: MIT
- Repository: https://github.com/brianlovin/agent-config/tree/1a9819ebf3fee811150fc76cbe177ea4e5f747ff/skills/tdd
- Ref: 6b4c2c37d714f625bf5f1482f739feeb23554773
- Supported tools: Claude, Codex, Claude Code
- Audit status: complete
- Agent install advisory: allowed
- Manual install advisory: allowed
- Artifact signature: available
- Audit attestation: unavailable
- Human verification: not\_verified
- Risk factors: external\_commands, network, env\_access
- Quality score: 78
- Quality tier: bronze
- Public page: https://skillstore.pages.dev/skills/brianlovin-tdd
- Manifest: https://skillstore.pages.dev/api/skills/brianlovin-tdd/manifest

## Capabilities

- Plans behavior-focused tests before implementation begins.
- Guides one test and one minimal implementation through each cycle.
- Distinguishes observable behavior tests from implementation-detail tests.
- Recommends boundary mocking and dependency injection for testability.
- Identifies refactoring candidates after the test suite reaches green.
- Reviews interface depth and surface area to simplify testing.

## Use Cases

- Develop a New Feature: Turn a requested capability into small behavior slices, then implement each slice through a red-green-refactor cycle.
- Repair a Regression: Reproduce a reported defect with a failing public-interface test before applying the smallest effective correction.
- Improve a Test Suite: Replace brittle implementation-detail tests with durable checks of observable behavior and system boundaries.

## Prompt Templates

### Start a TDD Feature

```
Use TDD to add [feature]. First identify the public interface and the single most important observable behavior.
```

### Fix a Bug Test First

```
Fix [bug] with TDD. Reproduce it through the public interface, make the test fail, then implement the minimal correction.
```

### Review Test Quality

```
Review tests for [module]. Identify implementation coupling, unnecessary internal mocks, and missing behavior coverage. Propose focused replacements in priority order.
```

### Design a Testable Interface

```
Design a testable interface for [capability]. Minimize surface area, inject external dependencies, define behavior slices, and plan incremental red-green-refactor cycles.
```

## Limitations

- It does not provide framework-specific test commands unless the project supplies them.
- It cannot guarantee complete coverage or identify every relevant edge case.
- It requires user decisions about public interfaces and behavior priorities.
- Its examples are illustrative and may need adaptation to the project language.

## Best Practices

- Agree on the public interface and highest-priority behavior before writing code.
- Complete one failing test and minimal implementation before starting another behavior.
- Refactor only after tests pass, and rerun them after each structural change.

## Anti Patterns

- Do not write the complete test suite before implementing any behavior.
- Do not mock internal collaborators or assert private call sequences.
- Do not add speculative production code beyond the current failing test.

## Security Audit

- Audited at: 2026-08-21T08:33:55.262\+00:00
- Summary: All 21 static alerts are false positives caused by inert Markdown examples, code fences, template literals, or unrelated prose. No executable scripts, malicious intent, credential exposure, prompt injection, or unauthorized network behavior were found.

## Stats

- Views: 0
- Downloads: 0
- Favorites: 0
- Popularity score: 0
