Squashed 'docs/standards/playbook/' changes from e504a68..b529012

b529012  test(tests): avoid hardcoded missing path
07583c8 🐛 fix(tests): make doc link check awk-portable
6244aa3 🔧 chore(ci): relax gitattributes check
31dd0c5 🐛 fix(scripts): require existing project root
15d4d63 🔧 chore(ci): install python3-pip
90c6313 🔧 chore(ci): run tests in a single job
d84eff0 🔧 chore(ci): make actions base url configurable
395598d 🔧 chore(ci): fix yaml step names
4ae2733  feat(sync_standards): auto-detect existing languages
e97fb00  feat(sync_standards): default gitattributes to append
da0ef2b  test: add automated tests and ci workflow
99bef30 🎨 style(markdown): format all markdown files with prettier
7e96bc8 ♻️ refactor(tsl): split function.md into 44 modular files
0d6b2a0 📝 docs(readme): add quick decision table and TL;DR for distribution methods
3b2188f 🎨 style(markdown): format markdown files with prettier
41fc43b 📝 docs(tsl): document {Unit.}Type source annotation
3dceaf7 📝 docs(tsl): clarify tsf-only top-level rules and type annotations
3a63829 📝 docs(skills): add create-plan skill
f02a707 🐛 fix(scripts): escape markdown backticks in vendor_playbook
064aa92 🐛 fix(scripts): correct bat scripts
4881feb 🔧 chore(gitattributes): enforce crlf for bat files
1fa3e2a 🐛 fix(scripts): escape parentheses in sync_standards output
3958cad 📝 docs(vendor_playbook): mention ci templates
9d059cf  feat(templates): add gitea ci example
a52bb24 📝 docs(codex_skills): normalize markdown formatting
cc8ad4c 📝 docs(skills): slim commit-message
2a98e15 🐛 fix(skills): quote YAML descriptions
8f78d22 🐛 fix(sync_standards): generate minimal AGENTS.md
5547665  feat(skills): add commit-message suggestion skill
3fe8bd7 🔧 chore(sync_standards): create AGENTS.md on sync
283d311  feat(playbook): add syntax book and codex skills tooling
5b97ed5 📝 docs(tsl): clarify syntax references
27e0700  feat(skills): add pdf/docx/pptx/xlsx wrapper workflows
5551363  feat(skills): add debugging and bulk refactor workflows
1d4f548  feat(skills): add built-in workflow skills
c0895dd 📝 docs(skills): add anthropics document-skills integration
cf9f80d 🔧 chore(playbook): add Claude Code skills guide and align python templates

git-subtree-dir: docs/standards/playbook
git-subtree-split: b529012c59c5d67c3073884d7b617763647417fd
This commit is contained in:
csh
2026-01-08 15:56:36 +08:00
parent eada742d75
commit ac794a6a70
113 changed files with 254751 additions and 176 deletions
+150
View File
@@ -0,0 +1,150 @@
# SKILLS
本文件定义:如何在仓库中落地与维护 **Codex CLI
skills**(实验功能),并给出与本 Playbook(`docs/` +
`.agents/`)配套的技能编写建议与内置技能清单。
> 提示:Codex skills 是“按用户安装”的(默认在
> `~/.codex/skills`)。本仓库将 skills 以可分发的形式放在
> `codex/skills/`,并提供脚本一键安装到你的 `CODEX_HOME`。
---
## 1. 启用 skills(必做)
`$CODEX_HOME/config.toml`(通常是 `~/.codex/config.toml`)中启用:
```toml
[features]
skills = true
```
修改后需要重启 `codex` 才会重新发现技能。
---
## 2. 本仓库的 skills 目录结构
本 Playbook 以“可 vendoring”的方式提供 skills
```txt
codex/skills/
<skill-name>/
SKILL.md
references/ # 可选:拆分参考文档
templates/ # 可选:模板
scripts/ # 可选:脚本/命令封装
```
最终安装到本机后,对应路径为:
```txt
$CODEX_HOME/skills/<skill-name>/SKILL.md
```
---
## 3. 安装到本机(推荐)
本仓库已提供跨平台安装脚本(会把 `codex/skills/*` 复制到
`$CODEX_HOME/skills/`):
- macOS/Linux`sh scripts/install_codex_skills.sh`
- PowerShell`powershell -File scripts/install_codex_skills.ps1`
- Windows bat`scripts/install_codex_skills.bat`
用法示例:
```bash
# 安装全部 skills
sh scripts/install_codex_skills.sh
# 只安装指定 skills
sh scripts/install_codex_skills.sh style-cleanup code-review-workflow
```
如果你的项目通过 `git subtree` vendoring 本 Playbook(推荐前缀
`docs/standards/playbook`),则在目标项目里执行:
```bash
sh docs/standards/playbook/scripts/install_codex_skills.sh
```
安装后重启 `codex`,即可在运行时看到 `## Skills` 列表。
---
## 4. `SKILL.md` 最小规范(Codex
- 文件名必须是 `SKILL.md`
- 必须包含 YAML frontmatter(用 `---` 包裹),且至少包含:
- `name`:非空,≤100 字符,建议 kebab-case 且与目录名一致
- `description`:非空,≤500 字符(写“用户会怎么说”的触发词;避免换行)
- frontmatter 之外的正文可以是任意 Markdown(用于工作流说明/决策树/命令/模板索引)
---
## 5. 使用方式
- 在对话中通过 `$<skill-name>` 直接点名触发(例如:`$style-cleanup`
- 在 Codex TUI 中可用 `/skills` 浏览与插入
---
## 6. 设计原则(写给维护者)
把 skill 当作“可检索的工作流模块”,而不是长篇教程:
1. **边界清晰**:只写“仓库/组织特定”的流程、约束与验收标准;避免通用编程常识。
2. **description 负责检索**:把团队常用说法(中英文同义词)写进
`description`,降低漏触发概率。
3. **SOP 化**:建议包含 Inputs → Procedure → Output Contract → Success Criteria
→ Failure Handling。
4. **渐进式披露**:主 `SKILL.md` 保持精炼;大段清单/模板放
`references/`,引用深度 ≤ 1。
5. **高风险低自由度**:破坏性操作(删数据/重写历史/生产变更)默认先停下确认,并给回滚方案。
---
## 7. Playbook 权威来源(可在 skill 中引用)
- 提交信息:`docs/common/commit_message.md`
- TSL`docs/tsl/code_style.md``docs/tsl/naming.md``docs/tsl/toolchain.md`
- C++`docs/cpp/code_style.md``docs/cpp/naming.md``docs/cpp/toolchain.md`
- Python`docs/python/style_guide.md``docs/python/tooling.md``docs/python/configuration.md`
若你的项目通过 git subtree 引入本 Playbook,常见路径为
`docs/standards/playbook/docs/...`;把上述 `docs/` 前缀替换为
`docs/standards/playbook/docs/` 即可。
---
## 8. 本 Playbook 内置 skills
位于 `codex/skills/`
- `commit-message`:基于 staged
diff 自动建议提交信息(`:emoji: type(scope): subject`
- `create-plan`:生成简明计划(适用于用户明确要求规划编码任务)
- `code-review-workflow`:结构化代码评审(正确性/安全/性能/测试)
- `style-cleanup`:整理代码风格(优先使用仓库既有 formatter/lint 工具链)
- `systematic-debugging`:系统化调试(先复现 → 再定位 → 再修复 → 再验证)
- `root-cause-tracing`:根因溯源 / RCA 模板
- `defense-in-depth`:关键路径分层校验/多道防线
- `bulk-refactor-workflow`:批量重构(安全做法 + 验证契约)
- `document-workflow`PDF/DOCX/PPTX/XLSX 文档工作流(带开源 fallback)
- `pdf-workflow` / `docx-workflow` / `pptx-workflow` /
`xlsx-workflow`:按格式拆分的文档子工作流
- `verification-before-completion`:先验证再宣称完成(证据链优先)
---
## 9. 运行时排障
- 不触发:
- 确认已启用 `[features] skills = true`
- 确认 skill 已安装到 `$CODEX_HOME/skills/<name>/SKILL.md`
- 重启 `codex`skills 只在启动时加载)
- 触发错:减少不同 skill 的 `description`
关键词重叠;让触发词更具体(语言/工具/目录名/流程名)。
- 启动报错:通常是 YAML frontmatter 不合法或字段超长;修复后重启即可。