TDD Guide
alirezarezvani/claude-skills
Test-driven development skill for writing unit tests, generating test fixtures and mocks, analyzing coverage gaps, and guiding red-green-refactor workflows across Jest, Pytest, JUnit, Vitest, and…
Drives test-first development through the RED, GREEN, REFACTOR cycle, with a config switch that selects between TDD and a DDD workflow for existing code.
$ npx skills add modu-ai/moai-adk --skill moai-workflow-tdd -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install modu-ai/moai-adk moai-workflow-tdd --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/modu-ai/moai-adk.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/moai-workflow-tdd .claude/skills/moai-workflow-tdd && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "moai-workflow-tdd" agent skill from https://github.com/modu-ai/moai-adk/tree/main/.claude/skills/moai-workflow-tdd into .claude/skills/moai-workflow-tdd/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "moai-workflow-tdd", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/modu-ai/moai-adk/tree/main/.claude/skills/moai-workflow-tddType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add modu-ai/moai-adk --skill moai-workflow-tdd -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install modu-ai/moai-adk moai-workflow-tdd --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/modu-ai/moai-adk.git skills-src && mkdir -p .agents/skills && cp -r skills-src/.claude/skills/moai-workflow-tdd .agents/skills/moai-workflow-tdd && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "moai-workflow-tdd" agent skill from https://github.com/modu-ai/moai-adk/tree/main/.claude/skills/moai-workflow-tdd into .agents/skills/moai-workflow-tdd/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "moai-workflow-tdd", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add modu-ai/moai-adk --skill moai-workflow-tdd -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install modu-ai/moai-adk moai-workflow-tdd --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/modu-ai/moai-adk.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/.claude/skills/moai-workflow-tdd .cursor/skills/moai-workflow-tdd && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "moai-workflow-tdd" agent skill from https://github.com/modu-ai/moai-adk/tree/main/.claude/skills/moai-workflow-tdd into .cursor/skills/moai-workflow-tdd/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "moai-workflow-tdd", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/modu-ai/moai-adk.git --path .claude/skills/moai-workflow-tdd--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add modu-ai/moai-adk --skill moai-workflow-tdd -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install modu-ai/moai-adk moai-workflow-tdd --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/modu-ai/moai-adk.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/.claude/skills/moai-workflow-tdd .gemini/skills/moai-workflow-tdd && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "moai-workflow-tdd" agent skill from https://github.com/modu-ai/moai-adk/tree/main/.claude/skills/moai-workflow-tdd into .gemini/skills/moai-workflow-tdd/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "moai-workflow-tdd", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install modu-ai/moai-adk moai-workflow-tddInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add modu-ai/moai-adk --skill moai-workflow-tdd -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/modu-ai/moai-adk.git skills-src && mkdir -p .github/skills && cp -r skills-src/.claude/skills/moai-workflow-tdd .github/skills/moai-workflow-tdd && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "moai-workflow-tdd" agent skill from https://github.com/modu-ai/moai-adk/tree/main/.claude/skills/moai-workflow-tdd into .github/skills/moai-workflow-tdd/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "moai-workflow-tdd", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add modu-ai/moai-adk --skill moai-workflow-tdd -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install modu-ai/moai-adk moai-workflow-tdd --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/modu-ai/moai-adk.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/.claude/skills/moai-workflow-tdd .opencode/skills/moai-workflow-tdd && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "moai-workflow-tdd" agent skill from https://github.com/modu-ai/moai-adk/tree/main/.claude/skills/moai-workflow-tdd into .opencode/skills/moai-workflow-tdd/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "moai-workflow-tdd", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
moai-workflow-tddDrives test-first development through the RED, GREEN, REFACTOR cycle, with a config switch that selects between TDD and a DDD workflow for existing code.
RED, GREEN, REFACTOR drives this workflow: write a failing test that defines the behavior, write the minimum code to pass, then improve the structure while the tests stay green. It is meant for new functionality, isolated modules, new API endpoints and UI components with defined behavior, and cases where a behavior spec drives the work.
Which workflow runs is decided by development_mode in .moai/config/sections/quality.yaml. With tdd, the default, this workflow applies; with ddd, the separate moai-workflow-ddd takes over, which uses an analyze, preserve, improve cycle and characterization tests to restructure existing code without changing behavior. TDD is not advised for refactoring, legacy code without tests or edits to existing files, where Hybrid mode is suggested.
The skill's allowed tools include Read, Write, Edit, Grep and Glob plus Bash commands for test and lint tooling across several ecosystems, such as pytest, ruff, npm, jest, vitest, go, cargo, mix, uv, bundle, php and phpunit. It is designed for Claude Code, and references/examples.md and references/reference.md carry worked examples and details.
3 steps, taken from the step headings in SKILL.md.
Read from SKILL.md and the folder at commit 2aab5f7. It shows what the files ask for, not the result of running them.
Pre-approves these tools, so the agent can use them without asking each time:
ReadWriteEditBash(pytest:*)Bash(ruff:*)Bash(npm:*)Bash(npx:*)Bash(node:*)Bash(jest:*)Bash(vitest:*)…and 9 more on the same allowed-tools line.
From allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md (its code samples are yaml).
From the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Designed for Claude Code
From compatibility in the SKILL.md frontmatter.
MoAI TDD Workflow loads about 3.1k tokens when it runs, and up to ~3.9k if it reads all its reference files. Until then it costs about 57 tokens; SKILL.md has 1,467 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from modu-ai/moai-adk at commit 2aab5f7, republished under its Apache-2.0 licence (© modu-ai). 1,467 words, ~3,074 tokens.
.claude/skills/moai-workflow-tdd/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.[NOTE] This workflow is selected based on .moai/config/sections/quality.yaml:
constitution:
development_mode: tdd # or dddWhen to use this workflow:
development_mode: tdd → Use TDD (this workflow, default)development_mode: ddd → Use DDD instead (moai-workflow-ddd)Key distinction:
Test-Driven Development provides a disciplined approach for creating new functionality where tests define the expected behavior before implementation.
Core Cycle - RED-GREEN-REFACTOR:
When to Use TDD:
When NOT to Use TDD:
TDD Approach:
DDD Approach:
The golden rule of TDD is that tests must be written before implementation code:
The RED phase focuses on defining the desired behavior through a failing test.
Before writing any implementation code:
Follow the Arrange-Act-Assert pattern:
The test must fail initially:
The GREEN phase focuses on writing minimal code to satisfy the test.
Write only enough code to make the test pass:
Run the test to confirm it passes:
The REFACTOR phase focuses on improving code quality while maintaining behavior.
With passing tests as a safety net:
After each refactoring step:
When executing TDD through manager-develop:
Step 1 - Understand Requirements:
Step 2 - RED Phase:
Step 3 - GREEN Phase:
Step 4 - REFACTOR Phase:
Step 5 - Repeat:
For features requiring multiple test cases:
Test Coverage (Required):
Code Quality (Goals):
Apply TRUST 5 framework with TDD focus:
TDD and DDD are complementary:
TDD integrates with testing workflow:
TDD outputs feed into quality assessment:
Test is Too Complex:
Implementation Grows Too Fast:
Refactoring Breaks Tests:
When TDD discipline breaks down:
Version: 1.0.0 Status: Active
<!-- moai:evolvable-start id="rationalizations" -->
| Rationalization | Reality |
|---|---|
| "I'll add tests after the implementation works" | Post-hoc tests verify what the code does, not what it should do. They miss the bugs RED phase catches. |
| "The existing tests cover this case" | Existing tests verify old behavior. New behavior needs its own failing test first. |
| "This function is too simple to test" | Simple functions accumulate complexity. The test documents expected behavior before drift. |
| "I tested it manually in the terminal" | Manual checks do not persist. Tomorrow's change breaks the contract with no signal. |
| "The test requires complex mocking" | If the test is hard to write, the code is hard to reason about. Refactor the design first. |
| "Tests slow me down" | Test-first surfaces design problems early, when they are cheapest to fix. |
| "I'll skip REFACTOR this cycle to keep moving" | Skipped refactors compound. The next cycle starts from a worse baseline. |
DAMP over DRY: In test code, prefer Descriptive And Meaningful Phrases over Don't Repeat Yourself. Duplication inside a test that makes the intent obvious is better than an abstraction that hides it.
Beyonce Rule: If you liked it, you should have put a test on it. Any behavior CI does not verify will eventually break without warning.
<!-- moai:evolvable-end -->
<!-- moai:evolvable-start id="red-flags" -->
<!-- moai:evolvable-end -->
<!-- moai:evolvable-start id="verification" -->
skip, xit, or disabled tests were added in this change<!-- moai:evolvable-end -->
[ZONE:Evolvable] [HARD] The Red Flags and Verification checklists above sit in advisory (evolvable) blocks and are consumed by no completion gate. This section promotes them into two enforced invariants that make test-first falsifiable in the completion matrix.
These two invariants close the falsifiability gap: before them, a fully-passing self-verification matrix was producible with NO RED evidence, so test-first could not be distinguished from test-after by the completion report. After them, the matrix requires the verbatim pre-GREEN RED output, so a run that skipped RED has no such output to supply and the matrix is structurally incomplete.
© modu-ai, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
SKILL.md and 2 other files (references) in .claude/skills/moai-workflow-tdd of modu-ai/moai-adk.
Open the folder on GitHubat commit 2aab5f7
MoAI TDD Workflow next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| MoAI TDD Workflow this skillmodu-ai/moai-adk | 1.2k | — | ~3.1k | Automated safety check: Pass | Apache-2.0 | |
| TDD Guidealirezarezvani/claude-skills | 28k | — | ~3.4k | Automated safety check: Pass | MIT | |
| TDD GuideLeoYeAI/openclaw-master-skills | 2.2k | — | ~1.4k | Automated safety check: Pass | MIT | |
| TDD Guideborghei/Claude-Skills | 886 | — | ~1.7k | Automated safety check: Pass | MIT | |
| TDD GuideaAAaqwq/AGI-Super-Team | 105 | 2 repos | ~1.1k | Automated safety check: Pass | MIT | |
| Test-Driven Development Enforcerzereight/gitlab-mcp | 2k | 1 repos | ~904 | Automated safety check: Pass | MIT |
alirezarezvani/claude-skills
Test-driven development skill for writing unit tests, generating test fixtures and mocks, analyzing coverage gaps, and guiding red-green-refactor workflows across Jest, Pytest, JUnit, Vitest, and…
LeoYeAI/openclaw-master-skills
Test-driven development skill for writing unit tests, generating test fixtures and mocks, analyzing coverage gaps, and guiding red-green-refactor workflows across Jest, Pytest, JUnit, Vitest, and…
borghei/Claude-Skills
Guide red-green-refactor TDD with test generation, coverage-gap analysis, and multi- framework support.
aAAaqwq/AGI-Super-Team
Test-driven development workflow with test generation, coverage analysis, and multi-framework support
zereight/gitlab-mcp
Enforces strict red-green-refactor, with a failing test first, the minimum code to pass it, then cleanup, and a quick reference for common test runners.
rohitg00/skillkit
Applies proven testing patterns — Arrange-Act-Assert (AAA), Given-When-Then, Test Data Builders, Object Mother, parameterized tests, fixtures, spies, and test doubles — to help write maintainable…
modu-ai/moai-adk
Builds hand-editable SVG diagrams from computed layout coordinates, lints the source and renders a 2x PNG, with rules for when mermaid is the better choice.
modu-ai/moai-adk
Reference for MoAI-ADK's core development principles: TRUST 5 quality gates, SPEC-first domain-driven workflow, agent delegation and token budgeting.
modu-ai/moai-adk
Manages SPEC documents for MoAI-ADK development, with GEARS or EARS requirement notation, acceptance criteria and a link into the Plan-Run-Sync workflow.
modu-ai/moai-adk
Gives each SPEC its own Git worktree with a registry of active workspaces, base-branch sync and cleanup of merged ones, inside the MoAI-ADK workflow.
modu-ai/moai-adk
Watches a pull request's CI checks after creation, separates required from auxiliary failures, applies limited safe fixes and escalates anything semantic to you.
modu-ai/moai-adk
Database guidance for PostgreSQL, MongoDB, Redis and Oracle plus Neon, Supabase and Firestore: schema design, indexing, query tuning and cloud database choice.
Categories
Drives test-first development through the RED, GREEN, REFACTOR cycle, with a config switch that selects between TDD and a DDD workflow for existing code. RED, GREEN, REFACTOR drives this workflow: write a failing test that defines the behavior, write the minimum code to pass, then improve the structure while the tests stay green. It is meant for new functionality, isolated modules, new API endpoints and UI components with defined behavior, and cases where a behavior spec drives the work.
MoAI TDD Workflow fits situations like: building a new feature from scratch with tests defining the behavior; adding an API endpoint with a clear contract, test first; choosing between TDD for new code and DDD for legacy code.
Run `npx skills add modu-ai/moai-adk --skill moai-workflow-tdd -a claude-code`. Or copy the skill folder (.claude/skills/moai-workflow-tdd in modu-ai/moai-adk) into .claude/skills/moai-workflow-tdd in your project. Claude Code loads it when a task matches its description.
Run `npx skills add modu-ai/moai-adk --skill moai-workflow-tdd -a codex`. Or copy the skill folder (.claude/skills/moai-workflow-tdd in modu-ai/moai-adk) into .agents/skills/moai-workflow-tdd in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add modu-ai/moai-adk --skill moai-workflow-tdd -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/moai-workflow-tdd, .gemini/skills/moai-workflow-tdd, .github/skills/moai-workflow-tdd and .opencode/skills/moai-workflow-tdd in your project.
SKILL.md names no scripts, command-line tools or credentials: MoAI TDD Workflow is instructions for the agent only. Our summary lists: A test runner for the project's language, such as pytest, jest or vitest; A MoAI project config at .moai/config/sections/quality.yaml. Its frontmatter pre-approves these tools: Read, Write, Edit, Bash(pytest:*), Bash(ruff:*), Bash(npm:*), Bash(npx:*), Bash(node:*), Bash(jest:*), Bash(vitest:*), Bash(go:*), Bash(cargo:*), Bash(mix:*), Bash(uv:*), Bash(bundle:*), Bash(php:*), Bash(phpunit:*), Grep, Glob. Compatibility (from SKILL.md): Designed for Claude Code.
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
MoAI TDD Workflow is published under the Apache-2.0 licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.
About 3.1k tokens (SKILL.md is roughly 12k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 804 tokens, read only when the agent opens those files.
Skills that share tags, products or a category with MoAI TDD Workflow: TDD Guide (alirezarezvani/claude-skills, 28k stars), TDD Guide (LeoYeAI/openclaw-master-skills, 2.2k stars), TDD Guide (borghei/Claude-Skills, 886 stars) and TDD Guide (aAAaqwq/AGI-Super-Team, 105 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
modu-ai (a GitHub organization) maintains it in modu-ai/moai-adk, which has 1,232 GitHub stars. The repository holds 48 skills in this directory. The repository was last updated on October 9, 2026.
Source: modu-ai/moai-adk on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.