team-skills 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/.claude/commands/team-pull.md +21 -0
  2. package/.claude/commands/team-push.md +28 -0
  3. package/.claude/commands/team-setup.md +183 -0
  4. package/.claude/commands/team-uninstall.md +107 -0
  5. package/CHANGELOG.md +41 -0
  6. package/LICENSE +21 -0
  7. package/README.md +421 -0
  8. package/bin/team-skills.js +2 -0
  9. package/hooks/hooks.json +16 -0
  10. package/hooks/session-start +34 -0
  11. package/package.json +58 -0
  12. package/scripts/check-skill-structure.js +89 -0
  13. package/skills/CLAUDE.md +121 -0
  14. package/skills/_team-rules/constitutional-rules.md +25 -0
  15. package/skills/_team-rules/four-state-protocol.md +10 -0
  16. package/skills/_team-rules/verification-protocol.md +55 -0
  17. package/skills/team-brainstorm/SKILL.md +168 -0
  18. package/skills/team-debug/SKILL.md +143 -0
  19. package/skills/team-feedback/SKILL.md +175 -0
  20. package/skills/team-finish/SKILL.md +151 -0
  21. package/skills/team-impl/SKILL.md +316 -0
  22. package/skills/team-impl/references/06-tdd-log-template.md +62 -0
  23. package/skills/team-impl/references/07-prompt-log-template.md +32 -0
  24. package/skills/team-impl/references/08-ai-decisions-template.md +16 -0
  25. package/skills/team-orchestrator/SKILL.md +584 -0
  26. package/skills/team-orchestrator/references/14-team-template.md +70 -0
  27. package/skills/team-orchestrator/references/15-brief-template.md +50 -0
  28. package/skills/team-review/SKILL.md +383 -0
  29. package/skills/team-review/references/11-review-template.md +63 -0
  30. package/skills/team-review/references/12-asset-update-template.md +45 -0
  31. package/skills/team-review/references/13-retrospective-template.md +40 -0
  32. package/skills/team-score/SKILL.md +330 -0
  33. package/skills/team-spec/SKILL.md +231 -0
  34. package/skills/team-spec/references/01-plan-template.md +67 -0
  35. package/skills/team-spec/references/02-context-template.md +46 -0
  36. package/skills/team-spec/references/04-boundary-template.md +23 -0
  37. package/skills/team-spec/references/05-risk-template.md +50 -0
  38. package/skills/team-spec/references/delta-spec-template.md +32 -0
  39. package/skills/team-spec/references/prompt-template.md +23 -0
  40. package/skills/team-spec/references/sdd-template.md +72 -0
  41. package/skills/team-test/SKILL.md +190 -0
  42. package/skills/team-test/references/09-test-matrix-template.md +40 -0
  43. package/skills/team-test/references/10-test-report-template.md +59 -0
  44. package/skills/team-verify/SKILL.md +151 -0
  45. package/skills/using-team-skills/SKILL.md +137 -0
  46. package/src/cli.js +27 -0
  47. package/src/commands/init.js +115 -0
  48. package/src/commands/list.js +150 -0
  49. package/src/commands/setup.js +125 -0
  50. package/src/commands/uninstall.js +113 -0
  51. package/src/commands/update.js +118 -0
  52. package/src/lib/constants.js +17 -0
  53. package/src/lib/fs-utils.js +117 -0
  54. package/src/lib/inventory.js +64 -0
  55. package/src/lib/logger.js +34 -0
  56. package/src/lib/manifest.js +45 -0
package/README.md ADDED
@@ -0,0 +1,421 @@
1
+ <div align="center">
2
+
3
+ # Team Skills
4
+
5
+ **让 AI Agent 团队像专业开发团队一样协作**
6
+
7
+ [![GitHub stars](https://img.shields.io/badge/dynamic/json?logo=github&label=Stars&style=flat-square&color=blue&query=%24.stargazers_count&url=https%3A%2F%2Fapi.github.com%2Frepos%2Fandeya%2Fteam-skills)](https://github.com/andeya/team-skills)
8
+ [![CI](https://img.shields.io/github/actions/workflow/status/andeya/team-skills/ci.yml?branch=master&style=flat-square&label=CI)](https://github.com/andeya/team-skills/actions)
9
+ [![License](https://img.shields.io/badge/license-MIT-green?style=flat-square)](LICENSE)
10
+ [![Claude Code](https://img.shields.io/badge/Claude%20Code-Ready-purple?style=flat-square)](https://claude.ai)
11
+ [![Cursor](https://img.shields.io/badge/Cursor-Ready-orange?style=flat-square)](https://cursor.sh)
12
+ [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen?style=flat-square)](CONTRIBUTING.md)
13
+ [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow?style=flat-square)](https://conventionalcommits.org)
14
+
15
+ **Spec-Driven · 有向图回退 · 质量门禁 · 100 分制评分**
16
+
17
+ </div>
18
+
19
+ ---
20
+
21
+ ## 🤔 你是否有过这些经历?
22
+
23
+ | 场景 | 传统做法 | 结果 |
24
+ |------|----------|------|
25
+ | 给 AI 一句话就写代码 | AI 产出随机,改 5 轮才接近需求 | ❌ 浪费时间 |
26
+ | AI 说"测试通过了" | 你相信了,结果 CI 全红 | ❌ 信任崩塌 |
27
+ | Review 发现 bug | 只能手动修,没有回退机制 | ❌ 重复劳动 |
28
+ | 换了 session 一切归零 | 规则不沉淀,每次从零开始 | ❌ 没有积累 |
29
+ | 不知道项目做得好不好 | 凭感觉判断 | ❌ 无法量化 |
30
+
31
+ **Team Skills 用工程化的方式解决了这些问题。**
32
+
33
+ ---
34
+
35
+ ## ✨ 为什么 Team Skills 与众不同?
36
+
37
+ ### 🎯 Spec-Driven,不是 Chat-Driven
38
+
39
+ ```
40
+ 传统方式:用户 → AI(一句话)→ 代码(随机产出)
41
+ Team Skills:用户 → H1确认 → SDD规格 → H2确认 → TDD实现 → 测试 → Review → H4验收
42
+ ```
43
+
44
+ 每个环节有明确的输入/输出标准,AI 不是"猜需求",而是**执行规格**。
45
+
46
+ ### 🔄 有向图回退,不是线性流水线
47
+
48
+ ```
49
+ testAgent 发现 bug ──→ 自动回退 implAgent
50
+ reviewAgent 发现 spec 遗漏 ──→ 自动回退 specAgent
51
+ 同一阶段回退 ≤ 2 次,超过触发人类介入
52
+ ```
53
+
54
+ **发现问题立即回退,不是"先记着后面修"**。
55
+
56
+ ### 🛡️ 质量门禁,不是"我觉得"
57
+
58
+ - **5 步验证协议**:确定命令 → 新鲜执行 → 完整阅读 → 检查退出码 → 声明通过
59
+ - **8 条 Constitutional Rules**:不可覆盖的硬约束
60
+ - **反规避条款**:预判 6 种常见借口并逐一反驳
61
+ - **三视角对抗审查**:攻击者/怀疑者/用户视角反向验证
62
+
63
+ ### 📊 100 分制评分,不是凭感觉
64
+
65
+ ```
66
+ 7 项硬门槛(任一不通过则整体不通过)
67
+ 5 个维度 × 25 子项
68
+ 每个子项有可检查的证据要求
69
+ ```
70
+
71
+ ---
72
+
73
+ ## 🚀 安装与使用
74
+
75
+ ### 前置条件
76
+
77
+ - **Node.js** >= 18
78
+ - **Claude Code** 或 **Cursor**:至少安装其中之一
79
+
80
+ ### 方式一:npx 安装(推荐)
81
+
82
+ 无需 clone 仓库,直接全局安装 Skills:
83
+
84
+ ```bash
85
+ npx team-skills setup
86
+ ```
87
+
88
+ ### 方式二:clone 后安装
89
+
90
+ ```bash
91
+ git clone https://github.com/andeya/team-skills.git
92
+ cd team-skills
93
+ npm install
94
+ npm run setup
95
+ ```
96
+
97
+ ### 方式三:初始化到项目(版本控制)
98
+
99
+ 将 Skills 复制到你的项目中,可以版本控制和自定义:
100
+
101
+ ```bash
102
+ npx team-skills init
103
+ # 或在已 clone 的仓库中
104
+ node bin/team-skills.js init /path/to/your-project
105
+ ```
106
+
107
+ 这会在项目中创建 `.team-skills/` 目录,包含所有 Skills、Hooks 和命令文件。
108
+
109
+ ### 安装内容
110
+
111
+ | 安装内容 | 说明 |
112
+ |----------|------|
113
+ | 12 个 Agent Skills | 安装到 `~/.agents/skills/`,Cursor 自动发现 |
114
+ | 斜杠命令 | 安装到 `~/.claude/commands/`,Claude Code 可用 `/team-{name}` |
115
+ | 共享规则 | `_team-rules/` 被所有 Skill 引用 |
116
+ | Hooks(可选) | session-start 钩子,每次新 session 自动加载 |
117
+
118
+ ### CLI 命令
119
+
120
+ | 命令 | 说明 |
121
+ |------|------|
122
+ | `team-skills setup [target]` | symlink 安装到全局目录(开发者模式) |
123
+ | `team-skills init [dir]` | 复制到用户项目(消费者模式) |
124
+ | `team-skills update [dir]` | 增量更新 init 的副本 |
125
+ | `team-skills uninstall [target]` | 移除所有 symlink |
126
+ | `team-skills list` | 列出已安装 Skills 及状态 |
127
+ | `team-skills --version` | 显示版本 |
128
+
129
+ 所有命令支持 `--dry-run` 查看将执行的操作。
130
+
131
+ ### 验证安装
132
+
133
+ 安装后,在聊天框中输入 `/` 查看是否出现 `team-` 开头的命令列表。或使用 CLI 检查:
134
+
135
+ ```bash
136
+ team-skills list
137
+
138
+ # 或在 Claude Code / Cursor 中
139
+ /using-team-skills
140
+
141
+ # 评估项目协作成熟度
142
+ /team-score
143
+ ```
144
+
145
+ ### 更新 Skills
146
+
147
+ ```bash
148
+ # npx 安装用户
149
+ npx team-skills setup
150
+
151
+ # 项目内 init 用户
152
+ npx team-skills update
153
+
154
+ # clone 安装用户
155
+ git pull && npm run setup
156
+ ```
157
+
158
+ ### 使用方式
159
+
160
+ #### 方式一:全自动编排(推荐)
161
+
162
+ 一条命令启动完整流水线,适合从零开始的功能开发:
163
+
164
+ ```bash
165
+ /team-orchestrator 实现用户登录功能
166
+ ```
167
+
168
+ 编排器会自动完成 7 个步骤:
169
+
170
+ ```
171
+
172
+ 1. H1: 向你确认目标理解
173
+ 2. specAgent: 产出 SDD 规格
174
+ 3. H2: 向你确认规格方案
175
+ 4. implAgent: TDD 实现
176
+ 5. testAgent: 四维测试
177
+ 6. reviewAgent: 五维审查
178
+ 7. H4: 向你交付验收
179
+
180
+ ```
181
+
182
+ 简单任务可用精简模式(H1 简化为单句确认,跳过 H2,H4 保留):
183
+
184
+ ```bash
185
+ /team-orchestrator --compact 修复登录页按钮样式
186
+ ```
187
+
188
+ #### 方式二:按需调用单个 Skill
189
+
190
+ 你可以在任意阶段单独调用某个 Skill,适合只想做其中一步的场景:
191
+
192
+ | 场景 | 命令 |
193
+ |------|------|
194
+ | 需求模糊,需要讨论 | `/team-brainstorm 这个功能怎么做?` |
195
+ | 一句话需求展开为规格 | `/team-spec 实现登录功能` |
196
+ | 已有规格,开始编码 | `/team-impl` |
197
+ | 测试覆盖够吗? | `/team-test` |
198
+ | 代码质量如何? | `/team-review` |
199
+ | 这个 bug 怎么回事? | `/team-debug` |
200
+ | 测试真的过了吗? | `/team-verify` |
201
+ | Review 反馈来了 | `/team-feedback` |
202
+ | 代码写完了 | `/team-finish` |
203
+ | 不知道用哪个 | `/using-team-skills` |
204
+
205
+ #### 方式三:评估项目成熟度
206
+
207
+ ```bash
208
+ /team-score
209
+ # 输出 100 分制评分报告 + 改进建议
210
+ ```
211
+
212
+ ---
213
+
214
+ ## 🏗️ 核心架构
215
+
216
+ ```mermaid
217
+ flowchart TD
218
+ classDef human fill:#e3f2fd,stroke:#1565c0,stroke-width:2px,color:#1565c0;
219
+ classDef agent fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px,color:#4a148c;
220
+ classDef kill fill:#ffebee,stroke:#c62828,stroke-width:2px,stroke-dasharray: 5 5,color:#b71c1c;
221
+
222
+ START(("用户提出需求"))
223
+ H1["H1: 人类确认目标理解<br/>← 人类介入点 #1"]:::human
224
+ SPEC["specAgent — 规格制定<br/>产出 01-05 + prompt-template<br/>Socratic 提问 → SDD 规格"]:::agent
225
+ H2["H2: 人类确认规格方案<br/>← 人类介入点 #2"]:::human
226
+ IMPL["implAgent — TDD 实现<br/>红-绿-重构循环<br/>增量提交 + 决策记录"]:::agent
227
+ TEST["testAgent — 四维测试<br/>功能/边界/异常/代码分支"]:::agent
228
+ REVIEW["reviewAgent — 五维审查<br/>资产沉淀 + 复盘"]:::agent
229
+ H4["H4: 人类验收交付物<br/>← 人类介入点 #4"]:::human
230
+ H3("H3: 人类介入 #3<br/>阻塞 / 决策 / Kill Switch"):::human
231
+
232
+ START --> H1
233
+ H1 -->|确认| SPEC
234
+ H1 -->|不确认| START
235
+
236
+ SPEC --> H2
237
+ H2 -->|确认| IMPL
238
+ H2 -->|不确认| SPEC
239
+ H2 -.->|Kill Switch| H3
240
+
241
+ IMPL --> TEST
242
+
243
+ TEST -->|全部通过| REVIEW
244
+ TEST -->|发现 bug| IMPL
245
+ TEST -->|spec 遗漏| SPEC
246
+ TEST -.->|不可行| H3
247
+
248
+ REVIEW -->|无问题| H4
249
+ REVIEW -->|P0/P1| IMPL
250
+ REVIEW -->|spec 遗漏| SPEC
251
+ REVIEW -.->|不可行| H3
252
+
253
+ H4 -->|验收通过| DONE(("完成 ✅"))
254
+ H4 -->|不通过| IMPL
255
+ ```
256
+
257
+ > H3 可在**任何阶段**触发,包括:发现任务不可行(Kill Switch)、回退超限、或需要人类决策的复杂问题。
258
+
259
+ ---
260
+
261
+ ## 🗺️ Skill 使用地图
262
+
263
+ > 从你的场景出发,找到对应的 Skill。实线是你主动调用,虚线是编排器自动调度。
264
+
265
+ ```mermaid
266
+ graph TD
267
+ classDef user fill:#e3f2fd,stroke:#1565c0,stroke-width:3px,color:#1565c0;
268
+ classDef skill fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px,color:#4a148c;
269
+ classDef orch fill:#fff3e0,stroke:#e65100,stroke-width:3px,color:#bf360c;
270
+
271
+ YOU((👤 你)):::user
272
+ YOU -->|"判断你的场景"| Q{你处于哪个阶段?}
273
+
274
+ Q -->|"需求模糊,需要讨论"| BRAIN[🧠 team-brainstorm<br/>→ 设计思路]:::skill
275
+ Q -->|"需求明确,需要规格"| SPEC[📝 team-spec<br/>→ SDD 规格文档]:::skill
276
+ Q -->|"规格就绪,需要实现"| IMPL[💻 team-impl<br/>→ 代码 + TDD 日志]:::skill
277
+ Q -->|"实现完成,需要测试"| TEST[🧪 team-test<br/>→ 四维测试报告]:::skill
278
+ Q -->|"代码就绪,需要审查"| REVIEW[🔍 team-review<br/>→ 五维审查报告]:::skill
279
+ Q -->|"收到审查反馈"| FB[💬 team-feedback<br/>→ 修改方案]:::skill
280
+ Q -->|"遇到 Bug"| DEBUG[🐛 team-debug<br/>→ 根因分析 + 修复]:::skill
281
+ Q -->|"实现完成,准备合并"| FINISH[🏁 team-finish<br/>→ 合并/PR/清理]:::skill
282
+ Q -->|"声称完成"| VERIFY[✅ team-verify<br/>→ 验证证据链]:::skill
283
+ Q -->|"评估项目成熟度"| SCORE[📊 team-score<br/>→ 100 分制评分]:::skill
284
+ Q -->|"不知道用哪个"| USING[🧭 using-team-skills<br/>→ Skill 推荐]:::skill
285
+ Q -->|"需要完整交付流水线"| ORCH[⚙️ team-orchestrator<br/>→ 全自动编排]:::orch
286
+
287
+ ORCH -.->|自动调度| SPEC
288
+ ORCH -.->|自动调度| IMPL
289
+ ORCH -.->|自动调度| TEST
290
+ ORCH -.->|自动调度| REVIEW
291
+ ORCH -.->|自动调度| FB
292
+ ORCH -.->|自动调度| FINISH
293
+ ORCH -.->|自动调度| VERIFY
294
+ ```
295
+
296
+ **使用说明:**
297
+
298
+ - **实线箭头 →**:你主动调用某个 Skill,适合只做其中一步
299
+ - **虚线箭头 ⇢**:编排器自动调度,适合需要完整流水线
300
+ - 每个 Skill 下方标注了它的产出物
301
+
302
+ ---
303
+
304
+ ## 📦 包含 12 个可独立使用的 Skill
305
+
306
+ | Skill | 一句话说明 | 使用场景 |
307
+ |-------|-----------|----------|
308
+ | `team-brainstorm` | 需求模糊时讨论形成方案 | "这个功能怎么做?" |
309
+ | `team-spec` | 一句话需求展开为完整 SDD 规格 | "实现登录功能" |
310
+ | `team-impl` | TDD 红-绿-重构循环实现 | "规格有了,开始写代码" |
311
+ | `team-test` | 四维测试矩阵 + 补充测试 | "测试覆盖够吗?" |
312
+ | `team-review` | 五维审查 + 资产沉淀 + 复盘 | "代码质量如何?" |
313
+ | `team-orchestrator` | 有向图流程编排,4 个人类介入点 | "我要完整交付流水线" |
314
+ | `team-verify` | 5 步验证门禁,杜绝虚假通过 | "测试真的过了吗?" |
315
+ | `team-debug` | 四阶段根因分析 + 修复 | "这个 bug 怎么回事?" |
316
+ | `team-feedback` | 先验证再实施,非表演性同意 | "Review 反馈来了" |
317
+ | `team-finish` | 分支完成处理(合并/PR/保留/丢弃) | "代码写完了" |
318
+ | `team-score` | 100 分制扫描评估 | "项目协作成熟度如何?" |
319
+ | `using-team-skills` | Meta-skill,自动引导你选正确的 Skill | "我该用哪个?" |
320
+
321
+ > 每个 Skill 可独立使用,也可通过 `team-orchestrator` 串联成完整流水线。
322
+
323
+ ---
324
+
325
+ ## 📋 每个任务产出 17 个结构化文档
326
+
327
+ ```
328
+ docs/tasks/{slug}/
329
+ ├── 01-plan.md # 任务规划(目标 + 分期 + 预算)
330
+ ├── 02-context.md # 上下文选择(术语 + 引用 + 排除)
331
+ ├── 03-sdd.md # SDD 规格(七部分完整)
332
+ ├── 04-boundary.md # 修改边界(allow + deny)
333
+ ├── 05-risk.md # 风险 + 验证计划
334
+ ├── prompt-template.md # AI 任务提示词模板
335
+ ├── 06-tdd-log.md # TDD 日志(红-绿-重构循环)
336
+ ├── 07-prompt-log.md # Prompt 工程记录(五要素 + 纠偏)
337
+ ├── 08-ai-decisions.md # AI 决策记录(选择 + 拒绝 + 理由)
338
+ ├── 09-test-matrix.md # 四维测试矩阵
339
+ ├── 10-test-report.md # 测试运行报告(证据链)
340
+ ├── 11-review.md # 代码审查报告(五维度 + 合规)
341
+ ├── 12-asset-update.md # 资产更新记录(消费方契约)
342
+ ├── 13-retrospective.md # 个人复盘(新规则沉淀)
343
+ ├── task-rules.md # 任务级规则
344
+ ├── 14-team.md # 团队协作记录
345
+ └── 15-brief.md # 答辩提纲
346
+ ```
347
+
348
+ ---
349
+
350
+ ## 🔧 兼容性
351
+
352
+ | 工具 | 调用方式 | 自动发现 |
353
+ |------|----------|----------|
354
+ | **Claude Code** | `/team-{name}` 斜杠命令 | `~/.claude/commands/` |
355
+ | **Cursor** | Skill 自动发现 | `~/.agents/skills/` |
356
+
357
+ ---
358
+
359
+ ## 📚 体系来源
360
+
361
+ Team Skills 融合了业界多个 AI 协作框架的精华:
362
+
363
+ | 来源 | 吸收的精华 |
364
+ |------|-----------|
365
+ | **SuperPowers** (obra) | 5 步验证协议、四态完成状态、反规避条款、Socratic 探索 |
366
+ | **OpenSpec** (Fission AI) | Delta Spec 增量规格、RFC 2119 + Given/When/Then |
367
+ | **Karpathy Skills** | 过度抽象防御、死代码清理、困惑管理 |
368
+ | **Agent-Style** | 5 条 LLM 输出质量约束 |
369
+ | **独创** | 有向图回退、评分追溯矩阵、消费方契约、H1-H4 人类介入点 |
370
+
371
+ ---
372
+
373
+ ## 🔧 本地开发
374
+
375
+ ### 前置要求
376
+
377
+ - Node.js >= 18
378
+
379
+ ### 安装依赖
380
+
381
+ ```bash
382
+ npm install
383
+ ```
384
+
385
+ ### 开发命令
386
+
387
+ ```bash
388
+ npm run lint # 检查 Markdown 格式 + Skill 结构完整性(CI 同款)
389
+ npm run format # 自动修复 Markdown 格式
390
+ npm run cli-test # CLI 冒烟测试
391
+ npm run setup # 安装 Skills 到全局目录
392
+ ```
393
+
394
+ ### CI 流程
395
+
396
+ 提交后 GitHub Actions 自动运行:
397
+
398
+ | Workflow | Job | 说明 |
399
+ |----------|-----|------|
400
+ | CI | Lint | Markdown 格式 + Skill 结构检查 |
401
+ | CI | CLI Smoke Test | CLI 功能验证 |
402
+ | CI | Check Links | 外部链接有效性 |
403
+ | Release | Publish to npm | `v*` tag 触发,自动发布到 npm |
404
+
405
+ ---
406
+
407
+ ## 🤝 贡献
408
+
409
+ 欢迎贡献!请先阅读 [CONTRIBUTING.md](CONTRIBUTING.md)。
410
+
411
+ - 🐛 [报告 Bug](https://github.com/andeya/team-skills/issues/new?template=bug_report.md)
412
+ - 💡 [提出新功能](https://github.com/andeya/team-skills/issues/new?template=feature_request.md)
413
+ - 📖 [改进文档](https://github.com/andeya/team-skills/pulls)
414
+
415
+ ---
416
+
417
+ <div align="center">
418
+
419
+ **如果 Team Skills 对你有帮助,请给一个 ⭐ — 让更多人看到工程化的 AI 协作方式。**
420
+
421
+ </div>
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import '../src/cli.js';
@@ -0,0 +1,16 @@
1
+ {
2
+ "hooks": {
3
+ "SessionStart": [
4
+ {
5
+ "matcher": "startup|clear|compact",
6
+ "hooks": [
7
+ {
8
+ "type": "command",
9
+ "command": "\"${CURSOR_PLUGIN_ROOT}/hooks/session-start\"",
10
+ "async": false
11
+ }
12
+ ]
13
+ }
14
+ ]
15
+ }
16
+ }
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env bash
2
+ # SessionStart hook for team-skills
3
+ # Injects using-team-skills meta-skill into session context
4
+
5
+ set -euo pipefail
6
+
7
+ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
8
+ PROJECT_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
9
+
10
+ meta_skill_content=$(cat "${PROJECT_ROOT}/skills/using-team-skills/SKILL.md" 2>&1 || echo "")
11
+
12
+ escape_for_json() {
13
+ local s="$1"
14
+ s="${s//\\/\\\\}"
15
+ s="${s//\"/\\\"}"
16
+ s="${s//$'\n'/\\n}"
17
+ s="${s//$'\r'/\\r}"
18
+ s="${s//$'\t'/\\t}"
19
+ printf '%s' "$s"
20
+ }
21
+
22
+ meta_skill_escaped=$(escape_for_json "$meta_skill_content")
23
+
24
+ session_context="You have Team Skills available. Use /team-orchestrator for full pipeline, or ask which skill fits your scenario.\n\n**Below is the using-team-skills meta-skill for reference:**\n\n${meta_skill_escaped}"
25
+
26
+ if [ -n "${CURSOR_PLUGIN_ROOT:-}" ]; then
27
+ printf '{\n "additional_context": "%s"\n}\n' "$session_context"
28
+ elif [ -n "${CLAUDE_PLUGIN_ROOT:-}" ] && [ -z "${COPILOT_CLI:-}" ]; then
29
+ printf '{\n "hookSpecificOutput": {\n "hookEventName": "SessionStart",\n "additionalContext": "%s"\n }\n}\n' "$session_context"
30
+ else
31
+ printf '{\n "additionalContext": "%s"\n}\n' "$session_context"
32
+ fi
33
+
34
+ exit 0
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "team-skills",
3
+ "version": "1.0.0",
4
+ "description": "AI Agent Skills framework — Spec-Driven development with directed-graph rollback, quality gates, and 100-point scoring",
5
+ "type": "module",
6
+ "bin": {
7
+ "team-skills": "./bin/team-skills.js"
8
+ },
9
+ "files": [
10
+ "bin/",
11
+ "src/",
12
+ "skills/",
13
+ "hooks/",
14
+ ".claude/commands/",
15
+ "scripts/",
16
+ "README.md",
17
+ "LICENSE",
18
+ "CHANGELOG.md"
19
+ ],
20
+ "scripts": {
21
+ "lint": "markdownlint-cli2 '**/*.md' '#node_modules' --config .markdownlint.json && node scripts/check-skill-structure.js",
22
+ "format": "markdownlint-cli2 '**/*.md' '#node_modules' --config .markdownlint.json --fix",
23
+ "cli-test": "node bin/team-skills.js --version && node bin/team-skills.js list && node bin/team-skills.js setup --dry-run",
24
+ "prepare": "git config core.hooksPath .githooks 2>/dev/null || true",
25
+ "setup": "node bin/team-skills.js setup",
26
+ "uninstall": "node bin/team-skills.js uninstall"
27
+ },
28
+ "engines": {
29
+ "node": ">=18"
30
+ },
31
+ "keywords": [
32
+ "ai",
33
+ "agent",
34
+ "skills",
35
+ "spec-driven",
36
+ "tdd",
37
+ "claude",
38
+ "cursor",
39
+ "code-review",
40
+ "ai-collaboration"
41
+ ],
42
+ "author": "Andeya <andeyalee@outlook.com>",
43
+ "license": "MIT",
44
+ "repository": {
45
+ "type": "git",
46
+ "url": "git+https://github.com/andeya/team-skills.git"
47
+ },
48
+ "homepage": "https://github.com/andeya/team-skills#readme",
49
+ "bugs": {
50
+ "url": "https://github.com/andeya/team-skills/issues"
51
+ },
52
+ "dependencies": {
53
+ "commander": "^13.0.0"
54
+ },
55
+ "devDependencies": {
56
+ "markdownlint-cli2": "^0.17.2"
57
+ }
58
+ }
@@ -0,0 +1,89 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Verify Skill structure: SKILL.md existence, required sections, shared rules.
5
+ * Used by both `npm run lint` and CI.
6
+ */
7
+
8
+ import { readdirSync, readFileSync, existsSync } from 'node:fs';
9
+ import { join } from 'node:path';
10
+ import { execSync } from 'node:child_process';
11
+
12
+ const root = execSync('git rev-parse --show-toplevel', { encoding: 'utf8' }).trim();
13
+
14
+ const REQUIRED_SECTIONS = [
15
+ ['角色定位'],
16
+ ['系统提示词'],
17
+ ['推理指引', '路由推理'],
18
+ ['Iron Law'],
19
+ ['执行步骤'],
20
+ ['自检门禁'],
21
+ ['完成标志'],
22
+ ['STOP Signals'],
23
+ ];
24
+
25
+ const SHARED_RULES = [
26
+ 'constitutional-rules.md',
27
+ 'verification-protocol.md',
28
+ 'four-state-protocol.md',
29
+ ];
30
+
31
+ let failed = false;
32
+
33
+ // 1. Discover skill directories
34
+ const skillDirs = [];
35
+ const skillsPath = join(root, 'skills');
36
+ for (const name of readdirSync(skillsPath)) {
37
+ if (name.startsWith('_') || name === 'CLAUDE.md') continue;
38
+ const dir = join(skillsPath, name);
39
+ try {
40
+ if (!readdirSync(dir)) continue;
41
+ } catch { continue; }
42
+ skillDirs.push({ name, dir });
43
+ }
44
+
45
+ // 2. Check SKILL.md existence
46
+ for (const { name, dir } of skillDirs) {
47
+ const skillFile = join(dir, 'SKILL.md');
48
+ if (!existsSync(skillFile)) {
49
+ console.error(`❌ ${name}: missing SKILL.md`);
50
+ failed = true;
51
+ }
52
+ }
53
+
54
+ // 3. Check required sections
55
+ for (const { name, dir } of skillDirs) {
56
+ const skillFile = join(dir, 'SKILL.md');
57
+ if (!existsSync(skillFile)) continue;
58
+
59
+ const content = readFileSync(skillFile, 'utf8');
60
+
61
+ for (const alternatives of REQUIRED_SECTIONS) {
62
+ const found = alternatives.some(alt => {
63
+ const pattern = new RegExp(`^#{2,3} ${alt}`, 'm');
64
+ return pattern.test(content);
65
+ });
66
+
67
+ if (!found) {
68
+ const label = alternatives.join('|');
69
+ console.error(`❌ ${name}: missing section '${label}'`);
70
+ failed = true;
71
+ }
72
+ }
73
+ }
74
+
75
+ // 4. Check shared rules
76
+ for (const file of SHARED_RULES) {
77
+ const p = join(root, 'skills', '_team-rules', file);
78
+ if (!existsSync(p)) {
79
+ console.error(`❌ Missing _team-rules/${file}`);
80
+ failed = true;
81
+ }
82
+ }
83
+
84
+ if (failed) {
85
+ console.error('\nSkill structure check failed.');
86
+ process.exit(1);
87
+ }
88
+
89
+ console.log('✅ All skill structure checks passed.');