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