Add Chinese documentation for custom skills development and reference guide

- Created a new document for custom skills development (`custom.md`) detailing the structure, creation, implementation, and best practices for developing custom CCW skills.
- Added an index document (`index.md`) summarizing all built-in skills, their categories, and usage examples.
- Introduced a reference guide (`reference.md`) providing a quick reference for all 33 built-in CCW skills, including triggers and purposes.
This commit is contained in:
catlog22
2026-03-01 13:08:12 +08:00
parent 2fb93d20e0
commit 8ceae6d6fd
78 changed files with 12352 additions and 3638 deletions

File diff suppressed because it is too large Load Diff

270
docs/zh/skills/custom.md Normal file
View File

@@ -0,0 +1,270 @@
# 自定义技能开发
创建和部署自定义 CCW 技能指南。
## 技能结构
```
~/.claude/skills/my-skill/
├── SKILL.md # 技能定义(必需)
├── index.ts # 技能逻辑(可选)
├── examples/ # 使用示例
└── README.md # 文档
```
## 创建技能
### 1. 定义技能元数据
创建带 YAML 前言的 `SKILL.md`
```markdown
---
name: my-skill
description: My custom skill for X
version: 1.0.0
author: Your Name <email@example.com>
tags: [custom, automation, frontend]
category: development
---
# My Custom Skill
## What It Does
技能用途和功能的详细描述。
## Usage
\`\`\`javascript
Skill(skill="my-skill", args="your input here")
\`\`\`
## Examples
### Example 1: Basic Usage
\`\`\`javascript
Skill(skill="my-skill", args="create user form")
\`\`\`
### Example 2: With Options
\`\`\`javascript
Skill(skill="my-skill", args={
component: "UserForm",
typescript: true,
styling: "tailwind"
})
\`\`\`
```
### 2. 实现技能逻辑(可选)
对于复杂技能,添加 `index.ts`
```typescript
import type { SkillContext, SkillResult } from '@ccw/types'
interface MySkillOptions {
component?: string
typescript?: boolean
styling?: 'css' | 'tailwind' | 'scss'
}
export async function execute(
args: string | MySkillOptions,
context: SkillContext
): Promise<SkillResult> {
// 解析输入
const options = typeof args === 'string'
? { component: args }
: args
// 执行技能逻辑
const result = await generateComponent(options)
return {
success: true,
output: result,
metadata: {
skill: 'my-skill',
version: '1.0.0',
timestamp: new Date().toISOString()
}
}
}
async function generateComponent(options: MySkillOptions) {
// 你的实现代码
return `// Generated code`
}
```
## 技能类别
### 开发
- 组件生成器
- API 脚手架
- 数据库模式创建
### 文档
- API 文档生成
- README 创建
- Changelog 生成
### DevOps
- CI/CD 配置
- Dockerfile 生成
- Kubernetes 清单
### 测试
- 测试生成
- Mock 创建
- 覆盖率报告
## 技能最佳实践
### 1. 明确用途
```markdown
# 好的:清晰和具体
name: generate-react-component
description: 生成带 hooks 和 TypeScript 的 React 组件
# 坏的:模糊和通用
name: code-helper
description: 帮助编码
```
### 2. 类型安全
```typescript
// 定义清晰的接口
interface Options {
name: string
typescript?: boolean
styling?: 'css' | 'tailwind'
}
// 验证输入
function validateOptions(options: any): Options {
if (!options.name) {
throw new Error('组件名称是必需的')
}
return options as Options
}
```
### 3. 错误处理
```typescript
try {
const result = await generateComponent(options)
return { success: true, output: result }
} catch (error) {
return {
success: false,
error: error.message,
suggestion: '确保组件名称有效'
}
}
```
### 4. 文档
```markdown
## Usage
\`\`\`javascript
Skill(skill="my-skill", args="...")
\`\`\`
## Options
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| name | string | required | 组件名称 |
| typescript | boolean | true | 使用 TypeScript |
## Examples
更多示例参见 `examples/` 目录。
```
## 发布技能
### 私有技能
`~/.claude/skills/` 中的技能自动可用。
### 团队技能
通过 git 共享技能:
```bash
# 创建技能仓库
mkdir my-ccw-skills
cd my-ccw-skills
git init
# 添加技能
mkdir skills/skill-1
# ... 添加技能文件
# 与团队共享
git remote add origin <repo-url>
git push -u origin main
```
团队成员安装:
```bash
git clone <repo-url> ~/.claude/skills/team-skills
```
### 公共技能
发布到 npm
```json
{
"name": "ccw-skills-my-skill",
"version": "1.0.0",
"ccw": {
"skills": ["my-skill"]
}
}
```
## 测试技能
`tests/` 中创建测试:
```typescript
import { describe, it, expect } from 'vitest'
import { execute } from '../index'
describe('my-skill', () => {
it('should generate component', async () => {
const result = await execute('UserForm', {})
expect(result.success).toBe(true)
expect(result.output).toContain('UserForm')
})
})
```
## 调试
启用调试日志:
```bash
export CCW_DEBUG=1
ccw skill run my-skill "test input"
```
::: info 参见
- [核心技能](./core-skills.md) - 内置技能参考
- [技能库](./index.md) - 所有可用技能
:::

275
docs/zh/skills/index.md Normal file
View File

@@ -0,0 +1,275 @@
# Skills 库
完整的 **33 个 CCW 内置技能**参考手册,涵盖 3 大类别,以及自定义技能开发指南。
## 什么是 Skills
Skills 是 CCW 可执行的、可复用的、领域特定的能力。每个技能都针对特定的开发任务或工作流而设计,可以组合成强大的工作流链。
## 类别概览
| 类别 | 数量 | 说明 |
|------|------|------|
| [独立技能](./core-skills.md#standalone-skills) | 12 | 用于特定任务的单用途技能 |
| [团队技能](./core-skills.md#team-skills) | 14 | 多代理协作技能 |
| [工作流技能](./core-skills.md#workflow-skills) | 7 | 规划和执行流水线技能 |
## 快速参考
### 独立技能
| 技能 | 触发器 | 说明 |
|------|--------|------|
| [brainstorm](./core-skills.md#brainstorm) | `brainstorm`, `头脑风暴` | 双模式统一头脑风暴 |
| [ccw-help](./core-skills.md#ccw-help) | `ccw-help`, `ccw-issue` | 命令帮助系统 |
| [memory-capture](./core-skills.md#memory-capture) | `memory capture`, `compact session` | 会话压缩或快速提示 |
| [memory-manage](./core-skills.md#memory-manage) | `memory manage`, `update claude`, `更新记忆` | CLAUDE.md 更新和文档生成 |
| [issue-manage](./core-skills.md#issue-manage) | `manage issue`, `list issues` | 交互式问题管理 |
| [review-code](./core-skills.md#review-code) | `review code`, `code review` | 6 维度代码审查 |
| [review-cycle](./core-skills.md#review-cycle) | `workflow:review-cycle` | 带自动修复的审查 |
| [skill-generator](./core-skills.md#skill-generator) | `create skill`, `new skill` | 创建技能的元技能 |
| [skill-tuning](./core-skills.md#skill-tuning) | `skill tuning`, `tune skill` | 技能诊断和优化 |
| [spec-generator](./core-skills.md#spec-generator) | `generate spec`, `create specification`, `spec generator` | 6 阶段规范生成 |
| [software-manual](./core-skills.md#software-manual) | `software manual`, `user guide` | 交互式 HTML 文档 |
| [command-generator](./core-skills.md#command-generator) | `generate command` | 命令文件生成 |
### 团队技能
| 技能 | 触发器 | 角色 | 说明 |
|------|--------|------|------|
| [team-lifecycle-v4](./core-skills.md#team-lifecycle-v4) | `team lifecycle` | 8 | 完整规范/实现/测试生命周期 |
| [team-brainstorm](./core-skills.md#team-brainstorm) | `team brainstorm` | 5 | 多角度创意生成 |
| [team-frontend](./core-skills.md#team-frontend) | `team frontend` | 6 | 带 UI/UX 的前端开发 |
| [team-issue](./core-skills.md#team-issue) | `team issue` | 6 | 问题解决流水线 |
| [team-iterdev](./core-skills.md#team-iterdev) | `team iterdev` | 5 | 生成器-评论者循环 |
| [team-planex](./core-skills.md#team-planex) | `team planex` | 3 | 规划-执行流水线 |
| [team-quality-assurance](./core-skills.md#team-quality-assurance) | `team qa`, `team quality-assurance` | 6 | QA 测试工作流 |
| [team-review](./core-skills.md#team-review) | `team-review` | 4 | 代码扫描和修复 |
| [team-roadmap-dev](./core-skills.md#team-roadmap-dev) | `team roadmap-dev` | 4 | 路线图驱动开发 |
| [team-tech-debt](./core-skills.md#team-tech-debt) | `tech debt cleanup`, `技术债务` | 6 | 技术债务识别 |
| [team-testing](./core-skills.md#team-testing) | `team testing` | 5 | 渐进式测试覆盖 |
| [team-uidesign](./core-skills.md#team-uidesign) | `team uidesign` | 4 | 带 Design Token 的 UI 设计 |
| [team-ultra-analyze](./core-skills.md#team-ultra-analyze) | `team ultra-analyze`, `team analyze` | 5 | 深度协作分析 |
### 工作流技能
| 技能 | 触发器 | 说明 |
|------|--------|------|
| [workflow-plan](./core-skills.md#workflow-plan) | `workflow-plan`, `workflow-plan-verify`, `workflow:replan` | 4 阶段规划带验证 |
| [workflow-lite-plan](./core-skills.md#workflow-lite-plan) | `workflow-lite-plan` | 轻量级规划 |
| [workflow-multi-cli-plan](./core-skills.md#workflow-multi-cli-plan) | `workflow-multi-cli-plan`, `workflow:multi-cli-plan` | 多 CLI 协作规划 |
| [workflow-execute](./core-skills.md#workflow-execute) | `workflow-execute` | 任务执行协调 |
| [workflow-tdd-plan](./core-skills.md#workflow-tdd-plan) | `workflow-tdd-plan` | TDD 红-绿-重构 |
| [workflow-test-fix](./core-skills.md#workflow-test-fix) | `workflow-test-fix`, `test fix workflow` | 测试-修复流水线 |
| [workflow-skill-designer](./core-skills.md#workflow-skill-designer) | `design workflow skill`, `create workflow skill` | 工作流创建元技能 |
## 工作流组合
技能可以组合实现强大的工作流。参见 [工作流组合](./core-skills.md#workflow-combinations) 了解 15 种预定义组合。
### 常用组合
#### 完整生命周期开发
```bash
Skill(skill="brainstorm")
Skill(skill="workflow-plan")
Skill(skill="workflow-execute")
Skill(skill="review-cycle")
```
#### 快速迭代
```bash
Skill(skill="workflow-lite-plan")
Skill(skill="workflow-execute")
```
#### 测试驱动开发
```bash
Skill(skill="workflow-tdd-plan", args="--mode tdd-plan")
Skill(skill="workflow-execute")
Skill(skill="workflow-tdd-plan", args="--mode tdd-verify")
```
## 使用技能
### CLI 接口
```bash
# 通过 ccw 命令调用
ccw --help
# 或直接使用触发器
ccw brainstorm
ccw team lifecycle
```
### 编程接口
```javascript
// 基本使用
Skill(skill="brainstorm")
// 带参数
Skill(skill="team-lifecycle-v4", args="Build user authentication")
// 带模式选择
Skill(skill="workflow-plan", args="--mode verify")
```
## 自定义技能
为团队特定工作流创建自己的技能:
### 技能结构
```
~/.claude/skills/my-skill/
├── SKILL.md # 技能定义
├── phases/ # 阶段文件(可选)
│ ├── phase-1.md
│ └── phase-2.md
└── templates/ # 输出模板(可选)
└── output.md
```
### 技能模板
```markdown
---
name: my-custom-skill
description: My custom skill for X
version: 1.0.0
triggers: [trigger1, trigger2]
---
# My Custom Skill
## Description
Detailed description of what this skill does.
## Phases
1. Phase 1: Description
2. Phase 2: Description
## Usage
\`\`\`javascript
Skill(skill="my-custom-skill", args="input")
\`\`\`
```
### 最佳实践
1. **单一职责**:每个技能应做好一件事
2. **清晰触发器**:定义可识别的触发短语
3. **渐进式阶段**:将复杂技能分解为阶段
4. **紧凑恢复**:使用 TodoWrite 进行进度跟踪
5. **文档**:包含使用示例和预期输出
## 实践示例
### 示例 1功能开发
**场景**:实现新的用户仪表板功能
```bash
# 步骤 1头脑风暴功能
ccw brainstorm
# 按提示定义:
# - 仪表板小部件(统计、图表、最近活动)
# - 布局偏好
# - 数据刷新间隔
# 步骤 2规划实现
ccw workflow-plan "Build user dashboard with configurable widgets"
# 输出IMPL-001.json 包含任务分解
# 步骤 3团队执行
ccw team lifecycle
# 或使用快速迭代:
ccw workflow-lite-plan && ccw workflow-execute
# 步骤 4审查和优化
ccw review-code
# 修复发现的问题
```
### 示例 2Bug 调查
**场景**:调试 API 端点性能问题
```bash
# 步骤 1快速分析
ccw cli -p "Analyze /api/users endpoint for N+1 query issues" --tool gemini --mode analysis
# 步骤 2深度调查如需要
ccw workflow:debug-with-file
# 创建假设、植入代码、分析日志
# 步骤 3应用修复
ccw workflow-execute --task "Fix N+1 query in user endpoint"
```
### 示例 3代码迁移
**场景**:从 JavaScript 迁移到 TypeScript
```bash
# 步骤 1分析代码库
ccw workflow:refactor-cycle
# 识别技术债务并创建迁移计划
# 步骤 2分阶段执行迁移
ccw team roadmap-dev --epic "ts-migration"
# 渐进式迁移模块并测试
```
### 示例 4文档生成
**场景**:生成 API 文档
```bash
# 步骤 1捕获现有模式
ccw memory:capture "API patterns: REST, versioning, error handling"
# 步骤 2生成文档
ccw software-manual --output ./docs/api/
```
### 示例 5代码审查流水线
**场景**:审查 PR 变更
```bash
# 全面审查
ccw review-code --focus security,performance
# 或使用循环自动修复
ccw review-cycle --max-iterations 3
```
### 最佳效果提示
1. **从小开始**:简单任务使用 `workflow-lite-plan`
2. **使用记忆**:用 `memory:capture` 捕获见解供将来参考
3. **验证计划**:执行前始终审查生成的计划
4. **迭代**:使用 `review-cycle` 持续改进
5. **检查会话**:使用 `workflow:session:list` 跟踪进度
## 设计模式
技能使用这些经证明的模式:
| 模式 | 示例 |
|------|------|
| 编排器 + 工作者 | team-lifecycle-v4 |
| 生成器-评论者循环 | team-iterdev |
| 波浪流水线 | team-planex |
| 红-绿-重构 | workflow-tdd-plan |
::: info 参见
- [核心技能参考](./core-skills.md) - 详细技能文档
- [自定义技能](./custom.md) - 技能开发指南
- [CLI 命令](../cli/commands.md) - 命令参考
- [代理](../agents/builtin.md) - 专业代理
:::

174
docs/zh/skills/reference.md Normal file
View File

@@ -0,0 +1,174 @@
---
适用CLI: claude
分类: specialized
---
# Skills 参考
**33 个 CCW 内置技能**快速参考指南。
## 核心技能
| 技能 | 触发器 | 用途 |
|------|--------|------|
| **brainstorm** | `brainstorm``头脑风暴` | 统一头脑风暴,双模式操作(自动流水线 / 单角色) |
| **review-code** | `review code``code review``审查代码` | 多维度代码审查6 维度) |
| **review-cycle** | `workflow:review-cycle` | 代码审查 + 自动修复编排 |
| **memory-capture** | `memory capture``compact session` | 会话压缩或快速提示捕获 |
| **memory-manage** | `memory manage``update claude``update memory``generate docs``更新记忆``生成文档` | CLAUDE.md 更新和文档生成 |
| **spec-generator** | `generate spec``create specification``spec generator``workflow:spec` | 6 阶段规范生成器(简介 → PRD → 架构 → 史诗) |
| **skill-generator** | `create skill``new skill` | 创建新 Claude Code 技能的元技能 |
| **skill-tuning** | `skill tuning``tune skill` | 通用技能诊断和优化工具 |
| **issue-manage** | `manage issue``list issues` | 交互式问题管理CRUD 操作) |
| **ccw-help** | `ccw-help``ccw-issue` | CCW 命令帮助系统 |
| **software-manual** | `software manual``user guide` | 生成交互式 TiddlyWiki 风格 HTML 手册 |
## 工作流技能
| 技能 | 触发器 | 用途 |
|------|--------|------|
| **workflow-plan** | `workflow-plan``workflow-plan-verify``workflow:replan` | 4 阶段规划工作流,带验证和交互式重新规划 |
| **workflow-lite-plan** | `workflow-lite-plan``workflow:lite-execute` | 轻量级规划和执行技能 |
| **workflow-multi-cli-plan** | `workflow-multi-cli-plan``workflow:multi-cli-plan` | 多 CLI 协作规划,带 ACE 上下文引擎 |
| **workflow-execute** | `workflow-execute` | 协调工作流任务的代理执行 |
| **workflow-tdd-plan** | `workflow-tdd-plan``workflow-tdd-verify` | TDD 工作流,带红-绿-重构任务链 |
| **workflow-test-fix** | `workflow-test-fix``test fix workflow` | 统一测试-修复流水线,带自适应策略 |
| **workflow-skill-designer** | `design workflow skill``create workflow skill``workflow skill designer` | 设计编排器+阶段结构化工作流技能的元技能 |
## 团队技能
| 技能 | 触发器 | 角色 | 用途 |
|------|--------|------|------|
| **team-lifecycle** | `team lifecycle` | 可变 | 完整 spec/impl/test 生命周期团队v5team-worker 架构) |
| **team-coordinate** | `team coordinate` | 可变 | 通用团队协调legacy |
| **team-coordinate-v2** | - | 可变 | team-worker 架构协调 |
| **team-executor** | `team executor` | 可变 | 轻量级会话执行 |
| **team-executor-v2** | - | 可变 | team-worker 架构执行 |
| **team-planex** | `team planex` | 3 | 规划-执行波浪流水线 |
| **team-iterdev** | `team iterdev` | 5 | 生成器-评论者循环迭代开发 |
| **team-issue** | `team issue` | 6 | 问题解决流水线 |
| **team-testing** | `team testing` | 5 | 渐进式测试覆盖团队 |
| **team-quality-assurance** | `team qa``team quality-assurance` | 6 | QA 闭环工作流 |
| **team-brainstorm** | `team brainstorm` | 5 | 多角色协作头脑风暴 |
| **team-uidesign** | `team ui design` | 4 | 带 Design Token 系统的 UI 设计团队 |
| **team-frontend** | `team frontend` | 6 | 带 UI/UX 集成的前端开发 |
| **team-review** | `team-review` | 4 | 代码扫描和自动修复 |
| **team-roadmap-dev** | `team roadmap-dev` | 4 | 路线图驱动开发 |
| **team-tech-debt** | `tech debt cleanup``team tech-debt``技术债务` | 6 | 技术债务识别和清理 |
| **team-ultra-analyze** | `team ultra-analyze``team analyze` | 5 | 深度协作分析 |
## 命令生成技能
| 技能 | 触发器 | 用途 |
|------|--------|------|
| **command-generator** | `generate command` | 命令文件生成元技能 |
## 技能类别摘要
| 类别 | 数量 | 说明 |
|------|------|------|
| 核心技能 | 12 | 用于特定任务的单用途技能 |
| 工作流技能 | 7 | 规划和执行流水线技能 |
| 团队技能 | 17+ | 多代理协作技能 |
| 命令生成技能 | 1 | 命令文件生成 |
| **总计** | **37+** | |
## 使用
### 基本调用
```javascript
Skill(skill="brainstorm")
Skill(skill="team-lifecycle", args="Build user authentication system")
Skill(skill="workflow-plan", args="--mode verify")
```
### CLI 调用
```bash
# 通过 /ccw 编排器
/ccw "brainstorm: user authentication flow"
/ccw "team planex: OAuth2 implementation"
# 直接触发器(某些上下文)
workflow-plan
team lifecycle
```
## 触发关键词
| 关键词 | 技能 |
|--------|------|
| `brainstorm``头脑风暴` | brainstorm |
| `review code``code review``审查代码` | review-code |
| `workflow:review-cycle` | review-cycle |
| `workflow-plan` | workflow-plan |
| `workflow-lite-plan` | workflow-lite-plan |
| `workflow-multi-cli-plan``workflow:multi-cli-plan` | workflow-multi-cli-plan |
| `workflow-execute` | workflow-execute |
| `workflow-tdd-plan` | workflow-tdd-plan |
| `workflow-test-fix``test fix workflow` | workflow-test-fix |
| `design workflow skill``create workflow skill``workflow skill designer` | workflow-skill-designer |
| `team lifecycle` | team-lifecycle (v5) |
| `team planex` | team-planex |
| `team iterdev` | team-iterdev |
| `team issue` | team-issue |
| `team testing` | team-testing |
| `team qa``team quality-assurance` | team-quality-assurance |
| `team brainstorm` | team-brainstorm |
| `team ui design``team uidesign` | team-uidesign |
| `team frontend` | team-frontend |
| `team-review` | team-review |
| `team roadmap-dev` | team-roadmap-dev |
| `tech debt cleanup``team tech-debt``技术债务` | team-tech-debt |
| `team ultra-analyze``team analyze` | team-ultra-analyze |
| `memory capture``compact session``记录``压缩会话` | memory-capture |
| `memory manage``update claude``update memory``generate docs``更新记忆``生成文档` | memory-manage |
| `generate spec``create specification``spec generator``workflow:spec` | spec-generator |
| `create skill``new skill` | skill-generator |
| `skill tuning``tune skill``skill diagnosis` | skill-tuning |
| `manage issue``list issues``edit issue` | issue-manage |
| `software manual``user guide``generate manual``create docs` | software-manual |
| `generate command` | command-generator |
## 团队技能架构
### 版本历史
| 版本 | 架构 | 状态 |
|------|------|------|
| v2 | Legacy | 已废弃 |
| v3 | 3 阶段生命周期 | Legacy |
| v4 | 5 阶段生命周期,带 inline discuss | 稳定 |
| **v5** | **team-worker 架构** | **最新** |
### v5 Team Worker 角色
最新的 team-lifecycle (v5) 使用 team-worker 代理,带动态角色分配:
| 角色 | 前缀 | 阶段 |
|------|------|------|
| doc-analyst | ANALYSIS | 需求分析 |
| doc-writer | DRAFT | 文档创建 |
| planner | PLAN | 实现规划 |
| executor | IMPL | 代码实现 |
| tester | TEST | 测试和 QA |
| reviewer | REVIEW | 代码审查 |
## 设计模式
| 模式 | 使用它的技能 |
|------|--------------|
| Orchestrator + Workers | team-lifecycle、team-testing、team-quality-assurance |
| Generator-Critic Loop | team-iterdev |
| Wave Pipeline | team-planex |
| Red-Green-Refactor | workflow-tdd-plan |
| Pure Orchestrator | workflow-plan、workflow-lite-plan |
| Progressive Phase Loading | workflow-plan、workflow-tdd-plan、team-lifecycle |
::: info 参见
- [核心技能详情](./core-skills.md) - 详细技能文档
- [自定义技能](./custom.md) - 创建你自己的技能
- [CLI 命令](../cli/commands.md) - 命令参考
- [团队工作流](../workflows/teams.md) - 团队工作流模式
:::