test-driven-development

Guides test-first development with RED-GREEN-REFACTOR cycles and bug reproduction tests.

Updated May 21, 2026
One-click install
npx skills add https://github.com/nicorevo/AI-SDLC-Template --skill test-driven-development-nicorevo
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/nicorevo/AI-SDLC-Template/tree/main/.opencode/skills/test-driven-development
Command: npx skills add https://github.com/nicorevo/AI-SDLC-Template --skill test-driven-development-nicorevo

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Code changes without tests ship unverified behavior, and bug fixes without reproduction tests leave regressions unguarded. This Skill enforces a test-first workflow so every behavior change is proven by a failing-then-passing test. ## Core Features & Use Cases - RED-GREEN-REFACTOR Cycle: Write a failing test first, implement the minimal code to pass it, then refactor with tests green. - Prove-It Pattern for Bugs: Reproduce any reported bug with a failing test before attempting a fix, then verify the fix and run the full suite. - Stack Discovery: Detects the repository's own test runner and conventions (npm, Gradle, pytest, Cargo, Go) instead of assuming defaults. - Use Case: A bug report says completing a task doesn't set its timestamp. Write a failing test that asserts completedAt is set, confirm it fails, implement the fix, and watch it pass with no regressions. ## Quick Start Use the test-driven-development skill to write a failing test for this bug report, then implement the fix and run the repository's full test suite.

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 on a bug fix?▼

Write a test that reproduces the bug first and confirm it fails, then implement the fix and confirm the test passes. Finally run the full test suite to verify no regressions were introduced.

How do I find the right test command for a repository?▼

Inspect the build files such as package.json, pom.xml, pyproject.toml, go.mod, or Cargo.toml, and prefer checked-in wrappers like ./gradlew or make test. README, CONTRIBUTING, and CI workflows show the commands that gate merges.

Should tests use mocks or real implementations?▼

Prefer real implementations first, then fakes, stubs, and mocks last. Reserve mocks for dependencies that are slow, non-deterministic, or have uncontrollable side effects like external APIs or email sending.

When should I not write tests for a change?▼

Skip tests only for pure configuration changes, documentation updates, or static content with no behavioral impact. Any change to logic, behavior, or edge case handling warrants a test.

Why do tests that pass on the first run signal a problem?▼

A test that passes immediately proves nothing about the new behavior, since it may not exercise the code you think it does. The RED step requires confirming the test fails before writing the implementation.