@ai-content-space/loopx 0.1.10 → 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 (77) hide show
  1. package/AGENTS.md +49 -0
  2. package/README.md +69 -448
  3. package/README.zh-CN.md +69 -459
  4. package/docs/loopx/design/loopx-skill-suite-v1-design.md +80 -0
  5. package/docs/loopx/plans/loopx-skill-suite-v1-implementation.md +81 -0
  6. package/package.json +7 -3
  7. package/plugins/loopx/.codex-plugin/plugin.json +4 -4
  8. package/plugins/loopx/skills/clarify/SKILL.md +38 -311
  9. package/plugins/loopx/skills/debug/SKILL.md +1 -1
  10. package/plugins/loopx/skills/exec/SKILL.md +71 -0
  11. package/plugins/loopx/skills/finish/SKILL.md +349 -0
  12. package/plugins/loopx/skills/fix-review/SKILL.md +216 -0
  13. package/plugins/loopx/skills/go-style/SKILL.md +2 -2
  14. package/plugins/loopx/skills/kratos/SKILL.md +1 -1
  15. package/plugins/loopx/skills/plan/SKILL.md +138 -271
  16. package/plugins/loopx/skills/refactor-plan/SKILL.md +71 -0
  17. package/plugins/loopx/skills/review/SKILL.md +72 -105
  18. package/plugins/loopx/skills/review/code-reviewer.md +168 -0
  19. package/plugins/loopx/skills/spec/DESIGN_SPEC_TEMPLATE.md +323 -0
  20. package/plugins/loopx/skills/spec/SKILL.md +76 -0
  21. package/plugins/loopx/skills/subagent-exec/SKILL.md +282 -0
  22. package/plugins/loopx/skills/subagent-exec/agents/openai.yaml +3 -0
  23. package/plugins/loopx/skills/subagent-exec/code-quality-reviewer-prompt.md +25 -0
  24. package/plugins/loopx/skills/subagent-exec/codex-subagents.md +37 -0
  25. package/plugins/loopx/skills/subagent-exec/implementer-prompt.md +113 -0
  26. package/plugins/loopx/skills/subagent-exec/spec-reviewer-prompt.md +61 -0
  27. package/plugins/loopx/skills/tdd/SKILL.md +1 -1
  28. package/plugins/loopx/skills/verify/SKILL.md +1 -1
  29. package/scripts/claude-workflow-hook.mjs +109 -0
  30. package/scripts/codex-workflow-hook.mjs +2 -5
  31. package/scripts/install-skills.mjs +3 -3
  32. package/scripts/verify-skills.mjs +34 -2
  33. package/skills/RESOLVER.md +22 -17
  34. package/skills/clarify/SKILL.md +38 -311
  35. package/skills/debug/SKILL.md +1 -1
  36. package/skills/exec/SKILL.md +71 -0
  37. package/skills/finish/SKILL.md +349 -0
  38. package/skills/fix-review/SKILL.md +216 -0
  39. package/skills/go-style/SKILL.md +2 -2
  40. package/skills/kratos/SKILL.md +1 -1
  41. package/skills/plan/SKILL.md +138 -271
  42. package/skills/refactor-plan/SKILL.md +71 -0
  43. package/skills/review/SKILL.md +72 -105
  44. package/skills/review/code-reviewer.md +168 -0
  45. package/skills/spec/DESIGN_SPEC_TEMPLATE.md +323 -0
  46. package/skills/spec/SKILL.md +76 -0
  47. package/skills/subagent-exec/SKILL.md +282 -0
  48. package/skills/subagent-exec/agents/openai.yaml +3 -0
  49. package/skills/subagent-exec/code-quality-reviewer-prompt.md +25 -0
  50. package/skills/subagent-exec/codex-subagents.md +37 -0
  51. package/skills/subagent-exec/implementer-prompt.md +113 -0
  52. package/skills/subagent-exec/spec-reviewer-prompt.md +61 -0
  53. package/skills/tdd/SKILL.md +1 -1
  54. package/skills/verify/SKILL.md +1 -1
  55. package/src/autopilot-runtime.mjs +1 -1
  56. package/src/cli.mjs +78 -7
  57. package/src/context-manifest.mjs +2 -2
  58. package/src/html-views.mjs +129 -195
  59. package/src/install-discovery.mjs +210 -6
  60. package/src/next-skill.mjs +2 -4
  61. package/src/plan-runtime.mjs +219 -93
  62. package/src/runtime-maintenance.mjs +5 -2
  63. package/src/workflow.mjs +749 -71
  64. package/templates/architecture.md +58 -16
  65. package/templates/development-plan.md +42 -12
  66. package/plugins/loopx/scripts/plugin-install.test.mjs +0 -125
  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/ai-slop-cleaner/SKILL.md +0 -114
  71. package/skills/archive/SKILL.md +0 -55
  72. package/skills/autopilot/SKILL.md +0 -93
  73. package/skills/autoresearch/SKILL.md +0 -68
  74. package/skills/build/SKILL.md +0 -228
  75. package/skills/deep-interview/SKILL.md +0 -461
  76. package/skills/ralph/SKILL.md +0 -271
  77. package/skills/ralplan/SKILL.md +0 -49
@@ -1,306 +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.10"
7
- argument-hint: "[--interactive] [--deliberate] [--direct <spec-path>] <clarified task or spec path>"
6
+ version: "0.2.1"
7
+ argument-hint: "<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
- - Treat human review as a first-class product surface: planning Markdown and HTML views must be readable enough for a reviewer to approve or reject without opening runtime state JSON.
38
- - Do not start implementation from `plan`.
39
- - Prefer a smaller executable plan over a broad plan that cannot be verified.
40
- - Preserve non-goals, decision boundaries, and residual-risk warnings from clarify.
41
- </Core_Principles>
42
-
43
- <Inputs>
44
- Accepted inputs:
45
-
46
- - an approved loopx clarify workflow slug
47
- - `.loopx/intake/clarify-*.md`
48
- - `.omx/specs/deep-interview-*.md`
49
- - a direct task description when enough context is already present
50
- - `--direct <spec-path>` to force a specific requirements artifact
51
-
52
- If no requirements artifact is provided, derive a task slug and run pre-context intake before planning.
53
- </Inputs>
54
-
55
- <Flags>
56
- - `--interactive`: ask the user at draft review and final approval boundaries.
57
- - `--deliberate`: force high-rigor planning. Add pre-mortem and expanded test planning.
58
- - `--direct <spec-path>`: use the given artifact as the planning source of truth.
59
-
60
- `ralplan` is a compatibility alias for this default consensus behavior. It should not maintain a separate planning contract.
61
- </Flags>
62
-
63
- <Pre_Context_Intake>
64
- Before planning:
12
+ ## Overview
65
13
 
66
- 1. Derive a task slug.
67
- 2. Reuse the latest relevant `.loopx/context/{slug}-*.md` snapshot when available.
68
- 3. If none exists, create `.loopx/context/{slug}-{timestamp}.md` with:
69
- - task statement
70
- - desired outcome
71
- - source requirements artifact
72
- - known facts / evidence
73
- - constraints
74
- - non-goals
75
- - decision boundaries
76
- - unknowns / open questions
77
- - likely codebase touchpoints
78
- 4. For brownfield tasks, inspect relevant repo files before finalizing the plan.
79
- 5. If ambiguity is still high, route back to `clarify` instead of inventing missing requirements.
80
- 6. If planning depends on unfamiliar SDKs, external APIs, or version-sensitive framework behavior, use official documentation or a researcher lane before final approval.
81
- </Pre_Context_Intake>
82
-
83
- <Consensus_Workflow>
84
- ## Step 1. Planner Draft
85
-
86
- Planner creates the initial plan package and a compact RALPLAN-DR summary:
87
-
88
- - Principles: 3-5 guiding constraints
89
- - Decision Drivers: top 3 forces shaping the plan
90
- - Viable Options: at least 2 options with bounded pros / cons
91
- - Rejected Options: explicit invalidation when only one option remains viable
92
- - Plan Package:
93
- - PRD / requirements translation
94
- - architecture approach
95
- - development plan
96
- - test plan
97
- - acceptance criteria
98
- - risk register
99
-
100
- In `--deliberate` mode, also include:
101
-
102
- - pre-mortem with 3 plausible failure scenarios
103
- - expanded test plan covering unit, integration, e2e, and observability where applicable
104
-
105
- ## Step 2. Draft User Review (`--interactive` only)
106
-
107
- If interactive mode is enabled, present the draft plus the DR summary and ask whether to:
108
-
109
- - proceed to Architect review
110
- - request changes
111
- - reject / stop
112
-
113
- Without `--interactive`, proceed automatically to Architect review.
114
-
115
- ## Step 3. Architect Review
116
-
117
- Architect reviews the plan for soundness. This step must finish before Critic starts.
118
-
119
- Architect must provide:
120
-
121
- - strongest steelman objection to the plan
122
- - at least one real tradeoff tension
123
- - architecture risks and mitigations
124
- - synthesis or recommended revision when the objection is valid
125
- - deliberate-mode principle-violation checks when applicable
126
-
127
- ## Step 4. Critic Gate
128
-
129
- Critic runs only after Architect review completes.
130
-
131
- Critic evaluates:
132
-
133
- - principle-option consistency
134
- - fairness of alternatives
135
- - clarity of risk mitigation
136
- - testable acceptance criteria
137
- - concrete verification steps
138
- - execution-input completeness for each new or changed ingress / workflow entrypoint
139
- - explicit non-goals and decision boundaries
140
- - in deliberate mode: pre-mortem and expanded test plan quality
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.
141
15
 
142
- Critic verdicts:
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.
143
17
 
144
- - `APPROVE`
145
- - `ITERATE`
146
- - `REJECT`
18
+ Use this skill after requirements are clear. The source may be:
147
19
 
148
- ## Step 5. Closed Re-Review Loop
20
+ - `docs/loopx/design/<需求名>需求设计文档.md`
21
+ - `.loopx/intake/clarify-<slug>-<timestamp>.md`
22
+ - an issue, PRD, or requirements document that already fixes material decisions
149
23
 
150
- If Critic returns `ITERATE` or `REJECT`, run a full closed loop:
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`.
151
25
 
152
- 1. collect Architect + Critic feedback
153
- 2. revise the plan with Planner
154
- 3. return to Architect review
155
- 4. return to Critic gate
156
- 5. repeat until `APPROVE` or 5 iterations
26
+ **Announce at start:** "I'm using the plan skill to create the implementation plan."
157
27
 
158
- Do not patch only the Critic complaint in isolation if the Architect objection implies a deeper plan change.
28
+ **Save plans to:** `docs/loopx/plans/YYYY-MM-DD-<feature-name>.md`
159
29
 
160
- ## Step 6. Final Plan Package
30
+ - User preferences for plan location override this default.
161
31
 
162
- On approval, write canonical planning artifacts:
32
+ ## Scope Check
163
33
 
164
- - `.loopx/workflows/<slug>/plan.md`
165
- - `.loopx/workflows/<slug>/architecture.md`
166
- - `.loopx/workflows/<slug>/development-plan.md`
167
- - `.loopx/workflows/<slug>/test-plan.md`
168
- - `.loopx/workflows/<slug>/requirement-traceability.md`
169
- - `.loopx/workflows/<slug>/plan-delegation-decision.md`
170
- - `.loopx/plans/prd-<slug>.md`
171
- - `.loopx/plans/test-spec-<slug>.md`
172
- - `.loopx/changes/active/<change-id>/proposal.md`
173
- - `.loopx/changes/active/<change-id>/spec-delta.md`
174
- - `.loopx/changes/active/<change-id>/design.md`
175
- - `.loopx/changes/active/<change-id>/tasks.md`
176
- - `.loopx/changes/active/<change-id>/slices.json`
177
- - `.loopx/changes/active/<change-id>/artifact-graph.json`
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.
178
35
 
179
- Also generate derived HTML reading views:
36
+ ## File Structure
180
37
 
181
- - `.loopx/workflows/<slug>/view/index.html`
182
- - `.loopx/workflows/<slug>/view/plan.html`
183
- - `.loopx/views/index.html`
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.
184
39
 
185
- The HTML files are derived reading views for human plan review. They are not canonical fact sources; Markdown and JSON remain authoritative.
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.
186
44
 
187
- The final plan must include:
45
+ This structure informs the task decomposition. Each task should produce self-contained changes that make sense independently.
188
46
 
189
- - Chinese reviewer-facing Markdown for `plan.md`, `architecture.md`, `development-plan.md`, `test-plan.md`, canonical PRD/test spec, traceability, and delegation decision; English prose is allowed only for code paths, API names, commands, enum values, and source terms
190
- - an HTML reading view that exposes stage status, human approval points, blockers, source coverage, and artifact summaries before the full Markdown bodies
191
- - a source-requirement coverage matrix that maps the original requirements/PRD to plan, architecture, slices, spec delta, and tests
192
- - a delegation decision with mode `local|critic-only|parallel-review`, score, triggers, and reason for whether subagent-style review is warranted
193
- - ADR: Decision, Drivers, Alternatives considered, Why chosen, Consequences, Follow-ups
194
- - concrete implementation steps sized to the actual task
195
- - target long-lived spec domains and an OpenSpec-style requirements delta for archive
196
- - vertical slices sized as independently verifiable tracer bullets, not horizontal layer-only task groups
197
- - execution inputs mapped to concrete sources before build starts
198
- - available execution lanes and recommended lane
199
- - test and verification commands
200
- - residual risks and assumptions
201
- - explicit build/autopilot handoff guidance
47
+ ## Bite-Sized Task Granularity
202
48
 
203
- ## Step 7. Execution Bridge
49
+ Each step is one action, normally 2-5 minutes:
204
50
 
205
- `plan` stops at an approved plan package.
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.
206
56
 
207
- In `--interactive` mode, ask for the next lane:
57
+ ## Plan Document Header
208
58
 
209
- - approve for `build`
210
- - approve for `autopilot`
211
- - request plan changes
212
- - stop
59
+ Every plan must start with this header:
213
60
 
214
- Without `--interactive`, report the approved plan and recommended next command, but do not launch execution.
215
- </Consensus_Workflow>
61
+ ```markdown
62
+ # [Feature Name] Implementation Plan
216
63
 
217
- <Final_Response_Contract>
218
- Default build handoff after an approved plan package:
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.
219
65
 
220
- ```text
221
- Next:
222
- $build .loopx/plans/prd-<slug>.md
66
+ **Source:** [Path to design, clarify bundle, issue, PRD, or requirements document]
67
+
68
+ **Goal:** [One sentence describing what this builds]
69
+
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"
223
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.
224
142
 
225
- 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`.
226
147
 
227
- 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:
228
153
 
229
154
  ```text
230
- HTML:
231
- .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?
232
163
  ```
233
- </Final_Response_Contract>
234
-
235
- <Runtime_State_Machine>
236
- `plan` must keep the planning gate machine-checkable. Runtime state should track:
237
-
238
- - `plan_current_iteration`: starts at `1`
239
- - `plan_max_iterations`: default `5`
240
- - `plan_consensus_mode`: `true` by default
241
- - `plan_deliberate_mode`: `true|false`
242
- - `plan_principles_resolved`: `true` after principles are explicit
243
- - `plan_options_reviewed`: `true` after alternatives are fairly compared
244
- - `plan_architect_review_status`: `not-started|complete|changes-requested`
245
- - `plan_critic_verdict`: `none|approve|iterate|reject`
246
- - `plan_package_status`: `missing|partial|complete`
247
- - `change_artifacts_status`: `missing|partial|complete|archived`
248
- - `spec_delta_status`: `missing|partial|complete`
249
- - `slice_artifacts_status`: `missing|partial|complete`
250
- - `plan_acceptance_criteria_testable`: `true|false`
251
- - `plan_verification_steps_resolved`: `true|false`
252
- - `plan_execution_inputs_resolved`: `true|false`
253
- - `source_requirements_status`: `complete|partial`
254
- - `requirement_traceability_path`: `.loopx/workflows/<slug>/requirement-traceability.md`
255
- - `plan_delegation_mode`: `local|critic-only|parallel-review`
256
- - `plan_delegation_decision_path`: `.loopx/workflows/<slug>/plan-delegation-decision.md`
257
- - `requested_transition`: remains explicit before build/autopilot
258
-
259
- The plan gate is blocked until:
260
-
261
- - plan package artifacts exist
262
- - Planner, Architect, and Critic evidence artifacts exist
263
- - reviewer-facing planning docs and derived canonical PRD/test spec are Chinese-readable
264
- - change proposal, spec delta, design, tasks, vertical slices, and artifact graph exist
265
- - spec delta declares target domains and `## ADDED|MODIFIED|REMOVED|RENAMED Requirements` blocks
266
- - every ADDED or MODIFIED requirement uses `### Requirement:`, contains SHALL or MUST text, and includes at least one `#### Scenario:`
267
- - vertical slices contain at least one `AFK` or `HITL` end-to-end slice with acceptance criteria and verification signal
268
- - Architect review is complete
269
- - Critic verdict is `approve`
270
- - acceptance criteria are testable
271
- - verification steps are concrete
272
- - execution inputs are fully mapped to concrete sources
273
- - source requirements are covered by `requirement-traceability.md`; uncovered original PRD requirements block build handoff
274
- - delegation decision is recorded in `plan-delegation-decision.md`; absence of an explicit local/critic/parallel-review rationale blocks build handoff
275
- - user approval exists for any execution transition
276
- </Runtime_State_Machine>
277
-
278
- <Must_Not_Decide_Automatically>
279
- - Do not skip Architect review.
280
- - Do not run Architect and Critic in parallel; Critic depends on Architect.
281
- - Do not launch build/autopilot without explicit approval.
282
- - Do not widen scope beyond clarify non-goals because a broader redesign seems cleaner.
283
- - Do not erase residual-risk warnings inherited from clarify.
284
- - Do not treat a plan as approved when Critic returns `ITERATE` or `REJECT`.
285
- </Must_Not_Decide_Automatically>
286
-
287
- <Output_Contract>
288
- Primary outputs:
289
-
290
- - approved plan package under `.loopx/workflows/<slug>/`
291
- - original source requirements and traceability matrix under `.loopx/workflows/<slug>/requirement-traceability.md`
292
- - delegation decision under `.loopx/workflows/<slug>/plan-delegation-decision.md`
293
- - canonical PRD and test spec under `.loopx/plans/`
294
- - change artifacts under `.loopx/changes/active/<change-id>/`
295
- - derived HTML reading views under `.loopx/workflows/<slug>/view/` and `.loopx/views/`
296
- - consensus review summary with Planner / Architect / Critic evidence
297
- - next-step recommendation
298
-
299
- Status output must clearly state:
300
-
301
- - current iteration
302
- - Architect review status
303
- - Critic verdict
304
- - missing plan gates, if any
305
- - whether execution is approved
306
- </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.1"
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>