LITE-PLAN.md 41.5 KB

erp-workflow-lite Implementation Plan

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.

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.

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-specfeature-tddfeature-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.

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).


Granularity note (read before executing)

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:

  • exact target path + frontmatter (name / description / user-invocable / allowed-tools),
  • which source skills/sections to take and exactly what to change (source files exist in this same worktree — this is concrete, not a placeholder),
  • the resulting step list,
  • which templates/banners it references,
  • a structural verification command.

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.

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).


Skill inventory: 25 → 11

Lite skill Dir Replaces (heavy) Disposition
plan-start crosscut plan-start keep, edit routing + banner
coding-start crosscut coding-start keep, edit routing + banner
lite-init plan project-init + scope-lock merge → ends at REQ-review stop
lite-design plan skeleton-gen + db-design-gen merge → ends at docs/03-review stop
lite-build-db plan db-init + downstream-gen merge → ends at plan-done stop
phase-driver coding module-start + frontend-start merge, phase param
feature-spec coding feature-brainstorm + feature-plan (+ fe-) merge, phase param
feature-tdd coding feature-tdd (+ fe-feature-tdd) merge, phase param
feature-review coding feature-verify + feature-review (+ fe-) merge, phase param
milestone coding test-gate + module-report + milestone-tag merge, phase inferred from branch
interrupt-check crosscut interrupt-check keep, edit condition 2 (docs/07 → .env.local)

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.)

Agents (2, kept): superpower-code-reviewer (backend), fe-code-reviewer (frontend) — selected by phase inside feature-review.

Hooks: 1 → 0. Delete hooks/ entirely.

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.


File structure after refactor

erp-workflow-plugin/ (branch: lite)
├── .claude-plugin/plugin.json        # MODIFY: version 0.1.0→0.1.0-lite, desc; skills dirs unchanged
├── README.md                          # MODIFY: rewrite component tables for lite
├── hooks/                             # DELETE (entire dir)
├── agents/
│   ├── superpower-code-reviewer.md    # KEEP
│   └── fe-code-reviewer.md            # KEEP
└── skills/
    ├── plan/
    │   ├── plan-start/                 # MOVED from crosscut (or keep in crosscut — see Task 7 note)
    │   ├── lite-init/                  # NEW (project-init + scope-lock)
    │   ├── lite-design/                # NEW (skeleton-gen + db-design-gen)
    │   └── lite-build-db/              # NEW (db-init + downstream-gen)
    ├── coding/
    │   ├── coding-start/               # (kept in crosscut — see Task 7 note)
    │   ├── phase-driver/               # NEW (module-start + frontend-start)
    │   ├── feature-spec/               # NEW (feature-brainstorm + feature-plan)
    │   ├── feature-tdd/                # NEW (feature-tdd + fe-feature-tdd merged)
    │   ├── feature-review/             # NEW (feature-verify + feature-review)
    │   └── milestone/                  # NEW (test-gate + module-report + milestone-tag)
    └── crosscut/
        ├── plan-start/                 # KEEP here (entry)
        ├── coding-start/               # KEEP here (entry)
        └── interrupt-check/            # KEEP, minor edit

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.


The phase parameter contract (shared by the unified loop)

Every unified coding skill takes/threads a phase value. Define it once here; each skill body references "the phase contract":

phase = "backend"  → unit/module under module-<id> branch
phase = "frontend" → page/feature under frontend-phase branch

Per-phase bindings:
                      backend                         frontend
  id token           REQ-XXX-NNN                      FE-NN
  branch             module-<module_id>               frontend-phase
  impl path guard    impl_file must NOT start frontend/  impl_file MUST start frontend/
  test command       ./scripts/test.sh (subagent)     vitest + playwright (subagent; cmds from docs/04 §零)
  reviewer agent     superpower-code-reviewer         fe-code-reviewer
  spec context       docs/01 REQ (ignore UI), docs/03 docs/01 REQ, docs/05, docs/04 §零 tokens, associated_prototypes[]
  done-mark target   docs/08 §二 REQ checkbox          docs/08 §三 FE checkbox
  ordering source    docs/08 §二 (module→REQ order)    docs/08 §三 (FE list order)

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-specfeature-tddfeature-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.


Task 1: Prep — branch hygiene, plugin.json, drop the hook

Files:

  • Modify: .claude-plugin/plugin.json
  • Delete: hooks/ (dir: hooks.json + scripts/log-cross-module.sh)

  • Step 1: Confirm we're on the lite branch in the worktree

Run: git branch --show-current Expected: lite

  • Step 2: Delete the hook directory
git rm -r hooks/

Expected: removes hooks/hooks.json and hooks/scripts/log-cross-module.sh.

  • Step 3: Edit plugin.json

Set "version": "0.1.0-lite" and "description": "ERP/全栈项目精简流程框架(lite):计划三段(一次性)+ 编码统一功能循环(后端模块 / 前端阶段共用),保留 TDD、需求可追溯、DB-as-SSoT + Flyway、本地里程碑 tag。". Leave "skills" array unchanged.

  • Step 4: Verify

Run: python3 -c "import json;json.load(open('.claude-plugin/plugin.json'))" && echo OK && ls hooks 2>/dev/null || echo "hooks gone" Expected: OK then hooks gone.

  • Step 5: Commit
git add -A && git commit -m "chore(lite): drop cross-module hook, bump plugin meta to lite"

Task 2: Build the unified feature loop (Tier 1 centerpiece)

This is the highest-value change. Create 3 phase-parameterized skills, then delete the 11 superseded loop skills.

2a. skills/coding/feature-spec/ (= feature-brainstorm + feature-plan, both phases)

Files:

  • Create: skills/coding/feature-spec/SKILL.md
  • Create: skills/coding/feature-spec/templates/feature-spec-plan-template.md

Frontmatter:

name: feature-spec
description: 统一功能循环第 1 步(后端 REQ / 前端 FE 共用,由 phase 参数区分)。交互式 Q&A → 产出"规格 + 任务级 TDD 计划"合并文档到 docs/superpowers/specs/,链入 feature-tdd。
user-invocable: false
allowed-tools: Read Write Grep Glob Skill AskUserQuestion Bash(mysql *)

Body — derive by merging:

  • 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.
  • Replace the "阶段范围(后端)" section with a phase switch referencing the phase contract above:
    • 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/.
    • 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.)
  • 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 §零环境".
  • 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.
  • 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.

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.)

  • 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.
  • Step 2: Write skills/coding/feature-spec/templates/feature-spec-plan-template.md per spec above.
  • Step 3: Write skills/coding/feature-spec/SKILL.md per spec above.
  • 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.

2b. skills/coding/feature-tdd/ (= backend feature-tdd + fe-feature-tdd)

Files:

  • Create: skills/coding/feature-tdd/SKILL.md
  • 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)

Frontmatter: name feature-tdd; same allowed-tools as heavy feature-tdd (Read Write Edit Agent Skill Bash(git add *) Bash(git commit *)).

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:

  • phase=backend: impl_file starting frontend/ → hard stop (existing behavior). Schema-first migration rule applies.
  • 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. Keep "all test runs go to Agent subagent" (preserves the saved test-isolation guarantee). End → Skill(feature-review) with { phase, id }.

  • Step 1: Read skills/coding/feature-tdd/SKILL.md + skills/coding/fe-feature-tdd/SKILL.md.

  • Step 2: Copy the commit-message template into the new dir.

  • Step 3: Write merged skills/coding/feature-tdd/SKILL.md.

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).

  • 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.

2c. skills/coding/feature-review/ (= feature-verify + feature-review)

Files:

  • Create: skills/coding/feature-review/SKILL.md
  • 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 ## 自审结论)
  • Create: skills/coding/feature-review/templates/commit-message-template.md (copy, for fix commits)

Frontmatter: name feature-review; allowed-tools Read Write Edit Skill Agent Bash(git add *) Bash(git commit *).

Body — merge into a 2-stage flow:

  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.
  2. Review stage (from feature-review): dispatch reviewer agent — phase=backendsuperpower-code-reviewer; phase=frontendfe-code-reviewer — render ## 自审结论 with verdict. Write the combined doc to docs/superpowers/reviews/<YYYY-MM-DD>-<id>.md.
  3. Dispatch by verdict (keep heavy logic, parameterized):
    • approve: mark done in docs/08 (phase=backend → §二 REQ checkbox [x]; phase=frontend → §三 FE checkbox [x]), then Skill(phase-driver) with { phase }.
    • request-changes (round<5): edit must_fix files, fix-commit, re-run from stage 1.
    • round==5: stop, escalate.
  • Step 1: Read the 2 source SKILLs + 2 source templates + agents/fe-code-reviewer.md (to confirm subagent_type name).
  • Step 2: Write the merged template.
  • Step 3: Copy commit-message template.
  • Step 4: Write skills/coding/feature-review/SKILL.md.
  • 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.

2d. Delete superseded loop skills

  • Step 1: Delete the 8 loop skills now replaced
git rm -r skills/coding/feature-brainstorm skills/coding/feature-plan skills/coding/feature-verify \
          skills/coding/fe-feature-brainstorm skills/coding/fe-feature-plan skills/coding/fe-feature-tdd \
          skills/coding/fe-feature-verify skills/coding/fe-feature-review

(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.)

  • 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.

  • Step 3: Commit

git add -A && git commit -m "feat(lite): unify backend+frontend feature loops into one phase-parameterized 3-step chain"

Task 3: Merge the two phase drivers → phase-driver

Files:

  • Create: skills/coding/phase-driver/SKILL.md
  • (No banner template — replace banners with a short inline printed status; see note.)
  • Delete: skills/coding/module-start/, skills/coding/frontend-start/

Frontmatter:

name: phase-driver
description: 统一阶段循环驱动(后端模块 / 前端阶段共用,由 phase 参数区分)。定位当前未完成单元并派发 feature-spec,全完成则派发 milestone。幂等可重入。
user-invocable: false
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 *)

Body — phase switch:

  • Receives { phase } from coding-start (or callback from feature-review approve, which passes the same phase it was running).
  • 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).
  • 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).
  • Replace both banner-template renders with a single inline 3-line status print (阶段 / 分支 / 进度 done/total / 下一单元). (Drops 2 banner templates.)

  • 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).

  • Step 2: Write skills/coding/phase-driver/SKILL.md.

  • Step 3: git rm -r skills/coding/module-start skills/coding/frontend-start

  • 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.

  • Step 5: Commit git add -A && git commit -m "feat(lite): merge module-start + frontend-start into phase-driver"


Task 4: Merge the milestone trio → milestone

Files:

  • Create: skills/coding/milestone/SKILL.md
  • Create: skills/coding/milestone/templates/milestone-report-template.md (trimmed from 12 → 6 sections, with a test-evidence section folded in)
  • Delete: skills/coding/test-gate/, skills/coding/module-report/, skills/coding/milestone-tag/

Frontmatter:

name: milestone
description: 单元(后端模块 / 前端阶段)全部 approve 后的收尾闸门:子会话跑测试 → 写精简完成报告 → 本地 merge 进默认分支 + 打 milestone/<id> tag + 回写 docs/08 → 自动回调 coding-start。phase 由当前分支推断。
user-invocable: false
allowed-tools: Read Write Edit Skill Agent Bash(git *)

Body — 4 stages (infer phase from branch like the heavy trio):

  • Stage 0: git branch --show-currentmodule-<id> ⇒ phase=backend, phase_id=<id>; frontend-phase ⇒ phase=frontend, phase_id=frontend-phase; else hard stop.
  • 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.)
  • 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.)
  • Stage 3 (integrate + tag): worktree-clean check → detect local main/mastergit 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.)
  • Stage 4: Skill(coding-start) callback (no human gate).

Trimmed report template milestone-report-template.md (6 sections):

# 完成报告 — {{phase_id}}({{phase}})

> 生成: {{date}} | 分支: {{branch}} | 里程碑: {{milestone_tag}}

## ① 单元信息
- 类型: {{phase}}  |  ID: {{phase_id}}  |  名称: {{name}}
- 覆盖单元(REQ / FE): {{covered_list}}

## ② 测试证据
- 命令: {{test_command}}  |  退出码: {{exit_code}}  |  通过/失败: {{passed}}/{{failed}}
- 摘要: {{stdout_excerpt}}

## ③ 文件变更
{{git_diff_stat}}

## ④ 数据库 / Migration(前端填 N/A)
{{migrations_summary}}

## ⑤ 偏离与取舍
{{deviations}}  <!-- 无则写"无偏离";前端额外列 DOM 与关联原型主结构差异 -->

## ⑥ 里程碑
- tag: {{milestone_tag}}
- 下一步: {{next_unit}}
  • 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.
  • Step 2: Write skills/coding/milestone/templates/milestone-report-template.md (6 sections above).
  • Step 3: Write skills/coding/milestone/SKILL.md (4 stages above).
  • Step 4: git rm -r skills/coding/test-gate skills/coding/module-report skills/coding/milestone-tag
  • 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.
  • Step 6: Commit git add -A && git commit -m "feat(lite): merge test-gate + module-report + milestone-tag into one milestone skill"

Task 5: Plan phase — lite-init (= project-init + scope-lock)

Files:

  • Create: skills/plan/lite-init/SKILL.md
  • 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
  • Copy skills/plan/scope-lock/scripts/render.shskills/plan/lite-init/scripts/render.sh
  • Delete: skills/plan/project-init/, skills/plan/scope-lock/

Frontmatter:

name: lite-init
description: 计划第 1 段——项目初始化 + 范围锁定。复制 CLAUDE.md/docs(01/04/08) 模板、依赖检查、git init,引导项目概述+技术栈+需求索引,生成 REQ 卡片骨架,停下等人工审阅 REQ。
user-invocable: false
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 *)

Body — concatenate the two source flows:

  1. Step 0: print lite flow banner with ▶ at "计划 ①" (banner created in Task 7).
  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.)
  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.
  4. Check docs/08 §一 lite checkboxes for stage ①, then STOP with the scope-lock REQ-review banner ("审阅完成后运行 /erp-workflow:plan-start").

Template edits:

  • 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.)
  • docs-08-initial-template.md: rewrite § 一 from A0–A5 to the lite 3-stage checklist (below). Keep § 二/§ 三 headers.
  • docs-04-stack-template.md: keep (will gain merged sections in Task 6/lite-design).

Lite docs/08 § 一 checklist (replaces A0–A5):

## 一、计划阶段进度

- [ ] 计划 ① 初始化 + 范围锁定 — lite-init
  - [ ] 项目文件骨架已创建(CLAUDE.md + docs/01 index + docs/04 + docs/08)
  - [ ] 依赖检查通过(git / mysql)
  - [ ] Git 已初始化
  - [ ] 项目概述已填写(CLAUDE.md § 🎯 项目概述)
  - [ ] 技术栈已确认(docs/04 § 零)
  - [ ] 需求清单索引已填写(docs/01-需求清单/index.md)
  - [ ] REQ 卡片骨架已生成(docs/01-需求清单/<module>/REQ-*.md)
- [ ] 计划 ② 脚手架 + 数据库设计 — lite-design
  - [ ] 架构文档已生成(docs/04 § 一+ | scripts/*.sh | .env.local | sql/migrations/)
  - [ ] docs/03 数据库设计已生成(REQ → 表/字段/索引/外键,回填 REQ 依赖表)
- [ ] 计划 ③ DB 初始化 + 下游文档 — lite-build-db
  - [ ] V1 migration 已生成并校验 + apply 到本地 MySQL
  - [ ] docs/05 API 契约已生成 + 回填 REQ 依赖接口
  - [ ] docs/08 § 二 模块清单(含 REQ 顺序)已生成
  • Step 1: Copy the 6 templates + render.sh into lite-init/.
  • Step 2: Edit lite-init/templates/docs-08-initial-template.md § 一 to the lite checklist above.
  • Step 3: Edit lite-init/templates/CLAUDE-template.md (interrupt condition 2; drop stale index table — placeholder for Task 8 re-index).
  • Step 4: Write skills/plan/lite-init/SKILL.md.
  • Step 5: git rm -r skills/plan/project-init skills/plan/scope-lock
  • 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).
  • Step 7: Commit git add -A && git commit -m "feat(lite): merge project-init + scope-lock into lite-init"

Task 6: Plan phase — lite-design + lite-build-db

6a. skills/plan/lite-design/ (= skeleton-gen + db-design-gen)

Files:

  • Create: skills/plan/lite-design/SKILL.md
  • 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
  • Copy skeleton-gen/scripts/merge-gitignore.sh
  • 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 / 交互约定, § 三 环境配置).
  • Delete: skills/plan/skeleton-gen/, skills/plan/db-design-gen/

Frontmatter:

name: lite-design
description: 计划第 2 段——生成架构文档(docs/04 § 一+,含前端 tokens + 环境)+ 工具脚本 + .env.local + sql/migrations/,然后从 REQ 正向设计 docs/03 并回填 REQ 依赖表,停下等人工审阅 docs/03。
user-invocable: false
allowed-tools: Read Write Edit Glob Grep Skill AskUserQuestion Bash(mkdir *) Bash(cp *) Bash(cat *) Bash(bash *)

Body:

  1. Step 0: lite flow banner ▶ at "计划 ②".
  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.)
  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(设计自动补)).
  4. Check docs/08 §一 stage ② boxes; STOP with docs/03-review banner ("审阅完成后运行 /erp-workflow:plan-start").
  • Step 1: Read skeleton-gen/SKILL.md, db-design-gen/SKILL.md + their templates + the docs-06-static + docs-07-env templates.
  • Step 2: Assemble lite-design/templates/docs-04-skeleton-template.md (skeleton outline + appended Tokens §二 + env §三).
  • Step 3: Copy remaining templates + merge-gitignore.sh into lite-design/.
  • Step 4: Write skills/plan/lite-design/SKILL.md.
  • Step 5: git rm -r skills/plan/skeleton-gen skills/plan/db-design-gen
  • 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.

6b. skills/plan/lite-build-db/ (= db-init + downstream-gen)

Files:

  • Create: skills/plan/lite-build-db/SKILL.md
  • Copy db-init/scripts/validate.shlite-build-db/scripts/validate.sh
  • Copy templates from downstream-gen: docs-05-header-template.md, docs-05-endpoint-template.md, docs-08-module-row-template.md
  • Delete: skills/plan/db-init/, skills/plan/downstream-gen/

Frontmatter:

name: lite-build-db
description: 计划第 3 段——解析 docs/03 → V1 migration + validate.sh 校验 + apply 到本地 MySQL;生成 docs/05 API 契约 + 回填 REQ 依赖接口;计算模块/REQ 顺序写入 docs/08 § 二(排序权威,取代 docs/02);最终占位符扫描后停下(计划完成)。
user-invocable: false
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 *)

Body:

  1. Step 0: lite flow banner ▶ at "计划 ③".
  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.
  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.
  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.
  • Step 1: Read db-init/SKILL.md, downstream-gen/SKILL.md (captured).
  • Step 2: Copy validate.sh + the 3 downstream templates into lite-build-db/.
  • Step 3: Write skills/plan/lite-build-db/SKILL.md (port the docs/02 ordering algorithm into the docs/08 §二 write step).
  • Step 4: git rm -r skills/plan/db-init skills/plan/downstream-gen
  • 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.
  • 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"

Task 7: Entries (plan-start, coding-start) + lite flow banner + interrupt-check

Files:

  • Create: skills/crosscut/plan-start/banners/flow-lite.txt (and reuse for coding-start, or one per entry)
  • Modify: skills/crosscut/plan-start/SKILL.md, skills/crosscut/coding-start/SKILL.md, skills/crosscut/interrupt-check/SKILL.md
  • 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).

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):

┌────────────────────────────────────────────────────────┐
│  erp-workflow-lite                                       │
│                                                          │
│  计划(/plan-start,一次性,2 个审阅断点)               │
│    ① lite-init      初始化 + REQ 卡片      ⏸ 审阅 REQ    │
│    ② lite-design    脚手架 + docs/03       ⏸ 审阅 schema │
│    ③ lite-build-db  V1+apply + docs/05/08                │
│                                                          │
│  编码(/coding-start,统一功能循环)                     │
│    后端模块循环  ┐                                       │
│    前端整体阶段  ┘→ phase-driver                         │
│        feature-spec → feature-tdd → feature-review       │
│        全 approve → milestone(test→报告→merge+tag)     │
└────────────────────────────────────────────────────────┘

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.

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).

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 ③.

  • 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).
  • Step 2: Edit plan-start/SKILL.md (routing + banner + 参考).
  • Step 3: Edit coding-start/SKILL.md (Plan check + dispatch to phase-driver + banner + 参考); delete old flow-overview.txt.
  • Step 4: Edit interrupt-check/SKILL.md (condition 2 + 参考 + drop cross-module ref).
  • 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.
  • 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"

Task 8: README + CLAUDE-template re-index + final consistency sweep

Files:

  • Modify: README.md (rewrite component tables: 11 skills, 2 agents, 0 hooks, trimmed templates, lite flow, 5-doc suite)
  • Modify: skills/plan/lite-init/templates/CLAUDE-template.md (end-of-file index table → lite skills + 5 docs)

  • 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 组件表".

  • Step 2: Update the CLAUDE-template index table to list the 11 lite skills + the 5 kept docs (01/03/04/05/08).

  • Step 3 (full sweep — orphans & dangling refs):

    • 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}.
    • For every ${CLAUDE_SKILL_DIR}/templates/..., ${CLAUDE_SKILL_DIR}/scripts/..., ${CLAUDE_PLUGIN_ROOT}/... reference: confirm the file exists at the corresponding skills/.../... path.
    • 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.
    • 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).
    • python3 -c "import json;json.load(open('.claude-plugin/plugin.json'))" && echo JSON_OK
  • Step 4: Fix anything the sweep flags.

  • Step 5: Commit git add -A && git commit -m "docs(lite): rewrite README + CLAUDE template index, final consistency sweep"


Self-Review (run against the spec)

Spec coverage:

  • Unify fe/backend loops → Task 2 (feature-spec/tdd/review, phase param). ✔
  • Collapse 5→3 steps → Task 2 (brainstorm+plan→spec; verify+review→review). ✔
  • Merge phase drivers → Task 3. ✔
  • Merge milestone trio → Task 4. ✔
  • Merge plan 6→3 respecting both review stops → Tasks 5–6. ✔
  • Trim docs to 01/03/04/05/08; fold 06 tokens + 07 env into 04 → Tasks 5 (§一 checklist), 6a (docs/04 fold). ✔
  • Move REQ ordering (was docs/02) into docs/08 §二 → Task 6b + consumed by Task 3 phase-driver. ✔
  • Drop cross-module-log + hook → Tasks 1, 2d, 7. ✔
  • Keep 2 reviewer agents, selected by phase → Task 2c. ✔
  • Preserve test-isolation (subagent) + traceability + Flyway + local milestone tag → Tasks 2b/2c/4/6b. ✔
  • Entry skills print ASCII flow first (saved feedback) → Task 7 flow-lite.txt. ✔

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.

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.

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.