tdd

Installation
SKILL.md

Test-Driven Development

Philosophy

Core principle: Tests should verify behavior through public interfaces, not implementation details. Code can change entirely; tests shouldn't.

Good tests are integration-style: they exercise real code paths through public APIs. They describe what the system does, not how it does it. A good test reads like a specification - "user can checkout with valid cart" tells you exactly what capability exists. These tests survive refactors because they don't care about internal structure.

Bad tests assert incidental implementation rather than the contract. Prefer public behavior; direct database or filesystem checks are appropriate when persistence, constraints, migrations, or external effects are the contract. The warning sign is a test changing solely because a private function was renamed while observable behavior stayed the same.

See tests.md for examples and mocking.md for mocking guidelines.

Anti-Pattern: Horizontal Slices

DO NOT write all tests first, then all implementation. This is "horizontal slicing" - treating RED as "write all tests" and GREEN as "write all code."

This produces crap tests:

Installs
3
First Seen
Mar 29, 2026