跳至正文
OpenAgentSkill
浏览已开放 · 目录记录日期 2026-11-21 · 自动更新和账户服务暂时关闭。
开发与测试

tdd

Spec-Driven TDD with a strict Red-Green-Refactor cycle using context-isolated subagents. Every feature starts with a structured spec; tests are generated from numbered acceptance criteria, with post-cycle three-dimension verification (Completeness + Traceability + Coherence), severity-tiered findings (CRITICAL/WARNING/SUGGESTION), and a spec-defect escape hatch that halts when the spec is internally contradictory or unimplementable instead of silently encoding it. Use when the user says "/tdd", "test first", "use tdd", "tdd approach", "write tests first", or when implementing new features/functionality. Trigger phrases: "implement", "add feature". Do NOT use for bug fixes without new tests, documentation changes, configuration-only changes, or refactoring existing code without new behavior.

kirillgreen · 已有静态检查记录

安装与使用

运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。

npx skills add kirillgreen/skills --skill tdd

技能说明


name: tdd description: > Spec-Driven TDD with a strict Red-Green-Refactor cycle using context-isolated subagents. Every feature starts with a structured spec; tests are generated from numbered acceptance criteria, with post-cycle three-dimension verification (Completeness + Traceability + Coherence), severity-tiered findings (CRITICAL/WARNING/SUGGESTION), and a spec-defect escape hatch that halts when the spec is internally contradictory or unimplementable instead of silently encoding it. Use when the user says "/tdd", "test first", "use tdd", "tdd approach", "write tests first", or when implementing new features/functionality. Trigger phrases: "implement", "add feature". Do NOT use for bug fixes without new tests, documentation changes, configuration-only changes, or refactoring existing code without new behavior.

/tdd -- Spec-Driven Test-Driven Development

Enforce strict Red-Green-Refactor cycle with context-isolated subagents. Every feature starts with a specification — numbered acceptance criteria that drive test generation and final verification.

Flow: Spec → RED → GREEN → REFACTOR → Verify

Mode Behavior Matrix

The cycle has two modes, set during Step 1. Each step below behaves differently per mode:

Steplocked-spec modeprompt-only mode
Step 1 Spec phaseFind existing or write new spec; lock at 1cUser declines spec; pass raw feature requirement instead
Phase 1 RED inputsLocked spec + AC-traceability instructionRaw feature requirement + "name tests after behavior, no AC- prefix"
Phase 1 spec coverage checkCompare tests vs locked spec criteriaSKIPPED (no spec)
Phase 2 spec_defect signalImplementer can raise spec_defect: trueDISABLED (no spec to be defective)
Step 4 Spec VerificationAll three dimensions runSKIPPED (no spec to verify against)
Final Report Spec line"[N] criteria defined""prompt-only mode"
Final Report Verification blockThree-dim breakdown"Verification: skipped (prompt-only mode)"

Maintenance note: every mode-specific branch in this runbook is tagged <!-- mode-fork --> in the source. Grep that tag to enumerate all branches. If this matrix grows past ~8 rows or the branches become hard to keep in sync, that's the signal to split /tdd-prompt-only into its own skill.

Severity Levels

Every check in this skill emits findings at one of three tiers:

  • [CRITICAL] — blocks the phase transition by default. May be acknowledged-overridden only with explicit user confirmation, in which case the finding still appears in the final report tagged (acknowledged). In Step 4 (the last phase, no next transition to block), CRITICAL findings do not stop the cycle from being reported, but they mandate a follow-up cycle and are listed prominently in the report.
  • [WARNING] — should fix. Cycle continues; findings appear in the final report.
  • [SUGGESTION] — informational. Surfaced once at the end, never blocks.

The final report tallies counts by tier. CRITICAL gates phase transitions (with optional acknowledged override); WARNING and SUGGESTION are advisory.

Findings Ledger

A single mutable list findings_ledger is the source of truth for all findings emitted during the cycle. The Final Report MUST be generated from this ledger, not recounted from memory.

Schema (one entry per finding):

- id: "F-001"                    # sequential, never reused
  tier: "CRITICAL"               # CRITICAL | WARNING | SUGGESTION
  phase: "post-red-lint"         # post-red-lint | post-green | post-refactor | step-4a | step-4b | step-4c | phase-3.5 | step-0.5 | step-1b
  check: "test-isolation"        # short identifier for the check that fired
  message: "Test imports utils/x.ts which doesn't exist"
  file: "src/utils/__tests__/x.test.ts:12"   # if applicable
  acknowledged: false            # true once the user explicitly approves the override
  acknowledged_reason: null      # user's stated reason if acknowledged
  acknowledged_at_phase: null    # phase where the override was approved
  carried_from_strike: 1         # null | 1 | 2 — for entries that survive a spec-defect cycle restart

Append rules:

  • Every emitted [CRITICAL], [WARNING], [SUGGESTION] finding gets one ledger entry. No exceptions.
  • IDs are sequential within a cycle, starting at F-001. Never renumber.
  • Severity tier and check identifier are immutable once written.
  • acknowledged: true is set ONLY when the user explicitly confirms an override (e.g., accepts an out-of-scope file). Never auto-flip.
  • Step 0.5 intent-check acknowledgements also go in the ledger as tier: "SUGGESTION", check: "intent-check-bypass", phase: "step-0.5", acknowledged: true, acknowledged_reason: <user's reason or "user chose (b) proceed">. This gives bug-fix-routed-acknowledgements a record so they appear in the Final Report.
  • Cycle restart stale-path scrub: when a spec-defect strike discards a test file, on strike-N entry the orchestrator strips from the ledger any entry whose file: path references the discarded test file path (and whose phase is post-red-lint). Cross-phase findings (Post-GREEN, Step 4, Phase 3.5) are NOT stripped — they describe state that may persist. Stripped entries are logged as (stripped on strike N — file discarded) for audit but not surfaced in the Final Report.

Cycle restart rules (spec-defect strike 1 → 2 transition):

  • When a spec_defect: true discards the test file and restarts RED, the ledger is preserved — not reset.
  • Existing entries gain carried_from_strike: 1 so they're distinguishable in the Final Report.
  • New entries on strike 2 use the next sequential ID after the last strike-1 entry.

Final Report rule:

  • The Final Report's Findings: N CRITICAL · N WARNING · N SUGGESTION line is computed by count by tier over the ledger.
阅读完整来源 ↗