From e5abcd101d05a62ef429085dd00a7d962289072c Mon Sep 17 00:00:00 2001 From: ning-inspire Date: Tue, 17 Nov 2026 11:06:23 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E6=9C=AC=E4=BB=93?= =?UTF-8?q?=E5=BA=93=E7=BB=B4=E6=8A=A4=E5=9E=8B=20skills?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新增 work-in-example、modify-example、modify-harness,并注册到 opencode 的 .agents/skills。 Co-authored-by: Cursor --- .agents/skills/modify-example/SKILL.md | 96 ++++++++++++++++++++++ .agents/skills/modify-harness/SKILL.md | 105 ++++++++++++++++++++++++ .agents/skills/work-in-example/SKILL.md | 88 ++++++++++++++++++++ AGENTS.md | 6 +- README.md | 5 +- opencode.jsonc | 1 + 6 files changed, 298 insertions(+), 3 deletions(-) create mode 100644 .agents/skills/modify-example/SKILL.md create mode 100644 .agents/skills/modify-harness/SKILL.md create mode 100644 .agents/skills/work-in-example/SKILL.md diff --git a/.agents/skills/modify-example/SKILL.md b/.agents/skills/modify-example/SKILL.md new file mode 100644 index 0000000..2b356dd --- /dev/null +++ b/.agents/skills/modify-example/SKILL.md @@ -0,0 +1,96 @@ +--- +name: modify-example +description: 先改 example-project 样例,再把约定回写刷新 harness 模板与安装器。当用户说"改样例"、"改 example-project"、"样例目录结构调整"、"以 example 为准刷新 harness"、modify-example 时使用。 +--- + +# 改样例 → 刷新 harness + +**方向**:`example-project/` 是事实源 → 约定成熟后再回写 harness 交付物。 + +适用于:目录布局、docs 约定、AGENTS 规范、overnight-runner 安装形态等,**先在样例里跑通**,再推广到安装器 / skill 模板。 + +## 什么时候用 + +- 要调整案例项目结构或文档体系,并希望新项目安装后长成一样 +- 用户明确说「先改 example,再刷 harness」 +- 不确定最终约定时,用 example 当沙盒试错 + +**不要用本 skill**:只改 harness 模板、占位符、安装脚本(用 `modify-harness`)。 + +## 硬性约束 + +1. **Plan 闸门**:在 `.agents/plan/YYYYMMDD-{slug}.md` 写方案,**等人确认**后再动手。 +2. **模块边界**:四个安装器/套件模块互不 import;只通过文件系统与清单通信。 +3. **不写死绝对路径**进会分发的产物;模板用 `{{PLACEHOLDER}}`,并登记 `agile-team-sdd/placeholders.md`。 +4. **不碰** example 业务代码之外的无关重构;安装器默认不覆盖,刷新用显式 `--force`。 +5. 改完跑 `./.agents/verify.sh`(动 overnight-runner 行为则全量,含冒烟)。 + +## 怎么做 + +### 1. 确认范围 + +分清本轮只动 example 的哪一块,以及回写会落到哪些 harness 模块: + +| example 改动 | 通常要回写 | +|---|---| +| `apps/`、根布局、脚本路径 | `harness-installer` 探测默认值、`agile-team-sdd` 占位符默认值、文档树 | +| `docs/features` 约定(编码文件夹、spec/plan、`_chores`) | `harness-installer/templates/docs/`、`ba-write-spec` / `dev-plan`、catalog、`placeholders.md` | +| `docs/facts` 等事实目录 | 模板骨架、相关 skill、`team-workflow-guide` | +| `.overnight-runner/` 布局 | `overnight-runner/scripts/install.sh` + README/SKILL | +| `AGENTS.md` 流程/检查清单 | `harness-installer/templates/AGENTS.md.template` | + +### 2. Plan → 等人确认 + +写清:目标结构、迁移映射、旧路径怎么处理、Phase 划分(example 先 / harness 后)、验证命令。 + +### 3. 只改 `example-project/` + +- 搬家优先 `git mv` 保历史 +- 同步活文档:`example-project/AGENTS.md`、`docs/README.md`、索引 README、队列里的 plan 路径 +- 历史已定稿 plan:**可不改语义**;为保链接可批量替换路径字符串 +- 此阶段 **不要** 先改模板「假装同步」——以 example 落地结果为准 + +### 4. 回写 harness(刷新) + +按映射改对应模块,常见清单: + +- [ ] `agile-team-sdd/placeholders.md` + `install.sh` 默认值 / PAIRS +- [ ] `agile-team-sdd/skills/*-template/SKILL.md` + `catalog.json` + `SKILL.md` / `README.md` 表格 +- [ ] `harness-installer/templates/**` + `scripts/init-harness.sh` +- [ ] `overnight-runner/scripts/install.sh` + 文档(若涉及) +- [ ] 根 `AGENTS.md` / `README.md` / `team-workflow-guide/index.html`(若流程或路径变了) + +### 5. 把刷新结果装回 example + +```bash +PATH_MODE=relative ./agile-team-sdd/install.sh example-project --force +# 若动了 overnight-runner 安装布局: +./overnight-runner/scripts/install.sh example-project --force +``` + +确认 `example-project/.agent/skills/` 无残留 `{{...}}`、路径与新约定一致。 + +### 6. 验证与自检 + +```bash +./.agents/verify.sh +``` + +- [ ] example 新结构可导航,无大面积死链 +- [ ] 占位符已登记;模板无未替换 `{{...}}` +- [ ] catalog ↔ 模板 ↔ 已安装三方一致 +- [ ] 文档同步检查(§13)已做 +- [ ] 提交说明含:改了什么 / 为什么 / 怎么验证 / 文档同步 + +## 反模式 + +- 只改 example 不回写 harness,导致「样例是一套、安装又是一套」 +- 未确认 Plan 就大面积搬家 +- 用绝对路径写进 skill 模板 +- 回写时漏掉 `placeholders.md` / `catalog.json` / 工作流指南中的一处 + +## 相关 + +- 反向流程:`.agents/skills/modify-harness/SKILL.md` +- 规范:根目录 `AGENTS.md` +- 验证:`./.agents/verify.sh` diff --git a/.agents/skills/modify-harness/SKILL.md b/.agents/skills/modify-harness/SKILL.md new file mode 100644 index 0000000..b2dc3bb --- /dev/null +++ b/.agents/skills/modify-harness/SKILL.md @@ -0,0 +1,105 @@ +--- +name: modify-harness +description: 先优化 harness(模板、占位符、安装器、skill),再安装刷新到 example-project。当用户说"改 harness"、"改模板"、"改占位符"、"优化安装器"、"刷新 example 上的 skills"、modify-harness 时使用。 +--- + +# 改 harness → 刷新 example + +**方向**:harness 交付物是事实源 → 改完后 **强制重装** 到 `example-project/`,保证样例与套件一致。 + +适用于:skill 模板正文、占位符、catalog、安装脚本、docs 骨架模板、overnight-runner 安装布局等。 + +## 什么时候用 + +- 优化 / 修复 harness 本身(不是先在业务样例里试约定) +- 用户明确说「改模板 / 安装器 / skill,再刷到 example」 +- 只改套件文档或触发描述,也需要重装时验证 example 仍干净 + +**不要用本 skill**:要以样例试出新目录/文档约定再推广(用 `modify-example`)。 + +## 硬性约束 + +1. **Plan 闸门**:在 `.agents/plan/YYYYMMDD-{slug}.md` 写方案,**等人确认**后再动手(纯文案微调且用户说跳过闸门除外)。 +2. **模块边界**:`agile-team-sdd` / `harness-installer` / `tool-chain-installer` / `overnight-runner` **互不 import**。 +3. 新增占位符必须登记 `agile-team-sdd/placeholders.md`;模板带 `TEMPLATE-ONLY` 块;`name` 与目录一致且模板带 `-template` 后缀。 +4. 安装脚本保持:`--help` / `--dry-run`、幂等、默认不覆盖、产物无安装机绝对路径。 +5. 改完:`PATH_MODE=relative` 重装 example skills,再跑 `./.agents/verify.sh`。 + +## 怎么做 + +### 1. 确认落点模块 + +| 改动类型 | 改哪里 | +|---|---| +| SDD skill 行为 / 触发词 | `agile-team-sdd/skills/-template/` + `catalog.json` + 套件 `SKILL.md`/`README.md` | +| 路径 / 默认目录 | `placeholders.md` + `install.sh`(及 `harness-installer/scripts/init-harness.sh` 若相关) | +| 目标项目 docs / AGENTS 骨架 | `harness-installer/templates/` | +| MCP 清单 | `tool-chain-installer/catalog/mcp-catalog.json` | +| overnight-runner 安装位置 / 配置 | `overnight-runner/scripts/install.sh` + 包代码 / 测试 | +| 流程与角色叙述 | `team-workflow-guide/index.html`(测试分类同时看 `example-project/docs/standards/test.md`) | + +### 2. Plan → 等人确认 + +写清:改哪些文件、是否破坏性(占位符改名、默认路径变更)、example 如何验证、是否需要 `--force` 重装。 + +### 3. 先写验证(若可自动化) + +- 能加进 `./.agents/verify.sh` 或 overnight-runner 单测/冒烟的先加 +- 破坏性约定变更:在 Plan 里写明迁移 / 兼容策略(旧路径自动迁?仅文档提示?) + +### 4. 实现 harness 改动 + +- 模板路径一律 `{{PLACEHOLDER}}` +- 新增 skill:建 `skills/-template/SKILL.md` → 登记 `catalog.json` → 更新套件表格 +- 改 overnight-runner 行为:保持零第三方依赖与 Python 3.9 语法约束 + +### 5. 刷新到 example-project + +先 dry-run,再强制安装: + +```bash +PATH_MODE=relative ./agile-team-sdd/install.sh example-project --dry-run +PATH_MODE=relative ./agile-team-sdd/install.sh example-project --force + +# 若改了 harness-installer 骨架且需要对照: +# ./harness-installer/scripts/init-harness.sh example-project --dry-run +# (对已填满的 example 慎用 --force,避免冲掉手写 AGENTS/docs) + +# 若改了 overnight-runner 安装器: +./overnight-runner/scripts/install.sh example-project --force +``` + +**注意**:`init-harness.sh --force` 会覆盖目标 `AGENTS.md` / docs 模板文件;example 已是完整范例时,优先手改对齐或只重装 skills,除非 Plan 明确要求强刷骨架。 + +### 6. 对齐 example 手写层(若需要) + +重装 skills **不会**自动改 `example-project/AGENTS.md`、业务 docs 正文。若 harness 约定变了而 example 手写层仍旧: + +- 按新约定改 example 文档树 / AGENTS 相关章节 +- 或开一轮 `modify-example` 专做样例对齐(在 Plan 里写明) + +### 7. 验证与自检 + +```bash +./.agents/verify.sh +# 改了 overnight-runner 行为:不要 --fast +``` + +- [ ] 模板无残留未登记占位符 +- [ ] example 已安装 skill 无 `{{...}}`、无本机绝对路径 +- [ ] catalog ↔ 模板 ↔ 已安装一致 +- [ ] §13 文档同步完成 +- [ ] 提交说明含验证方式与文档同步检查 + +## 反模式 + +- 改完模板不 `--force` 重装 example,样例 skills 继续说旧路径 +- 把 example 当安装器的输出随便 `--force` 冲掉手写 AGENTS,却不在 Plan 里声明 +- 只改 `example-project/.agent/skills/` 已安装副本,不改 `*-template`(下次安装会盖回去) +- 跨模块直接 import 代码 + +## 相关 + +- 反向流程:`.agents/skills/modify-example/SKILL.md` +- 规范:根目录 `AGENTS.md` +- 验证:`./.agents/verify.sh` diff --git a/.agents/skills/work-in-example/SKILL.md b/.agents/skills/work-in-example/SKILL.md new file mode 100644 index 0000000..308ae17 --- /dev/null +++ b/.agents/skills/work-in-example/SKILL.md @@ -0,0 +1,88 @@ +--- +name: work-in-example +description: 在 example-project 上下文中开发或改约定;结束时若识别到需要改 harness 则询问是否更新。当用户说"在 example 里做"、"只改样例"、"example 上下文"、work-in-example、以案例项目为工作区时使用。 +--- + +# 工作在 example 上下文 + +默认工作区是 **`example-project/`**:改代码、docs、AGENTS、已安装 skills 的行为验证,都以样例项目为准。 + +本 skill **不**默认回写 harness。只有当你识别到「样例里的约定已经偏离套件模板 / 安装器」时,在收尾阶段 **询问** 是否更新 harness。 + +## 什么时候用 + +- 用户要在样例里实现功能、改文档、调 overnight-runner 配置、验证流程 +- 明确「先只动 example,别管 harness」 +- 不确定会不会波及 harness,需要结束时再决策 + +**不要用本 skill**: + +- 一开始就确定要改模板/占位符/安装器 → `modify-harness` +- 一开始就确定「example 试约定 → 强制回写套件」→ `modify-example` + +## 工作边界 + +| 可以改 | 默认不要改(除非用户确认更新 harness) | +|---|---| +| `example-project/**` | `agile-team-sdd/`、`harness-installer/`、`tool-chain-installer/`、`overnight-runner/`(套件源) | +| 样例内 `.agent/skills/`(仅作本地验证时可改,须知重装会覆盖) | 根 `AGENTS.md` 里套件级约定(可提建议,不擅自改) | + +本仓库自身的 Plan 仍写在 `.agents/plan/`(若改动触及 harness 仓库规范)。 +example 业务 Plan 写在 `example-project/docs/features/.../plan.md` 或 `_chores/`。 + +## 怎么做 + +### 1. 锚定上下文 + +- 路径、命令、自测都以 `example-project/` 为根(如 `apps/backend`、`docs/features/`、`.overnight-runner/`) +- 读 `example-project/AGENTS.md` 与相关 docs,按其规范执行 +- 需要安装态 skill 时,以 `example-project/.agent/skills/` 为准 + +### 2. 执行用户任务 + +按 example 的开发流程做(Plan 闸门、自测、文档同步等,见 `example-project/AGENTS.md` §14)。 + +过程中若发现「套件模板明显落后于样例约定」,**先记在清单里,不要中途擅自改 harness**,除非用户当场要求。 + +### 3. 收尾:识别是否需要更新 harness + +任务完成后,用下面信号判断(命中任一条即视为「可能需要更新 harness」): + +| 信号 | 例子 | +|---|---| +| 目录/命名约定变了 | feature 文件夹编码规则、`spec.md`/`plan.md` 布局、`apps/`、`.overnight-runner/` | +| 文档骨架变了 | `docs/` 下新目录、facts/business、`_chores` 语义 | +| 流程/检查清单变了 | `example-project/AGENTS.md` 与模板 `AGENTS.md.template` 明显不一致 | +| 安装默认值会错 | 新默认路径、端口、测试命令,现有 `placeholders.md` / `install.sh` 对不上 | +| skill 行为以样例为准改过 | 只改了 `.agent/skills/` 已安装副本,模板仍是旧的 | + +**未命中**:正常收尾(验证、文档同步、提交说明),不必提 harness。 + +**命中**:在最终回复里 **明确询问**(不要默认执行),例如: + +> 本轮在 example 中出现了与 harness 不一致的约定:\<一句话列出信号\>。 +> 是否需要现在更新 harness(按 `modify-example`:回写模板/安装器并重装 example skills)? +> 回复「是 / 否」即可。 + +- 用户说 **是** → 切换遵循 `modify-example`(写/补 Plan → 等人确认若尚未覆盖 harness 回写 → 回写 → `PATH_MODE=relative` 重装 → `./.agents/verify.sh`) +- 用户说 **否** → 在收尾注明「已知漂移,暂不回写」,可把差异记进 `.agents/plan/` 或回复中的 follow-up 列表 +- 用户说 **稍后 / 另开一轮** → 记下,不在本轮改 harness + +## 硬性约束 + +1. 未经询问确认,**禁止**修改 harness 源模块与根套件文档(维护型 skill 目录除外的只读参考可以读)。 +2. 不要把「改了 example 已安装 skill」当成「harness 已更新」。 +3. 询问时只给一次清晰二选一,附上为何认为需要更新;不要偷偷 `--force` 重装。 +4. 若用户同意更新 harness,遵守根 `AGENTS.md` 的 Plan 闸门与模块边界。 + +## 反模式 + +- 在 example 里改完目录约定,静默改掉 `harness-installer` 模板 +- 把套件 skill 模板和 example 已安装副本改成两套长期分叉且不告知 +- 把任何 docs 措辞差异都升级成「必须更新 harness」(仅约定/结构/安装默认值类信号才问) + +## 相关 + +- 同意回写后:`.agents/skills/modify-example/SKILL.md` +- 直接改套件:`.agents/skills/modify-harness/SKILL.md` +- 验证:`./.agents/verify.sh` diff --git a/AGENTS.md b/AGENTS.md index 55f2a11..e41c17e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -26,7 +26,7 @@ ``` team-harness-suite/ -├── .agents/ # 本仓库自用:verify.sh + plan/ +├── .agents/ # 本仓库自用:verify.sh + plan/ + skills/ ├── agile-team-sdd/ # SDD 技能套件(16 个 skill 模板 + 安装器) ├── harness-installer/ # 初始化目标项目的 AGENTS.md + docs/ 骨架 ├── tool-chain-installer/ # 安装 MCP 工具链到项目配置 @@ -58,6 +58,7 @@ team-harness-suite/ | **安装器型** | `harness-installer/`、`tool-chain-installer/` | 一个 skill,作用是把东西装进目标项目 | | **套件型** | `agile-team-sdd/` | 一个 skill(安装器)+ N 个 skill 模板,一次装一批 | | **运行时型** | `overnight-runner/` | 一个 skill,作用是 **启动** 一个长跑工具 | +| **维护型** | `.agents/skills/` | 本仓库自用:`work-in-example`(样例上下文)与 example↔harness 刷新(不装进目标项目) | | **文档型** | `team-workflow-guide/` | 不是 skill,是人读的指南 | ### SKILL.md 格式(强制) @@ -409,7 +410,8 @@ team-harness-suite/ │ ├── .agents/ │ ├── verify.sh # 一键验证 -│ └── plan/ # 本仓库自身的开发计划(业务项目仍用 docs/plans/) +│ ├── plan/ # 本仓库自身的开发计划(业务项目用 feature/plan 或 _chores) +│ └── skills/ # 本仓库维护型 skill(work-in-example / modify-example / modify-harness) │ ├── agile-team-sdd/ │ ├── README.md # 套件说明 diff --git a/README.md b/README.md index 8fde70c..cce5c5f 100644 --- a/README.md +++ b/README.md @@ -144,7 +144,10 @@ team-harness-suite/ ├── team-workflow-guide/ # 团队流程与角色手册 ├── overnight-runner/ # 无人值守跑 plan 的分屏面板 + 看门狗 ├── example-project/ # 全栈参考实现(已装全套 skills) -├── .agents/verify.sh # 一键验证(语法 / skill 一致性 / 链接 / 冒烟测试) +├── .agents/ +│ ├── verify.sh # 一键验证 +│ ├── plan/ # 本仓库开发计划 +│ └── skills/ # 维护型:work-in-example / modify-example / modify-harness └── opencode.jsonc # 注册本仓库的 skills 路径 ``` diff --git a/opencode.jsonc b/opencode.jsonc index b7155ea..bae41dc 100644 --- a/opencode.jsonc +++ b/opencode.jsonc @@ -3,6 +3,7 @@ "skills": { "paths": [ + ".agents/skills", "agile-team-sdd", "harness-installer", "tool-chain-installer",