Commit 5d67162b5ff39f95865b0f9f0164d580d634dfdb
1 parent
6eef75b0
skill(project-init/skeleton-gen/db-design-gen): drop idempotency restatements an…
…d parenthetical 参考 blocks
Showing
3 changed files
with
22 additions
and
43 deletions
skills/plan/db-design-gen/SKILL.md
| 1 | --- | 1 | --- |
| 2 | name: db-design-gen | 2 | name: db-design-gen |
| 3 | -description: A3 DB 设计 + REQ 回填——A0 确认 schema 约定写入 docs/04 + CLAUDE.md;基于 docs/01 REQ 卡片正向设计 docs/03(表/字段/索引/外键/业务注记),并回填 REQ 卡片「依赖表」与模块头「涉及表」的 `TBD(A3 自动补)`。停下等人工审阅。 | 3 | +description: A3 DB 设计 + REQ 回填——基于 docs/01 REQ 卡片正向设计 docs/03 并回填 REQ 卡片与模块头的 TBD 占位。 |
| 4 | user-invocable: false | 4 | user-invocable: false |
| 5 | allowed-tools: Read Write Edit Grep Glob AskUserQuestion | 5 | allowed-tools: Read Write Edit Grep Glob AskUserQuestion |
| 6 | --- | 6 | --- |
| @@ -9,11 +9,6 @@ allowed-tools: Read Write Edit Grep Glob AskUserQuestion | @@ -9,11 +9,6 @@ allowed-tools: Read Write Edit Grep Glob AskUserQuestion | ||
| 9 | 9 | ||
| 10 | # db-design-gen | 10 | # db-design-gen |
| 11 | 11 | ||
| 12 | -## 前置条件 | ||
| 13 | - | ||
| 14 | -- A1 `scope-lock` 已完成:`docs/01-需求清单/<module>/_module.md` + `docs/01-需求清单/<module>/REQ-*.md` 已生成,含 `TBD(A3 自动补)` 占位。 | ||
| 15 | -- A2 `skeleton-gen` 已完成:`docs/04-技术规范.md § 一+` 命名规范已生成(本 skill 推导表/字段命名时严格遵循)。 | ||
| 16 | - | ||
| 17 | ## 执行步骤 | 12 | ## 执行步骤 |
| 18 | 13 | ||
| 19 | ### 步骤 A0:确认 ERP schema 约定(一次性) | 14 | ### 步骤 A0:确认 ERP schema 约定(一次性) |
skills/plan/project-init/SKILL.md
| @@ -7,13 +7,11 @@ allowed-tools: Read Write Glob Edit Skill Bash(node *) Bash(git init) Bash(git r | @@ -7,13 +7,11 @@ allowed-tools: Read Write Glob Edit Skill Bash(node *) Bash(git init) Bash(git r | ||
| 7 | 7 | ||
| 8 | **所有输出必须使用中文。** | 8 | **所有输出必须使用中文。** |
| 9 | 9 | ||
| 10 | -你负责在项目目录中创建初始文件结构,已存在的文件不覆盖。 | ||
| 11 | - | ||
| 12 | ## 执行步骤 | 10 | ## 执行步骤 |
| 13 | 11 | ||
| 14 | ### A. 幂等复制模板文件(用 Glob + Read + Write,跨平台无 shell) | 12 | ### A. 幂等复制模板文件(用 Glob + Read + Write,跨平台无 shell) |
| 15 | 13 | ||
| 16 | -对下表每个文件:先用 `Glob` 判断目标路径是否已存在;**已存在则跳过**(不覆盖,幂等);不存在则用 `Read` 读模板、用 `Write` **原样**写到目标路径(`Write` 会自动创建缺失的父目录 `docs/01-需求清单/`,无需 `mkdir`)。 | 14 | +对下表每个文件:先用 `Glob` 判断目标路径是否已存在;**已存在则跳过**;不存在则用 `Read` 读模板、用 `Write` **原样**写到目标路径(`Write` 会自动创建缺失的父目录)。 |
| 17 | 15 | ||
| 18 | | 模板 | 目标路径 | | 16 | | 模板 | 目标路径 | |
| 19 | |---|---| | 17 | |---|---| |
| @@ -27,9 +25,9 @@ allowed-tools: Read Write Glob Edit Skill Bash(node *) Bash(git init) Bash(git r | @@ -27,9 +25,9 @@ allowed-tools: Read Write Glob Edit Skill Bash(node *) Bash(git init) Bash(git r | ||
| 27 | 25 | ||
| 28 | ### B. 依赖检查(跨平台,只检测不自动安装) | 26 | ### B. 依赖检查(跨平台,只检测不自动安装) |
| 29 | 27 | ||
| 30 | -对 **git、mysql、node** 三个命令做**跨平台 PATH 检测**:缺失则按当前操作系统(`process.platform`)打印对应安装指引并**停下**(不自动安装、不改 PATH——自动包管理在 Windows / 受限环境下不可靠,且静默改 PATH 有副作用)。 | 28 | +检测 git/mysql/node 是否在 PATH; 缺失则打印 OS 对应安装指引并停下. |
| 31 | 29 | ||
| 32 | -用 `Bash` 跑下面这段 `node` 脚本(用 `process.platform` 区分 `darwin` / `win32` / `linux`,跨平台检测命令是否在 PATH 上): | 30 | +用 `Bash` 跑下面这段 `node` 脚本: |
| 33 | 31 | ||
| 34 | ```bash | 32 | ```bash |
| 35 | node -e ' | 33 | node -e ' |
| @@ -103,8 +101,7 @@ if (missing.length) { | @@ -103,8 +101,7 @@ if (missing.length) { | ||
| 103 | 101 | ||
| 104 | ## 参考 | 102 | ## 参考 |
| 105 | 103 | ||
| 106 | -- `${CLAUDE_SKILL_DIR}/templates/CLAUDE-template.md`(项目级 CLAUDE.md 模板) | ||
| 107 | -- `${CLAUDE_SKILL_DIR}/templates/docs-01-index-template.md`(需求索引初稿) | ||
| 108 | -- `${CLAUDE_SKILL_DIR}/templates/docs-04-stack-template.md`(默认技术栈) | ||
| 109 | -- `${CLAUDE_SKILL_DIR}/templates/docs-08-initial-template.md`(A 阶段进度初始化) | ||
| 110 | -- 下游:`scope-lock`(A1,自动派发) | 104 | +- `${CLAUDE_SKILL_DIR}/templates/CLAUDE-template.md` |
| 105 | +- `${CLAUDE_SKILL_DIR}/templates/docs-01-index-template.md` | ||
| 106 | +- `${CLAUDE_SKILL_DIR}/templates/docs-04-stack-template.md` | ||
| 107 | +- `${CLAUDE_SKILL_DIR}/templates/docs-08-initial-template.md` |
skills/plan/skeleton-gen/SKILL.md
| @@ -7,8 +7,6 @@ allowed-tools: Read Write Edit Skill Grep Glob AskUserQuestion Bash(node *) | @@ -7,8 +7,6 @@ allowed-tools: Read Write Edit Skill Grep Glob AskUserQuestion Bash(node *) | ||
| 7 | 7 | ||
| 8 | **所有输出必须使用中文。** | 8 | **所有输出必须使用中文。** |
| 9 | 9 | ||
| 10 | -# skeleton-gen | ||
| 11 | - | ||
| 12 | ## 执行步骤 | 10 | ## 执行步骤 |
| 13 | 11 | ||
| 14 | ### A. 读取锁定的输入 | 12 | ### A. 读取锁定的输入 |
| @@ -34,8 +32,6 @@ allowed-tools: Read Write Edit Skill Grep Glob AskUserQuestion Bash(node *) | @@ -34,8 +32,6 @@ allowed-tools: Read Write Edit Skill Grep Glob AskUserQuestion Bash(node *) | ||
| 34 | | `docs/07-环境配置.md` | `${CLAUDE_SKILL_DIR}/templates/docs-07-env-template.md` | | 32 | | `docs/07-环境配置.md` | `${CLAUDE_SKILL_DIR}/templates/docs-07-env-template.md` | |
| 35 | | `docs/09-项目目录结构.md` | `${CLAUDE_SKILL_DIR}/templates/docs-09-structure-template.md` | | 33 | | `docs/09-项目目录结构.md` | `${CLAUDE_SKILL_DIR}/templates/docs-09-structure-template.md` | |
| 36 | 34 | ||
| 37 | -> **docs/07 只记规则,不记具体配置值**:端口 / 包名 / 库名 / 初始账号等真实值在 `config-vars.yaml`(A1 scope-lock 已锁)与 `.env.local`(敏感)里,docs/07 只写命名约定、端口约定、安全规则,并指向这两个文件。 | ||
| 38 | - | ||
| 39 | 项目专属标识(根包名 / 命名空间)保留 `【人工填写:<说明>】` 占位,等人工在 docs/09 顶部补填一次后,其他文件复用。 | 35 | 项目专属标识(根包名 / 命名空间)保留 `【人工填写:<说明>】` 占位,等人工在 docs/09 顶部补填一次后,其他文件复用。 |
| 40 | 36 | ||
| 41 | ### B.2 追加 docs/04 § 一+(保留 § 零 不覆盖) | 37 | ### B.2 追加 docs/04 § 一+(保留 § 零 不覆盖) |
| @@ -74,15 +70,6 @@ docs/04 已由 scope-lock 写入 § 零。本步骤追加 § 一 ~ 三。 | @@ -74,15 +70,6 @@ docs/04 已由 scope-lock 写入 § 零。本步骤追加 § 一 ~ 三。 | ||
| 74 | - `{{e2e_cmd}}` E2E(无 E2E 工具则填 `echo "[test.mjs] e2e 略"`) | 70 | - `{{e2e_cmd}}` E2E(无 E2E 工具则填 `echo "[test.mjs] e2e 略"`) |
| 75 | 71 | ||
| 76 | > 占位是普通 shell 命令字符串,模板在运行期用 `spawnSync(cmd, { shell:true })` 跨平台执行(Windows 走 cmd.exe,*nix 走 /bin/sh),缺席 stack 由模板内的 `existsSync('backend')` / `existsSync('frontend')` 守卫跳过。 | 72 | > 占位是普通 shell 命令字符串,模板在运行期用 `spawnSync(cmd, { shell:true })` 跨平台执行(Windows 走 cmd.exe,*nix 走 /bin/sh),缺席 stack 由模板内的 `existsSync('backend')` / `existsSync('frontend')` 守卫跳过。 |
| 77 | -> 推断规则:根据 `docs/04 § 零` 。 | ||
| 78 | -> - 「后端*」存在 → 据后端技术栈推 backend 三槽(build / lint / test 命令) | ||
| 79 | -> - 「前端*」存在 → 据前端技术栈推 frontend 三槽 | ||
| 80 | -> - 缺席 stack → 三槽全填 `echo skip`(该 stack 目录不存在时模板不会执行,但占位须为合法命令) | ||
| 81 | -> - `{{e2e_cmd}}` 通常仅前端,按上述前端规则或填 `echo "[test.mjs] e2e 略"` | ||
| 82 | -> | ||
| 83 | -> 表结构异常(列名变更 / 无中文前缀)时停下,用 `AskUserQuestion` 让用户显式确认每 stack 命令。 | ||
| 84 | - | ||
| 85 | -> 注:生成的 `scripts/*.mjs` 由 `node` 直接执行,**无需 `chmod +x`**(跨平台无文件权限位概念)。 | ||
| 86 | 73 | ||
| 87 | 完成后,用 `Edit` 在 `docs/08-模块任务管理.md` 中勾选: | 74 | 完成后,用 `Edit` 在 `docs/08-模块任务管理.md` 中勾选: |
| 88 | - ` - [ ] 工具脚本已生成(scripts/*.mjs、.env.local)` | 75 | - ` - [ ] 工具脚本已生成(scripts/*.mjs、.env.local)` |
| @@ -96,7 +83,7 @@ docs/04 已由 scope-lock 写入 § 零。本步骤追加 § 一 ~ 三。 | @@ -96,7 +83,7 @@ docs/04 已由 scope-lock 写入 § 零。本步骤追加 § 一 ~ 三。 | ||
| 96 | node "${CLAUDE_PLUGIN_ROOT}/lib/merge-gitignore.mjs" .gitignore "${CLAUDE_SKILL_DIR}/templates/gitignore-append-template" | 83 | node "${CLAUDE_PLUGIN_ROOT}/lib/merge-gitignore.mjs" .gitignore "${CLAUDE_SKILL_DIR}/templates/gitignore-append-template" |
| 97 | ``` | 84 | ``` |
| 98 | 85 | ||
| 99 | -> `.gitignore` 不存在时先用 `Write` 建一个空文件再调用(`merge-gitignore.mjs` 的第一个参数须可读)。 | 86 | +> `.gitignore` 不存在则先 Write 空文件。 |
| 100 | 87 | ||
| 101 | 完成后,用 `Edit` 在 `docs/08-模块任务管理.md` 中勾选: | 88 | 完成后,用 `Edit` 在 `docs/08-模块任务管理.md` 中勾选: |
| 102 | - ` - [ ] .gitignore 已配置` | 89 | - ` - [ ] .gitignore 已配置` |
| @@ -145,16 +132,16 @@ QA 横幅涵盖:产出文件清单(docs/04 / 06 / 07 / 09 + config-vars.yaml | @@ -145,16 +132,16 @@ QA 横幅涵盖:产出文件清单(docs/04 / 06 / 07 / 09 + config-vars.yaml | ||
| 145 | 132 | ||
| 146 | ## 参考 | 133 | ## 参考 |
| 147 | 134 | ||
| 148 | -- `docs/04-技术规范.md` § 零(技术栈输入) | ||
| 149 | -- `docs/01-需求清单/index.md`(模块索引输入) | ||
| 150 | -- `${CLAUDE_SKILL_DIR}/templates/docs-04-skeleton-template.md`(大纲) | ||
| 151 | -- `${CLAUDE_SKILL_DIR}/templates/docs-06-static-template.md`(大纲) | ||
| 152 | -- `${CLAUDE_SKILL_DIR}/templates/docs-07-env-template.md`(大纲) | ||
| 153 | -- `${CLAUDE_SKILL_DIR}/templates/docs-09-structure-template.md`(大纲) | ||
| 154 | -- `${CLAUDE_SKILL_DIR}/templates/scripts-test-template.mjs`(推断命令填充 7 槽:backend/frontend × build/lint/test + e2e;缺席 stack 填 `echo skip`) | ||
| 155 | -- `${CLAUDE_SKILL_DIR}/templates/scripts-setup-test-db-template.mjs`(0 槽位,跨平台 .env.local 解析 + DROP/CREATE) | ||
| 156 | -- `${CLAUDE_SKILL_DIR}/templates/env-local-template`(0 槽位;C.1 据 `config-vars.yaml` 的 `secrets_ref` 追加项目专属 secret 键) | ||
| 157 | -- `config-vars.yaml`(A1 scope-lock 输出,仓库根;C.1 读其 `secrets_ref` 对齐 `.env.local`,E.1 扫其残留 `【人工填写:`) | ||
| 158 | -- `${CLAUDE_SKILL_DIR}/templates/gitignore-append-template`(0 槽位) | ||
| 159 | -- `${CLAUDE_SKILL_DIR}/templates/styles-tokens-template.css`(0 槽位,样式 token 骨架) | ||
| 160 | -- `${CLAUDE_PLUGIN_ROOT}/lib/merge-gitignore.mjs`(.gitignore 逐行判重并集合并,跨平台纯 Node) | 135 | +- `docs/04-技术规范.md` § 零 |
| 136 | +- `docs/01-需求清单/index.md` | ||
| 137 | +- `${CLAUDE_SKILL_DIR}/templates/docs-04-skeleton-template.md` | ||
| 138 | +- `${CLAUDE_SKILL_DIR}/templates/docs-06-static-template.md` | ||
| 139 | +- `${CLAUDE_SKILL_DIR}/templates/docs-07-env-template.md` | ||
| 140 | +- `${CLAUDE_SKILL_DIR}/templates/docs-09-structure-template.md` | ||
| 141 | +- `${CLAUDE_SKILL_DIR}/templates/scripts-test-template.mjs` | ||
| 142 | +- `${CLAUDE_SKILL_DIR}/templates/scripts-setup-test-db-template.mjs` | ||
| 143 | +- `${CLAUDE_SKILL_DIR}/templates/env-local-template` | ||
| 144 | +- `config-vars.yaml` | ||
| 145 | +- `${CLAUDE_SKILL_DIR}/templates/gitignore-append-template` | ||
| 146 | +- `${CLAUDE_SKILL_DIR}/templates/styles-tokens-template.css` | ||
| 147 | +- `${CLAUDE_PLUGIN_ROOT}/lib/merge-gitignore.mjs` |