cc-codeconductor 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/README.md +4 -2
  2. package/dist/core/verification/verification-runner.d.ts +7 -0
  3. package/dist/index.d.ts +1 -1
  4. package/dist/index.js +1413 -309
  5. package/dist/library.js +29 -1
  6. package/dist/validation/schemas.d.ts +97 -26
  7. package/package.json +1 -1
  8. package/presets/agy/AGENTS.md +10 -9
  9. package/presets/agy/hooks.json +2 -2
  10. package/presets/agy/scripts/invoke-hook.cjs +115 -0
  11. package/presets/agy/skills/backlog/SKILL.md +40 -70
  12. package/presets/agy/skills/cc-spec-mutation/SKILL.md +165 -0
  13. package/presets/agy/skills/cc-tdd-cycle/SKILL.md +3 -0
  14. package/presets/agy/skills/evaluation/SKILL.md +61 -2
  15. package/presets/agy/skills/openspec/SKILL.md +49 -19
  16. package/presets/agy/skills/testing-tdd/SKILL.md +53 -0
  17. package/presets/agy/skills/using-cc-skills/SKILL.md +48 -0
  18. package/presets/agy/workflows/cc-api-contract.md +14 -0
  19. package/presets/agy/workflows/cc-db-migration.md +14 -0
  20. package/presets/agy/workflows/cc-feature.md +18 -0
  21. package/presets/agy/workflows/cc-fix.md +14 -0
  22. package/presets/agy/workflows/cc-iterative.md +14 -0
  23. package/presets/agy/workflows/cc-openspec.md +14 -0
  24. package/presets/agy/workflows/cc-scorecard.md +2 -0
  25. package/presets/agy/workflows/cc-spec-mutation.md +191 -0
  26. package/presets/agy/workflows/cc-tdd-cycle.md +14 -0
  27. package/presets/claude/commands/cc/api-contract.md +14 -0
  28. package/presets/claude/commands/cc/db-migration.md +14 -0
  29. package/presets/claude/commands/cc/feature.md +18 -0
  30. package/presets/claude/commands/cc/fix.md +17 -0
  31. package/presets/claude/commands/cc/iterative.md +14 -0
  32. package/presets/claude/commands/cc/openspec.md +14 -0
  33. package/presets/claude/commands/cc/review.md +3 -0
  34. package/presets/claude/commands/cc/scorecard.md +2 -0
  35. package/presets/claude/commands/cc/spec-mutation.md +190 -0
  36. package/presets/claude/commands/cc/tdd-cycle.md +17 -0
  37. package/presets/claude/settings.json +13 -11
  38. package/presets/claude/skills/backlog/SKILL.md +40 -70
  39. package/presets/claude/skills/evaluation/SKILL.md +47 -24
  40. package/presets/claude/skills/openspec/SKILL.md +46 -38
  41. package/presets/claude/skills/testing-tdd/SKILL.md +53 -0
  42. package/presets/claude/skills/using-cc-skills/SKILL.md +48 -0
  43. package/presets/codex/AGENTS.md +16 -12
  44. package/presets/codex/skills/backlog/SKILL.md +61 -0
  45. package/presets/codex/skills/cc-api-contract/SKILL.md +87 -0
  46. package/presets/codex/skills/cc-backlog/SKILL.md +108 -0
  47. package/presets/codex/skills/cc-clarify/SKILL.md +36 -0
  48. package/presets/codex/skills/cc-council/SKILL.md +92 -0
  49. package/presets/codex/skills/cc-db-migration/SKILL.md +88 -0
  50. package/presets/codex/skills/cc-explore/SKILL.md +40 -0
  51. package/presets/codex/skills/cc-feature/SKILL.md +154 -0
  52. package/presets/codex/skills/cc-fix/SKILL.md +165 -0
  53. package/presets/codex/skills/cc-handoff/SKILL.md +45 -0
  54. package/presets/codex/skills/cc-iterative/SKILL.md +150 -0
  55. package/presets/codex/skills/cc-openspec/SKILL.md +191 -0
  56. package/presets/codex/skills/cc-pagespeed/SKILL.md +124 -0
  57. package/presets/codex/skills/cc-prototype/SKILL.md +42 -0
  58. package/presets/codex/skills/cc-refactor/SKILL.md +163 -0
  59. package/presets/codex/skills/cc-review/SKILL.md +152 -0
  60. package/presets/codex/skills/cc-scorecard/SKILL.md +82 -0
  61. package/presets/codex/skills/cc-security/SKILL.md +182 -0
  62. package/presets/codex/skills/cc-spec-mutation/SKILL.md +192 -0
  63. package/presets/codex/skills/cc-tdd-cycle/SKILL.md +266 -0
  64. package/presets/codex/skills/cc-test-plan/SKILL.md +153 -0
  65. package/presets/codex/skills/cc-triage/SKILL.md +38 -0
  66. package/presets/codex/skills/evaluation/SKILL.md +65 -0
  67. package/presets/codex/skills/openspec/SKILL.md +66 -0
  68. package/presets/codex/skills/testing-tdd/SKILL.md +53 -0
  69. package/presets/codex/skills/using-cc-skills/SKILL.md +48 -0
  70. package/presets/cursor/commands/cc/api-contract.md +14 -0
  71. package/presets/cursor/commands/cc/db-migration.md +14 -0
  72. package/presets/cursor/commands/cc/feature.md +18 -0
  73. package/presets/cursor/commands/cc/fix.md +17 -0
  74. package/presets/cursor/commands/cc/iterative.md +14 -0
  75. package/presets/cursor/commands/cc/openspec.md +14 -0
  76. package/presets/cursor/commands/cc/scorecard.md +2 -0
  77. package/presets/cursor/commands/cc/spec-mutation.md +190 -0
  78. package/presets/cursor/commands/cc/tdd-cycle.md +14 -0
  79. package/presets/cursor/skills/backlog/SKILL.md +40 -70
  80. package/presets/cursor/skills/evaluation/SKILL.md +61 -4
  81. package/presets/cursor/skills/openspec/SKILL.md +46 -36
  82. package/presets/cursor/skills/testing-tdd/SKILL.md +35 -574
  83. package/presets/cursor/skills/using-cc-skills/SKILL.md +48 -0
  84. package/presets/gemini/commands/cc/api-contract.toml +82 -0
  85. package/presets/gemini/commands/cc/ask.toml +54 -0
  86. package/presets/gemini/commands/cc/backlog.toml +103 -0
  87. package/presets/gemini/commands/cc/clarify.toml +31 -0
  88. package/presets/gemini/commands/cc/council.toml +87 -0
  89. package/presets/gemini/commands/cc/db-migration.toml +83 -0
  90. package/presets/gemini/commands/cc/explore.toml +35 -0
  91. package/presets/gemini/commands/cc/feature.toml +153 -0
  92. package/presets/gemini/commands/cc/fix.toml +163 -0
  93. package/presets/gemini/commands/cc/handoff.toml +40 -0
  94. package/presets/gemini/commands/cc/iterative.toml +145 -0
  95. package/presets/gemini/commands/cc/openspec.toml +186 -0
  96. package/presets/gemini/commands/cc/pagespeed.toml +119 -0
  97. package/presets/gemini/commands/cc/prototype.toml +37 -0
  98. package/presets/gemini/commands/cc/refactor.toml +158 -0
  99. package/presets/gemini/commands/cc/review.toml +150 -0
  100. package/presets/gemini/commands/cc/scorecard.toml +77 -0
  101. package/presets/gemini/commands/cc/security.toml +177 -0
  102. package/presets/gemini/commands/cc/spec-mutation.toml +187 -0
  103. package/presets/gemini/commands/cc/tdd-cycle.toml +264 -0
  104. package/presets/gemini/commands/cc/test-plan.toml +148 -0
  105. package/presets/gemini/commands/cc/triage.toml +33 -0
  106. package/presets/opencode/README.md +24 -21
  107. package/presets/opencode/agents/architect.md +6 -0
  108. package/presets/opencode/agents/implementer.md +7 -0
  109. package/presets/opencode/agents/reviewer.md +6 -0
  110. package/presets/opencode/agents/tester.md +6 -0
  111. package/presets/opencode/commands/cc-api-contract.md +14 -0
  112. package/presets/opencode/commands/cc-db-migration.md +14 -0
  113. package/presets/opencode/commands/cc-feature.md +18 -0
  114. package/presets/opencode/commands/cc-fix.md +17 -0
  115. package/presets/opencode/commands/cc-iterative.md +14 -0
  116. package/presets/opencode/commands/cc-openspec.md +14 -0
  117. package/presets/opencode/commands/cc-scorecard.md +2 -0
  118. package/presets/opencode/commands/cc-spec-mutation.md +190 -0
  119. package/presets/opencode/commands/cc-tdd-cycle.md +14 -0
  120. package/presets/opencode/opencode.jsonc +1 -1
  121. package/presets/opencode/prompts/v1.0.0/architect.md +6 -0
  122. package/presets/opencode/prompts/v1.0.0/implementer.md +7 -0
  123. package/presets/opencode/prompts/v1.0.0/reviewer.md +6 -0
  124. package/presets/opencode/prompts/v1.0.0/tester.md +6 -0
  125. package/presets/opencode/skills/backlog/SKILL.md +40 -70
  126. package/presets/opencode/skills/evaluation/SKILL.md +61 -2
  127. package/presets/opencode/skills/openspec/SKILL.md +46 -34
  128. package/presets/opencode/skills/testing-tdd/SKILL.md +35 -574
  129. package/presets/opencode/skills/using-cc-skills/SKILL.md +48 -0
  130. package/presets/shared/__pycache__/mutation_runner.cpython-314.pyc +0 -0
  131. package/presets/shared/invoke-hook.cjs +115 -0
  132. package/presets/shared/mutation_runner.py +273 -0
  133. package/src/presets/manifests/agy.yml +2 -0
  134. package/src/presets/manifests/claude.yml +3 -0
  135. package/src/presets/manifests/gemini.yml +15 -0
  136. package/src/presets/models/agy.yml +24 -24
  137. package/src/presets/models/claude.yml +10 -10
  138. package/src/presets/models/codex.yml +10 -10
  139. package/src/presets/models/cursor.yml +10 -10
  140. package/src/presets/models/gemini.yml +10 -10
  141. package/src/presets/models/opencode.yml +10 -10
  142. package/presets/agy/scripts/post-tool.sh +0 -25
  143. package/presets/agy/scripts/pre-tool.sh +0 -56
@@ -0,0 +1,192 @@
1
+ ---
2
+ name: cc-spec-mutation
3
+ description: into an immutable Gherkin contract (SHA-256 frozen), implement under the three laws of TDD, pass a judge audit, and merge only if every mutant dies.
4
+ ---
5
+
6
+ # spec-mutation
7
+
8
+ Invoke as `$cc-spec-mutation`. The user request follows the skill mention.
9
+
10
+ # Spec-Mutation — Hard Spec → TDD → Judge → Mutation Gate
11
+
12
+ Scope: $ARGUMENTS
13
+
14
+ Describe what behavior you want to implement. Include:
15
+
16
+ - The function, method, or feature to implement
17
+ - The expected behavior (inputs, outputs, invariants, edge cases)
18
+ - The allowed file scope (production files that may change)
19
+ - The test command for the affected suite (e.g. `pytest tests/test_billing.py`)
20
+
21
+ ---
22
+
23
+ ## Step 0 — CCEP Bootstrap
24
+
25
+ Command: `spec-mutation` (fixed for this workflow — do not infer from user text)
26
+
27
+ 1. Run: `npx cc-codeconductor ccep parse --command spec-mutation "$ARGUMENTS" --output json`
28
+ 2. Run: `npx cc-codeconductor ccep resolve --command spec-mutation "$ARGUMENTS" --output json`
29
+ 3. Run: `npx cc-codeconductor ccep profile spec-mutation --output json`
30
+ 4. After planner/intake JSON is available, run: `npx cc-codeconductor ccep evaluate --command spec-mutation --input <planner.json> --output json`. If `stop` is true, show questions or risks and wait for human input.
31
+ 5. Delegate to subagents using compiled CCEP prompts — never forward raw `$ARGUMENTS` to planners.
32
+ Canonical delivery order is test-before-implement whenever both phases apply.
33
+
34
+ ---
35
+
36
+ ## Step 0b — OpenSpec quality gates
37
+
38
+ If `openspec status` reports an active change folder:
39
+
40
+ 1. Run: `npx cc-codeconductor openspec validate --output json`
41
+ 2. Run: `npx cc-codeconductor openspec analyze --output json`
42
+ 3. If analyze `stop` is true or any finding is CRITICAL, stop. Do not delegate to implementer.
43
+ 4. Next command spelling on this runner: `/cc:spec-mutation`
44
+
45
+ Local development: `bun run dev <same argv>`. Published package: `npx cc-codeconductor`.
46
+
47
+ ---
48
+
49
+ ## Contract
50
+
51
+ The Gherkin specification is the **immutable contract** of the system. No code
52
+ merges unless it survives intentional source mutations. The loop is closed:
53
+
54
+ ```
55
+ [Human + spec_partner] ──> [gherkin_author] ──> [Test Freeze: SHA-256]
56
+
57
+ ┌──────────────────────────────────────────────────────┘
58
+
59
+ [tdd_craftsman] <───────────────┐ (surviving mutant)
60
+ (Red-Green-Refactor) │
61
+ │ │
62
+ ▼ │
63
+ [judge] ───────────> [mutation_testing] ───> [Safe Merge]
64
+ ```
65
+
66
+ Role mapping onto Conductor Agents (AGENTS.md):
67
+
68
+ | Workflow role | Conductor Agent | Deliverable |
69
+ | ------------------ | ----------------- | ------------------------------------------ |
70
+ | `craftsman_lead` | `orchestrator` | Routed Task Cards, per-stage scorecards |
71
+ | `spec_partner` | `task-coach` | Spec draft with invariants and boundaries |
72
+ | `gherkin_author` | `contract-builder`| Strict `.feature` file (Given/When/Then) |
73
+ | `tdd_craftsman` | `tester` → `implementer` | Failing test, then minimal production code |
74
+ | `judge` | `reviewer` | Binary verdict (PASS/REJECT) with scoring |
75
+ | `mutation_testing` | `tester` (runner) | Killed/survived mutant report |
76
+
77
+ ## Stage 1 — Interactive refinement (`spec_partner` / task-coach)
78
+
79
+ Do not jump to implementation. Apply Socratic questioning to the initial intent:
80
+
81
+ - Preconditions, postconditions, and edge cases.
82
+ - Invariant matrix: what must always be true.
83
+ - Scope boundaries: explicit `Scope / Files` and `Scope / Out` for the Task Card.
84
+
85
+ Stop gate: human confirms the draft before formalization.
86
+
87
+ ## Stage 2 — Hard Spec formalization (`gherkin_author` / contract-builder)
88
+
89
+ Formalize the agreed draft into `specs/<task>.feature` using strict Gherkin:
90
+
91
+ - No vague language ("must respond fast" is forbidden — use measurable Then steps).
92
+ - Every scenario declares preconditions (`Given`), actions (`When`), and
93
+ observable states (`Then`).
94
+ - Once the human approves the `.feature`, freeze it:
95
+
96
+ ```bash
97
+ shasum -a 256 specs/<task>.feature tests/ > .codeconductor/tasks/<task_id>.lock
98
+ ```
99
+
100
+ From this point `specs/` and `tests/` are **read-only** for implementation
101
+ agents. Before every later gate, recompute the hash; any single-byte difference
102
+ aborts the pipeline with scorecard 0 (Specification Gaming).
103
+
104
+ ## Stage 3 — TDD under the three laws (`tdd_craftsman`)
105
+
106
+ Delegates to the `/cc:tdd-cycle` state machine (`tddCycleStateMachine` in
107
+ `domain/loop`). Evidence must be captured with `captureTddSuiteEvidence` — do
108
+ not hand-edit JSON under `.codeconductor/evidence/`.
109
+
110
+ 1. **Law 1 (RED):** no production code except to make a failing test pass. A
111
+ compile error from a missing interface counts as a failure.
112
+ 2. **Law 2:** write exactly one failing assertion or scenario at a time.
113
+ 3. **Law 3 (GREEN):** write only the minimal production code to pass. No
114
+ speculative code, no preventive heuristics, stdlib-first.
115
+
116
+ Hard rule: any write attempt against `specs/` or `tests/` during GREEN/REFACTOR
117
+ is a harness violation — stop execution and report.
118
+
119
+ ## Stage 4 — Judge audit (`judge` / reviewer)
120
+
121
+ Deterministic gates before spending compute on mutation:
122
+
123
+ - Clean compile / diagnostics exit code 0.
124
+ - Traceability: every Gherkin step maps to an implemented test step.
125
+ - Scope Gaming audit: `git diff --name-only` must match the Task Card
126
+ `Scope / Files` exactly. Relaxed types, weakened assertions, or out-of-scope
127
+ edits → REJECT with findings.
128
+
129
+ Verdict is binary: PASS continues to the mutation gate; REJECT returns to the
130
+ `implement` phase with the findings attached.
131
+
132
+ ## Stage 5 — Mutation gate (`mutation_testing`)
133
+
134
+ Run the deterministic AST mutator shipped with this preset:
135
+
136
+ ```bash
137
+ python3 presets/shared/mutation_runner.py \
138
+ --target <production_file.py> \
139
+ --test-command "<test command>" \
140
+ --spec-folder specs
141
+ ```
142
+
143
+ The runner applies deterministic operator mutations (`>` → `<=`, `==` → `!=`,
144
+ `is` → `is not`, …) one at a time, re-runs the suite per mutant, and restores
145
+ the original source unconditionally (`finally` rollback).
146
+
147
+ - **Mutant killed (tests fail):** the suite detects the corruption. Continue.
148
+ - **Mutant survived (tests pass):** the tests are blind to this branch. The
149
+ runner writes `specs/handover.md` + appends to
150
+ `specs/implementation-summary.md` and exits with code **2**.
151
+
152
+ Non-Python stacks: substitute Stryker (JS/TS), PITest (JVM), or Mutmut
153
+ (Python full-suite) with the same contract — 100% kill rate or hands-off.
154
+
155
+ ### Hands-off protocol (exit code 2)
156
+
157
+ 1. Do NOT modify production code to "fix" a surviving mutant.
158
+ 2. Route back to `tdd_craftsman` with `specs/handover.md` as input: write the
159
+ missing failing test (Law 1 & 2) that asserts the mutated branch.
160
+ 3. Re-run stages 3–5.
161
+
162
+ ### Circuit breaker (max 3 loops)
163
+
164
+ The orchestrator keeps a persistent counter per Task Card. If the
165
+ `tdd_craftsman ↔ mutation_testing` loop does not reach a 100% kill rate after
166
+ **3 iterations**:
167
+
168
+ - Cancel active subagents (stop token/context spend).
169
+ - `git checkout -- <scope>` rollback to the last clean state.
170
+ - Scorecard: `STATUS = BLOCKED`; escalate to a human operator. The branch stays
171
+ frozen until human arbitration.
172
+
173
+ ## Guardrails (harness-enforced, not prompt-enforced)
174
+
175
+ - **Test Freezing:** SHA-256 of `specs/` + `tests/` stored in
176
+ `.codeconductor/tasks/<task_id>.lock`; hash mismatch aborts the pipeline.
177
+ - **Scope Guardian:** `fs_write`/`fs_patch` paths are validated against the Task
178
+ Card `Scope / Files`; path escapes (`../`) and critical files (`**/.env*`,
179
+ `**/credentials*`, infrastructure roots) are denied per `policy.yml`.
180
+ - **RBAC per role:** `gherkin_author` writes only `specs/`; `tdd_craftsman`
181
+ reads specs/tests and writes only scoped `src/`; `judge` and
182
+ `mutation_testing` are read-only except the runner's rolled-back patch.
183
+ - **Worktree isolation:** run the whole flow in a dedicated `git worktree`;
184
+ protected branches (`main`, `master`, `develop`) are never touched.
185
+
186
+ ## Completion criteria
187
+
188
+ - [ ] `.feature` approved and frozen (SHA-256 lock file exists and matches).
189
+ - [ ] RED → GREEN → REFACTOR evidence captured per phase.
190
+ - [ ] Judge verdict PASS (compile clean, traceability complete, scope clean).
191
+ - [ ] Mutation runner exits 0 with `total_mutants_killed == total_points`.
192
+ - [ ] Scorecard records the kill rate and iteration count (≤ 3).
@@ -0,0 +1,266 @@
1
+ ---
2
+ name: cc-tdd-cycle
3
+ description: test first, implement the minimum code to pass it, then refactor with the suite green.
4
+ ---
5
+
6
+ # tdd-cycle
7
+
8
+ Invoke as `$cc-tdd-cycle`. The user request follows the skill mention.
9
+
10
+ # TDD Cycle — Red → Green → Refactor
11
+
12
+ Scope: $ARGUMENTS
13
+
14
+ Describe what behavior you want to implement. Include:
15
+
16
+ - The function, method, or feature to implement
17
+ - The expected behavior (inputs and outputs, or acceptance criteria)
18
+ - Any known constraints or edge cases
19
+ - Relevant files or modules (if known)
20
+
21
+ ---
22
+
23
+ ## Step 0 — CCEP Bootstrap
24
+
25
+ Command: `tdd-cycle` (fixed for this workflow — do not infer from user text)
26
+
27
+ 1. Run: `npx cc-codeconductor ccep parse --command tdd-cycle "$ARGUMENTS" --output json`
28
+ 2. Run: `npx cc-codeconductor ccep resolve --command tdd-cycle "$ARGUMENTS" --output json`
29
+ 3. Run: `npx cc-codeconductor ccep profile tdd-cycle --output json`
30
+ 4. After planner/intake JSON is available, run: `npx cc-codeconductor ccep evaluate --command tdd-cycle --input <planner.json> --output json`. If `stop` is true, show questions or risks and wait for human input.
31
+ 5. Delegate to subagents using compiled CCEP prompts — never forward raw `$ARGUMENTS` to planners.
32
+ Canonical delivery order is test-before-implement whenever both phases apply.
33
+
34
+ ---
35
+
36
+ ## Step 0b — OpenSpec quality gates
37
+
38
+ If `openspec status` reports an active change folder:
39
+
40
+ 1. Run: `npx cc-codeconductor openspec validate --output json`
41
+ 2. Run: `npx cc-codeconductor openspec analyze --output json`
42
+ 3. If analyze `stop` is true or any finding is CRITICAL, stop. Do not delegate to implementer.
43
+ 4. Next command spelling on this runner: `/cc:tdd-cycle`
44
+
45
+ Local development: `bun run dev <same argv>`. Published package: `npx cc-codeconductor`.
46
+
47
+ ---
48
+
49
+
50
+ ## Before you begin — mandatory pre-check
51
+
52
+ This command enforces strict TDD discipline. The three phases are sequential and
53
+ non-negotiable:
54
+
55
+ 1. **RED** — a failing test exists before any implementation code is written
56
+ 2. **GREEN** — the minimum implementation to make the test pass (no more)
57
+ 3. **REFACTOR** — clean up the code while keeping all tests green
58
+
59
+ Do not write implementation code during RED. Do not refactor during GREEN.
60
+ Mixing phases invalidates the cycle.
61
+
62
+ ## Verifiable phase gates
63
+
64
+ RED → GREEN and GREEN → REFACTOR are enforced by `tddCycleStateMachine` in
65
+ `domain/loop`. Evidence must be captured with `captureTddSuiteEvidence` (verification
66
+ runner) — do not hand-edit JSON under `.codeconductor/evidence/`.
67
+
68
+ - RED→GREEN requires runner evidence that the suite **failed**.
69
+ - GREEN→REFACTOR requires runner evidence that the suite **passed**.
70
+
71
+ Do not advance phases until that evidence exists.
72
+
73
+ ---
74
+
75
+ ## Phase 1 — RED (Tester role)
76
+
77
+ Invoke the `tester` subagent via the Task tool.
78
+
79
+ ### 1a — Scope clarification
80
+
81
+ Before writing any test, confirm:
82
+
83
+ - What is the unit of behavior being tested? (function, method, endpoint, domain
84
+ rule)
85
+ - What are the inputs and expected outputs?
86
+ - What are the failure cases?
87
+
88
+ If the scope is ambiguous, ask one clarifying question and wait for the answer.
89
+
90
+ ### 1b — Write the failing test
91
+
92
+ Write a test that:
93
+
94
+ - Targets exactly the behavior described in the scope
95
+ - Fails for the right reason (not a compile error, not a missing dependency —
96
+ the logic does not exist yet)
97
+ - Has a name that describes the behavior: `given_X_when_Y_then_Z` or equivalent
98
+ in the project's test naming convention
99
+ - Covers at minimum: one happy path, one edge case, one failure case
100
+
101
+ Do not write the implementation. Do not make the test pass by any means other
102
+ than the implementation that will follow in Phase 2.
103
+
104
+ ### 1c — Run the test suite and confirm RED
105
+
106
+ Run the test suite. The new test must fail. Existing tests must pass.
107
+
108
+ If the new test passes without implementation, the test is wrong. Fix the test
109
+ before continuing.
110
+
111
+ **RED Phase Report:**
112
+
113
+ ```
114
+ ## RED Phase Report
115
+
116
+ **Test file**: [path/to/test/file]
117
+ **Tests written**:
118
+ - [test name] — [what it verifies]
119
+
120
+ **Suite result**: [X passing, Y failing]
121
+ **New test status**: FAIL ✓
122
+ **Failure reason**: [quoted error or assertion message]
123
+ **Existing tests**: [all passing | N failing — list]
124
+ ```
125
+
126
+ **STOP. Show the RED Phase Report. Do not proceed to GREEN without
127
+ confirmation.**
128
+
129
+ ---
130
+
131
+ ## Phase 2 — GREEN (Implementer role)
132
+
133
+ Invoke the `implementer` subagent via the Task tool.
134
+
135
+ ### 2a — Read the failing test before writing any code
136
+
137
+ Understand exactly what the test asserts. Write only the code that satisfies
138
+ that assertion. Nothing more.
139
+
140
+ ### 2b — Implement the minimum
141
+
142
+ Rules for GREEN phase:
143
+
144
+ - Write the smallest amount of code that makes the failing test pass
145
+ - Do not add features not tested
146
+ - Do not clean up or restructure existing code — that is Refactor's job
147
+ - Do not add new tests — that is another RED cycle
148
+ - Hardcoding a return value is acceptable if it makes the test pass (the
149
+ Refactor phase will generalize it)
150
+
151
+ ### 2c — Run the test suite and confirm GREEN
152
+
153
+ Run the test suite. The new test must pass. All previously passing tests must
154
+ still pass.
155
+
156
+ If any previously passing test now fails, you introduced a regression. Fix it
157
+ before continuing.
158
+
159
+ **GREEN Phase Report:**
160
+
161
+ ```
162
+ ## GREEN Phase Report
163
+
164
+ **Files changed**:
165
+ - [path/to/file] — [what was added, one sentence]
166
+
167
+ **Implementation approach**: [one sentence — what the code does]
168
+ **Suite result**: [X passing, Y failing]
169
+ **New test status**: PASS ✓
170
+ **Regressions**: [none | list failing tests]
171
+ ```
172
+
173
+ **STOP. Show the GREEN Phase Report. Do not proceed to REFACTOR without
174
+ confirmation.**
175
+
176
+ ---
177
+
178
+ ## Phase 3 — REFACTOR (Implementer role, then Reviewer role)
179
+
180
+ Invoke the `implementer` subagent via the Task tool.
181
+
182
+ ### 3a — Assess what needs cleaning
183
+
184
+ Before touching any code, identify:
185
+
186
+ - Duplication introduced during GREEN
187
+ - Names that do not clearly express intent
188
+ - Abstractions that belong in a separate function or module
189
+ - Logic that is hardcoded and should be generalized
190
+
191
+ Do not invent improvements. Only address what is directly in the implementation
192
+ written in Phase 2.
193
+
194
+ ### 3b — Refactor
195
+
196
+ Rules for REFACTOR phase:
197
+
198
+ - All tests must remain GREEN throughout — run the suite after each change
199
+ - Do not add new behavior
200
+ - Do not add new tests (if you discover untested behavior, note it for a new RED
201
+ cycle)
202
+ - Do not change function signatures unless the original was clearly wrong
203
+
204
+ ### 3c — Run the test suite and confirm GREEN after refactor
205
+
206
+ The full suite must pass. If any test fails during refactor, undo the last
207
+ change and investigate.
208
+
209
+ ### 3d — Review (Reviewer role)
210
+
211
+ Invoke the `reviewer` subagent via the Task tool.
212
+
213
+ Review only the refactored code against these axes:
214
+
215
+ | Axis | What to check |
216
+ | ------------- | --------------------------------------------------------------- |
217
+ | Scope | Did the refactor change any behavior? |
218
+ | Correctness | Does the logic still satisfy the original test intent? |
219
+ | Architecture | Does the code follow existing project patterns? |
220
+ | Test coverage | Are all written tests still meaningful (not trivially passing)? |
221
+
222
+ Produce a Review Report. CRITICAL findings block completion.
223
+
224
+ **REFACTOR Phase Report:**
225
+
226
+ ```
227
+ ## REFACTOR Phase Report
228
+
229
+ **Changes made**:
230
+ - [path/to/file] — [what was cleaned up]
231
+
232
+ **Suite result**: [X passing, Y failing]
233
+ **Behavioral changes**: none (refactor only)
234
+
235
+ ### Review findings
236
+ **CRITICAL**: (none) | [list]
237
+ **WARNING**: (none) | [list]
238
+ **SUGGESTION**: (none) | [list]
239
+
240
+ **Verdict**: approved | approved with warnings | blocked
241
+ ```
242
+
243
+ ---
244
+
245
+ ## Completion
246
+
247
+ The TDD cycle is complete when:
248
+
249
+ - RED: at least one failing test was written and confirmed failing
250
+ - GREEN: the minimum implementation makes the test pass
251
+ - REFACTOR: the code is clean, all tests pass, no CRITICAL review findings
252
+
253
+ **Final Summary:**
254
+
255
+ ```
256
+ ## TDD Cycle Summary
257
+
258
+ **Behavior implemented**: [one sentence]
259
+ **Tests written**: [count] — [list test names]
260
+ **Files changed**: [list]
261
+ **Suite result**: [X passing, Y failing]
262
+ **Cycle status**: complete | blocked (reason)
263
+ ```
264
+
265
+ If the behavior requires additional test cases, start a new `/tdd-cycle` with
266
+ the next scenario. One cycle = one behavior.
@@ -0,0 +1,153 @@
1
+ ---
2
+ name: cc-test-plan
3
+ description: unit, integration, contract, and edge cases without writing implementation code.
4
+ ---
5
+
6
+ # test-plan
7
+
8
+ Invoke as `$cc-test-plan`. The user request follows the skill mention.
9
+
10
+ # Test Plan Workflow
11
+
12
+ Scope: $ARGUMENTS
13
+
14
+ Specify what to plan tests for. Examples:
15
+
16
+ - A feature name: `user authentication`
17
+ - A module or file path: `src/orders/OrderService.kt`
18
+ - A Task Card title: `Add paginated product listing endpoint`
19
+ - A PR or branch: `feature/payment-retry`
20
+
21
+ If $ARGUMENTS is empty, describe the scope in your next message before
22
+ proceeding.
23
+
24
+ ---
25
+
26
+ ## Step 0 — CCEP Bootstrap
27
+
28
+ Command: `test-plan` (fixed for this workflow — do not infer from user text)
29
+
30
+ 1. Run: `npx cc-codeconductor ccep parse --command test-plan "$ARGUMENTS" --output json`
31
+ 2. Run: `npx cc-codeconductor ccep resolve --command test-plan "$ARGUMENTS" --output json`
32
+ 3. Run: `npx cc-codeconductor ccep profile test-plan --output json`
33
+ 4. After planner/intake JSON is available, run: `npx cc-codeconductor ccep evaluate --command test-plan --input <planner.json> --output json`. If `stop` is true, show questions or risks and wait for human input.
34
+ 5. Delegate to subagents using compiled CCEP prompts — never forward raw `$ARGUMENTS` to planners.
35
+
36
+ ---
37
+
38
+ ## Step 1 — Scope confirmation
39
+
40
+ Before generating the test plan, confirm the scope is well-defined.
41
+
42
+ A valid scope includes:
43
+
44
+ - The behavior or module under test
45
+ - The acceptance criteria or expected behavior (from the Task Card if available)
46
+ - Known edge cases or failure modes
47
+
48
+ If the scope is vague (e.g., "test the whole service"), ask one clarifying
49
+ question and wait for the answer.
50
+
51
+ ---
52
+
53
+ ## Step 2 — Test plan generation (Tester role, planning mode)
54
+
55
+ Invoke the `tester` subagent via the Task tool.
56
+
57
+ Produce a test plan document — not test code. The plan will be used as input
58
+ when tests are actually written.
59
+
60
+ Cover the following layers:
61
+
62
+ **Unit tests**
63
+
64
+ - Individual functions or methods in isolation
65
+ - One test per behavior, not per method
66
+ - Input/output contracts, null handling, type coercion
67
+
68
+ **Integration tests**
69
+
70
+ - Interactions between two or more components
71
+ - Database read/write cycles (if applicable)
72
+ - External service boundaries (mocked or stubbed)
73
+
74
+ **Contract tests**
75
+
76
+ - API endpoint contracts: request shape, response shape, status codes
77
+ - Event schema contracts (if event-driven components are in scope)
78
+
79
+ **Edge cases**
80
+
81
+ - Empty inputs, boundary values, max/min limits
82
+ - Concurrent access (if shared state is involved)
83
+ - Failure paths: what happens when a dependency is unavailable
84
+
85
+ **Regression cases**
86
+
87
+ - Known past bugs that must not recur (include reference if available)
88
+
89
+ ---
90
+
91
+ ## Step 3 — Test Plan format
92
+
93
+ Produce the plan in this format:
94
+
95
+ ```markdown
96
+ ## Test Plan — [Scope Name]
97
+
98
+ ### Scope
99
+ [What is being tested and why]
100
+
101
+ ### Unit Tests
102
+ | Test ID | Target | Scenario | Expected Result |
103
+ | ------- | ------ | -------- | --------------- |
104
+ | U-001 | ... | ... | ... |
105
+
106
+ ### Integration Tests
107
+ | Test ID | Components | Scenario | Expected Result |
108
+ | ------- | ---------- | -------- | --------------- |
109
+ | I-001 | ... | ... | ... |
110
+
111
+ ### Contract Tests
112
+ | Test ID | Endpoint/Event | Property | Expected Value |
113
+ | ------- | -------------- | -------- | -------------- |
114
+ | C-001 | ... | ... | ... |
115
+
116
+ ### Edge Cases
117
+ | Test ID | Input/Condition | Expected Behavior |
118
+ | ------- | --------------- | ----------------- |
119
+ | E-001 | ... | ... |
120
+
121
+ ### Regression Cases
122
+ | Test ID | Reference | Scenario | Must Not Happen |
123
+ | ------- | --------- | -------- | --------------- |
124
+ | R-001 | ... | ... | ... |
125
+
126
+ ### Coverage Targets
127
+ - Minimum unit coverage: [% or "all acceptance criteria covered"]
128
+ - Integration scenarios: [count]
129
+ - Contract validations: [count]
130
+
131
+ ### Out of Scope
132
+ [What this test plan explicitly does not cover and why]
133
+ ```
134
+
135
+ ---
136
+
137
+ ## Step 4 — Human review
138
+
139
+ Show the Test Plan before any tests are written. The Test Plan is an artifact
140
+ for review and approval.
141
+
142
+ Writing test code is a separate action — run `/feature` or add a test task to
143
+ implement from this plan.
144
+
145
+ ---
146
+
147
+ ## Completion
148
+
149
+ Deliver the complete Test Plan document. Save it as
150
+ `docs/test-plans/[scope-slug].md` if requested.
151
+
152
+ This command produces a plan, not test files. No production code and no test
153
+ code is written during this command.
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: cc-triage
3
+ description: CodeConductor triage workflow
4
+ ---
5
+
6
+ # triage
7
+
8
+ Invoke as `$cc-triage`. The user request follows the skill mention.
9
+
10
+ # Triage Workflow
11
+
12
+ Triage request: $ARGUMENTS
13
+
14
+ ## Step 0 — CCEP Bootstrap
15
+
16
+ Command: `triage` (fixed for this workflow — do not infer from user text)
17
+
18
+ 1. Run: `npx cc-codeconductor ccep parse --command triage "$ARGUMENTS" --output json`
19
+ 2. Run: `npx cc-codeconductor ccep resolve --command triage "$ARGUMENTS" --output json`
20
+ 3. Run: `npx cc-codeconductor ccep profile triage --output json`
21
+ 4. After planner/intake JSON is available, run: `npx cc-codeconductor ccep evaluate --command triage --input <planner.json> --output json`. If `stop` is true, show questions or risks and wait for human input.
22
+ 5. Delegate to subagents using compiled CCEP prompts — never forward raw `$ARGUMENTS` to planners.
23
+
24
+ ---
25
+
26
+ ## Step 1 — Classify (task-coach)
27
+
28
+ Invoke `task-coach`. Produce: title, type (`feature` | `fix` | `refactor` | `review` | `docs` | `test`), risk, named scope, and the destination command (`feature`, `fix`, `refactor`, `review`, `explore`, …).
29
+
30
+ Ask one question per unresolved branch. If the human is unavailable, emit a Markdown questionnaire and stop at ConfirmationGate.
31
+
32
+ **STOP here. Show the classification and wait for confirmation before running the destination workflow.**
33
+
34
+ ---
35
+
36
+ ## Completion
37
+
38
+ Do not implement. Hand the human a destination slash command and a partial Task Card.