skillfed

tdd

tdd guides you through writing tests before implementation using the red-green-refactor workflow. Each cycle commits a failing test marked red, then minimal passing code marked green, with refactoring only after all tests pass. The skill enforces behavioral testing over implementation details and includes commit hygiene checks to keep your tree lint-clean at every step.

tdd teaches the red-green-refactor cycle: write a failing test, commit it, implement minimally to pass, commit green, then refactor.

AI-generated summary based on this skill's SKILL.md

0 0 MIT updated by frankify-app

Install

frankify-app/skills/tdd · repository language: Shell

CLI (skillfed)coming soon
git clone https://github.com/frankify-app/skills
cp -r skills/derived/tdd ~/.claude/skills/tdd

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

What is the red green refactor cycle in tdd?

tdd's red-green-refactor cycle is the core workflow: first write a failing test (red), then write minimal code to make it pass (green), then refactor safely knowing tests still pass. Each phase gets its own commit, creating an auditable history where every commit is either a failing test, passing code, or a refactoring. This discipline keeps your tree lint-clean and your changes traceable.

How do I write tests first with tdd?

tdd teaches you to write failing tests before any implementation. Start by describing the behavior you want in a test, run it to confirm it fails (red phase), then write just enough code to pass it (green phase). This inverts traditional development: the test becomes your specification. tdd guides you to focus on what the code should do, not how it does it, preventing over-engineering.

How should I structure tdd commits for auditable test history?

tdd enforces a commit protocol where each phase—red test, green code, refactoring—gets its own commit. This creates an auditable history showing exactly when tests were added and when implementation followed. The skill includes commit hygiene checks to keep your repository lint-clean at every step, making it easy to review or bisect changes later.

What testing anti-patterns should I avoid in tdd?

tdd helps you sidestep common pitfalls: testing implementation details instead of behavior, writing tests after code (defeating TDD's design benefits), or skipping refactoring. The skill teaches behavioral testing that survives refactoring, so your tests describe what the code does, not how. Avoid brittle tests tied to internal structure; tdd guides you toward resilient, maintainable test suites.

Can tdd help with vertical-slice testing instead of layers?

tdd includes guidance on vertical-slice testing, where you test a complete feature end-to-end rather than isolated horizontal layers. This approach often catches real integration issues earlier and keeps tests closer to user behavior. tdd's behavioral focus naturally aligns with vertical slices, helping you write tests that matter.

How does tdd ensure tests don't become brittle after refactoring?

tdd emphasizes behavioral testing over implementation details, so your tests describe outcomes, not internal mechanics. When you refactor during the refactor phase (with all tests passing), behavioral tests remain valid because the external contract hasn't changed. This discipline means your test suite survives refactoring intact, supporting long-term code health.

SKILL.md

rendered from the published skill — quoted content, verbatim

Test-Driven Development

Write test first. Commit it red. Write minimal code to pass. Commit green. Refactor.

Core principle: tests verify behavior through public interfaces, not implementation. Code can change entirely; tests shouldn't. A test that breaks when you rename an internal function — with no behavior change — was testing implementation.

(truncated - see the full file via the links below)

Read as markdown · JSON record · Browse the source repository

File tree — 8 files
derived/tdd/SKILL.md
derived/tdd/deep-modules.md
derived/tdd/interface-design.md
derived/tdd/lint-red.sh
derived/tdd/mocking.md
derived/tdd/refactoring.md
derived/tdd/testing-anti-patterns.md
derived/tdd/tests.md

Related skills

Tags

test-first-methodology commit-hygiene behavioral-verification vertical-slicing implementation-agnostic refactor-discipline marker-enforcement interface-design