compose:tdd

Enforces test-driven development with red-green-refactor cycles before writing production code.

Updated Jun 27, 2026
One-click install
npx skills add https://github.com/HKUST-QUANT-SOCIETY/quantcode --skill compose-tdd-hkust-quant-society
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: compose:tdd
Source: https://github.com/HKUST-QUANT-SOCIETY/quantcode/tree/main/.opencode/meta-skills/tdd
Command: npx skills add https://github.com/HKUST-QUANT-SOCIETY/quantcode --skill compose-tdd-hkust-quant-society

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Developers often write production code first and add tests afterward, which produces tests that pass immediately and prove nothing about correctness. This Skill enforces a strict test-first discipline so every feature and bugfix is backed by a test that was watched failing before implementation. ## Core Features & Use Cases - Red-Green-Refactor Enforcement: Guides the AI through writing one failing test, verifying the failure, writing minimal passing code, and refactoring while staying green. - Rationalization Detection: Lists common excuses for skipping TDD ("too simple to test", "I'll test after") and counters each with concrete reasoning. - Bug Fix Workflow: Reproduces bugs as failing tests first, ensuring the fix is proven and regression-protected. - Use Case: When asked to add a retry mechanism to an API client, the AI first writes a failing test asserting three retry attempts, watches it fail, then implements the minimal loop to make it pass. ## Quick Start Implement the new validation feature using test-driven development, writing a failing test first and showing me it fails before writing any implementation code.

Frequently Asked Questions about compose:tdd

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

FAQPage Schema
How do I practice test-driven development on a new feature?

Write one minimal failing test describing the desired behavior, run it to confirm it fails for the right reason, then write the simplest code that makes it pass. Refactor only while all tests stay green, then repeat the cycle for the next behavior.

How do I fix a bug using TDD?

Write a failing test that reproduces the bug first, such as asserting that an empty email returns an error. Watch it fail, implement the minimal fix, and confirm the test passes, which also prevents future regressions.

Why should tests be written before implementation code?

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 rather than a typo or existing behavior.

When is it acceptable to skip test-driven development?

Exceptions are limited to throwaway prototypes, generated code, and configuration files, and should be raised with the user first. Production code written without a prior failing test should be deleted and rewritten test-first.

What should I do if a test passes immediately after writing it?

An immediately passing test means it is testing existing behavior, not the new feature. Fix the test so it targets the missing behavior, run it again, and confirm it fails before writing any implementation code.