tdd-principles

Guides writing durable tests that assert observable behavior rather than implementation artifacts.

Updated May 26, 2026
One-click install
npx skills add https://github.com/robot-denny/ai-sketchlab --skill tdd-principles-robot-denny
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd-principles
Source: https://github.com/robot-denny/ai-sketchlab/tree/main/.agents/skills/tdd-principles
Command: npx skills add https://github.com/robot-denny/ai-sketchlab --skill tdd-principles-robot-denny

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Tests can be written first, go red, then green, and still be bad tests — coupling to implementation details, computing expected values the same way the code does, or asserting that artifacts merely exist. This Skill defines what a test should actually assert so tests survive refactoring and genuinely prove behavior. ## Core Features & Use Cases - Behavior-focused assertions: Assert observable behavior through public interfaces instead of internal call counts, private helpers, or file existence. - Independent expected values: Source expected values from spec scenarios, hand-computed examples, or known-good results rather than replicating implementation logic. - Harness-free RED→GREEN: Use a build plus a written-down manual check as the red-green signal in projects with no test runner, and produce evidence artifacts instead of unverifiable claims. - Use Case: When filling a plan's Test-first block or diagnosing a test that broke after a pure refactoring, consult this Skill to determine whether the test was asserting the wrong thing. ## Quick Start Ask the AI to review a test you are about to write against tdd-principles to confirm it asserts observable behavior with independently sourced expected values.

Frequently Asked Questions about tdd-principles

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write tests that survive refactoring?

Assert observable behavior through the public interface rather than implementation artifacts like internal call counts or private helpers. A test that fails when behavior did not change is testing the wrong thing and should be rewritten against the observable surface.

What is wrong with asserting that a file or class exists?

A presence assertion is fragile by construction: it passes when the artifact exists but does not work, and fails when the artifact is correctly removed or renamed. Instead, ask what the artifact is for and assert that behavior.

How do I do TDD when a project has no test runner?

Treat a build plus one concrete, written-down manual check as the RED→GREEN signal: state expected behavior before and after the change, then verify both. Author the target test file anyway so it is ready when a harness arrives.

Why should expected test values come from an independent source?

A test that computes its expected value the same way the implementation does passes by construction and can never disagree with the code. Use literals from spec scenarios, hand-computed examples, or known-good captured results instead.

Do tests written after the code still need to fail first?

Yes. Break the behavior or assert a wrong value and watch the test go red before making it pass. A test that has never failed proves only that it runs, not that it verifies anything.