Commit 1a85f0b033f08ba4bda538e47854af93c9c5a46c
1 parent
18c67809
docs(lite): add erp-workflow-lite refactor implementation plan
Showing
1 changed file
with
532 additions
and
0 deletions
LITE-PLAN.md
0 → 100644
| 1 | +# erp-workflow-lite Implementation Plan | ||
| 2 | + | ||
| 3 | +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. | ||
| 4 | + | ||
| 5 | +**Goal:** Refactor the 25-skill `erp-workflow` plugin into an ~11-skill "lite" variant for smaller full-stack apps — by unifying the duplicated backend/frontend feature loops, collapsing the 5-step loop to 3, merging the 6-skill plan phase to 3, merging the 3-skill milestone machinery to 1, and trimming the 10-document suite to the essentials (01/03/04/05/08) — while preserving TDD, REQ→DB→API→code traceability, DB-as-SSoT + Flyway, and test-gated local milestones. | ||
| 6 | + | ||
| 7 | +**Architecture:** The heavy plugin runs two structurally-identical 5-step feature chains (backend `feature-*` + frontend `fe-feature-*`). Lite collapses both into ONE phase-parameterized 3-step chain (`feature-spec` → `feature-tdd` → `feature-review`) where a `phase ∈ {backend, frontend}` argument selects scope, context sources, template branch, and reviewer agent. The two phase drivers merge into one `phase-driver`; the `test-gate → module-report → milestone-tag` trio merges into one `milestone`; the plan phase's 6 one-shot skills merge into 3 aligned to the two existing human review checkpoints. Cross-module change tracking (skill + hook) is removed entirely. | ||
| 8 | + | ||
| 9 | +**Tech Stack:** Claude Code plugin = Markdown `SKILL.md` files (YAML frontmatter + body), `templates/*.md`, `scripts/*.sh`, `banners/*.txt`, `agents/*.md`, `.claude-plugin/plugin.json`. No compiler/test-runner — verification is structural (grep for stale references, frontmatter/name consistency, `${CLAUDE_PLUGIN_ROOT}`/`${CLAUDE_SKILL_DIR}` path resolution, valid JSON, no dangling `Skill()` calls). | ||
| 10 | + | ||
| 11 | +--- | ||
| 12 | + | ||
| 13 | +## Granularity note (read before executing) | ||
| 14 | + | ||
| 15 | +This is a **merge/refactor of existing, well-specified files**, not greenfield code. Pre-pasting the full body of all 11 lite skills here would duplicate ~2000 lines that already exist in the worktree. Instead, each task states: | ||
| 16 | +- exact target path + frontmatter (`name` / `description` / `user-invocable` / `allowed-tools`), | ||
| 17 | +- **which source skills/sections to take and exactly what to change** (source files exist in this same worktree — this is concrete, not a placeholder), | ||
| 18 | +- the resulting step list, | ||
| 19 | +- which templates/banners it references, | ||
| 20 | +- a structural verification command. | ||
| 21 | + | ||
| 22 | +Full literal content is given only for genuinely-new glue: the phase-parameter contract, the lite flow banner, the trimmed milestone-report template, and the `docs/08 § 一` lite checklist. | ||
| 23 | + | ||
| 24 | +The worktree already contains a full checkout of the heavy plugin on branch `lite`. Building = transforming this tree in place (create lite skills, delete superseded ones). | ||
| 25 | + | ||
| 26 | +--- | ||
| 27 | + | ||
| 28 | +## Skill inventory: 25 → 11 | ||
| 29 | + | ||
| 30 | +| Lite skill | Dir | Replaces (heavy) | Disposition | | ||
| 31 | +|---|---|---|---| | ||
| 32 | +| `plan-start` | crosscut | plan-start | keep, edit routing + banner | | ||
| 33 | +| `coding-start` | crosscut | coding-start | keep, edit routing + banner | | ||
| 34 | +| `lite-init` | plan | project-init + scope-lock | merge → ends at REQ-review stop | | ||
| 35 | +| `lite-design` | plan | skeleton-gen + db-design-gen | merge → ends at docs/03-review stop | | ||
| 36 | +| `lite-build-db` | plan | db-init + downstream-gen | merge → ends at plan-done stop | | ||
| 37 | +| `phase-driver` | coding | module-start + frontend-start | merge, `phase` param | | ||
| 38 | +| `feature-spec` | coding | feature-brainstorm + feature-plan (+ fe-) | merge, `phase` param | | ||
| 39 | +| `feature-tdd` | coding | feature-tdd (+ fe-feature-tdd) | merge, `phase` param | | ||
| 40 | +| `feature-review` | coding | feature-verify + feature-review (+ fe-) | merge, `phase` param | | ||
| 41 | +| `milestone` | coding | test-gate + module-report + milestone-tag | merge, phase inferred from branch | | ||
| 42 | +| `interrupt-check` | crosscut | interrupt-check | keep, edit condition 2 (docs/07 → .env.local) | | ||
| 43 | + | ||
| 44 | +**Deleted skills (14):** project-init, scope-lock, skeleton-gen, db-design-gen, db-init, downstream-gen, module-start, frontend-start, feature-brainstorm, feature-plan, feature-verify, fe-feature-{brainstorm,plan,tdd,verify,review} (5), test-gate, module-report, milestone-tag, cross-module-log. (Names reused as lite skills where applicable.) | ||
| 45 | + | ||
| 46 | +**Agents (2, kept):** `superpower-code-reviewer` (backend), `fe-code-reviewer` (frontend) — selected by `phase` inside `feature-review`. | ||
| 47 | + | ||
| 48 | +**Hooks:** 1 → 0. Delete `hooks/` entirely. | ||
| 49 | + | ||
| 50 | +**Doc suite:** keep **docs/01** (REQ list), **docs/03** (DB design), **docs/04** (coding constraints — now absorbs docs/06 Design Tokens + interaction rules and docs/07 env notes), **docs/05** (API contract), **docs/08** (task tracking + becomes the module/REQ ordering authority, replacing docs/02). Drop docs/02, 06, 07, 09, 10 as standalone files. | ||
| 51 | + | ||
| 52 | +--- | ||
| 53 | + | ||
| 54 | +## File structure after refactor | ||
| 55 | + | ||
| 56 | +``` | ||
| 57 | +erp-workflow-plugin/ (branch: lite) | ||
| 58 | +├── .claude-plugin/plugin.json # MODIFY: version 0.1.0→0.1.0-lite, desc; skills dirs unchanged | ||
| 59 | +├── README.md # MODIFY: rewrite component tables for lite | ||
| 60 | +├── hooks/ # DELETE (entire dir) | ||
| 61 | +├── agents/ | ||
| 62 | +│ ├── superpower-code-reviewer.md # KEEP | ||
| 63 | +│ └── fe-code-reviewer.md # KEEP | ||
| 64 | +└── skills/ | ||
| 65 | + ├── plan/ | ||
| 66 | + │ ├── plan-start/ # MOVED from crosscut (or keep in crosscut — see Task 7 note) | ||
| 67 | + │ ├── lite-init/ # NEW (project-init + scope-lock) | ||
| 68 | + │ ├── lite-design/ # NEW (skeleton-gen + db-design-gen) | ||
| 69 | + │ └── lite-build-db/ # NEW (db-init + downstream-gen) | ||
| 70 | + ├── coding/ | ||
| 71 | + │ ├── coding-start/ # (kept in crosscut — see Task 7 note) | ||
| 72 | + │ ├── phase-driver/ # NEW (module-start + frontend-start) | ||
| 73 | + │ ├── feature-spec/ # NEW (feature-brainstorm + feature-plan) | ||
| 74 | + │ ├── feature-tdd/ # NEW (feature-tdd + fe-feature-tdd merged) | ||
| 75 | + │ ├── feature-review/ # NEW (feature-verify + feature-review) | ||
| 76 | + │ └── milestone/ # NEW (test-gate + module-report + milestone-tag) | ||
| 77 | + └── crosscut/ | ||
| 78 | + ├── plan-start/ # KEEP here (entry) | ||
| 79 | + ├── coding-start/ # KEEP here (entry) | ||
| 80 | + └── interrupt-check/ # KEEP, minor edit | ||
| 81 | +``` | ||
| 82 | + | ||
| 83 | +> **Directory decision:** To minimize churn and keep `plugin.json` untouched, leave `plan-start` and `coding-start` in `skills/crosscut/` (they are entries, already there). Put the 3 new plan skills in `skills/plan/`, the 4 new coding skills in `skills/coding/`. `plugin.json` already declares `["./skills/plan","./skills/coding","./skills/crosscut"]` — no change needed to the array. | ||
| 84 | + | ||
| 85 | +--- | ||
| 86 | + | ||
| 87 | +## The `phase` parameter contract (shared by the unified loop) | ||
| 88 | + | ||
| 89 | +Every unified coding skill takes/threads a `phase` value. Define it once here; each skill body references "the phase contract": | ||
| 90 | + | ||
| 91 | +``` | ||
| 92 | +phase = "backend" → unit/module under module-<id> branch | ||
| 93 | +phase = "frontend" → page/feature under frontend-phase branch | ||
| 94 | + | ||
| 95 | +Per-phase bindings: | ||
| 96 | + backend frontend | ||
| 97 | + id token REQ-XXX-NNN FE-NN | ||
| 98 | + branch module-<module_id> frontend-phase | ||
| 99 | + impl path guard impl_file must NOT start frontend/ impl_file MUST start frontend/ | ||
| 100 | + test command ./scripts/test.sh (subagent) vitest + playwright (subagent; cmds from docs/04 §零) | ||
| 101 | + reviewer agent superpower-code-reviewer fe-code-reviewer | ||
| 102 | + spec context docs/01 REQ (ignore UI), docs/03 docs/01 REQ, docs/05, docs/04 §零 tokens, associated_prototypes[] | ||
| 103 | + done-mark target docs/08 §二 REQ checkbox docs/08 §三 FE checkbox | ||
| 104 | + ordering source docs/08 §二 (module→REQ order) docs/08 §三 (FE list order) | ||
| 105 | +``` | ||
| 106 | + | ||
| 107 | +`phase-driver` is invoked with `{ phase }` by `coding-start`. It dispatches `feature-spec` with `{ phase, id, name, associated_reqs[]?, associated_prototypes[]? }` (the last two only for frontend). `feature-spec` → `feature-tdd` → `feature-review` each pass `{ phase, id }` forward. `milestone` does NOT need the param passed — it infers phase from the current git branch (`module-*` → backend, `frontend-phase` → frontend), exactly as the heavy trio did. | ||
| 108 | + | ||
| 109 | +--- | ||
| 110 | + | ||
| 111 | +## Task 1: Prep — branch hygiene, plugin.json, drop the hook | ||
| 112 | + | ||
| 113 | +**Files:** | ||
| 114 | +- Modify: `.claude-plugin/plugin.json` | ||
| 115 | +- Delete: `hooks/` (dir: `hooks.json` + `scripts/log-cross-module.sh`) | ||
| 116 | + | ||
| 117 | +- [ ] **Step 1: Confirm we're on the `lite` branch in the worktree** | ||
| 118 | + | ||
| 119 | +Run: `git branch --show-current` | ||
| 120 | +Expected: `lite` | ||
| 121 | + | ||
| 122 | +- [ ] **Step 2: Delete the hook directory** | ||
| 123 | + | ||
| 124 | +```bash | ||
| 125 | +git rm -r hooks/ | ||
| 126 | +``` | ||
| 127 | +Expected: removes `hooks/hooks.json` and `hooks/scripts/log-cross-module.sh`. | ||
| 128 | + | ||
| 129 | +- [ ] **Step 3: Edit plugin.json** | ||
| 130 | + | ||
| 131 | +Set `"version": "0.1.0-lite"` and `"description": "ERP/全栈项目精简流程框架(lite):计划三段(一次性)+ 编码统一功能循环(后端模块 / 前端阶段共用),保留 TDD、需求可追溯、DB-as-SSoT + Flyway、本地里程碑 tag。"`. Leave `"skills"` array unchanged. | ||
| 132 | + | ||
| 133 | +- [ ] **Step 4: Verify** | ||
| 134 | + | ||
| 135 | +Run: `python3 -c "import json;json.load(open('.claude-plugin/plugin.json'))" && echo OK && ls hooks 2>/dev/null || echo "hooks gone"` | ||
| 136 | +Expected: `OK` then `hooks gone`. | ||
| 137 | + | ||
| 138 | +- [ ] **Step 5: Commit** | ||
| 139 | + | ||
| 140 | +```bash | ||
| 141 | +git add -A && git commit -m "chore(lite): drop cross-module hook, bump plugin meta to lite" | ||
| 142 | +``` | ||
| 143 | + | ||
| 144 | +--- | ||
| 145 | + | ||
| 146 | +## Task 2: Build the unified feature loop (Tier 1 centerpiece) | ||
| 147 | + | ||
| 148 | +This is the highest-value change. Create 3 phase-parameterized skills, then delete the 11 superseded loop skills. | ||
| 149 | + | ||
| 150 | +### 2a. `skills/coding/feature-spec/` (= feature-brainstorm + feature-plan, both phases) | ||
| 151 | + | ||
| 152 | +**Files:** | ||
| 153 | +- Create: `skills/coding/feature-spec/SKILL.md` | ||
| 154 | +- Create: `skills/coding/feature-spec/templates/feature-spec-plan-template.md` | ||
| 155 | + | ||
| 156 | +**Frontmatter:** | ||
| 157 | +```yaml | ||
| 158 | +name: feature-spec | ||
| 159 | +description: 统一功能循环第 1 步(后端 REQ / 前端 FE 共用,由 phase 参数区分)。交互式 Q&A → 产出"规格 + 任务级 TDD 计划"合并文档到 docs/superpowers/specs/,链入 feature-tdd。 | ||
| 160 | +user-invocable: false | ||
| 161 | +allowed-tools: Read Write Grep Glob Skill AskUserQuestion Bash(mysql *) | ||
| 162 | +``` | ||
| 163 | + | ||
| 164 | +**Body — derive by merging:** | ||
| 165 | +- Take `feature-brainstorm` steps 1–4 (context gather, Q&A, write spec, self-audit) AND `feature-plan` steps 3–6 (file-structure derivation, bite-sized task derivation, plan self-review) into ONE flow that produces a single combined doc. | ||
| 166 | +- Replace the "阶段范围(后端)" section with a **phase switch** referencing the phase contract above: | ||
| 167 | + - `phase=backend`: scope = controller/service/repository/DTO/校验/SQL migration/REST; read `docs/01` REQ card (ignore UI), `docs/03`; impl tasks must NOT target `frontend/`. | ||
| 168 | + - `phase=frontend`: scope = 组件树/状态机/交互/API 调用/Design Tokens 引用/业务校验前端复刻; read `associated_prototypes[]`, `associated_reqs[]` REQ cards, `docs/05` (filtered), `docs/04 §零` tokens; impl tasks MUST target `frontend/`. (Pull the frontend context list verbatim from `fe-feature-brainstorm` step 1.) | ||
| 169 | +- Keep the placeholder rules block (no `【人工填写:】`; check `.env.local`/`docs/04`/`CLAUDE.md`/code then `AskUserQuestion`) — merge the two near-identical copies into one, change "docs/07-环境配置.md" → ".env.local + docs/04 §零环境". | ||
| 170 | +- Keep `feature-plan`'s "Plan 文件头 / Task 结构 / 允许的代码块场景 / 任务原则" verbatim (it is phase-agnostic) — but change the header line `Parent skill feature-tdd executes...` to keep `feature-tdd`. | ||
| 171 | +- Output: ONE file `docs/superpowers/specs/<YYYY-MM-DD>-<id>.md` rendered from the new combined template (id = REQ-id or FE-NN). Then **same-turn** `Skill(feature-tdd)` passing `{ phase, id }`. Keep the "no bridging narration" warning. | ||
| 172 | + | ||
| 173 | +**Template `feature-spec-plan-template.md`:** merge `feature-brainstorm/templates/feature-spec-template.md` (spec sections) + `feature-plan/templates/feature-plan-template.md` (plan header + task structure) into one doc with two top-level parts: `## 规格` then `## 任务级计划`. Add a frontmatter-style top line `阶段: {{phase}}`. Include both a backend-oriented and frontend-oriented spec section under `## 规格`, marked `(phase=backend 填写)` / `(phase=frontend 填写)`, instructing the skill to fill only the active phase's section. (Read both source templates in the worktree to assemble.) | ||
| 174 | + | ||
| 175 | +- [ ] **Step 1:** Read source files: `skills/coding/feature-brainstorm/SKILL.md`, `skills/coding/fe-feature-brainstorm/SKILL.md`, `skills/coding/feature-plan/SKILL.md`, and the 3 source templates. | ||
| 176 | +- [ ] **Step 2:** Write `skills/coding/feature-spec/templates/feature-spec-plan-template.md` per spec above. | ||
| 177 | +- [ ] **Step 3:** Write `skills/coding/feature-spec/SKILL.md` per spec above. | ||
| 178 | +- [ ] **Step 4 (verify):** `grep -n 'phase=backend\|phase=frontend' skills/coding/feature-spec/SKILL.md` shows both branches; `grep -n 'Skill(feature-tdd)' skills/coding/feature-spec/SKILL.md` present; no reference to `feature-brainstorm`/`feature-plan`/`fe-feature` remains in the new file. | ||
| 179 | + | ||
| 180 | +### 2b. `skills/coding/feature-tdd/` (= backend feature-tdd + fe-feature-tdd) | ||
| 181 | + | ||
| 182 | +**Files:** | ||
| 183 | +- Create: `skills/coding/feature-tdd/SKILL.md` | ||
| 184 | +- Create: `skills/coding/feature-tdd/templates/commit-message-template.md` (copy existing `feature-tdd/templates/commit-message-template.md` verbatim — it already supports `req_id = FE-NN`) | ||
| 185 | + | ||
| 186 | +**Frontmatter:** name `feature-tdd`; same `allowed-tools` as heavy `feature-tdd` (`Read Write Edit Agent Skill Bash(git add *) Bash(git commit *)`). | ||
| 187 | + | ||
| 188 | +**Body — merge:** Base on heavy `feature-tdd` (red-green-commit, tests dispatched to subagent, schema-migration-first rule, `interrupt-check` at >10 fails). Add the phase switch on the **path guard** (護栏) and **test command** from the phase contract: | ||
| 189 | +- `phase=backend`: impl_file starting `frontend/` → hard stop (existing behavior). Schema-first migration rule applies. | ||
| 190 | +- `phase=frontend`: impl_file NOT starting `frontend/` → hard stop. No SQL migration step (schema is backend-complete). Tests = jsdom component + Playwright E2E to subagent (pull from `fe-feature-tdd`). Commit trailer `REQ_ID: FE-NN`. | ||
| 191 | +Keep "all test runs go to Agent subagent" (preserves the saved test-isolation guarantee). End → `Skill(feature-review)` with `{ phase, id }`. | ||
| 192 | + | ||
| 193 | +- [ ] **Step 1:** Read `skills/coding/feature-tdd/SKILL.md` + `skills/coding/fe-feature-tdd/SKILL.md`. | ||
| 194 | +- [ ] **Step 2:** Copy the commit-message template into the new dir. | ||
| 195 | +- [ ] **Step 3:** Write merged `skills/coding/feature-tdd/SKILL.md`. | ||
| 196 | + | ||
| 197 | +> **Path collision note:** the new `feature-tdd` lives at the SAME path as the heavy one. When executing, build the new dir alongside, or stage the new content and overwrite. Simplest: overwrite `skills/coding/feature-tdd/SKILL.md` in place with merged content (template path is unchanged). | ||
| 198 | + | ||
| 199 | +- [ ] **Step 4 (verify):** `grep -n 'phase=frontend\|frontend/\|Skill(feature-review)\|Agent' skills/coding/feature-tdd/SKILL.md` shows phase guard both directions, subagent dispatch, and the chain call. | ||
| 200 | + | ||
| 201 | +### 2c. `skills/coding/feature-review/` (= feature-verify + feature-review) | ||
| 202 | + | ||
| 203 | +**Files:** | ||
| 204 | +- Create: `skills/coding/feature-review/SKILL.md` | ||
| 205 | +- Create: `skills/coding/feature-review/templates/feature-review-template.md` (merge `feature-verify/templates/feature-verify-evidence-template.md` evidence block + `feature-review/templates/feature-review-template.md` verdict block into ONE doc: `## 验证证据` then `## 自审结论`) | ||
| 206 | +- Create: `skills/coding/feature-review/templates/commit-message-template.md` (copy, for fix commits) | ||
| 207 | + | ||
| 208 | +**Frontmatter:** name `feature-review`; allowed-tools `Read Write Edit Skill Agent Bash(git add *) Bash(git commit *)`. | ||
| 209 | + | ||
| 210 | +**Body — merge into a 2-stage flow:** | ||
| 211 | +1. **Verify stage** (from `feature-verify`): dispatch test run to Agent subagent → structured JSON → render the `## 验证证据` section. If `exit_code != 0` or `failed > 0` → stop, do not review. | ||
| 212 | +2. **Review stage** (from `feature-review`): dispatch reviewer agent — **`phase=backend` → `superpower-code-reviewer`; `phase=frontend` → `fe-code-reviewer`** — render `## 自审结论` with `verdict`. Write the combined doc to `docs/superpowers/reviews/<YYYY-MM-DD>-<id>.md`. | ||
| 213 | +3. Dispatch by verdict (keep heavy logic, parameterized): | ||
| 214 | + - **approve:** mark done in docs/08 (`phase=backend` → §二 REQ checkbox `[x]`; `phase=frontend` → §三 FE checkbox `[x]`), then `Skill(phase-driver)` with `{ phase }`. | ||
| 215 | + - **request-changes (round<5):** edit must_fix files, fix-commit, re-run from stage 1. | ||
| 216 | + - **round==5:** stop, escalate. | ||
| 217 | + | ||
| 218 | +- [ ] **Step 1:** Read the 2 source SKILLs + 2 source templates + `agents/fe-code-reviewer.md` (to confirm subagent_type name). | ||
| 219 | +- [ ] **Step 2:** Write the merged template. | ||
| 220 | +- [ ] **Step 3:** Copy commit-message template. | ||
| 221 | +- [ ] **Step 4:** Write `skills/coding/feature-review/SKILL.md`. | ||
| 222 | +- [ ] **Step 5 (verify):** `grep -n 'superpower-code-reviewer\|fe-code-reviewer\|Skill(phase-driver)\|round == 5\|exit_code' skills/coding/feature-review/SKILL.md` shows both reviewers, the callback to phase-driver, the 5-round cap, and the verify gate. | ||
| 223 | + | ||
| 224 | +### 2d. Delete superseded loop skills | ||
| 225 | + | ||
| 226 | +- [ ] **Step 1: Delete the 8 loop skills now replaced** | ||
| 227 | + | ||
| 228 | +```bash | ||
| 229 | +git rm -r skills/coding/feature-brainstorm skills/coding/feature-plan skills/coding/feature-verify \ | ||
| 230 | + skills/coding/fe-feature-brainstorm skills/coding/fe-feature-plan skills/coding/fe-feature-tdd \ | ||
| 231 | + skills/coding/fe-feature-verify skills/coding/fe-feature-review | ||
| 232 | +``` | ||
| 233 | +(Heavy `feature-tdd` and `feature-review` dirs are kept but their SKILL.md was overwritten in 2b/2c; their stale templates `feature-verify-evidence-template.md` etc. do not live in those dirs, so nothing else to remove there.) | ||
| 234 | + | ||
| 235 | +- [ ] **Step 2 (verify no dangling refs):** `grep -rn 'fe-feature\|feature-brainstorm\|feature-plan\|feature-verify' skills/` returns ONLY hits inside doc/comment prose you intend (ideally zero). Fix any real `Skill()`/path references. | ||
| 236 | + | ||
| 237 | +- [ ] **Step 3: Commit** | ||
| 238 | + | ||
| 239 | +```bash | ||
| 240 | +git add -A && git commit -m "feat(lite): unify backend+frontend feature loops into one phase-parameterized 3-step chain" | ||
| 241 | +``` | ||
| 242 | + | ||
| 243 | +--- | ||
| 244 | + | ||
| 245 | +## Task 3: Merge the two phase drivers → `phase-driver` | ||
| 246 | + | ||
| 247 | +**Files:** | ||
| 248 | +- Create: `skills/coding/phase-driver/SKILL.md` | ||
| 249 | +- (No banner template — replace banners with a short inline printed status; see note.) | ||
| 250 | +- Delete: `skills/coding/module-start/`, `skills/coding/frontend-start/` | ||
| 251 | + | ||
| 252 | +**Frontmatter:** | ||
| 253 | +```yaml | ||
| 254 | +name: phase-driver | ||
| 255 | +description: 统一阶段循环驱动(后端模块 / 前端阶段共用,由 phase 参数区分)。定位当前未完成单元并派发 feature-spec,全完成则派发 milestone。幂等可重入。 | ||
| 256 | +user-invocable: false | ||
| 257 | +allowed-tools: Read Write Edit Skill Glob Grep AskUserQuestion Bash(git branch *) Bash(git checkout *) Bash(git rev-parse *) Bash(git status *) Bash(git symbolic-ref *) Bash(git tag *) Bash(find *) Bash(ls *) | ||
| 258 | +``` | ||
| 259 | + | ||
| 260 | +**Body — phase switch:** | ||
| 261 | +- Receives `{ phase }` from `coding-start` (or callback from `feature-review` approve, which passes the same phase it was running). | ||
| 262 | +- **`phase=backend`** (from `module-start`): locate first module whose `docs/08 §二 里程碑:` is `—`/tag-missing; extract `req_list[]` from that module's REQ sub-items in **docs/08 §二** (ordering authority — NOT docs/02); ensure on `module-<module_id>` branch (branch logic from `module-start` step 3); compute `done_reqs[]` from `docs/superpowers/reviews/*.md` verdict=approve; print short status line; dispatch `feature-spec {phase:backend, id:<first incomplete REQ>}` OR, if all REQ done, `Skill(milestone)`. | ||
| 263 | +- **`phase=frontend`** (from `frontend-start`): step 1 prototype gate (≥1 `prototype/**/*.html`, else `AskUserQuestion`); step 2 prepare FE list in `docs/08 §三` (load existing `FE-NN` bullets OR derive from prototype+docs/01+docs/05 — pull verbatim from `frontend-start` step 2); ensure on `frontend-phase` branch; compute `done_fes[]` from `reviews/*-FE-*.md`; print short status; dispatch `feature-spec {phase:frontend, id:FE-NN, name, associated_reqs[], associated_prototypes[]}` OR, if all FE done, `Skill(milestone)`. | ||
| 264 | +- Replace both banner-template renders with a single inline 3-line status print (`阶段 / 分支 / 进度 done/total / 下一单元`). (Drops 2 banner templates.) | ||
| 265 | + | ||
| 266 | +- [ ] **Step 1:** Read `module-start/SKILL.md` + `frontend-start/SKILL.md` (already captured) and confirm docs/08 §二 carries REQ order (it does — written by lite-build-db, Task 6). | ||
| 267 | +- [ ] **Step 2:** Write `skills/coding/phase-driver/SKILL.md`. | ||
| 268 | +- [ ] **Step 3:** `git rm -r skills/coding/module-start skills/coding/frontend-start` | ||
| 269 | +- [ ] **Step 4 (verify):** `grep -rn 'module-start\|frontend-start' skills/` → 0 real references. `grep -n 'phase=backend\|phase=frontend\|Skill(feature-spec)\|Skill(milestone)\|docs/08 §\|docs/08-模块任务管理' skills/coding/phase-driver/SKILL.md` shows both branches + both dispatch targets + docs/08 ordering. | ||
| 270 | +- [ ] **Step 5: Commit** `git add -A && git commit -m "feat(lite): merge module-start + frontend-start into phase-driver"` | ||
| 271 | + | ||
| 272 | +--- | ||
| 273 | + | ||
| 274 | +## Task 4: Merge the milestone trio → `milestone` | ||
| 275 | + | ||
| 276 | +**Files:** | ||
| 277 | +- Create: `skills/coding/milestone/SKILL.md` | ||
| 278 | +- Create: `skills/coding/milestone/templates/milestone-report-template.md` (trimmed from 12 → 6 sections, with a test-evidence section folded in) | ||
| 279 | +- Delete: `skills/coding/test-gate/`, `skills/coding/module-report/`, `skills/coding/milestone-tag/` | ||
| 280 | + | ||
| 281 | +**Frontmatter:** | ||
| 282 | +```yaml | ||
| 283 | +name: milestone | ||
| 284 | +description: 单元(后端模块 / 前端阶段)全部 approve 后的收尾闸门:子会话跑测试 → 写精简完成报告 → 本地 merge 进默认分支 + 打 milestone/<id> tag + 回写 docs/08 → 自动回调 coding-start。phase 由当前分支推断。 | ||
| 285 | +user-invocable: false | ||
| 286 | +allowed-tools: Read Write Edit Skill Agent Bash(git *) | ||
| 287 | +``` | ||
| 288 | + | ||
| 289 | +**Body — 4 stages (infer phase from branch like the heavy trio):** | ||
| 290 | +- **Stage 0:** `git branch --show-current` → `module-<id>` ⇒ phase=backend, phase_id=`<id>`; `frontend-phase` ⇒ phase=frontend, phase_id=`frontend-phase`; else hard stop. | ||
| 291 | +- **Stage 1 (test-gate):** dispatch test command to Agent subagent (backend `./scripts/test.sh`; frontend cmds from `docs/04 §零`), render evidence into report's `## 测试证据` section, commit evidence. Fail → print the heavy `test-gate` recovery banner (③ env path now says ".env.local / docs/04" not docs/07) and STOP. (Preserves test-isolation guarantee.) | ||
| 292 | +- **Stage 2 (report):** render the trimmed report (6 sections, below) from git summaries (`git diff --stat`/`--name-status`/`git log --oneline` over branch range — NOT diff bodies), write `docs/superpowers/module-reports/<YYYY-MM-DD>-<phase_id>.md`, commit. (Drops the cross-module §⑦ hard-verify since cross-module-log is gone.) | ||
| 293 | +- **Stage 3 (integrate + tag):** worktree-clean check → detect local `main`/`master` → `git merge --no-ff <branch>` → writeback `docs/08` milestone field (§二 module `里程碑:` for backend, §三 `整体里程碑:` for frontend) + commit → `git tag -a milestone/<phase_id>` (skip if exists) → append tag to report §⑥ + commit. (Verbatim from `milestone-tag` steps 2–7.) | ||
| 294 | +- **Stage 4:** `Skill(coding-start)` callback (no human gate). | ||
| 295 | + | ||
| 296 | +**Trimmed report template `milestone-report-template.md` (6 sections):** | ||
| 297 | +```markdown | ||
| 298 | +# 完成报告 — {{phase_id}}({{phase}}) | ||
| 299 | + | ||
| 300 | +> 生成: {{date}} | 分支: {{branch}} | 里程碑: {{milestone_tag}} | ||
| 301 | + | ||
| 302 | +## ① 单元信息 | ||
| 303 | +- 类型: {{phase}} | ID: {{phase_id}} | 名称: {{name}} | ||
| 304 | +- 覆盖单元(REQ / FE): {{covered_list}} | ||
| 305 | + | ||
| 306 | +## ② 测试证据 | ||
| 307 | +- 命令: {{test_command}} | 退出码: {{exit_code}} | 通过/失败: {{passed}}/{{failed}} | ||
| 308 | +- 摘要: {{stdout_excerpt}} | ||
| 309 | + | ||
| 310 | +## ③ 文件变更 | ||
| 311 | +{{git_diff_stat}} | ||
| 312 | + | ||
| 313 | +## ④ 数据库 / Migration(前端填 N/A) | ||
| 314 | +{{migrations_summary}} | ||
| 315 | + | ||
| 316 | +## ⑤ 偏离与取舍 | ||
| 317 | +{{deviations}} <!-- 无则写"无偏离";前端额外列 DOM 与关联原型主结构差异 --> | ||
| 318 | + | ||
| 319 | +## ⑥ 里程碑 | ||
| 320 | +- tag: {{milestone_tag}} | ||
| 321 | +- 下一步: {{next_unit}} | ||
| 322 | +``` | ||
| 323 | + | ||
| 324 | +- [ ] **Step 1:** Read `test-gate/SKILL.md`, `module-report/SKILL.md`, `milestone-tag/SKILL.md` (captured) + `module-report/templates/module-report-template.md` + `test-gate/templates/test-gate-result-template.md`. | ||
| 325 | +- [ ] **Step 2:** Write `skills/coding/milestone/templates/milestone-report-template.md` (6 sections above). | ||
| 326 | +- [ ] **Step 3:** Write `skills/coding/milestone/SKILL.md` (4 stages above). | ||
| 327 | +- [ ] **Step 4:** `git rm -r skills/coding/test-gate skills/coding/module-report skills/coding/milestone-tag` | ||
| 328 | +- [ ] **Step 5 (verify):** `grep -rn 'test-gate\|module-report\|milestone-tag' skills/` → 0 real `Skill()`/path refs. `grep -n 'merge --no-ff\|git tag -a\|Skill(coding-start)\|Agent' skills/coding/milestone/SKILL.md` shows integrate+tag+callback+subagent. | ||
| 329 | +- [ ] **Step 6: Commit** `git add -A && git commit -m "feat(lite): merge test-gate + module-report + milestone-tag into one milestone skill"` | ||
| 330 | + | ||
| 331 | +--- | ||
| 332 | + | ||
| 333 | +## Task 5: Plan phase — `lite-init` (= project-init + scope-lock) | ||
| 334 | + | ||
| 335 | +**Files:** | ||
| 336 | +- Create: `skills/plan/lite-init/SKILL.md` | ||
| 337 | +- Copy into `skills/plan/lite-init/templates/`: `CLAUDE-template.md`, `docs-01-index-template.md`, `docs-08-initial-template.md`, `docs-04-stack-template.md`, `req-card-template.md`, `_module-template.md` | ||
| 338 | +- Copy `skills/plan/scope-lock/scripts/render.sh` → `skills/plan/lite-init/scripts/render.sh` | ||
| 339 | +- Delete: `skills/plan/project-init/`, `skills/plan/scope-lock/` | ||
| 340 | + | ||
| 341 | +**Frontmatter:** | ||
| 342 | +```yaml | ||
| 343 | +name: lite-init | ||
| 344 | +description: 计划第 1 段——项目初始化 + 范围锁定。复制 CLAUDE.md/docs(01/04/08) 模板、依赖检查、git init,引导项目概述+技术栈+需求索引,生成 REQ 卡片骨架,停下等人工审阅 REQ。 | ||
| 345 | +user-invocable: false | ||
| 346 | +allowed-tools: Glob Read Edit Grep Skill AskUserQuestion Bash(mkdir *) Bash(cp *) Bash(sed *) Bash(bash *) Bash(cat *) Bash(git init) Bash(command -v *) Bash(uname *) Bash(brew *) Bash(apt *) Bash(apt-get *) Bash(yum *) Bash(apk *) Bash(export PATH=*) Bash(echo *) | ||
| 347 | +``` | ||
| 348 | + | ||
| 349 | +**Body — concatenate the two source flows:** | ||
| 350 | +1. Step 0: print lite flow banner with ▶ at "计划 ①" (banner created in Task 7). | ||
| 351 | +2. project-init A–C: idempotent `cp -n` of CLAUDE.md + docs/01 index + docs/04 + docs/08; dep check (git, mysql); `git init`. (docs/04/06/07 NOT separately copied — only docs/04, which is the merged constraints doc.) | ||
| 352 | +3. scope-lock A–D: guide project overview (CLAUDE.md), tech stack (docs/04 §零), req index (docs/01 index), then generate REQ cards via `render.sh`. | ||
| 353 | +4. Check `docs/08 §一` lite checkboxes for stage ①, then **STOP** with the scope-lock REQ-review banner ("审阅完成后运行 /erp-workflow:plan-start"). | ||
| 354 | + | ||
| 355 | +**Template edits:** | ||
| 356 | +- `CLAUDE-template.md`: remove the end-of-file skill index table referencing 25 skills/docs 02/06/07/09/10; § 🚩 中断机制 condition 2 change "docs/07-环境配置.md" → ".env.local / docs/04 §零环境"; keep the 4 work principles. (Detailed re-index happens in Task 8.) | ||
| 357 | +- `docs-08-initial-template.md`: rewrite `§ 一` from A0–A5 to the **lite 3-stage checklist** (below). Keep `§ 二`/`§ 三` headers. | ||
| 358 | +- `docs-04-stack-template.md`: keep (will gain merged sections in Task 6/lite-design). | ||
| 359 | + | ||
| 360 | +**Lite `docs/08 § 一` checklist (replaces A0–A5):** | ||
| 361 | +```markdown | ||
| 362 | +## 一、计划阶段进度 | ||
| 363 | + | ||
| 364 | +- [ ] 计划 ① 初始化 + 范围锁定 — lite-init | ||
| 365 | + - [ ] 项目文件骨架已创建(CLAUDE.md + docs/01 index + docs/04 + docs/08) | ||
| 366 | + - [ ] 依赖检查通过(git / mysql) | ||
| 367 | + - [ ] Git 已初始化 | ||
| 368 | + - [ ] 项目概述已填写(CLAUDE.md § 🎯 项目概述) | ||
| 369 | + - [ ] 技术栈已确认(docs/04 § 零) | ||
| 370 | + - [ ] 需求清单索引已填写(docs/01-需求清单/index.md) | ||
| 371 | + - [ ] REQ 卡片骨架已生成(docs/01-需求清单/<module>/REQ-*.md) | ||
| 372 | +- [ ] 计划 ② 脚手架 + 数据库设计 — lite-design | ||
| 373 | + - [ ] 架构文档已生成(docs/04 § 一+ | scripts/*.sh | .env.local | sql/migrations/) | ||
| 374 | + - [ ] docs/03 数据库设计已生成(REQ → 表/字段/索引/外键,回填 REQ 依赖表) | ||
| 375 | +- [ ] 计划 ③ DB 初始化 + 下游文档 — lite-build-db | ||
| 376 | + - [ ] V1 migration 已生成并校验 + apply 到本地 MySQL | ||
| 377 | + - [ ] docs/05 API 契约已生成 + 回填 REQ 依赖接口 | ||
| 378 | + - [ ] docs/08 § 二 模块清单(含 REQ 顺序)已生成 | ||
| 379 | +``` | ||
| 380 | + | ||
| 381 | +- [ ] **Step 1:** Copy the 6 templates + render.sh into `lite-init/`. | ||
| 382 | +- [ ] **Step 2:** Edit `lite-init/templates/docs-08-initial-template.md` § 一 to the lite checklist above. | ||
| 383 | +- [ ] **Step 3:** Edit `lite-init/templates/CLAUDE-template.md` (interrupt condition 2; drop stale index table — placeholder for Task 8 re-index). | ||
| 384 | +- [ ] **Step 4:** Write `skills/plan/lite-init/SKILL.md`. | ||
| 385 | +- [ ] **Step 5:** `git rm -r skills/plan/project-init skills/plan/scope-lock` | ||
| 386 | +- [ ] **Step 6 (verify):** `grep -rn 'project-init\|scope-lock\|A0\|A1' skills/plan/` → 0 real refs; `grep -n 'Skill(' skills/plan/lite-init/SKILL.md` chains nowhere (ends with STOP) — confirm it does NOT auto-call lite-design (must stop for REQ review). | ||
| 387 | +- [ ] **Step 7: Commit** `git add -A && git commit -m "feat(lite): merge project-init + scope-lock into lite-init"` | ||
| 388 | + | ||
| 389 | +--- | ||
| 390 | + | ||
| 391 | +## Task 6: Plan phase — `lite-design` + `lite-build-db` | ||
| 392 | + | ||
| 393 | +### 6a. `skills/plan/lite-design/` (= skeleton-gen + db-design-gen) | ||
| 394 | + | ||
| 395 | +**Files:** | ||
| 396 | +- Create: `skills/plan/lite-design/SKILL.md` | ||
| 397 | +- Copy templates from skeleton-gen: `docs-04-skeleton-template.md` (will absorb tokens+env), `scripts-setup-test-db-template.sh`, `scripts-test-template.sh`, `env-local-template`, `gitignore-append-template`; from db-design-gen: `docs-03-header-template.md`, `docs-03-table-template.md` | ||
| 398 | +- Copy `skeleton-gen/scripts/merge-gitignore.sh` | ||
| 399 | +- **Fold in (do not copy as standalone):** the Design-Tokens/interaction content from `skeleton-gen/templates/docs-06-static-template.md` and env content from `docs-07-env-template.md` → append as new sections in `docs-04-skeleton-template.md` (`§ 二 前端 Design Tokens / 交互约定`, `§ 三 环境配置`). | ||
| 400 | +- Delete: `skills/plan/skeleton-gen/`, `skills/plan/db-design-gen/` | ||
| 401 | + | ||
| 402 | +**Frontmatter:** | ||
| 403 | +```yaml | ||
| 404 | +name: lite-design | ||
| 405 | +description: 计划第 2 段——生成架构文档(docs/04 § 一+,含前端 tokens + 环境)+ 工具脚本 + .env.local + sql/migrations/,然后从 REQ 正向设计 docs/03 并回填 REQ 依赖表,停下等人工审阅 docs/03。 | ||
| 406 | +user-invocable: false | ||
| 407 | +allowed-tools: Read Write Edit Glob Grep Skill AskUserQuestion Bash(mkdir *) Bash(cp *) Bash(cat *) Bash(bash *) | ||
| 408 | +``` | ||
| 409 | + | ||
| 410 | +**Body:** | ||
| 411 | +1. Step 0: lite flow banner ▶ at "计划 ②". | ||
| 412 | +2. skeleton-gen portion: generate `docs/04 § 一+` (coding spec + folded tokens + env), `scripts/setup-test-db.sh`, `scripts/test.sh` (4 cmd slots inferred from docs/04 §零), `.env.local`, create `sql/migrations/`, merge `.gitignore`. (Drop docs/06, docs/07, docs/09 standalone generation.) | ||
| 413 | +3. db-design-gen portion: design `docs/03` from docs/01 REQ cards; backfill REQ card dependency tables (`TBD(A3 自动补)` → table names — keep the marker text or relabel to `TBD(设计自动补)`). | ||
| 414 | +4. Check docs/08 §一 stage ② boxes; **STOP** with docs/03-review banner ("审阅完成后运行 /erp-workflow:plan-start"). | ||
| 415 | + | ||
| 416 | +- [ ] **Step 1:** Read `skeleton-gen/SKILL.md`, `db-design-gen/SKILL.md` + their templates + the docs-06-static + docs-07-env templates. | ||
| 417 | +- [ ] **Step 2:** Assemble `lite-design/templates/docs-04-skeleton-template.md` (skeleton outline + appended Tokens §二 + env §三). | ||
| 418 | +- [ ] **Step 3:** Copy remaining templates + merge-gitignore.sh into `lite-design/`. | ||
| 419 | +- [ ] **Step 4:** Write `skills/plan/lite-design/SKILL.md`. | ||
| 420 | +- [ ] **Step 5:** `git rm -r skills/plan/skeleton-gen skills/plan/db-design-gen` | ||
| 421 | +- [ ] **Step 6 (verify):** `grep -rn 'skeleton-gen\|db-design-gen\|docs/06\|docs/07\|docs/09' skills/plan/lite-design/` → only intended (tokens/env now inside docs/04). Confirm SKILL ends with STOP, does not auto-call lite-build-db. | ||
| 422 | + | ||
| 423 | +### 6b. `skills/plan/lite-build-db/` (= db-init + downstream-gen) | ||
| 424 | + | ||
| 425 | +**Files:** | ||
| 426 | +- Create: `skills/plan/lite-build-db/SKILL.md` | ||
| 427 | +- Copy `db-init/scripts/validate.sh` → `lite-build-db/scripts/validate.sh` | ||
| 428 | +- Copy templates from downstream-gen: `docs-05-header-template.md`, `docs-05-endpoint-template.md`, `docs-08-module-row-template.md` | ||
| 429 | +- Delete: `skills/plan/db-init/`, `skills/plan/downstream-gen/` | ||
| 430 | + | ||
| 431 | +**Frontmatter:** | ||
| 432 | +```yaml | ||
| 433 | +name: lite-build-db | ||
| 434 | +description: 计划第 3 段——解析 docs/03 → V1 migration + validate.sh 校验 + apply 到本地 MySQL;生成 docs/05 API 契约 + 回填 REQ 依赖接口;计算模块/REQ 顺序写入 docs/08 § 二(排序权威,取代 docs/02);最终占位符扫描后停下(计划完成)。 | ||
| 435 | +user-invocable: false | ||
| 436 | +allowed-tools: Read Write Edit Glob Grep Skill AskUserQuestion Bash(mkdir *) Bash(mysql *) Bash(set *) Bash(. .env.local) Bash(grep *) Bash(bash *) Bash(./scripts/setup-test-db.sh) Bash(cat *) Bash(cp *) | ||
| 437 | +``` | ||
| 438 | + | ||
| 439 | +**Body:** | ||
| 440 | +1. Step 0: lite flow banner ▶ at "计划 ③". | ||
| 441 | +2. db-init portion: translate docs/03 → `sql/migrations/V1__initial_schema.sql`; run `validate.sh`; verify `.env.local` creds; mysql connect; `setup-test-db.sh` DROP+CREATE; apply V1; `SHOW TABLES` self-check. | ||
| 442 | +3. downstream-gen portion (TRIMMED): generate `docs/05` (header + per-REQ endpoint) + backfill REQ `依赖接口`; **compute the module-topo + intra-module REQ order (the docs/02 §二 algorithm, steps A.1–A.6) and write it as the ordered `docs/08 § 二` module bullets** (module rows from `docs-08-module-row-template.md`, REQ sub-items in computed order). **Do NOT generate docs/02, docs/06 §三, docs/10.** | ||
| 443 | +4. Consistency check (each docs/01 REQ appears in docs/05; docs/08 §二 module set complete) + final placeholder scan (`TBD(...)` auto-fill + `【人工填写:】` QA loop). Check docs/08 §一 stage ③; print plan-done banner; STOP. | ||
| 444 | + | ||
| 445 | +- [ ] **Step 1:** Read `db-init/SKILL.md`, `downstream-gen/SKILL.md` (captured). | ||
| 446 | +- [ ] **Step 2:** Copy validate.sh + the 3 downstream templates into `lite-build-db/`. | ||
| 447 | +- [ ] **Step 3:** Write `skills/plan/lite-build-db/SKILL.md` (port the docs/02 ordering algorithm into the docs/08 §二 write step). | ||
| 448 | +- [ ] **Step 4:** `git rm -r skills/plan/db-init skills/plan/downstream-gen` | ||
| 449 | +- [ ] **Step 5 (verify):** `grep -rn 'db-init\|downstream-gen\|docs/02\|docs/10' skills/plan/lite-build-db/` → 0 stale; `grep -n 'docs/08 § 二\|拓扑\|topo\|REQ 顺序' skills/plan/lite-build-db/SKILL.md` confirms ordering moved into docs/08. | ||
| 450 | +- [ ] **Step 6: Commit** `git add -A && git commit -m "feat(lite): merge plan phase into lite-design + lite-build-db, move REQ ordering into docs/08"` | ||
| 451 | + | ||
| 452 | +--- | ||
| 453 | + | ||
| 454 | +## Task 7: Entries (`plan-start`, `coding-start`) + lite flow banner + `interrupt-check` | ||
| 455 | + | ||
| 456 | +**Files:** | ||
| 457 | +- Create: `skills/crosscut/plan-start/banners/flow-lite.txt` (and reuse for coding-start, or one per entry) | ||
| 458 | +- Modify: `skills/crosscut/plan-start/SKILL.md`, `skills/crosscut/coding-start/SKILL.md`, `skills/crosscut/interrupt-check/SKILL.md` | ||
| 459 | +- Delete stale banners: `skills/crosscut/coding-start/banners/flow-overview.txt` (replace) and any A-phase per-step banners under deleted plan skills (already removed with their dirs). | ||
| 460 | + | ||
| 461 | +**Lite flow banner `flow-lite.txt`** (single diagram; entry skills print it with a `▶` marker note before the dispatch banner — satisfies the saved feedback that entry skills must show the ASCII flow first): | ||
| 462 | +``` | ||
| 463 | +┌────────────────────────────────────────────────────────┐ | ||
| 464 | +│ erp-workflow-lite │ | ||
| 465 | +│ │ | ||
| 466 | +│ 计划(/plan-start,一次性,2 个审阅断点) │ | ||
| 467 | +│ ① lite-init 初始化 + REQ 卡片 ⏸ 审阅 REQ │ | ||
| 468 | +│ ② lite-design 脚手架 + docs/03 ⏸ 审阅 schema │ | ||
| 469 | +│ ③ lite-build-db V1+apply + docs/05/08 │ | ||
| 470 | +│ │ | ||
| 471 | +│ 编码(/coding-start,统一功能循环) │ | ||
| 472 | +│ 后端模块循环 ┐ │ | ||
| 473 | +│ 前端整体阶段 ┘→ phase-driver │ | ||
| 474 | +│ feature-spec → feature-tdd → feature-review │ | ||
| 475 | +│ 全 approve → milestone(test→报告→merge+tag) │ | ||
| 476 | +└────────────────────────────────────────────────────────┘ | ||
| 477 | +``` | ||
| 478 | + | ||
| 479 | +**`plan-start` edits:** step 0 prints `flow-lite.txt`; routing reads `docs/08 §一` lite stages (①/②/③) → dispatch `lite-init` / `lite-design` / `lite-build-db` (find first unchecked). When all 3 done → prompt `/erp-workflow:coding-start`. Update 参考 to lite skill names. | ||
| 480 | + | ||
| 481 | +**`coding-start` edits:** step 0 prints `flow-lite.txt`; step 2 Plan-completion check reads the lite `§一` (stages ①–③ all checked) instead of A0–A5; step 3 backend check unchanged (docs/08 §二 + tag) but dispatch → `Skill(phase-driver)` with `{phase:backend}`; step 4 frontend check unchanged but dispatch → `Skill(phase-driver)` with `{phase:frontend}`. Update 参考 (module-start/frontend-start → phase-driver). | ||
| 482 | + | ||
| 483 | +**`interrupt-check` edits:** condition 2 text "涉及 docs/07-环境配置.md 中的人工填写字段" → "涉及 .env.local / docs/04 §零环境 中的密钥/账密字段"; remove the §🟡 软规则 / cross-module-log reference in 参考 (cross-module-log deleted). Caller list: keep feature-tdd 步骤 (>10 fails) + milestone test-fail banner ③. | ||
| 484 | + | ||
| 485 | +- [ ] **Step 1:** Create `skills/crosscut/plan-start/banners/flow-lite.txt` and `skills/crosscut/coding-start/banners/flow-lite.txt` (same content, or symlink-by-copy). | ||
| 486 | +- [ ] **Step 2:** Edit `plan-start/SKILL.md` (routing + banner + 参考). | ||
| 487 | +- [ ] **Step 3:** Edit `coding-start/SKILL.md` (Plan check + dispatch to phase-driver + banner + 参考); delete old `flow-overview.txt`. | ||
| 488 | +- [ ] **Step 4:** Edit `interrupt-check/SKILL.md` (condition 2 + 参考 + drop cross-module ref). | ||
| 489 | +- [ ] **Step 5 (verify):** `grep -rn 'module-start\|frontend-start\|cross-module-log\|flow-overview\|A0~A5\|A0-A5' skills/crosscut/` → 0 stale; `grep -n 'phase:backend\|phase:frontend\|phase-driver\|flow-lite' skills/crosscut/coding-start/SKILL.md` present. | ||
| 490 | +- [ ] **Step 6: Commit** `git add -A && git commit -m "feat(lite): rewire entries to lite stages + phase-driver, add lite flow banner, trim interrupt-check"` | ||
| 491 | + | ||
| 492 | +--- | ||
| 493 | + | ||
| 494 | +## Task 8: README + CLAUDE-template re-index + final consistency sweep | ||
| 495 | + | ||
| 496 | +**Files:** | ||
| 497 | +- Modify: `README.md` (rewrite component tables: 11 skills, 2 agents, 0 hooks, trimmed templates, lite flow, 5-doc suite) | ||
| 498 | +- Modify: `skills/plan/lite-init/templates/CLAUDE-template.md` (end-of-file index table → lite skills + 5 docs) | ||
| 499 | + | ||
| 500 | +- [ ] **Step 1:** Rewrite README sections: 这个插件做什么 (lite flow), Skill 清单 (11), Hook 清单 (none), Templates 清单 (regenerate from actual files), 前置依赖 (unchanged), 设计原则 (keep). Per the dev-workspace CLAUDE.md rule "新增/删除 skill 后同步更新 CLAUDE-template 末尾索引表 + README 组件表". | ||
| 501 | +- [ ] **Step 2:** Update the CLAUDE-template index table to list the 11 lite skills + the 5 kept docs (01/03/04/05/08). | ||
| 502 | +- [ ] **Step 3 (full sweep — orphans & dangling refs):** | ||
| 503 | + - `grep -rn 'Skill(' skills/ | grep -oE 'Skill\([a-z-]+\)'` → every name ∈ {plan-start, coding-start, lite-init, lite-design, lite-build-db, phase-driver, feature-spec, feature-tdd, feature-review, milestone, interrupt-check}. | ||
| 504 | + - For every `${CLAUDE_SKILL_DIR}/templates/...`, `${CLAUDE_SKILL_DIR}/scripts/...`, `${CLAUDE_PLUGIN_ROOT}/...` reference: confirm the file exists at the corresponding `skills/.../...` path. | ||
| 505 | + - `for d in $(find skills -name SKILL.md); do name=$(grep -m1 '^name:' $d | cut -d' ' -f2); dir=$(basename $(dirname $d)); [ "$name" = "$dir" ] || echo "MISMATCH $d: $name vs $dir"; done` → no output. | ||
| 506 | + - `grep -rn 'docs/02\|docs/06\|docs/07\|docs/09\|docs/10\|fe-feature\|cross-module' skills/ agents/ README.md` → 0 (or only intentional historical prose). | ||
| 507 | + - `python3 -c "import json;json.load(open('.claude-plugin/plugin.json'))" && echo JSON_OK` | ||
| 508 | +- [ ] **Step 4:** Fix anything the sweep flags. | ||
| 509 | +- [ ] **Step 5: Commit** `git add -A && git commit -m "docs(lite): rewrite README + CLAUDE template index, final consistency sweep"` | ||
| 510 | + | ||
| 511 | +--- | ||
| 512 | + | ||
| 513 | +## Self-Review (run against the spec) | ||
| 514 | + | ||
| 515 | +**Spec coverage:** | ||
| 516 | +- Unify fe/backend loops → Task 2 (feature-spec/tdd/review, phase param). ✔ | ||
| 517 | +- Collapse 5→3 steps → Task 2 (brainstorm+plan→spec; verify+review→review). ✔ | ||
| 518 | +- Merge phase drivers → Task 3. ✔ | ||
| 519 | +- Merge milestone trio → Task 4. ✔ | ||
| 520 | +- Merge plan 6→3 respecting both review stops → Tasks 5–6. ✔ | ||
| 521 | +- Trim docs to 01/03/04/05/08; fold 06 tokens + 07 env into 04 → Tasks 5 (§一 checklist), 6a (docs/04 fold). ✔ | ||
| 522 | +- Move REQ ordering (was docs/02) into docs/08 §二 → Task 6b + consumed by Task 3 phase-driver. ✔ | ||
| 523 | +- Drop cross-module-log + hook → Tasks 1, 2d, 7. ✔ | ||
| 524 | +- Keep 2 reviewer agents, selected by phase → Task 2c. ✔ | ||
| 525 | +- Preserve test-isolation (subagent) + traceability + Flyway + local milestone tag → Tasks 2b/2c/4/6b. ✔ | ||
| 526 | +- Entry skills print ASCII flow first (saved feedback) → Task 7 flow-lite.txt. ✔ | ||
| 527 | + | ||
| 528 | +**Type/contract consistency:** `phase ∈ {backend, frontend}` used identically across feature-spec/tdd/review/phase-driver; `id` = REQ-XXX-NNN (backend) / FE-NN (frontend) throughout; chain is `coding-start → phase-driver → feature-spec → feature-tdd → feature-review → (approve) phase-driver | (all done) milestone → coding-start`; `milestone` infers phase from branch (no param) — consistent with heavy trio. | ||
| 529 | + | ||
| 530 | +**Placeholder scan:** merge instructions reference concrete existing source files/sections in this worktree; no "TBD/implement later". New literal artifacts (flow banner, report template, docs/08 §一 checklist, phase contract) are fully specified. | ||
| 531 | + | ||
| 532 | +**Open risk to flag at execution:** Task 2b overwrites `skills/coding/feature-tdd/SKILL.md` in place (path reused) — ensure the merged frontend test logic is actually merged in, not lost. Verify with the Step-4 grep before deleting fe-feature-tdd. |