test-driven-development

Enforces red-green-refactor test-first workflow for features, bugfixes, and refactoring.

Updated Jul 9, 2026
One-click install
npx skills add https://github.com/octanutri-clin/octaclin --skill test-driven-development-octanutri-clin
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/octanutri-clin/octaclin/tree/main/.agents/skills/test-driven-development
Command: npx skills add https://github.com/octanutri-clin/octaclin --skill test-driven-development-octanutri-clin

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Developers often write code before tests, producing tests that pass immediately and prove nothing about correctness. This Skill enforces a strict test-first discipline so every behavior change is verified by a failing test before implementation begins. ## Core Features & Use Cases - Red-Green-Refactor Enforcement: Guides the full cycle of writing a failing test, verifying the failure, writing minimal code to pass, and refactoring while staying green. - Rationalization Detection: Lists common excuses for skipping TDD (e.g., "too simple to test", "I'll test after") and explains why each is invalid. - Testing Anti-Pattern Reference: Ships a companion reference covering mock-behavior testing, test-only production methods, incomplete mocks, and over-mocking. - Use Case: When fixing a bug where an empty email is accepted, write a failing test asserting the rejection, watch it fail, implement the minimal validation, and confirm all tests pass. ## Quick Start Ask the AI to implement a new feature or bugfix using strict test-driven development with a failing test written first.

Frequently Asked Questions about test-driven-development

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

FAQPage Schema
How do I practice test-driven development step by step?

Follow the red-green-refactor cycle: write one minimal failing test, run it and confirm it fails for the expected reason, write the simplest code to make it pass, then refactor while keeping all tests green. Repeat for each new behavior.

Should I write tests before or after implementation code?

Write tests before implementation. Tests written after code pass immediately, which proves nothing about whether they test the right behavior. Watching a test fail first confirms it actually exercises the missing feature.

When is it acceptable to skip TDD?

Only for throwaway prototypes, generated code, or configuration files, and only with explicit approval from your human partner. Exploration is fine, but the exploratory code should be discarded and rewritten test-first.

Why is testing mock behavior a bad practice?

Asserting on mock elements verifies the mock exists, not that the component works. Tests should exercise real behavior; mock only to isolate slow or external dependencies, and mirror the complete real API structure in mock data.

What should I do when a test is hard to write?

A hard-to-write test usually signals an unclear or overly coupled design. Simplify the interface, use dependency injection instead of heavy mocking, or write the wished-for API first and let the test define the design.