一键导入
tdd
Strict test-driven development for behavior changes. Requires verified RED before production code, minimal GREEN, and refactor only after passing tests.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Strict test-driven development for behavior changes. Requires verified RED before production code, minimal GREEN, and refactor only after passing tests.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Meta-orchestrator — dispatches to the right skill for the task. Use before any non-trivial work.
Library-agnostic Flutter/Dart code review checklist covering widget best practices, state management patterns (BLoC, Riverpod, Provider, GetX, MobX, Signals), Dart idioms, performance, accessibility, security, and clean architecture.
Structured 6-phase debugging. Build feedback loop first, reproduce deterministically, hypothesize with ranked falsifiable theories, instrument one variable at a time, fix with regression test, cleanup. Use when a bug exists, tests fail unexpectedly, or behavior is wrong and cause is unknown.
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.
Database migration best practices for schema changes, data migrations, rollbacks, and zero-downtime deployments across PostgreSQL, MySQL, and common ORMs (Prisma, Drizzle, Kysely, Django, TypeORM, golang-migrate).
Run integration and e2e tests after unit tests pass. Use after /supergraph:fix when unit tests are green.
| name | tdd |
| description | Strict test-driven development for behavior changes. Requires verified RED before production code, minimal GREEN, and refactor only after passing tests. |
| mcp | codebase-memory-mcp |
Use CBM_PROJECT graph evidence only after healthy index_status. A stale or
degraded index requires index_repository before detect_changes, trace_path,
or validated cycles, hubs, bridges, and test-gaps recipes. Missing required
tests blocks GREEN.
Strict TDD for features, bug fixes, refactors.
Iron Law: NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
Delete means delete: Production code written before verified failing test → delete and restart from RED.
Full TDD: new features, behavior changes, refactoring. Fast TDD: bug fixes (add regression test → RED verify → minimal fix). Ask to skip: config-only, generated code, throwaway prototype, docs-only.
needs_test → red_verified → green_verified → refactor_allowed → complete
"🔴 /supergraph:tdd — TDD: [full|fast] for [behavior]..."
Behavior: [single externally visible behavior]
Test file: [path] | Test name: [name]
Command: [focused test command]
Expected RED: [why it should fail before implementation]
One behavior per test. Public behavior, not internals. Real code over mocks.
Write one failing test, then run immediately:
<write test> && $TEST_CMD <focused command>
Valid RED: fails for the expected missing behavior, not syntax/import/typo.
Record evidence:
## TDD Evidence — RED
- RED: `[command]` → FAIL ([expected missing behavior])
Serena diagnostics (optional): If /supergraph:scan was not run this session, call mcp__serena__initial_instructions() first. Then: mcp__serena__get_diagnostics_for_file(file=<test_file>) — confirm no type errors mask the real missing behavior. Skip if Serena unavailable or SERENA_ACTIVE=false.
Invalid RED → fix test setup, don't write production code yet.
Write only enough code to pass the test. No abstractions, no cleanup, no extra features.
Delete any production code written before RED.
Serena surgery (optional): Prefer mcp__serena__replace_symbol_body(symbol=<fn>) over raw file edits for targeted function-body implementation — exact, no risk of touching surrounding code. Skip if Serena unavailable.
Run focused test → broader suite:
## TDD Evidence — GREEN
- GREEN: `[command]` → PASS
- Suite: PASS
Serena diagnostics (optional): mcp__serena__get_diagnostics_for_file(file=<source_file>) — confirm no new type errors introduced by implementation. Skip if Serena unavailable.
Failing test → fix code, not test. Other tests fail → fix now.
Rename, deduplicate, extract. No behavior changes. Re-run tests.
Before any rename (optional): Enumerate all callers first to confirm scope:
mcp__serena__find_referencing_symbols(symbol=<symbol_to_rename>)
Then use mcp__serena__rename_symbol(old=<name>, new=<name>) for safe codebase-wide rename instead of grep/replace.
Skip if Serena unavailable — fall back to manual grep + Edit.
Before marking complete:
## TDD Complete
- Behavior: [behavior]
- Mode: full|fast
- RED verified: yes | GREEN verified: yes | Refactor: yes|none
- Tests: PASS
Per behavior: ✅ /supergraph:tdd — behavior N: [brief]
Final:
✅ /supergraph:tdd complete
- Behaviors: N | Mode: full|fast | Tests: PASS | Lint: PASS
- Next: /supergraph:fix → /supergraph:verify → /supergraph:review
For bugs, skip full TDD ceremony:
Plans must include TDD metadata per behavior task:
TDD:
- Behavior: [single behavior] | Test file: [path] | Test name: [name]
- RED command: `[focused test command]` | Expected RED failure: [missing behavior]
- Minimal GREEN change: [smallest implementation] | Mocking: none | [why unavoidable]
red_verified| Symptom | Fix |
|---|---|
| Production code before failing test | Delete, start RED |
| Tests after implementation | Next behavior test-first, remove untested code |
| "Too small to test" | Write one-liner test |
| Immediate pass accepted as RED | Test is wrong — revise |
| Pre-written implementation kept as reference | Delete, start fresh |
| Over-building before tests need it | YAGNI — remove |
Reject tests that only prove mocks exist or were called.