test-driven-development

Write failing tests first to verify behavior via RED/Green/Refactor.

2|Updated May 3, 2026
One-click install
npx skills add https://github.com/Rosetears520/aili-workflows --skill test-driven-development-rosetears520
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/Rosetears520/aili-workflows/tree/main/skills/test-driven-development
Command: npx skills add https://github.com/Rosetears520/aili-workflows --skill test-driven-development-rosetears520

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill eliminates regressions and uncertainty by requiring you to prove behavior with failing tests first, then minimal code until tests pass, and finally safe refactoring.

Core Features & Use Cases

  • RED/Green/Refactor TDD Cycle: Write a failing test, implement the smallest change to make it pass, then refactor without changing behavior.
  • Prove-It Pattern for Bug Fixes: Reproduce the bug by writing a test that fails before applying any fix.
  • Testing Strategy Guidance: Use a sensible test pyramid (mostly small/unit tests), prefer outcome-based assertions over interaction-based assertions, and avoid common test anti-patterns like flakiness or testing framework internals.
  • Browser Runtime Verification: When changes affect the browser, pair tests with runtime verification using OpenCode browser tools and (optionally) Playwright MCP or DevTools MCP.

Quick Start

Use the test-driven-development skill to create a failing test for the behavior you want to change, then implement the minimum code until the test passes.

Frequently Asked Questions about test-driven-development

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

FAQPage Schema
How do I write a failing test first to prove a bug fix is correct?

Test-driven development eliminates regressions by enforcing a RED/Green/Refactor cycle: you write a failing test for new behavior, implement the smallest code change to make it pass, and then safely refactor without altering the proven behavior.

Can I use test-driven development for browser-impacting changes?

Yes, test-driven development supports browser runtime verification by pairing tests with OpenCode browser tools, and optionally Playwright MCP or DevTools MCP, to validate changes that affect the browser across integration boundaries.

What is the best way to structure unit and integration tests to avoid flakiness?

The best way to avoid flakiness is using a sensible test pyramid with mostly small unit tests, preferring outcome-based assertions over interaction-based assertions, and avoiding testing framework internals to ensure reproducible verification.

Does test-driven development work for modifying existing functionality?

Yes, test-driven development works for modifying existing functionality by writing a failing test that defines the desired new behavior, then implementing the minimal logic change until the test passes with deterministic assertions.

Why should I use the RED/Green/Refactor cycle instead of writing tests after implementation?

The RED/Green/Refactor cycle prevents regressions and uncertainty by requiring you to prove behavior with failing tests first, ensuring your subsequent code changes satisfy requirements for reproducible verification via an evidence-focused approach.