moai-workflow-tdd
Skill1.2k starsChanged 3 months agoApache-2.0View on GitHub
Test-Driven Development workflow specialist using RED-GREEN-REFACTOR cycle for test-first software development. Use when developing new features from scratch or when behavior specification drives implementation.
1 other project uses a version of this, 1 of them edited.
Trending
Quiet since September.thin dataabout the whole repository
Most recently taken up by
- modu-ai/cc-pluginsedited, first seen Feb 11, 2026
Who's talking about modu-ai/moai-adk
- Ven0m0/claude-config“Add a structured external integration plan to the root TODO backlog”GitHub · Mar 18, 2026 · 4 reactions
- Ven0m0/claude-config“TODO list”GitHub · Jan 31, 2026 · 1 reactions
- sudosubin/agents.nix“agent-skills.github.modu-ai.moai-adk: init at 3.1.2”GitHub · Sep 30, 2026
- anthropics/claude-code“Worktree-isolation Bash check folds command substitutions in quoted-delimiter heredoc bodies but refuses …”GitHub · Sep 7, 2026
- bjw202/minidiscord“docs(t41): moai gate 종료 코드 합류 — upstream 이슈 문안 (제출 안 함)”GitHub · Sep 6, 2026
The biggest 5 of 13 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 13
Talked about on GitHub (13 times).
On GitHub · 13
- Mar 18, 2026Add a structured external integration plan to the root TODO backlog — Ven0m0/claude-config4 reactions · 4 comments
- Jan 31, 2026TODO list — Ven0m0/claude-config1 reaction · 18 comments
- Sep 30, 2026agent-skills.github.modu-ai.moai-adk: init at 3.1.2 — sudosubin/agents.nix0 reactions
- Sep 7, 2026Worktree-isolation Bash check folds command substitutions in quoted-delimiter heredoc bodies but refuses braces there, though such bodies cannot expand — anthropics/claude-code0 reactions
- Sep 6, 2026docs(t41): moai gate 종료 코드 합류 — upstream 이슈 문안 (제출 안 함) — bjw202/minidiscord0 reactions
8 more on GitHub
- Jul 23, 2026Hands-on eval: promote MoAI-ADK to core tier — cameronsjo/spec-compare0 reactions
- Apr 22, 2026Add MoAI-ADK to Collections & Libraries — travisvn/awesome-claude-skills0 reactions
- Apr 22, 2026Add MoAI-ADK to Meta & Orchestration category — VoltAgent/awesome-claude-code-subagents0 reactions
- Apr 22, 2026Add MoAI-ADK — SPEC-first Agentic Development Kit — jqueryscript/awesome-claude-code0 reactions
- Apr 22, 2026Add MoAI-ADK — SPEC-first AI-assisted coding framework — wsxiaoys/awesome-ai-coding0 reactions
- Apr 22, 2026Add MoAI-ADK — SPEC-first Agentic Development Kit for Claude Code — e2b-dev/awesome-ai-agents0 reactions
- Nov 19, 2025Issue #1: Estructura base del proyecto .NET 9 — mjcuadrado/mjcuadrado-net-sdk0 reactions
- Nov 13, 2025fix: resolve conflitos Git + remove hooks SYNC bloqueantes (Windows f… — PedroGiudice/lex-vector0 reactions
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 1
- modu-ai/cc-plugins★ 6886% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository45 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- hns-lsel-applierSkill
- hns-lsel-curatorSkill
- hns-moaiadk-best-practicesSkill
- hns-moaiadk-dev-referenceSkill
- hns-moaiadk-patternsSkill
- hns-oss-docs-i18n-rulesSkill
- hns-oss-docs-readme-syncSkill
- hns-oss-docs-structure-mapSkill
- hns-oss-docs-verifySkill
- hns-workflow-ci-loopSkill
- moai-domain-backendSkill
- moai-domain-databaseSkill
- moai-domain-design-dnaSkill
- moai-domain-frontendSkill
- moai-domain-html-reportSkill
- moai-domain-humanizeSkill
- moai-domain-svg-infographicSkill
- moai-foundation-ccSkill
- moai-foundation-coreSkill
- moai-foundation-qualitySkill
- moai-foundation-thinkingSkill
- moai-harness-learnerSkill
- moai-kanban-foremanSkill
- moai-meta-harnessSkill
- moai-ref-api-patternsSkill
- moai-ref-cross-model-auditSkill
- moai-ref-git-workflowSkill
- moai-ref-llm-securitySkill
- moai-ref-owasp-checklistSkill
- moai-ref-react-patternsSkill
- moai-ref-secopsSkill
- moai-ref-seoSkill
- moai-ref-supply-chainSkill
- moai-ref-testing-pyramidSkill
- moai-ref-ui-polishSkill
- moaiSkill
- moai-workflow-dddSkill
- moai-workflow-docs-claim-checkSkill
- moai-workflow-loopSkill
- moai-workflow-projectSkill
- moai-workflow-specSkill
- moai-workflow-testingSkill
- moai-workflow-worktreeSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
42 rules. About 0 are common, 42 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈42
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 56
Test-Driven Development provides a disciplined approach for creating new functionality where tests define the expected behavior before …
- Distinctive: line 64
When to Use TDD:
- Distinctive: line 68
When behavior specification drives development
- Distinctive: line 73
When NOT to Use TDD:
- Distinctive: line 76
When behavior preservation is the primary goal
- Distinctive: line 78
When modifying existing files (consider Hybrid mode)
- Distinctive: line 91
Test Type: Specification tests that define expected behavior
- Distinctive: line 99
Test Type: Characterization tests that capture current behavior
- Distinctive: line 121
Before writing any implementation code:
- Distinctive: line 125
Write one test at a time
- Distinctive: line 126
Keep tests focused and specific
- Distinctive: line 127
Use descriptive test names that document behavior
- Distinctive: line 131
Follow the Arrange-Act-Assert pattern:
- Distinctive: line 151
Write only enough code to make the test pass:
- Distinctive: line 154
Do not add features not required by tests
- Distinctive: line 160
Run the test to confirm it passes:
- Distinctive: line 162
All assertions must succeed
- Distinctive: line 163
No other tests should break
- Distinctive: line 181
After each refactoring step:
- Distinctive: line 184
If any test fails, revert immediately
- Distinctive: line 185
Commit when tests pass
- Distinctive: line 193
When executing TDD through manager-develop:
- Distinctive: line 197
Read SPEC document for feature scope
- Distinctive: line 203
Write first failing test
- Distinctive: line 204
Verify test fails for the right reason
- Distinctive: line 210
Run test to verify it passes
- Distinctive: line 244
All public interfaces tested
- Distinctive: line 249
No test written after implementation
- Distinctive: line 297
Test is Too Complex:
- Distinctive: line 300
Test one behavior at a time
- Distinctive: line 301
Use test fixtures for complex setup
- Distinctive: line 307
Keep GREEN phase minimal
- Distinctive: line 313
Ensure tests verify behavior, not implementation
- Distinctive: line 317
When TDD discipline breaks down:
- Distinctive: line 319
Stop and assess current state
- Distinctive: line 320
Write characterization tests for existing code
- Distinctive: line 322
Consider switching to Hybrid mode
- Distinctive: line 344
Beyonce Rule: If you liked it, you should have put a test on it.
- Distinctive: line 352
Test names describe implementation (test_function_returns_true) instead of behavior (test_user_login_rejects_expired_token)
- Distinctive: line 353
All tests in a new file pass on first run — no RED phase was captured
- Distinctive: line 354
Commit message says "add tests" after the feature is already merged
- Distinctive: line 355
Test suite contains mocks of the code under test (mocking implementation, not collaborators)
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Test-Driven Development (TDD) Workflow
Development Mode Configuration (CRITICAL)
[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:
- TDD (default): Test-first development for all work, including brownfield projects with pre-RED analysis
- DDD: Characterization-test-first for existing codebases with minimal test coverage
Quick Reference
Test-Driven Development provides a disciplined approach for creating new functionality where tests define the expected behavior before implementation.
Core Cycle - RED-GREEN-REFACTOR:
- RED: Write a failing test that defines desired behavior
- GREEN: Write minimal code to make the test pass
- REFACTOR: Improve code structure while keeping tests green
When to Use TDD:
- Creating new functionality from scratch
- Building isolated modules with no existing dependencies
- When behavior specification drives development
- New API endpoints with clear contracts
- New UI components with defined behavior
- Greenfield projects (rare - usually Hybrid is better)
When NOT to Use TDD:
- Refactoring existing code (use DDD instead)
- When behavior preservation is the primary goal
- Legacy codebase without test coverage (use DDD first)
- When modifying existing files (consider Hybrid mode)
Core Philosophy
TDD vs DDD Comparison
TDD Approach:
- Cycle: RED-GREEN-REFACTOR
- Goal: Create new functionality through tests
- Starting Point: No code exists
- Test Type: Specification tests that define expected behavior
- Outcome: New working code with test coverage
DDD Approach:
- Cycle: ANALYZE-PRESERVE-IMPROVE
- Goal: Improve structure without behavior change
- Starting Point: Existing code with defined behavior
- Test Type: Characterization tests that capture current behavior
- Outcome: Better structured code with identical behavior
Test-First Principle
The golden rule of TDD is that tests must be written before implementation code:
- Tests define the contract
- Tests document expected behavior
- Tests catch regressions immediately
- Implementation is driven by test requirements
Implementation Guide
Phase 1: RED - Write a Failing Test
The RED phase focuses on defining the desired behavior through a failing test.
Writing Effective Tests
Before writing any implementation code:
- Understand the requirement clearly
- Define the expected behavior in test form
- Write one test at a time
- Keep tests focused and specific
- Use descriptive test names that document behavior
Test Structure
Follow the Arrange-Act-Assert pattern:
- Arrange: Set up test data and dependencies
- Act: Execute the code under test
- Assert: Verify the expected outcome
Verification
The test must fail initially:
- Confirms the test actually tests something
- Ensures the test is not passing by accident
- Documents the gap between current and desired state
Phase 2: GREEN - Make the Test Pass
The GREEN phase focuses on writing minimal code to satisfy the test.
Minimal Implementation
Write only enough code to make the test pass:
- Do not over-engineer
- Do not add features not required by tests
- Focus on correctness, not perfection
- Hardcode values if necessary (refactor later)
Verification
Run the test to confirm it passes:
- All assertions must succeed
- No other tests should break
- Implementation satisfies the test requirements
Phase 3: REFACTOR - Improve the Code
The REFACTOR phase focuses on improving code quality while maintaining behavior.
Safe Refactoring
With passing tests as a safety net:
- Remove duplication
- Improve naming and readability
- Extract methods and classes
- Apply design patterns where appropriate
Continuous Verification
After each refactoring step:
- Run all tests
- If any test fails, revert immediately
- Commit when tests pass
TDD Workflow Execution
Standard TDD Session
When executing TDD through manager-develop:
Step 1 - Understand Requirements:
- Read SPEC document for feature scope
- Identify test cases from acceptance criteria
- Plan test implementation order
Step 2 - RED Phase:
- Write first failing test
- Verify test fails for the right reason
- Document expected behavior
Step 3 - GREEN Phase:
- Write minimal implementation
- Run test to verify it passes
- Move to next test
Step 4 - REFACTOR Phase:
- Review code for improvements
- Apply refactoring with tests as safety net
- Commit clean code
Step 5 - Repeat:
- Continue RED-GREEN-REFACTOR cycle
- Until all requirements are implemented
- Until all acceptance criteria pass
TDD Loop Pattern
For features requiring multiple test cases:
- Identify all test cases upfront
- Prioritize by dependency and complexity
- Execute RED-GREEN-REFACTOR for each
- Maintain cumulative test suite
Quality Metrics
TDD Success Criteria
Test Coverage (Required):
- Minimum 80% coverage per commit
- 90% recommended for new code
- All public interfaces tested
Code Quality (Goals):
- All tests pass
- No test written after implementation
- Clear test names documenting behavior
- Minimal implementation satisfying tests
TDD-Specific TRUST Validation
Apply TRUST 5 framework with TDD focus:
- Testability: Test-first approach ensures testability
- Readability: Tests document expected behavior
- Understandability: Tests serve as living documentation
- Security: Security tests written before implementation
- Transparency: Test failures provide immediate feedback
Integration Points
With DDD Workflow
TDD and DDD are complementary:
- TDD for new code
- DDD for existing code refactoring
- Hybrid mode combines both approaches
With Testing Workflow
TDD integrates with testing workflow:
- Uses specification tests
- Integrates with coverage tools
- Supports mutation testing for test quality
With Quality Framework
TDD outputs feed into quality assessment:
- Coverage metrics tracked
- TRUST 5 validation for changes
- Quality gates enforce standards
Troubleshooting
Common Issues
Test is Too Complex:
- Break into smaller, focused tests
- Test one behavior at a time
- Use test fixtures for complex setup
Implementation Grows Too Fast:
- Resist urge to implement untested features
- Return to RED phase for new functionality
- Keep GREEN phase minimal
Refactoring Breaks Tests:
- Revert immediately
- Refactor in smaller steps
- Ensure tests verify behavior, not implementation
Recovery Procedures
When TDD discipline breaks down:
- Stop and assess current state
- Write characterization tests for existing code
- Resume TDD for remaining features
- Consider switching to Hybrid mode
Version: 1.0.0 Status: Active
<!-- moai:evolvable-start id="rationalizations" -->Common 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" -->Red Flags
- Implementation file created in the same commit as its test file (RED phase skipped)
- Test names describe implementation (test_function_returns_true) instead of behavior (test_user_login_rejects_expired_token)
- All tests in a new file pass on first run — no RED phase was captured
- Commit message says "add tests" after the feature is already merged
- Test suite contains mocks of the code under test (mocking implementation, not collaborators)
- Coverage dropped in the commit that added a new feature
<!-- moai:evolvable-end --><!-- moai:evolvable-start id="verification" -->Verification
- Git history shows a failing-test commit before the implementation commit, or evidence of RED in the same commit
- Test names read as behavior specifications, not function descriptions
- Every new public function has at least one corresponding test case
- Full test suite passes (paste command output)
- Coverage for changed files is measured and reported (show tool output)
- No
skip,xit, or disabled tests were added in this change - REFACTOR phase was executed or explicitly justified as unnecessary
<!-- moai:evolvable-end -->Test-First Anti-Cheat
[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.
- Invariant i — RED failure output is mandatory completion evidence. The verbatim RED failing-test output (the failing-test run captured BEFORE any implementation makes it pass) MUST be observed and shown as part of run-phase completion evidence. A run that cannot produce this output skipped RED and cannot be reported as clean.
- Invariant ii — implementation written before its failing test is deleted and re-derived test-first. Any implementation code written before its failing test exists MUST be deleted and re-derived from a failing test (RED then GREEN). "I already wrote the implementation, so the test passes on first run" is the exact failure mode this invariant forbids — it is test-after, not test-first, and it leaves no RED output (Invariant i) to show as evidence.
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.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

