@ai-content-space/loopx 0.1.9 → 0.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 (72) hide show
  1. package/AGENTS.md +50 -0
  2. package/README.md +59 -446
  3. package/README.zh-CN.md +59 -457
  4. package/docs/loopx/design/loopx-skill-suite-v1-design.md +73 -0
  5. package/docs/loopx/plans/loopx-skill-suite-v1-implementation.md +77 -0
  6. package/package.json +5 -2
  7. package/plugins/loopx/.codex-plugin/plugin.json +4 -4
  8. package/plugins/loopx/scripts/plugin-install.test.mjs +20 -20
  9. package/plugins/loopx/skills/clarify/SKILL.md +38 -311
  10. package/plugins/loopx/skills/debug/SKILL.md +1 -1
  11. package/plugins/loopx/skills/exec/SKILL.md +71 -0
  12. package/plugins/loopx/skills/finish/SKILL.md +254 -0
  13. package/plugins/loopx/skills/fix-review/SKILL.md +216 -0
  14. package/plugins/loopx/skills/go-style/SKILL.md +1 -1
  15. package/plugins/loopx/skills/kratos/SKILL.md +1 -1
  16. package/plugins/loopx/skills/plan/SKILL.md +136 -258
  17. package/plugins/loopx/skills/refactor-plan/SKILL.md +71 -0
  18. package/plugins/loopx/skills/review/SKILL.md +72 -105
  19. package/plugins/loopx/skills/review/code-reviewer.md +168 -0
  20. package/plugins/loopx/skills/spec/DESIGN_SPEC_TEMPLATE.md +323 -0
  21. package/plugins/loopx/skills/spec/SKILL.md +76 -0
  22. package/plugins/loopx/skills/subagent-exec/SKILL.md +282 -0
  23. package/plugins/loopx/skills/subagent-exec/agents/openai.yaml +3 -0
  24. package/plugins/loopx/skills/subagent-exec/code-quality-reviewer-prompt.md +25 -0
  25. package/plugins/loopx/skills/subagent-exec/codex-subagents.md +37 -0
  26. package/plugins/loopx/skills/subagent-exec/implementer-prompt.md +113 -0
  27. package/plugins/loopx/skills/subagent-exec/spec-reviewer-prompt.md +61 -0
  28. package/plugins/loopx/skills/tdd/SKILL.md +1 -1
  29. package/plugins/loopx/skills/verify/SKILL.md +1 -1
  30. package/scripts/claude-workflow-hook.mjs +109 -0
  31. package/scripts/codex-workflow-hook.mjs +2 -5
  32. package/scripts/install-skills.mjs +3 -3
  33. package/scripts/verify-skills.mjs +32 -1
  34. package/skills/RESOLVER.md +26 -17
  35. package/skills/clarify/SKILL.md +38 -311
  36. package/skills/debug/SKILL.md +1 -1
  37. package/skills/exec/SKILL.md +71 -0
  38. package/skills/finish/SKILL.md +254 -0
  39. package/skills/fix-review/SKILL.md +216 -0
  40. package/skills/go-style/SKILL.md +1 -1
  41. package/skills/kratos/SKILL.md +1 -1
  42. package/skills/plan/SKILL.md +136 -258
  43. package/skills/refactor-plan/SKILL.md +71 -0
  44. package/skills/review/SKILL.md +72 -105
  45. package/skills/review/code-reviewer.md +168 -0
  46. package/skills/spec/DESIGN_SPEC_TEMPLATE.md +323 -0
  47. package/skills/spec/SKILL.md +76 -0
  48. package/skills/subagent-exec/SKILL.md +282 -0
  49. package/skills/subagent-exec/agents/openai.yaml +3 -0
  50. package/skills/subagent-exec/code-quality-reviewer-prompt.md +25 -0
  51. package/skills/subagent-exec/codex-subagents.md +37 -0
  52. package/skills/subagent-exec/implementer-prompt.md +113 -0
  53. package/skills/subagent-exec/spec-reviewer-prompt.md +61 -0
  54. package/skills/tdd/SKILL.md +1 -1
  55. package/skills/verify/SKILL.md +1 -1
  56. package/src/autopilot-runtime.mjs +1 -1
  57. package/src/cli.mjs +79 -5
  58. package/src/context-manifest.mjs +2 -2
  59. package/src/html-views.mjs +457 -95
  60. package/src/install-discovery.mjs +210 -6
  61. package/src/next-skill.mjs +2 -4
  62. package/src/plan-runtime.mjs +572 -93
  63. package/src/runtime-maintenance.mjs +60 -16
  64. package/src/workflow.mjs +989 -65
  65. package/templates/architecture.md +58 -16
  66. package/templates/development-plan.md +42 -12
  67. package/plugins/loopx/skills/archive/SKILL.md +0 -55
  68. package/plugins/loopx/skills/autopilot/SKILL.md +0 -93
  69. package/plugins/loopx/skills/build/SKILL.md +0 -228
  70. package/skills/archive/SKILL.md +0 -55
  71. package/skills/autopilot/SKILL.md +0 -93
  72. package/skills/build/SKILL.md +0 -228
@@ -1,295 +1,173 @@
1
1
  ---
2
2
  name: plan
3
- description: "Creates a consensus-first loopx plan package with Planner, Architect, and Critic review from an approved spec. Not for unresolved requirements or direct implementation."
4
- when_to_use: "plan, planning, consensus planning, PRD, architecture plan, test plan, approved clarify spec, 规划, 方案, 架构评审"
3
+ description: "Creates bite-sized implementation plans from approved requirements, clarify output, or design specs with exact files, tests, commands, expected output, and execution handoff. Not for unresolved requirements, design decisions, PRD generation, or code changes."
4
+ when_to_use: "plan, implementation plan, execution plan, task breakdown, approved requirements, approved design spec, docs/loopx/design, 实施计划, 执行计划, 任务拆分"
5
5
  metadata:
6
- version: "0.1.9"
7
- argument-hint: "[--interactive] [--deliberate] [--direct <spec-path>] <clarified task or spec path>"
6
+ version: "0.2.0"
7
+ argument-hint: "[--direct <design-spec-path>] <design spec path or feature name>"
8
8
  ---
9
9
 
10
10
  # loopx Plan
11
11
 
12
- <Purpose>
13
- `plan` is loopx's canonical planning gate. It turns an approved clarify result or execution-ready spec into a reviewed plan package before build or autopilot starts.
14
-
15
- By default, `plan` includes the full consensus review loop formerly documented under `ralplan`: Planner -> Architect -> Critic. Planner creates the plan, Architect reviews it, Critic gates it, and the plan iterates until approved or the iteration cap is reached.
16
- </Purpose>
17
-
18
- <Use_When>
19
- - A clarify spec exists and needs a concrete execution package.
20
- - The user asks for `plan`, `ralplan`, consensus planning, PRD, test spec, implementation plan, or architecture review.
21
- - The request is clear enough to plan, but execution should not start before architecture and verification shape are reviewed.
22
- - The downstream path may be `build`, `autopilot`, or another execution lane, but still needs a stable plan artifact first.
23
- </Use_When>
24
-
25
- <Do_Not_Use_When>
26
- - Requirements are still vague enough that intent, non-goals, or decision boundaries are unresolved. Use `clarify` first.
27
- - The user explicitly asks to implement a concrete small change immediately and no planning gate is needed.
28
- - A current approved plan package already exists and the next action is execution.
29
- </Do_Not_Use_When>
30
-
31
- <Core_Principles>
32
- - Default planning is consensus-first, not lightweight-by-default.
33
- - Treat the clarify spec as source of truth; do not re-interview unless the spec is incomplete or contradictory.
34
- - Keep planning artifact-bound: produce PRD, architecture, development plan, and test plan outputs.
35
- - Preserve accepted intent as durable change artifacts: proposal, spec delta, design, tasks, and artifact dependency graph.
36
- - Separate planning approval from execution approval.
37
- - Do not start implementation from `plan`.
38
- - Prefer a smaller executable plan over a broad plan that cannot be verified.
39
- - Preserve non-goals, decision boundaries, and residual-risk warnings from clarify.
40
- </Core_Principles>
41
-
42
- <Inputs>
43
- Accepted inputs:
44
-
45
- - an approved loopx clarify workflow slug
46
- - `.loopx/intake/clarify-*.md`
47
- - `.omx/specs/deep-interview-*.md`
48
- - a direct task description when enough context is already present
49
- - `--direct <spec-path>` to force a specific requirements artifact
50
-
51
- If no requirements artifact is provided, derive a task slug and run pre-context intake before planning.
52
- </Inputs>
53
-
54
- <Flags>
55
- - `--interactive`: ask the user at draft review and final approval boundaries.
56
- - `--deliberate`: force high-rigor planning. Add pre-mortem and expanded test planning.
57
- - `--direct <spec-path>`: use the given artifact as the planning source of truth.
58
-
59
- `ralplan` is a compatibility alias for this default consensus behavior. It should not maintain a separate planning contract.
60
- </Flags>
12
+ ## Overview
61
13
 
62
- <Pre_Context_Intake>
63
- Before planning:
14
+ Write comprehensive implementation plans assuming the engineer has zero context for our codebase and questionable taste. Document everything they need to know: which files to touch for each task, code, testing, docs they might need to check, and how to test it. Give them the whole plan as bite-sized tasks. DRY. YAGNI. TDD. Frequent commits.
64
15
 
65
- 1. Derive a task slug.
66
- 2. Reuse the latest relevant `.loopx/context/{slug}-*.md` snapshot when available.
67
- 3. If none exists, create `.loopx/context/{slug}-{timestamp}.md` with:
68
- - task statement
69
- - desired outcome
70
- - source requirements artifact
71
- - known facts / evidence
72
- - constraints
73
- - non-goals
74
- - decision boundaries
75
- - unknowns / open questions
76
- - likely codebase touchpoints
77
- 4. For brownfield tasks, inspect relevant repo files before finalizing the plan.
78
- 5. If ambiguity is still high, route back to `clarify` instead of inventing missing requirements.
79
- 6. If planning depends on unfamiliar SDKs, external APIs, or version-sensitive framework behavior, use official documentation or a researcher lane before final approval.
80
- </Pre_Context_Intake>
81
-
82
- <Consensus_Workflow>
83
- ## Step 1. Planner Draft
84
-
85
- Planner creates the initial plan package and a compact RALPLAN-DR summary:
86
-
87
- - Principles: 3-5 guiding constraints
88
- - Decision Drivers: top 3 forces shaping the plan
89
- - Viable Options: at least 2 options with bounded pros / cons
90
- - Rejected Options: explicit invalidation when only one option remains viable
91
- - Plan Package:
92
- - PRD / requirements translation
93
- - architecture approach
94
- - development plan
95
- - test plan
96
- - acceptance criteria
97
- - risk register
98
-
99
- In `--deliberate` mode, also include:
100
-
101
- - pre-mortem with 3 plausible failure scenarios
102
- - expanded test plan covering unit, integration, e2e, and observability where applicable
103
-
104
- ## Step 2. Draft User Review (`--interactive` only)
105
-
106
- If interactive mode is enabled, present the draft plus the DR summary and ask whether to:
107
-
108
- - proceed to Architect review
109
- - request changes
110
- - reject / stop
111
-
112
- Without `--interactive`, proceed automatically to Architect review.
113
-
114
- ## Step 3. Architect Review
115
-
116
- Architect reviews the plan for soundness. This step must finish before Critic starts.
117
-
118
- Architect must provide:
119
-
120
- - strongest steelman objection to the plan
121
- - at least one real tradeoff tension
122
- - architecture risks and mitigations
123
- - synthesis or recommended revision when the objection is valid
124
- - deliberate-mode principle-violation checks when applicable
125
-
126
- ## Step 4. Critic Gate
127
-
128
- Critic runs only after Architect review completes.
16
+ Assume they are a skilled developer, but know almost nothing about our toolset or problem domain. Assume they don't know good test design very well.
129
17
 
130
- Critic evaluates:
131
-
132
- - principle-option consistency
133
- - fairness of alternatives
134
- - clarity of risk mitigation
135
- - testable acceptance criteria
136
- - concrete verification steps
137
- - execution-input completeness for each new or changed ingress / workflow entrypoint
138
- - explicit non-goals and decision boundaries
139
- - in deliberate mode: pre-mortem and expanded test plan quality
18
+ Use this skill after requirements are clear. The source may be:
140
19
 
141
- Critic verdicts:
20
+ - `docs/loopx/design/<需求名>需求设计文档.md`
21
+ - `.loopx/intake/clarify-<slug>-<timestamp>.md`
22
+ - an issue, PRD, or requirements document that already fixes material decisions
142
23
 
143
- - `APPROVE`
144
- - `ITERATE`
145
- - `REJECT`
24
+ Do not re-decide product or architecture. If the source is incomplete, contradictory, or missing product behavior, API, data, state, permission, migration, compatibility, or architecture decisions, return to `clarify` or `spec` instead of filling those gaps inside `plan`.
146
25
 
147
- ## Step 5. Closed Re-Review Loop
26
+ **Announce at start:** "I'm using the plan skill to create the implementation plan."
148
27
 
149
- If Critic returns `ITERATE` or `REJECT`, run a full closed loop:
28
+ **Save plans to:** `docs/loopx/plans/YYYY-MM-DD-<feature-name>.md`
150
29
 
151
- 1. collect Architect + Critic feedback
152
- 2. revise the plan with Planner
153
- 3. return to Architect review
154
- 4. return to Critic gate
155
- 5. repeat until `APPROVE` or 5 iterations
30
+ - User preferences for plan location override this default.
156
31
 
157
- Do not patch only the Critic complaint in isolation if the Architect objection implies a deeper plan change.
32
+ ## Scope Check
158
33
 
159
- ## Step 6. Final Plan Package
34
+ If the design spec covers multiple independent subsystems, it should have been broken into sub-project specs before planning. If it wasn't, suggest breaking this into separate plans: one per subsystem. Each plan should produce working, testable software on its own.
160
35
 
161
- On approval, write canonical planning artifacts:
36
+ ## File Structure
162
37
 
163
- - `.loopx/workflows/<slug>/plan.md`
164
- - `.loopx/workflows/<slug>/architecture.md`
165
- - `.loopx/workflows/<slug>/development-plan.md`
166
- - `.loopx/workflows/<slug>/test-plan.md`
167
- - `.loopx/workflows/<slug>/requirement-traceability.md`
168
- - `.loopx/plans/prd-<slug>.md`
169
- - `.loopx/plans/test-spec-<slug>.md`
170
- - `.loopx/changes/active/<change-id>/proposal.md`
171
- - `.loopx/changes/active/<change-id>/spec-delta.md`
172
- - `.loopx/changes/active/<change-id>/design.md`
173
- - `.loopx/changes/active/<change-id>/tasks.md`
174
- - `.loopx/changes/active/<change-id>/slices.json`
175
- - `.loopx/changes/active/<change-id>/artifact-graph.json`
38
+ Before defining tasks, map out which files will be created or modified and what each one is responsible for. This is where decomposition decisions get locked in.
176
39
 
177
- Also generate derived HTML reading views:
40
+ - Design units with clear boundaries and well-defined interfaces. Each file should have one clear responsibility.
41
+ - Prefer smaller, focused files over large files that do too much.
42
+ - Files that change together should live together. Split by responsibility, not by technical layer.
43
+ - In existing codebases, follow established patterns. If the codebase uses large files, don't unilaterally restructure. If a file you're modifying has grown unwieldy, including a split in the plan is reasonable.
178
44
 
179
- - `.loopx/workflows/<slug>/view/index.html`
180
- - `.loopx/workflows/<slug>/view/plan.html`
181
- - `.loopx/views/index.html`
45
+ This structure informs the task decomposition. Each task should produce self-contained changes that make sense independently.
182
46
 
183
- The HTML files are derived reading views for human plan review. They are not canonical fact sources; Markdown and JSON remain authoritative.
47
+ ## Bite-Sized Task Granularity
184
48
 
185
- The final plan must include:
49
+ Each step is one action, normally 2-5 minutes:
186
50
 
187
- - a source-requirement coverage matrix that maps the original requirements/PRD to plan, architecture, slices, spec delta, and tests
188
- - ADR: Decision, Drivers, Alternatives considered, Why chosen, Consequences, Follow-ups
189
- - concrete implementation steps sized to the actual task
190
- - target long-lived spec domains and an OpenSpec-style requirements delta for archive
191
- - vertical slices sized as independently verifiable tracer bullets, not horizontal layer-only task groups
192
- - execution inputs mapped to concrete sources before build starts
193
- - available execution lanes and recommended lane
194
- - test and verification commands
195
- - residual risks and assumptions
196
- - explicit build/autopilot handoff guidance
51
+ - "Write the failing test" is a step.
52
+ - "Run it to make sure it fails" is a step.
53
+ - "Implement the minimal code to make the test pass" is a step.
54
+ - "Run the tests and make sure they pass" is a step.
55
+ - "Commit" is a step.
197
56
 
198
- ## Step 7. Execution Bridge
57
+ ## Plan Document Header
199
58
 
200
- `plan` stops at an approved plan package.
59
+ Every plan must start with this header:
201
60
 
202
- In `--interactive` mode, ask for the next lane:
61
+ ```markdown
62
+ # [Feature Name] Implementation Plan
203
63
 
204
- - approve for `build`
205
- - approve for `autopilot`
206
- - request plan changes
207
- - stop
64
+ > **For agentic workers:** REQUIRED SUB-SKILL: Use loopx:subagent-exec (recommended) or loopx:exec to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
208
65
 
209
- Without `--interactive`, report the approved plan and recommended next command, but do not launch execution.
210
- </Consensus_Workflow>
66
+ **Source:** [Path to design, clarify bundle, issue, PRD, or requirements document]
211
67
 
212
- <Final_Response_Contract>
213
- Default build handoff after an approved plan package:
68
+ **Goal:** [One sentence describing what this builds]
214
69
 
215
- ```text
216
- Next:
217
- $build .loopx/plans/prd-<slug>.md
70
+ **Architecture:** [2-3 sentences summarizing the approved approach; do not introduce new design decisions]
71
+
72
+ **Tech Stack:** [Key technologies/libraries]
73
+
74
+ ---
75
+ ```
76
+
77
+ ## Task Structure
78
+
79
+ ````markdown
80
+ ### Task N: [Component Name]
81
+
82
+ **Files:**
83
+ - Create: `exact/path/to/file.py`
84
+ - Modify: `exact/path/to/existing.py:123-145`
85
+ - Test: `tests/exact/path/to/test.py`
86
+
87
+ - [ ] **Step 1: Write the failing test**
88
+
89
+ ```python
90
+ def test_specific_behavior():
91
+ result = function(input)
92
+ assert result == expected
93
+ ```
94
+
95
+ - [ ] **Step 2: Run test to verify it fails**
96
+
97
+ Run: `pytest tests/path/test.py::test_name -v`
98
+ Expected: FAIL with "function not defined"
99
+
100
+ - [ ] **Step 3: Write minimal implementation**
101
+
102
+ ```python
103
+ def function(input):
104
+ return expected
105
+ ```
106
+
107
+ - [ ] **Step 4: Run test to verify it passes**
108
+
109
+ Run: `pytest tests/path/test.py::test_name -v`
110
+ Expected: PASS
111
+
112
+ - [ ] **Step 5: Commit**
113
+
114
+ ```bash
115
+ git add tests/path/test.py src/path/file.py
116
+ git commit -m "feat: add specific feature"
218
117
  ```
118
+ ````
119
+
120
+ ## No Placeholders
121
+
122
+ Every step must contain the actual content an engineer needs. These are plan failures; never write them:
123
+
124
+ - "TBD", "TODO", "implement later", "fill in details"
125
+ - "Add appropriate error handling" / "add validation" / "handle edge cases"
126
+ - "Write tests for the above" without actual test code
127
+ - "Similar to Task N"; repeat the code because the engineer may be reading tasks out of order
128
+ - Steps that describe what to do without showing how when code is required
129
+ - References to types, functions, or methods not defined in any task
130
+
131
+ ## Remember
132
+
133
+ - Exact file paths always
134
+ - Complete code in every step when a step changes code
135
+ - Exact commands with expected output
136
+ - DRY, YAGNI, TDD, frequent commits
137
+ - The approved design spec is binding; do not expand scope
138
+
139
+ ## Self-Review
140
+
141
+ After writing the complete plan, look at the design spec with fresh eyes and check the plan against it. This is a checklist you run yourself, not a subagent dispatch.
219
142
 
220
- Use the artifact-first PRD path because it pins build to the approved plan package. Do not emit `$build <slug>` as the primary handoff when `.loopx/plans/prd-<slug>.md` is known. If execution is not approved or plan gates remain blocked, state the blocker instead of emitting a build handoff.
143
+ 1. **Spec coverage:** Skim each section/requirement in the design spec. Can you point to a task that implements it? List any gaps.
144
+ 2. **Placeholder scan:** Search your plan for red flags from the "No Placeholders" section. Fix them.
145
+ 3. **Type consistency:** Do the types, method signatures, and property names you used in later tasks match what you defined in earlier tasks?
146
+ 4. **Design drift:** Did you introduce a new architecture, API, data model, or business behavior not present in the design spec? If yes, return to `spec`.
221
147
 
222
- Also report the generated HTML reading entrypoint so the user can review the plan without running another command:
148
+ If you find issues, fix them inline. If you find a design requirement with no task, add the task.
149
+
150
+ ## Execution Handoff
151
+
152
+ After saving the plan, offer execution choice:
223
153
 
224
154
  ```text
225
- HTML:
226
- .loopx/workflows/<slug>/view/index.html
155
+ Plan complete and saved to `docs/loopx/plans/<filename>.md`.
156
+
157
+ Two execution options:
158
+
159
+ 1. Subagent-Driven (recommended) - dispatch a fresh subagent per task, review between tasks, fast iteration
160
+ 2. Inline Execution - execute tasks in this session using exec, batch execution with checkpoints
161
+
162
+ Which approach?
227
163
  ```
228
- </Final_Response_Contract>
229
-
230
- <Runtime_State_Machine>
231
- `plan` must keep the planning gate machine-checkable. Runtime state should track:
232
-
233
- - `plan_current_iteration`: starts at `1`
234
- - `plan_max_iterations`: default `5`
235
- - `plan_consensus_mode`: `true` by default
236
- - `plan_deliberate_mode`: `true|false`
237
- - `plan_principles_resolved`: `true` after principles are explicit
238
- - `plan_options_reviewed`: `true` after alternatives are fairly compared
239
- - `plan_architect_review_status`: `not-started|complete|changes-requested`
240
- - `plan_critic_verdict`: `none|approve|iterate|reject`
241
- - `plan_package_status`: `missing|partial|complete`
242
- - `change_artifacts_status`: `missing|partial|complete|archived`
243
- - `spec_delta_status`: `missing|partial|complete`
244
- - `slice_artifacts_status`: `missing|partial|complete`
245
- - `plan_acceptance_criteria_testable`: `true|false`
246
- - `plan_verification_steps_resolved`: `true|false`
247
- - `plan_execution_inputs_resolved`: `true|false`
248
- - `source_requirements_status`: `complete|partial`
249
- - `requirement_traceability_path`: `.loopx/workflows/<slug>/requirement-traceability.md`
250
- - `requested_transition`: remains explicit before build/autopilot
251
-
252
- The plan gate is blocked until:
253
-
254
- - plan package artifacts exist
255
- - change proposal, spec delta, design, tasks, vertical slices, and artifact graph exist
256
- - spec delta declares target domains and `## ADDED|MODIFIED|REMOVED|RENAMED Requirements` blocks
257
- - every ADDED or MODIFIED requirement uses `### Requirement:`, contains SHALL or MUST text, and includes at least one `#### Scenario:`
258
- - vertical slices contain at least one `AFK` or `HITL` end-to-end slice with acceptance criteria and verification signal
259
- - Architect review is complete
260
- - Critic verdict is `approve`
261
- - acceptance criteria are testable
262
- - verification steps are concrete
263
- - execution inputs are fully mapped to concrete sources
264
- - source requirements are covered by `requirement-traceability.md`; uncovered original PRD requirements block build handoff
265
- - user approval exists for any execution transition
266
- </Runtime_State_Machine>
267
-
268
- <Must_Not_Decide_Automatically>
269
- - Do not skip Architect review.
270
- - Do not run Architect and Critic in parallel; Critic depends on Architect.
271
- - Do not launch build/autopilot without explicit approval.
272
- - Do not widen scope beyond clarify non-goals because a broader redesign seems cleaner.
273
- - Do not erase residual-risk warnings inherited from clarify.
274
- - Do not treat a plan as approved when Critic returns `ITERATE` or `REJECT`.
275
- </Must_Not_Decide_Automatically>
276
-
277
- <Output_Contract>
278
- Primary outputs:
279
-
280
- - approved plan package under `.loopx/workflows/<slug>/`
281
- - original source requirements and traceability matrix under `.loopx/workflows/<slug>/requirement-traceability.md`
282
- - canonical PRD and test spec under `.loopx/plans/`
283
- - change artifacts under `.loopx/changes/active/<change-id>/`
284
- - derived HTML reading views under `.loopx/workflows/<slug>/view/` and `.loopx/views/`
285
- - consensus review summary with Planner / Architect / Critic evidence
286
- - next-step recommendation
287
-
288
- Status output must clearly state:
289
-
290
- - current iteration
291
- - Architect review status
292
- - Critic verdict
293
- - missing plan gates, if any
294
- - whether execution is approved
295
- </Output_Contract>
164
+
165
+ If Subagent-Driven is chosen:
166
+
167
+ - REQUIRED SUB-SKILL: Use `loopx:subagent-exec`
168
+ - Fresh subagent per task plus two-stage review
169
+
170
+ If Inline Execution is chosen:
171
+
172
+ - REQUIRED SUB-SKILL: Use `loopx:exec`
173
+ - Batch execution with checkpoints for review
@@ -0,0 +1,71 @@
1
+ ---
2
+ name: refactor-plan
3
+ description: "Creates a behavior-preserving refactor plan with user interview, repo evidence, tiny commits, scope boundaries, and testing decisions. Not for feature changes or immediate implementation."
4
+ when_to_use: "refactor-plan, refactor request, refactoring RFC, tiny commits, behavior-preserving cleanup, architecture cleanup, 重构计划"
5
+ metadata:
6
+ version: "0.2.0"
7
+ ---
8
+
9
+ This skill will be invoked when the user wants to create a refactor request. You should go through the steps below. You may skip steps if you don't consider them necessary.
10
+
11
+ 1. Ask the user for a long, detailed description of the problem they want to solve and any potential ideas for solutions.
12
+
13
+ 2. Explore the repo to verify their assertions and understand the current state of the codebase.
14
+
15
+ 3. Ask whether they have considered other options, and present other options to them.
16
+
17
+ 4. Interview the user about the implementation. Be extremely detailed and thorough.
18
+
19
+ 5. Hammer out the exact scope of the implementation. Work out what you plan to change and what you plan not to change.
20
+
21
+ 6. Look in the codebase to check for test coverage of this area of the codebase. If there is insufficient test coverage, ask the user what their plans for testing are.
22
+
23
+ 7. Break the implementation into a plan of tiny commits. Remember Martin Fowler's advice to "make each refactoring step as small as possible, so that you can always see the program working."
24
+
25
+ 8. Write the refactor plan to `docs/loopx/refactors/YYYY-MM-DD-<topic>.md`. If the repository has an issue workflow and the user wants an issue, also create a GitHub issue with the same plan. Use the following template:
26
+
27
+ <refactor-plan-template>
28
+
29
+ ## Problem Statement
30
+
31
+ The problem that the developer is facing, from the developer's perspective.
32
+
33
+ ## Solution
34
+
35
+ The solution to the problem, from the developer's perspective.
36
+
37
+ ## Commits
38
+
39
+ A LONG, detailed implementation plan. Write the plan in plain English, breaking down the implementation into the tiniest commits possible. Each commit should leave the codebase in a working state.
40
+
41
+ ## Decision Document
42
+
43
+ A list of implementation decisions that were made. This can include:
44
+
45
+ - The modules that will be built/modified
46
+ - The interfaces of those modules that will be modified
47
+ - Technical clarifications from the developer
48
+ - Architectural decisions
49
+ - Schema changes
50
+ - API contracts
51
+ - Specific interactions
52
+
53
+ Do NOT include specific file paths or code snippets. They may end up being outdated very quickly.
54
+
55
+ ## Testing Decisions
56
+
57
+ A list of testing decisions that were made. Include:
58
+
59
+ - A description of what makes a good test (only test external behavior, not implementation details)
60
+ - Which modules will be tested
61
+ - Prior art for the tests (i.e. similar types of tests in the codebase)
62
+
63
+ ## Out of Scope
64
+
65
+ A description of the things that are out of scope for this refactor.
66
+
67
+ ## Further Notes (optional)
68
+
69
+ Any further notes about the refactor.
70
+
71
+ </refactor-plan-template>