
tdd-workflow
Drive implementation with the red-green-refactor test-first loop. Use when the user asks to build a feature "with TDD", "test-first", "write the tests first", or when correctness matters and behavior is specifiable as tests.
- Installs
- 61
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/composio-community/opencode-skills --skill tdd-workflow- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads tdd-workflow automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
TDD Workflow
A disciplined red → green → refactor loop. One failing test at a time, the minimum code to pass, then refactor under a green bar. This is a methodology skill — follow the loop exactly; do not batch.
When to use
Use when behavior can be expressed as assertions: business logic, parsers, APIs, algorithms, bug fixes (reproduce as a failing test first). Skip for throwaway spikes, pure UI layout, or exploratory prototypes with no maintenance horizon.
The loop
RED — write one failing test
- Pick the smallest unspecified behavior.
- Write one test asserting it. Run it. Confirm it fails for the right reason (assertion failure, not import/syntax error).
- A test that passes immediately, or fails on a typo, is not a red. Fix and re-run.
GREEN — minimum code to pass
- Write the least code that makes that test pass — hardcoding is acceptable here.
- Run the full test suite, not just the new test. Green means all pass.
- Do not add untested code "while you're there." If you want it, it needs a test → back to RED.
REFACTOR — improve under green
- Remove duplication, clarify names, simplify structure.
- Re-run the full suite after each change. Any red → revert the refactor, don't debug forward.
- No behavior change here. New behavior is a new RED.
Repeat until the feature's behaviors are all covered.
Setup
Detect the project's existing runner — do not introduce a new one.
# JS/TS: npx vitest run | npx jest
# Python: pytest -q
# Go: go test ./...
# Rust: cargo test
If no framework exists, ask which to add before starting; match the ecosystem default.
Bug-fix mode
- RED: write a test that reproduces the bug and fails.
- GREEN: fix until it passes and nothing else breaks.
- The reproduction test stays as a regression guard.
Never fix a bug without a failing test that proves it existed.
Test quality
- One behavior per test; the name states the behavior.
- Assert observable outcomes, not internal calls, unless the interaction is the contract.
- Cover edge cases as their own REDs: empty, boundary, invalid input, async failure, concurrency.
- A test you can't make fail by breaking the code tests nothing — delete or fix it.
Anti-patterns
- Writing implementation first, then tests to match it (that's not TDD).
- Writing 10 tests then implementing — you lose the design feedback.
- Skipping the "confirm it fails" step.
- Refactoring and adding behavior in the same step.
- Mocking so heavily the test passes even when the real code is broken.
Done when
All behaviors have failing-first tests that now pass, full suite is green, no untested production code, and the bug-fix tests are retained as regression coverage.
FAQ
What does the tdd-workflow skill do?
Drive implementation with the red-green-refactor test-first loop. Use when the user asks to build a feature "with TDD", "test-first", "write the tests first", or when correctness matters and behavior is specifiable as tests.
How do I install tdd-workflow?
Run npx skills add https://github.com/composio-community/opencode-skills --skill tdd-workflow in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/tdd-workflow/ (personal) or .claude/skills/tdd-workflow/ (project).
Which AI agents can use tdd-workflow?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is tdd-workflow safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains tdd-workflow?
It is published by composio-community in composio-community/opencode-skills. It has 61 recorded installs.
More from composio-community/opencode-skills
frontend-design-systems
composio-community/opencode-skills
Open the skill to read its SKILL.md instructions.
playwright-mcp-workflows
composio-community/opencode-skills
Open the skill to read its SKILL.md instructions.
repo-context-packaging
composio-community/opencode-skills
Open the skill to read its SKILL.md instructions.
vercel-react-best-practices
composio-community/opencode-skills
Open the skill to read its SKILL.md instructions.
multi-agent-orchestration
composio-community/opencode-skills
Open the skill to read its SKILL.md instructions.
context-engineering
composio-community/opencode-skills
Workflow for managing, structuring, compressing, and orchestrating context effectively for Claude and AI agent systems to improve reasoning quality, execution consistency, and long-term workflow scalability.
Popular testing & qa skills
tdd
mattpocock/skills
Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.
grilling
mattpocock/skills
Grill the user relentlessly about a plan, decision, or idea. Use when the user wants to stress-test their thinking, or uses any 'grill' trigger phrases.
migrate-to-shoehorn
mattpocock/skills
Migrate test files from as type assertions to @total-typescript/shoehorn. Use when user mentions shoehorn, wants to replace as in tests, or needs partial test data.
run-train
lllllllama/rigorpilot-skills
Rigor Train skill for deep learning research repositories. Use when a documented or selected training command should be run conservatively for startup verification, short-run verification, full kickoff, or resume, with command, config, seed, log, checkpoint, status, and metric evidence written to standardized trainoutputs/. Do not use for environment setup, exploratory sweeps, speculative idea implementation, or end-to-end orchestration.
test-driven-development
obra/superpowers
Use when implementing any feature or bugfix, before writing implementation code
finishing-a-development-branch
obra/superpowers
Use when implementation is complete, all tests pass, and you need to decide how to integrate the work