cc-codeconductor 0.2.1

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 (93) hide show
  1. package/LICENSE +18 -0
  2. package/README.md +319 -0
  3. package/dist/index.js +12741 -0
  4. package/package.json +51 -0
  5. package/policy.yml +124 -0
  6. package/presets/claude/CLAUDE.md +598 -0
  7. package/presets/claude/commands/cc/feature.md +115 -0
  8. package/presets/claude/commands/cc/fix.md +121 -0
  9. package/presets/claude/commands/cc/refactor.md +148 -0
  10. package/presets/claude/commands/cc/review.md +126 -0
  11. package/presets/claude/commands/cc/tdd-cycle.md +226 -0
  12. package/presets/claude/commands/cc/test-plan.md +138 -0
  13. package/presets/claude/settings.json +37 -0
  14. package/presets/claude/skills/api-versioning/SKILL.md +389 -0
  15. package/presets/claude/skills/django-orm/SKILL.md +455 -0
  16. package/presets/claude/skills/django-testing/SKILL.md +409 -0
  17. package/presets/claude/skills/jpa-postgres/SKILL.md +618 -0
  18. package/presets/claude/skills/python/SKILL.md +606 -0
  19. package/presets/claude/skills/python-django-stack/SKILL.md +492 -0
  20. package/presets/claude/skills/python-fastapi-stack/SKILL.md +457 -0
  21. package/presets/claude/skills/spring-boot-feature/SKILL.md +558 -0
  22. package/presets/claude/skills/spring-boot-kotlin/SKILL.md +400 -0
  23. package/presets/claude/skills/sqlalchemy/SKILL.md +466 -0
  24. package/presets/claude/skills/testing-strategy/SKILL.md +479 -0
  25. package/presets/codex/AGENTS.md +883 -0
  26. package/presets/codex/README.md +102 -0
  27. package/presets/codex/skills/api-versioning/SKILL.md +389 -0
  28. package/presets/codex/skills/django-orm/SKILL.md +455 -0
  29. package/presets/codex/skills/django-testing/SKILL.md +409 -0
  30. package/presets/codex/skills/jpa-postgres/SKILL.md +618 -0
  31. package/presets/codex/skills/python/SKILL.md +606 -0
  32. package/presets/codex/skills/python-django-stack/SKILL.md +492 -0
  33. package/presets/codex/skills/python-fastapi-stack/SKILL.md +457 -0
  34. package/presets/codex/skills/spring-boot-feature/SKILL.md +558 -0
  35. package/presets/codex/skills/spring-boot-kotlin/SKILL.md +400 -0
  36. package/presets/codex/skills/sqlalchemy/SKILL.md +466 -0
  37. package/presets/codex/skills/testing-strategy/SKILL.md +479 -0
  38. package/presets/opencode/README.md +191 -0
  39. package/presets/opencode/agents/architect.md +133 -0
  40. package/presets/opencode/agents/docs.md +113 -0
  41. package/presets/opencode/agents/implementer.md +116 -0
  42. package/presets/opencode/agents/orchestrator.md +248 -0
  43. package/presets/opencode/agents/repo-explorer.md +119 -0
  44. package/presets/opencode/agents/reviewer.md +130 -0
  45. package/presets/opencode/agents/task-coach.md +103 -0
  46. package/presets/opencode/agents/tester.md +269 -0
  47. package/presets/opencode/commands/cc-feature.md +114 -0
  48. package/presets/opencode/commands/cc-fix.md +123 -0
  49. package/presets/opencode/commands/cc-refactor.md +148 -0
  50. package/presets/opencode/commands/cc-review.md +141 -0
  51. package/presets/opencode/commands/cc-tdd-cycle.md +225 -0
  52. package/presets/opencode/commands/cc-test-plan.md +144 -0
  53. package/presets/opencode/opencode.jsonc +89 -0
  54. package/presets/opencode/prompts/v0.1.0/architect.md +213 -0
  55. package/presets/opencode/prompts/v0.1.0/docs.md +181 -0
  56. package/presets/opencode/prompts/v0.1.0/implementer.md +154 -0
  57. package/presets/opencode/prompts/v0.1.0/orchestrator.md +169 -0
  58. package/presets/opencode/prompts/v0.1.0/repo-explorer.md +102 -0
  59. package/presets/opencode/prompts/v0.1.0/reviewer.md +183 -0
  60. package/presets/opencode/prompts/v0.1.0/task-coach.md +142 -0
  61. package/presets/opencode/prompts/v0.1.0/tester.md +160 -0
  62. package/presets/opencode/prompts/v0.2.0/architect.md +219 -0
  63. package/presets/opencode/prompts/v0.2.0/docs.md +187 -0
  64. package/presets/opencode/prompts/v0.2.0/implementer.md +160 -0
  65. package/presets/opencode/prompts/v0.2.0/orchestrator.md +238 -0
  66. package/presets/opencode/prompts/v0.2.0/repo-explorer.md +108 -0
  67. package/presets/opencode/prompts/v0.2.0/reviewer.md +190 -0
  68. package/presets/opencode/prompts/v0.2.0/task-coach.md +153 -0
  69. package/presets/opencode/prompts/v0.2.0/tester.md +249 -0
  70. package/presets/opencode/skills/api-versioning/SKILL.md +388 -0
  71. package/presets/opencode/skills/astro/SKILL.md +313 -0
  72. package/presets/opencode/skills/code-review/SKILL.md +202 -0
  73. package/presets/opencode/skills/django-orm/SKILL.md +455 -0
  74. package/presets/opencode/skills/django-testing/SKILL.md +408 -0
  75. package/presets/opencode/skills/django-uv/SKILL.md +400 -0
  76. package/presets/opencode/skills/jpa-postgres/SKILL.md +617 -0
  77. package/presets/opencode/skills/nextjs-typescript/SKILL.md +385 -0
  78. package/presets/opencode/skills/python/SKILL.md +605 -0
  79. package/presets/opencode/skills/python-django-stack/SKILL.md +491 -0
  80. package/presets/opencode/skills/python-fastapi-stack/SKILL.md +456 -0
  81. package/presets/opencode/skills/security/SKILL.md +376 -0
  82. package/presets/opencode/skills/spring-boot-feature/SKILL.md +557 -0
  83. package/presets/opencode/skills/spring-boot-kotlin/SKILL.md +399 -0
  84. package/presets/opencode/skills/spring-boot-testing-strategy/SKILL.md +470 -0
  85. package/presets/opencode/skills/sqlalchemy/SKILL.md +465 -0
  86. package/presets/opencode/skills/testing-tdd/SKILL.md +586 -0
  87. package/src/presets/council/council.yml +59 -0
  88. package/src/presets/manifests/claude.yml +23 -0
  89. package/src/presets/manifests/codex.yml +12 -0
  90. package/src/presets/manifests/opencode.yml +18 -0
  91. package/src/presets/models/claude.yml +37 -0
  92. package/src/presets/models/codex.yml +38 -0
  93. package/src/presets/models/opencode.yml +37 -0
@@ -0,0 +1,121 @@
1
+ ---
2
+ description: >-
3
+ [cc: alias] Run the bug fix workflow — risk-based routing through task
4
+ validation, implementation, testing, and optional review.
5
+ ---
6
+
7
+ # Bug Fix Workflow
8
+
9
+ Bug description: $ARGUMENTS
10
+
11
+ Provide the following information in $ARGUMENTS:
12
+
13
+ - What is the incorrect behavior (actual)
14
+ - What is the expected behavior
15
+ - Steps to reproduce
16
+ - Environment or version where the bug occurs (if known)
17
+ - Any relevant error messages or stack traces
18
+
19
+ ---
20
+
21
+ ## Step 1 — Task Card validation (Task Coach role)
22
+
23
+ Adopt the **Task Coach** role as defined in `CLAUDE.md`.
24
+
25
+ Produce a Task Card that includes:
26
+
27
+ - A clear statement of actual vs. expected behavior
28
+ - Reproduction steps (or a note that they are unknown)
29
+ - Risk classification: `low`, `medium`, or `high`
30
+ - Scope: which files or modules are likely affected
31
+
32
+ If reproduction steps are missing, ask for them before classifying risk. A bug
33
+ without a reproduction path cannot be classified reliably.
34
+
35
+ **STOP here. Show the Task Card and wait for human confirmation.**
36
+
37
+ ---
38
+
39
+ ## Step 2 — Route by risk
40
+
41
+ Read the risk field from the Task Card and follow the corresponding route.
42
+
43
+ ### Low-risk route
44
+
45
+ Applies when: the bug is isolated to a single component, existing tests cover
46
+ the affected code, and no public API or shared state is involved.
47
+
48
+ Route: Task Coach → Implementer → Tester
49
+
50
+ Proceed directly to Step 3a.
51
+
52
+ ### Medium or high-risk route
53
+
54
+ Applies when: the bug touches shared state, a public API, auth or payment paths,
55
+ database writes, or the root cause is not yet understood.
56
+
57
+ Route: Task Coach → Architect → Implementer → Tester → Reviewer
58
+
59
+ Adopt the **Architect** role before implementation. Architect must:
60
+
61
+ - Identify the root cause (or document that it is unknown)
62
+ - Define the fix approach and affected files
63
+ - Flag any regression risk to adjacent components
64
+ - Produce a Technical Plan
65
+
66
+ **STOP here if high-risk. Show the Technical Plan and wait for human approval
67
+ before continuing.**
68
+
69
+ ---
70
+
71
+ ## Step 3a — Implementation, low-risk (Implementer role)
72
+
73
+ Adopt the **Implementer** role as defined in `CLAUDE.md`. Use the Task Card.
74
+ Implementer creates a Git Worktree before touching any file; all edits happen inside it.
75
+
76
+ 1. Locate the defect using the reproduction steps.
77
+ 2. Apply the minimal fix — no unrelated changes.
78
+ 3. Run the test suite.
79
+ 4. Produce an Implementation Summary: root cause, fix applied, files changed.
80
+
81
+ ---
82
+
83
+ ## Step 3b — Implementation, medium/high-risk (Implementer role)
84
+
85
+ Adopt the **Implementer** role as defined in `CLAUDE.md`. Use the approved
86
+ Technical Plan and the Task Card.
87
+ Implementer creates a Git Worktree before touching any file; all edits happen inside it.
88
+
89
+ Follow the plan exactly. Any deviation requires a new Technical Plan approval.
90
+ After implementation, run the full test suite.
91
+
92
+ ---
93
+
94
+ ## Step 4 — Regression tests (Tester role)
95
+
96
+ Adopt the **Tester** role as defined in `CLAUDE.md`. Apply for all risk levels.
97
+
98
+ 1. Write a regression test that reproduces the original bug (fails before the
99
+ fix, passes after).
100
+ 2. Verify that existing tests still pass.
101
+ 3. Produce a Test Report: test added, case covered.
102
+
103
+ ---
104
+
105
+ ## Step 5 — Review (Reviewer role) — medium/high-risk only
106
+
107
+ Adopt the **Reviewer** role as defined in `CLAUDE.md`. Use the diff and Task
108
+ Card.
109
+
110
+ Produce a Review Report with CRITICAL / WARNING / SUGGESTION findings. If any
111
+ CRITICAL findings exist, **STOP**. Do not close the fix until they are resolved.
112
+
113
+ ---
114
+
115
+ ## Completion
116
+
117
+ Report: Task Card, Implementation Summary, regression test added, Review Report
118
+ (if applicable).
119
+
120
+ The fix is complete only when: the regression test passes, the full suite
121
+ passes, and no CRITICAL review findings remain.
@@ -0,0 +1,148 @@
1
+ ---
2
+ description: >-
3
+ [cc: alias] Run the refactor workflow — mandatory architectural justification,
4
+ test verification, risk-based implementation, and scope enforcement.
5
+ ---
6
+
7
+ # Refactor Workflow
8
+
9
+ Refactor description: $ARGUMENTS
10
+
11
+ Describe what you want to refactor and why. Include:
12
+
13
+ - The current structure or pattern being changed
14
+ - The target structure or pattern
15
+ - The motivation (performance, readability, architectural alignment, etc.)
16
+ - Known risk areas or dependencies
17
+
18
+ ---
19
+
20
+ ## Prerequisite — Test coverage check
21
+
22
+ Before any role is adopted, verify that the code being refactored has adequate
23
+ test coverage.
24
+
25
+ A refactor without tests is not a refactor — it is a rewrite with unknown
26
+ behavioral consequences.
27
+
28
+ If coverage is insufficient:
29
+
30
+ 1. **STOP**. Report the coverage gap.
31
+ 2. Suggest running `/test-plan` first to establish coverage.
32
+ 3. Do not proceed with the refactor until coverage is confirmed.
33
+
34
+ ---
35
+
36
+ ## Step 1 — Architectural justification (Architect role)
37
+
38
+ Adopt the **Architect** role as defined in `CLAUDE.md`. Always invoke this step
39
+ first, regardless of risk level. A refactor without a written justification is
40
+ scope creep in disguise.
41
+
42
+ Produce a Refactor Plan that includes:
43
+
44
+ - Statement of the problem with the current structure
45
+ - Proposed target structure and rationale
46
+ - Affected files and module boundaries
47
+ - Risk level: `low`, `medium`, or `high`
48
+ - Behavioral invariants that must not change
49
+ - Open questions requiring human input
50
+
51
+ **Scope creep warning:** If during planning you identify unrelated improvements,
52
+ list them separately as "Out of scope." They are not part of this refactor.
53
+
54
+ **STOP here. Show the Refactor Plan and wait for explicit human approval. Do not
55
+ proceed without written approval of the plan.**
56
+
57
+ ---
58
+
59
+ ## Step 2 — Route by risk
60
+
61
+ Read the risk field from the Refactor Plan and follow the corresponding route.
62
+
63
+ ### Low-risk route
64
+
65
+ Applies when: the refactor is purely internal, no public interfaces change, full
66
+ test coverage exists for the affected code, and behavioral impact is isolated to
67
+ the refactored module.
68
+
69
+ Route: Architect (done) → Implementer
70
+
71
+ Proceed to Step 3a.
72
+
73
+ ### Medium or high-risk route
74
+
75
+ Applies when: module boundaries change, shared interfaces are affected,
76
+ performance characteristics may change, or the refactor touches more than two
77
+ files with behavioral impact.
78
+
79
+ Route: Architect (done) → Implementer → Reviewer
80
+
81
+ Proceed to Step 3b.
82
+
83
+ ---
84
+
85
+ ## Step 3a — Implementation, low-risk (Implementer role)
86
+
87
+ Adopt the **Implementer** role as defined in `CLAUDE.md`. Use the approved
88
+ Refactor Plan.
89
+ Implementer creates a Git Worktree before touching any file; all edits happen inside it.
90
+
91
+ 1. Read the Refactor Plan before opening any file.
92
+ 2. Apply only the changes specified in the plan.
93
+ 3. Run the full test suite before and after — both runs must pass.
94
+ 4. Produce an Implementation Summary: what changed, what did not change, test
95
+ results before and after.
96
+
97
+ Any deviation from the plan — including "obvious improvements" encountered
98
+ during implementation — must be flagged and held for a separate task.
99
+
100
+ ---
101
+
102
+ ## Step 3b — Implementation, medium/high-risk (Implementer role)
103
+
104
+ Same rules as Step 3a. Additionally:
105
+
106
+ - Document any unexpected complexity discovered during implementation.
107
+ - Pause and report if complexity changes the risk assessment.
108
+ - If new risks are found, **STOP** and report before continuing.
109
+
110
+ ---
111
+
112
+ ## Step 4 — Test suite verification
113
+
114
+ For all risk levels, confirm:
115
+
116
+ - All tests that existed before the refactor still pass.
117
+ - No test was deleted or commented out to make the suite pass.
118
+ - Behavior documented in the Task Card remains unchanged.
119
+
120
+ If any test fails that was passing before, the refactor has introduced a
121
+ regression. **STOP and report.**
122
+
123
+ ---
124
+
125
+ ## Step 5 — Code review (Reviewer role) — medium/high-risk only
126
+
127
+ Adopt the **Reviewer** role as defined in `CLAUDE.md`. Use the diff and Refactor
128
+ Plan.
129
+
130
+ Verify:
131
+
132
+ - The implementation matches the approved plan.
133
+ - No behavior was changed beyond the plan's scope.
134
+ - No unrelated files were modified.
135
+
136
+ Review Report must include CRITICAL / WARNING / SUGGESTION findings. CRITICAL
137
+ findings block completion.
138
+
139
+ ---
140
+
141
+ ## Completion
142
+
143
+ Report: Refactor Plan (approved), Implementation Summary, test results before
144
+ and after, Review Report (if applicable).
145
+
146
+ The refactor is complete only when: all pre-existing tests still pass, the
147
+ implementation matches the approved plan exactly, and no CRITICAL review
148
+ findings remain.
@@ -0,0 +1,126 @@
1
+ ---
2
+ description: >-
3
+ [cc: alias] Run a structured code review — produces a Review Report with
4
+ CRITICAL, WARNING, and SUGGESTION findings; CRITICAL findings block merge.
5
+ ---
6
+
7
+ # Code Review Workflow
8
+
9
+ Review target: $ARGUMENTS
10
+
11
+ Specify what to review. Accepted formats:
12
+
13
+ - A branch name: `feature/my-branch`
14
+ - A file or set of files: `src/api/UserController.kt`
15
+ - A pull request reference: `PR #42`
16
+ - Empty — defaults to the current working diff (`git diff`)
17
+
18
+ ---
19
+
20
+ ## Step 1 — Diff collection
21
+
22
+ Before adopting the Reviewer role, collect the diff for the specified target.
23
+
24
+ If $ARGUMENTS is empty or not provided:
25
+
26
+ - Use `git diff HEAD` as the review target.
27
+
28
+ If $ARGUMENTS is a branch name:
29
+
30
+ - Use `git diff main...$ARGUMENTS` (or `develop` if main is not the base).
31
+
32
+ If $ARGUMENTS is a PR reference:
33
+
34
+ - Retrieve the PR diff and the PR description for context.
35
+
36
+ If $ARGUMENTS is a file path:
37
+
38
+ - Use `git diff HEAD -- $ARGUMENTS`.
39
+
40
+ Show the diff summary (files changed, lines added/removed) before proceeding.
41
+
42
+ ---
43
+
44
+ ## Step 2 — Code review (Reviewer role)
45
+
46
+ Adopt the **Reviewer** role as defined in `CLAUDE.md`.
47
+
48
+ Evaluate the diff against the following checklist:
49
+
50
+ **Correctness**
51
+
52
+ - Does the implementation match the stated intent?
53
+ - Are there logic errors, off-by-one errors, or unhandled edge cases?
54
+
55
+ **Architecture alignment**
56
+
57
+ - Does the change follow existing module boundaries?
58
+ - Does it introduce unplanned coupling or layering violations?
59
+
60
+ **Security**
61
+
62
+ - Are inputs validated before use?
63
+ - Is there any credential, token, or secret in the diff?
64
+ - Are there SQL injection, XSS, or injection risks?
65
+
66
+ **Performance**
67
+
68
+ - Does the change introduce N+1 queries, blocking I/O, or O(n²) loops?
69
+
70
+ **Test coverage**
71
+
72
+ - Do tests exist for the new or changed behavior?
73
+ - Are assertions meaningful (not just checking that no exception is thrown)?
74
+
75
+ **Documentation**
76
+
77
+ - Are public interfaces documented?
78
+ - Is CHANGELOG updated if behavior changed?
79
+
80
+ ---
81
+
82
+ ## Step 3 — Review Report
83
+
84
+ Produce a structured Review Report with findings in three categories:
85
+
86
+ ```markdown
87
+ ## Review Report
88
+
89
+ ### CRITICAL
90
+ [Findings that must be fixed before merge — file:line, description, suggested resolution]
91
+
92
+ ### WARNING
93
+ [Findings that should be resolved before merge — same format as CRITICAL]
94
+
95
+ ### SUGGESTION
96
+ [Optional improvements — style, readability, future-proofing. These do not block merge.]
97
+
98
+ ### Summary
99
+ - Files reviewed: N
100
+ - Total findings: N (X critical, Y warnings, Z suggestions)
101
+ - Merge recommendation: APPROVED | BLOCKED
102
+ ```
103
+
104
+ ---
105
+
106
+ ## Step 4 — Merge decision
107
+
108
+ If any CRITICAL findings exist:
109
+
110
+ - The Review Report status is **BLOCKED**.
111
+ - Report all CRITICAL findings.
112
+ - Do not proceed until each CRITICAL finding is resolved.
113
+ - After resolution, run `/review` again on the same target.
114
+
115
+ If no CRITICAL findings exist:
116
+
117
+ - The Review Report status is **APPROVED**.
118
+ - Report any WARNINGs and SUGGESTIONs for human awareness.
119
+ - The human makes the final merge decision.
120
+
121
+ ---
122
+
123
+ ## Completion
124
+
125
+ Deliver the complete Review Report. Never summarize or omit findings. Every
126
+ finding must include a location and an actionable description.
@@ -0,0 +1,226 @@
1
+ ---
2
+ description: >-
3
+ [cc: alias] Run a structured Red-Green-Refactor TDD cycle — write a failing
4
+ test first, implement the minimum code to pass it, then refactor with the
5
+ suite green.
6
+ ---
7
+
8
+ # TDD Cycle — Red → Green → Refactor
9
+
10
+ Scope: $ARGUMENTS
11
+
12
+ Describe what behavior you want to implement. Include:
13
+
14
+ - The function, method, or feature to implement
15
+ - The expected behavior (inputs and outputs, or acceptance criteria)
16
+ - Any known constraints or edge cases
17
+ - Relevant files or modules (if known)
18
+
19
+ ---
20
+
21
+ ## Before you begin — mandatory pre-check
22
+
23
+ This command enforces strict TDD discipline. The three phases are sequential and
24
+ non-negotiable:
25
+
26
+ 1. **RED** — a failing test exists before any implementation code is written
27
+ 2. **GREEN** — the minimum implementation to make the test pass (no more)
28
+ 3. **REFACTOR** — clean up the code while keeping all tests green
29
+
30
+ Do not write implementation code during RED. Do not refactor during GREEN.
31
+ Mixing phases invalidates the cycle.
32
+
33
+ ---
34
+
35
+ ## Phase 1 — RED (Tester role)
36
+
37
+ Adopt the **Tester** role as defined in `CLAUDE.md`.
38
+
39
+ ### 1a — Scope clarification
40
+
41
+ Before writing any test, confirm:
42
+
43
+ - What is the unit of behavior being tested? (function, method, endpoint, domain
44
+ rule)
45
+ - What are the inputs and expected outputs?
46
+ - What are the failure cases?
47
+
48
+ If the scope is ambiguous, ask one clarifying question and wait for the answer.
49
+
50
+ ### 1b — Write the failing test
51
+
52
+ Write a test that:
53
+
54
+ - Targets exactly the behavior described in the scope
55
+ - Fails for the right reason (not a compile error, not a missing dependency —
56
+ the logic does not exist yet)
57
+ - Has a name that describes the behavior: `given_X_when_Y_then_Z` or equivalent
58
+ in the project's test naming convention
59
+ - Covers at minimum: one happy path, one edge case, one failure case
60
+
61
+ Do not write the implementation. Do not make the test pass by any means other
62
+ than the implementation that will follow in Phase 2.
63
+
64
+ ### 1c — Run the test suite and confirm RED
65
+
66
+ Run the test suite. The new test must fail. Existing tests must pass.
67
+
68
+ If the new test passes without implementation, the test is wrong. Fix the test
69
+ before continuing.
70
+
71
+ **RED Phase Report:**
72
+
73
+ ```
74
+ ## RED Phase Report
75
+
76
+ **Test file**: [path/to/test/file]
77
+ **Tests written**:
78
+ - [test name] — [what it verifies]
79
+
80
+ **Suite result**: [X passing, Y failing]
81
+ **New test status**: FAIL ✓
82
+ **Failure reason**: [quoted error or assertion message]
83
+ **Existing tests**: [all passing | N failing — list]
84
+ ```
85
+
86
+ **STOP. Show the RED Phase Report. Do not proceed to GREEN without
87
+ confirmation.**
88
+
89
+ ---
90
+
91
+ ## Phase 2 — GREEN (Implementer role)
92
+
93
+ Adopt the **Implementer** role as defined in `CLAUDE.md`.
94
+
95
+ ### 2a — Read the failing test before writing any code
96
+
97
+ Understand exactly what the test asserts. Write only the code that satisfies
98
+ that assertion. Nothing more.
99
+
100
+ ### 2b — Implement the minimum
101
+
102
+ Rules for GREEN phase:
103
+
104
+ - Write the smallest amount of code that makes the failing test pass
105
+ - Do not add features not tested
106
+ - Do not clean up or restructure existing code — that is Refactor's job
107
+ - Do not add new tests — that is another RED cycle
108
+ - Hardcoding a return value is acceptable if it makes the test pass (the
109
+ Refactor phase will generalize it)
110
+
111
+ ### 2c — Run the test suite and confirm GREEN
112
+
113
+ Run the test suite. The new test must pass. All previously passing tests must
114
+ still pass.
115
+
116
+ If any previously passing test now fails, you introduced a regression. Fix it
117
+ before continuing.
118
+
119
+ **GREEN Phase Report:**
120
+
121
+ ```
122
+ ## GREEN Phase Report
123
+
124
+ **Files changed**:
125
+ - [path/to/file] — [what was added, one sentence]
126
+
127
+ **Implementation approach**: [one sentence — what the code does]
128
+ **Suite result**: [X passing, Y failing]
129
+ **New test status**: PASS ✓
130
+ **Regressions**: [none | list failing tests]
131
+ ```
132
+
133
+ **STOP. Show the GREEN Phase Report. Do not proceed to REFACTOR without
134
+ confirmation.**
135
+
136
+ ---
137
+
138
+ ## Phase 3 — REFACTOR (Implementer role, then Reviewer role)
139
+
140
+ Adopt the **Implementer** role as defined in `CLAUDE.md`.
141
+
142
+ ### 3a — Assess what needs cleaning
143
+
144
+ Before touching any code, identify:
145
+
146
+ - Duplication introduced during GREEN
147
+ - Names that do not clearly express intent
148
+ - Abstractions that belong in a separate function or module
149
+ - Logic that is hardcoded and should be generalized
150
+
151
+ Do not invent improvements. Only address what is directly in the implementation
152
+ written in Phase 2.
153
+
154
+ ### 3b — Refactor
155
+
156
+ Rules for REFACTOR phase:
157
+
158
+ - All tests must remain GREEN throughout — run the suite after each change
159
+ - Do not add new behavior
160
+ - Do not add new tests (if you discover untested behavior, note it for a new RED
161
+ cycle)
162
+ - Do not change function signatures unless the original was clearly wrong
163
+
164
+ ### 3c — Run the test suite and confirm GREEN after refactor
165
+
166
+ The full suite must pass. If any test fails during refactor, undo the last
167
+ change and investigate.
168
+
169
+ ### 3d — Review (Reviewer role)
170
+
171
+ Adopt the **Reviewer** role as defined in `CLAUDE.md`.
172
+
173
+ Review only the refactored code against these axes:
174
+
175
+ | Axis | What to check |
176
+ | ------------- | --------------------------------------------------------------- |
177
+ | Scope | Did the refactor change any behavior? |
178
+ | Correctness | Does the logic still satisfy the original test intent? |
179
+ | Architecture | Does the code follow existing project patterns? |
180
+ | Test coverage | Are all written tests still meaningful (not trivially passing)? |
181
+
182
+ Produce a Review Report. CRITICAL findings block completion.
183
+
184
+ **REFACTOR Phase Report:**
185
+
186
+ ```
187
+ ## REFACTOR Phase Report
188
+
189
+ **Changes made**:
190
+ - [path/to/file] — [what was cleaned up]
191
+
192
+ **Suite result**: [X passing, Y failing]
193
+ **Behavioral changes**: none (refactor only)
194
+
195
+ ### Review findings
196
+ **CRITICAL**: (none) | [list]
197
+ **WARNING**: (none) | [list]
198
+ **SUGGESTION**: (none) | [list]
199
+
200
+ **Verdict**: approved | approved with warnings | blocked
201
+ ```
202
+
203
+ ---
204
+
205
+ ## Completion
206
+
207
+ The TDD cycle is complete when:
208
+
209
+ - RED: at least one failing test was written and confirmed failing
210
+ - GREEN: the minimum implementation makes the test pass
211
+ - REFACTOR: the code is clean, all tests pass, no CRITICAL review findings
212
+
213
+ **Final Summary:**
214
+
215
+ ```
216
+ ## TDD Cycle Summary
217
+
218
+ **Behavior implemented**: [one sentence]
219
+ **Tests written**: [count] — [list test names]
220
+ **Files changed**: [list]
221
+ **Suite result**: [X passing, Y failing]
222
+ **Cycle status**: complete | blocked (reason)
223
+ ```
224
+
225
+ If the behavior requires additional test cases, start a new `/tdd-cycle` with
226
+ the next scenario. One cycle = one behavior.