标签 多智能体开发框架 下的文章

Claude Code Workflow (CCW)


Claude Code Workflow (CCW) 是一个 JSON 驱动的多智能体开发框架,具有智能 CLI 编排(Gemini/Qwen/Codex)、上下文优先架构和自动化工作流执行。它将 AI 开发从简单的提示词链接转变为一个强大的编排系统。

项目地址:

catlog22/Claude-Code-Workflow: JSON-driven multi-agent development framework with intelligent CLI orchestration (Gemini/Qwen/Codex), context-first architecture, and automated workflow execution

安装方式:

npm install -g claude-code-workflow
ccw install #安装工作流
ccw view #打开看板 


个人理解

无论 Skills 还是 Slash command 本质都是规范化的提示词,Skill 可以看作有标准结构文件结构的提示词组合。渐进式披露是一种设计思路,并不是 Skill 的机制,slash command 也可实现。在 Skill 没有出来之前,CCW 的工作流命令已经采用类似的设计机制,将一个复杂的工作流转为链式调用 command,以提升命令遵循度。对于长序列任务,例如 /workflow:plan 在上下文收集阶段只关注于上下文收集,产出内容再调用任务生成命令,而不是将上下文探索和生成命令写到一起。

编写 Skill 也会遇到 command 执行过程中上下文被挤爆的问题,压缩后可能遗忘内容,进而影响执行指令。根据前面开发经验,总结了一些设计技巧,创建了 Skill-generator 专门为复杂工作流生成的 meta-Skill。


如何使用 CCW 进行 Skill 设计

总结起来就是三步:


执行流程

步骤 1: CLI 分析

提示词输入:


可以在 ccw view 界面查看流式输出:

步骤 2: 完成后进行 Review




步骤 3: 进行 Agent 修复


SKill.md

---
name: review-code
description: Multi-dimensional code review with structured reports. Analyzes correctness, readability, performance, security, testing, and architecture. Triggers on "review code", "code review", "审查代码", "代码审查".
allowed-tools: Task, AskUserQuestion, Read, Write, Glob, Grep, Bash, mcp__ace-tool__search_context, mcp__ide__getDiagnostics
---

# Review Code

Multi-dimensional code review skill that analyzes code across 6 key dimensions and generates structured review reports with actionable recommendations.

## Architecture Overview

┌─────────────────────────────────────────────────────────────────┐
│  ⚠️ Phase 0: Specification Study (强制前置)                       │
│              → 阅读 specs/review-dimensions.md                   │
│              → 理解审查维度和问题分类标准                          │
└───────────────┬─────────────────────────────────────────────────┘
                ↓
┌─────────────────────────────────────────────────────────────────┐
│           Orchestrator (状态驱动决策)                             │
│           → 读取状态 → 选择审查动作 → 执行 → 更新状态              │
└───────────────┬─────────────────────────────────────────────────┘
                │
    ┌───────────┼───────────┬───────────┬───────────┐
    ↓           ↓           ↓           ↓           ↓
┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐
│ Collect │ │ Quick   │ │ Deep    │ │ Report  │ │Complete │
│ Context │ │ Scan    │ │ Review  │ │ Generate│ │         │
└─────────┘ └─────────┘ └─────────┘ └─────────┘ └─────────┘
     ↓           ↓           ↓           ↓
┌─────────────────────────────────────────────────────────────────┐
│                     Review Dimensions                            │
│  ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐            │
│  │Correctness│ │Readability│ │Performance│ │ Security │            │
│  └──────────┘ └──────────┘ └──────────┘ └──────────┘            │
│  ┌──────────┐ ┌──────────┐                                       │
│  │ Testing  │ │Architecture│                                      │
│  └──────────┘ └──────────┘                                       │
└─────────────────────────────────────────────────────────────────┘


## Key Design Principles

1. **多维度审查**: 覆盖正确性、可读性、性能、安全性、测试覆盖、架构一致性六大维度
2. **分层执行**: 快速扫描识别高风险区域,深入审查聚焦关键问题
3. **结构化报告**: 按严重程度分类,提供文件位置和修复建议
4. **状态驱动**: 自主模式,根据审查进度动态选择下一步动作

---

## ⚠️ Mandatory Prerequisites (强制前置条件)

> **⛔ 禁止跳过**: 在执行任何审查操作之前,**必须**完整阅读以下文档。

### 规范文档 (必读)

| Document | Purpose | Priority |
|----------|---------|----------|
| [specs/review-dimensions.md](specs/review-dimensions.md) | 审查维度定义和检查点 | **P0 - 最高** |
| [specs/issue-classification.md](specs/issue-classification.md) | 问题分类和严重程度标准 | **P0 - 最高** |
| [specs/quality-standards.md](specs/quality-standards.md) | 审查质量标准 | P1 |

### 模板文件 (生成前必读)

| Document | Purpose |
|----------|---------|
| [templates/review-report.md](templates/review-report.md) | 审查报告模板 |
| [templates/issue-template.md](templates/issue-template.md) | 问题记录模板 |

---

## Execution Flow


┌─────────────────────────────────────────────────────────────────┐
│  Phase 0: Specification Study (强制前置 - 禁止跳过)               │
│  → Read: specs/review-dimensions.md                              │
│  → Read: specs/issue-classification.md                           │
│  → 理解审查标准和问题分类                                          │
├─────────────────────────────────────────────────────────────────┤
│  Action: collect-context                                         │
│  → 收集目标文件/目录                                               │
│  → 识别技术栈和语言                                                │
│  → Output: state.context (files, language, framework)            │
├─────────────────────────────────────────────────────────────────┤
│  Action: quick-scan                                              │
│  → 快速扫描整体结构                                                │
│  → 识别高风险区域                                                  │
│  → Output: state.risk_areas, state.scan_summary                  │
├─────────────────────────────────────────────────────────────────┤
│  Action: deep-review (per dimension)                             │
│  → 逐维度深入审查                                                  │
│  → 记录发现的问题                                                  │
│  → Output: state.findings[]                                      │
├─────────────────────────────────────────────────────────────────┤
│  Action: generate-report                                         │
│  → 汇总所有发现                                                    │
│  → 生成结构化报告                                                  │
│  → Output: review-report.md                                      │
├─────────────────────────────────────────────────────────────────┤
│  Action: complete                                                │
│  → 保存最终状态                                                    │
│  → 输出审查摘要                                                    │
└─────────────────────────────────────────────────────────────────┘


## Directory Setup


const timestamp = new Date().toISOString().slice(0,19).replace(/[-:T]/g, '');
const workDir = `.workflow/.scratchpad/review-code-${timestamp}`;

Bash(`mkdir -p "${workDir}"`);
Bash(`mkdir -p "${workDir}/findings"`);


## Output Structure


.workflow/.scratchpad/review-code-{timestamp}/
├── state.json                    # 审查状态
├── context.json                  # 目标上下文
├── findings/                     # 问题发现
│   ├── correctness.json
│   ├── readability.json
│   ├── performance.json
│   ├── security.json
│   ├── testing.json
│   └── architecture.json
└── review-report.md              # 最终审查报告


## Review Dimensions

| Dimension | Focus Areas | Key Checks |
|-----------|-------------|------------|
| **Correctness** | 逻辑正确性 | 边界条件、错误处理、null 检查 |
| **Readability** | 代码可读性 | 命名规范、函数长度、注释质量 |
| **Performance** | 性能效率 | 算法复杂度、I/O 优化、资源使用 |
| **Security** | 安全性 | 注入风险、敏感信息、权限控制 |
| **Testing** | 测试覆盖 | 测试充分性、边界覆盖、可维护性 |
| **Architecture** | 架构一致性 | 设计模式、分层结构、依赖管理 |

## Issue Severity Levels

| Level | Prefix | Description | Action Required |
|-------|--------|-------------|-----------------|
| **Critical** | [C] | 阻塞性问题,必须立即修复 | Must fix before merge |
| **High** | [H] | 重要问题,需要修复 | Should fix |
| **Medium** | [M] | 建议改进 | Consider fixing |
| **Low** | [L] | 可选优化 | Nice to have |
| **Info** | [I] | 信息性建议 | For reference |

## Reference Documents

| Document | Purpose |
|----------|---------|
| [phases/orchestrator.md](phases/orchestrator.md) | 审查编排器 |
| [phases/state-schema.md](phases/state-schema.md) | 状态结构定义 |
| [phases/actions/action-collect-context.md](phases/actions/action-collect-context.md) | 收集上下文 |
| [phases/actions/action-quick-scan.md](phases/actions/action-quick-scan.md) | 快速扫描 |
| [phases/actions/action-deep-review.md](phases/actions/action-deep-review.md) | 深入审查 |
| [phases/actions/action-generate-report.md](phases/actions/action-generate-report.md) | 生成报告 |
| [phases/actions/action-complete.md](phases/actions/action-complete.md) | 完成审查 |
| [specs/review-dimensions.md](specs/review-dimensions.md) | 审查维度规范 |
| [specs/issue-classification.md](specs/issue-classification.md) | 问题分类标准 |
| [specs/quality-standards.md](specs/quality-standards.md) | 质量标准 |
| [templates/review-report.md](templates/review-report.md) | 报告模板 |
| [templates/issue-template.md](templates/issue-template.md) | 问题模板 |

  review-code/
  ├── SKILL.md                  
  ├── phases/
  │   ├── orchestrator.md       # 编排器
  │   ├── state-schema.md       # 状态定义
  │   └── actions/
  │       ├── action-collect-context.md
  │       ├── action-quick-scan.md
  │       ├── action-deep-review.md
  │       ├── action-generate-report.md
  │       └── action-complete.md
  ├── specs/
  │   ├── review-dimensions.md  
  │   ├── issue-classification.md # 问题分类标准
  │   └── quality-standards.md  # 质量标准
  └── templates/
      ├── review-report.md      # 报告模板
      └── issue-template.md     # 问题模板 


总结

通过上述三个步骤生成一份规范化提示词。如需获得更优效果,需要观察执行过程,借助 cli 分析进行微调。


下贴预告


— 全文完 (采用 ccw text-formatter skill 进行格式化) —


📌 转载信息
转载时间:
2026/1/14 10:58:40