diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..5d7ae20 --- /dev/null +++ b/Makefile @@ -0,0 +1,113 @@ +# Claude Code Multi-Agent Workflow System Makefile +# Quick deployment for BMAD and Requirements workflows + +.PHONY: help install deploy-bmad deploy-requirements deploy-all clean test + +# Default target +help: + @echo "Claude Code Multi-Agent Workflow - Quick Deployment" + @echo "" + @echo "Usage: make [target]" + @echo "" + @echo "Targets:" + @echo " install - Install all configurations to Claude Code" + @echo " deploy-bmad - Deploy BMAD workflow (bmad-pilot)" + @echo " deploy-requirements - Deploy Requirements workflow (requirements-pilot)" + @echo " deploy-commands - Deploy all slash commands" + @echo " deploy-agents - Deploy all agent configurations" + @echo " deploy-all - Deploy everything (commands + agents)" + @echo " test-bmad - Test BMAD workflow with sample" + @echo " test-requirements - Test Requirements workflow with sample" + @echo " clean - Clean generated artifacts" + @echo " help - Show this help message" + +# Configuration paths +CLAUDE_CONFIG_DIR = ~/.claude +COMMANDS_DIR = commands +AGENTS_DIR = agents +OUTPUT_STYLES_DIR = output-styles +SPECS_DIR = .claude/specs + +# Install all configurations +install: deploy-all + @echo "✅ Installation complete!" + +# Deploy BMAD workflow +deploy-bmad: + @echo "🚀 Deploying BMAD workflow..." + @mkdir -p $(CLAUDE_CONFIG_DIR)/commands + @mkdir -p $(CLAUDE_CONFIG_DIR)/agents + @mkdir -p $(CLAUDE_CONFIG_DIR)/output-styles + @cp $(COMMANDS_DIR)/bmad-pilot.md $(CLAUDE_CONFIG_DIR)/commands/ + @cp $(AGENTS_DIR)/bmad-*.md $(CLAUDE_CONFIG_DIR)/agents/ + @cp $(OUTPUT_STYLES_DIR)/bmad.md $(CLAUDE_CONFIG_DIR)/output-styles/ 2>/dev/null || true + @echo "✅ BMAD workflow deployed successfully!" + @echo " Usage: /bmad-pilot \"your feature description\"" + +# Deploy Requirements workflow +deploy-requirements: + @echo "🚀 Deploying Requirements workflow..." + @mkdir -p $(CLAUDE_CONFIG_DIR)/commands + @mkdir -p $(CLAUDE_CONFIG_DIR)/agents + @cp $(COMMANDS_DIR)/requirements-pilot.md $(CLAUDE_CONFIG_DIR)/commands/ + @cp $(AGENTS_DIR)/requirements-*.md $(CLAUDE_CONFIG_DIR)/agents/ + @echo "✅ Requirements workflow deployed successfully!" + @echo " Usage: /requirements-pilot \"your feature description\"" + +# Deploy all commands +deploy-commands: + @echo "📦 Deploying all slash commands..." + @mkdir -p $(CLAUDE_CONFIG_DIR)/commands + @cp $(COMMANDS_DIR)/*.md $(CLAUDE_CONFIG_DIR)/commands/ + @echo "✅ All commands deployed!" + @echo " Available commands:" + @echo " - /bmad-pilot (Full agile workflow)" + @echo " - /requirements-pilot (Requirements-driven)" + @echo " - /ask, /code, /debug, /test, /review" + @echo " - /optimize, /bugfix, /refactor, /docs, /think" + +# Deploy all agents +deploy-agents: + @echo "🤖 Deploying all agents..." + @mkdir -p $(CLAUDE_CONFIG_DIR)/agents + @cp $(AGENTS_DIR)/*.md $(CLAUDE_CONFIG_DIR)/agents/ + @echo "✅ All agents deployed!" + +# Deploy everything +deploy-all: deploy-commands deploy-agents + @mkdir -p $(CLAUDE_CONFIG_DIR)/output-styles + @cp $(OUTPUT_STYLES_DIR)/*.md $(CLAUDE_CONFIG_DIR)/output-styles/ 2>/dev/null || true + @echo "✨ Full deployment complete!" + @echo "" + @echo "Quick Start:" + @echo " BMAD: /bmad-pilot \"build user authentication\"" + @echo " Requirements: /requirements-pilot \"implement JWT auth\"" + @echo " Manual: /ask → /code → /test → /review" + +# Test BMAD workflow +test-bmad: + @echo "🧪 Testing BMAD workflow..." + @echo "Run in Claude Code:" + @echo '/bmad-pilot "Simple todo list with add/delete functions"' + +# Test Requirements workflow +test-requirements: + @echo "🧪 Testing Requirements workflow..." + @echo "Run in Claude Code:" + @echo '/requirements-pilot "Basic CRUD API for products"' + +# Clean generated artifacts +clean: + @echo "🧹 Cleaning artifacts..." + @rm -rf $(SPECS_DIR) + @echo "✅ Cleaned!" + +# Quick deployment shortcuts +bmad: deploy-bmad +requirements: deploy-requirements +all: deploy-all + +# Version info +version: + @echo "Claude Code Multi-Agent Workflow System v3.1" + @echo "BMAD + Requirements-Driven Development" \ No newline at end of file diff --git a/README-zh.md b/README-zh.md index b7d28ab..cadb208 100644 --- a/README-zh.md +++ b/README-zh.md @@ -1,498 +1,236 @@ -# Claude Code 多智能体工作流系统 +# Claude Code 多智能体工作流系统 v3.1 [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Claude Code](https://img.shields.io/badge/Claude-Code-blue)](https://claude.ai/code) +[![Version](https://img.shields.io/badge/Version-3.1-green)](https://github.com/) -> 将开发流程从手动命令链升级为自动化专家团队,95%质量保证。 +> 企业级敏捷开发工作流自动化与多智能体编排 -## 🚀 从手工作坊到自动化工厂 +## 🚀 BMAD 方法论:敏捷开发自动化 + +**BMAD (Business-Minded Agile Development)** 将您的开发流程转换为全自动化的敏捷工作流,配备角色化 AI 智能体和质量门控。 + +### 一条命令,完整工作流 -**传统方式**: 手动命令链,需要持续监督 ```bash -/ask → /code → /test → /review → /optimize -# 1-2小时手动操作,上下文污染,质量不确定 +/bmad-pilot "构建电商结账系统,集成支付功能" +# 自动化:产品 → 架构 → 冲刺 → 开发 → 审查 → 测试 ``` -**现在**: 一键自动化专家工作流 -```bash -/requirements-pilot "实现JWT用户认证系统" -# 30分钟自动执行,90%质量门控,零人工干预 +## 🎯 BMAD 工作流架构 + +```mermaid +graph LR + PO[产品负责人] -->|PRD 90+| Architect[架构师] + Architect -->|设计 90+| SM[Scrum Master] + SM -->|冲刺计划| Dev[开发者] + Dev -->|代码| Review[审查] + Review -->|Pass/Fail| QA[测试] + QA -->|测试| Done[完成] ``` -## 🎯 核心价值主张 +### 核心特性 -本仓库提供了一个**Claude Code元框架**,实现: +- **🤖 6个专业智能体**:PO、Architect、SM、Dev、Review、QA +- **📊 质量门控**:90% 阈值自动优化 +- **✅ 确认节点**:关键阶段用户确认 +- **📁 持久化产物**:所有文档保存至 `./.claude/specs/` +- **🔄 迭代优化**:自动改进直至质量达标 -- **🤖 多智能体协调**: 专业AI团队并行工作 -- **⚡ 质量门控自动化**: 95%阈值自动优化循环 -- **🔄 工作流自动化**: 从需求到生产就绪代码 -- **📊 上下文隔离**: 每个智能体保持专注专业性,无污染 +## 📋 BMAD 智能体与角色 -## 📋 两种主要使用模式 - -### 1. 🏭 Requirements-Driven 工作流(自动化专家团队) - -**架构**: 需求导向工作流与质量门控 -``` -requirements-generate → requirements-code → requirements-review → (≥90%?) → requirements-testing - ↑ ↓ (<90%) - ←←←←←← 自动优化循环 ←←←←←← -``` - -**使用方法**: -```bash -# 一条命令完成完整开发工作流 -/requirements-pilot "构建用户管理系统,支持RBAC权限控制" - -# 高级多阶段工作流 -先使用 requirements-generate,然后 requirements-code,再用 requirements-review, -如果评分 ≥90% 则使用 requirements-testing -``` - -**质量评分体系** (总分100%): -- 功能性 (40%) -- 集成性 (25%) -- 代码质量 (20%) -- 性能 (15%) - -### 2. 🎛️ 自定义命令(手动编排) - -**架构**: 针对性专业技能的独立斜杠命令 -```bash -/ask # 技术咨询和架构指导 -/code # 功能实现,带约束条件 -/debug # 使用UltraThink方法论的系统化问题分析 -/test # 全面测试策略 -/review # 多维度代码验证 -/optimize # 性能优化协调 -/bugfix # 错误解决工作流 -/refactor # 代码重构协调 -/docs # 文档生成 -/think # 高级思考和分析 -``` - -**渐进式示例**: -```bash -# 逐步开发,手动控制每个环节 -/ask "帮我理解微服务架构需求" -/code "实现带限流功能的网关" -/test "创建负载测试套件" -/review "验证安全性和性能" -/optimize "为生产环境优化性能" -``` +| 智能体 | 角色 | 质量门控 | 输出 | +|--------|------|----------|------| +| **bmad-po** (Sarah) | 产品需求收集 | 90/100 PRD 评分 | `01-product-requirements.md` | +| **bmad-architect** (Winston) | 技术设计与架构 | 90/100 设计评分 | `02-system-architecture.md` | +| **bmad-sm** (Mike) | 冲刺计划与任务分解 | 用户确认 | `03-sprint-plan.md` | +| **bmad-dev** (Alex) | 功能实现 | 代码完成 | 实现文件 | +| **bmad-review** | 独立代码审查 | Pass/Risk/Fail | `04-dev-reviewed.md` | +| **bmad-qa** (Emma) | 测试与质量保证 | 测试执行 | `05-qa-report.md` | ## 🚀 快速开始 -### 1. 配置设置 - -克隆或复制配置结构: -```bash -# 你的项目目录 -├── commands/ # 11个专业斜杠命令 -├── agents/ # 9个专家智能体配置 -└── CLAUDE.md # 项目特定指导原则 -``` - -### 2. 基本使用 - -**完整功能开发**: -```bash -/requirements-pilot "实现OAuth2认证,支持刷新令牌" -``` - -**BMAD Pilot(产品→架构→冲刺→开发→测试,含确认门)**: -```bash -/bmad-pilot "新增看板模块,支持角色权限与移动端" -# 选项:--skip-tests | --direct-dev | --skip-scan -``` - -**手动开发流程**: -```bash -/ask "可扩展微服务的设计原则" -/code "实现OAuth2,遵循安全最佳实践" -/test "创建全面测试套件" -/review "验证实现质量" -``` - -### 3. 预期输出 - -**自动化工作流结果**: -- ✅ 需求确认,90+质量评分 -- ✅ 实现就绪技术规格 -- ✅ 生产就绪代码,遵循最佳实践 -- ✅ 全面测试套件 (单元 + 集成 + 功能测试) -- ✅ 90%+ 质量验证评分 - -## 🏗️ 架构概览 - -### 核心组件 - -#### **Commands 目录** (`/commands/`) -- **咨询服务**: `/ask` - 架构指导(不修改代码) -- **实现工具**: `/code` - 带约束的功能开发 -- **质量保证**: `/test`, `/review`, `/debug` -- **优化工具**: `/optimize`, `/refactor` -- **错误解决**: `/bugfix` - 系统化错误修复工作流 -- **文档工具**: `/docs` - 文档生成 -- **分析工具**: `/think` - 高级思考和分析 -- **需求工具**: `/requirements-pilot` - 完整需求驱动工作流 -- **BMAD Pilot**: `/bmad-pilot` - 多智能体质控工作流(PO → Architect → SM → Dev → QA) - -#### **Agents 目录** (`/agents/`) -- **requirements-generate**: 为代码生成优化的技术规格生成 -- **requirements-code**: 最小架构开销的直接实现智能体 -- **requirements-review**: 专注功能性和可维护性的实用代码审查 -- **requirements-testing**: 专注功能验证的实用测试智能体 -- **bugfix**: 分析和修复软件缺陷的错误解决专家 -- **bugfix-verify**: 客观评估的修复验证专家 -- **code**: 直接实现的开发协调器 -- **debug**: UltraThink系统化问题分析 -- **optimize**: 性能优化协调 - -### 多智能体协调系统 - -**4个核心专家**: -1. **需求生成专家** - 实现就绪的技术规格 -2. **代码实现专家** - 直接、实用的代码实现 -3. **质量审查专家** - 实用质量审查与评分 -4. **测试协调专家** - 功能验证和测试 - -**关键特性**: -- **独立上下文**: 专家间无上下文污染 -- **质量门控**: 90%阈值自动进展判断 -- **迭代改进**: 自动优化循环 -- **可追溯性**: 完整规格 → 代码 → 测试追溯链 - -## 📚 工作流示例 - -### 企业用户认证系统 - -**输入**: -```bash -/requirements-pilot "企业JWT认证系统,支持RBAC,500并发用户,集成现有LDAP" -``` - -**自动化执行过程**: -1. **需求确认** (质量: 92/100) - 交互式澄清 - - 功能清晰度、技术特定性、实现完整性 - - **决策**: ≥90%,进入实现阶段 - -2. **第1轮** (质量: 83/100) - 基础实现 - - 问题: 错误处理不完整,集成问题 - - **决策**: <90%,重新开始并改进 - -3. **第2轮** (质量: 93/100) - 生产就绪 - - **决策**: ≥90%,进入功能测试 - -**最终交付物**: -- 质量评估的需求确认 -- 实现就绪技术规格 -- 带RBAC的实用JWT实现 -- 带正确错误处理的LDAP集成 -- 专注关键路径的功能测试套件 - -### API网关开发 - -**输入**: -```bash -/ask "高性能API网关的设计考虑" -# (交互式咨询阶段) - -/code "实现微服务API网关,支持限流和熔断器" -# (实现阶段) - -/test "为网关创建全面测试套件" -# (测试阶段) -``` - -**结果**: -- 性能模式的架构咨询 -- 带负载均衡策略的详细规格 -- 带监控的生产就绪实现 - -## 🔧 高级使用模式 - -### 自定义工作流组合 +### 一键安装 ```bash -# 调试 → 修复 → 验证工作流 -先使用 debug 分析 [性能问题], -然后用 code 实现修复, -再用 review 确保质量 +# 克隆仓库 +git clone https://github.com/your-repo/claude-code-workflows.git +cd claude-code-workflows -# 完整开发 + 优化流水线 -先使用 requirements-pilot 处理 [功能开发], -然后用 review 进行质量验证, -如果评分 ≥95% 则使用 test 进行全面测试, -最后用 optimize 确保生产就绪 +# 使用 make 安装所有配置 +make install + +# 或部署特定工作流 +make deploy-bmad # 仅部署 BMAD 工作流 +make deploy-requirements # 仅部署 Requirements 工作流 +make deploy-all # 部署所有命令和智能体 ``` -### 质量驱动开发 +### 基本 BMAD 工作流 ```bash -# 迭代质量改进 -先使用 review 评估 [现有代码], -如果评分 <95% 则用 code 基于反馈改进, -重复直到达到质量阈值 +# 完整敏捷工作流(所有阶段) +/bmad-pilot "用户认证系统,支持 OAuth2 和多因素认证" + +# 快速原型(跳过测试) +/bmad-pilot "管理后台" --skip-tests + +# 直接开发(跳过冲刺计划) +/bmad-pilot "修复登录问题" --direct-dev + +# 跳过仓库扫描(使用现有上下文) +/bmad-pilot "添加功能" --skip-scan ``` -## 🎯 效益与影响 +### 工作流产物 -| 维度 | 手动命令 | Requirements-Driven工作流 | -|------|-------------|------------------| -| **复杂度** | 手动触发每个步骤 | 一键启动完整流水线 | -| **质量** | 主观评估 | 90%客观评分 | -| **上下文** | 污染,需要/clear | 隔离,无污染 | -| **专业性** | AI角色切换 | 专注的专家 | -| **错误处理** | 手动发现/修复 | 自动优化 | -| **时间投入** | 1-2小时手动工作 | 30分钟自动化 | +每次 BMAD 运行创建结构化文档: -## 🔮 关键创新 +``` +.claude/specs/user-authentication/ +├── 00-repository-context.md # 仓库分析 +├── 01-product-requirements.md # PRD 及业务目标 +├── 02-system-architecture.md # 技术设计 +├── 03-sprint-plan.md # 冲刺任务 +├── 04-dev-reviewed.md # 代码审查报告(v3.1 新增) +└── 05-qa-report.md # 测试结果 +``` -### 1. **专家深度 > 通才广度** -每个智能体在独立上下文中专注各自领域专业知识,避免角色切换导致的质量下降。 +## 🎨 BMAD 输出样式 -### 2. **智能质量门控** -90%客观评分,自动决策工作流进展或优化循环。 +BMAD 工作流使用专门的输出样式: +- 创建阶段隔离的上下文 +- 管理智能体交接 +- 跟踪质量评分 +- 处理确认门控 +- 支持 Codex CLI 集成 -### 3. **完全自动化** -一条命令触发端到端开发工作流,最少人工干预。 +## ⚡ v3.1 新特性 -### 4. **持续改进** -质量反馈驱动自动规格优化,创建智能改进循环。 +### 独立代码审查智能体 +- **bmad-review**:Dev 和 QA 之间的自动审查 +- **双版本支持**: + - 标准版:Claude Code 原生审查 + - 增强版:通过 Codex CLI 调用 GPT-5 +- **三级状态**:Pass / Pass with Risk / Fail -## 🛠️ 配置说明 +### 增强工作流 +- Dev → Review → QA 质量链 +- 自动更新冲刺计划 +- 针对性 QA 测试建议 -### 设置Sub-Agents +## 📊 质量评分系统 -1. **创建智能体配置**: 将智能体文件复制到Claude Code配置中 -2. **配置命令**: 设置工作流触发命令 -3. **自定义质量门控**: 根据需要调整评分阈值 +### PRD 质量(100分) +- 业务价值:30 +- 功能需求:25 +- 用户体验:20 +- 技术约束:15 +- 范围与优先级:10 -### 工作流定制 +### 架构质量(100分) +- 设计质量:30 +- 技术选型:25 +- 可扩展性:20 +- 安全性:15 +- 可行性:10 + +### 审查状态 +- **Pass**:无问题,进入 QA +- **Pass with Risk**:非关键问题 +- **Fail**:必须返回 Dev + +## 🔧 高级用法 + +### 仓库上下文 +BMAD 自动扫描仓库了解: +- 技术栈 +- 项目结构 +- 现有模式 +- 依赖关系 +- 编码规范 + +### 交互式优化 +每个阶段支持迭代改进: +``` +PO: "这是 PRD(评分:75/100)" +用户: "添加移动端支持和离线模式" +PO: "更新的 PRD(评分:92/100)✅" +``` + +### 确认门控 +关键阶段需要明确确认: +``` +架构师: "技术设计完成(评分:93/100)" +系统: "准备继续?(yes/no)" +用户: yes +``` + +--- + +## 🏭 Requirements-Driven 工作流 + +适用于简单项目的轻量级替代方案: ```bash -# 带特定质量要求的自定义工作流 -先使用 requirements-pilot 处理 [严格安全要求和性能约束], -然后用 review 验证并设置 [90%最低阈值], -继续优化直到达到阈值 +/requirements-pilot "实现 JWT 认证" +# 自动化:需求 → 代码 → 审查 → 测试 ``` -## 📖 命令参考 +### 特性 +- 90% 质量门控 +- 自动优化循环 +- 实现导向规格 +- 实用主义优先 -### Requirements 工作流 -- `/requirements-pilot` - 完整的需求驱动开发工作流 -- 交互式需求确认 → 技术规格 → 实现 → 测试 +## 🛠️ 其他命令 -### 开发命令 -- `/ask` - 架构咨询(不修改代码) -- `/code` - 带约束的功能实现 -- `/debug` - 系统化问题分析 -- `/test` - 全面测试策略 -- `/review` - 多维度代码验证 - -### 优化命令 -- `/optimize` - 性能优化协调 -- `/refactor` - 带质量门控的代码重构 - -### 其他命令 -- `/bugfix` - 错误解决工作流 +### 开发命令 +- `/ask` - 技术咨询 +- `/code` - 直接实现 +- `/debug` - 系统化调试 +- `/test` - 测试策略 +- `/review` - 代码验证 +- `/optimize` - 性能优化 +- `/bugfix` - 错误解决 +- `/refactor` - 代码改进 - `/docs` - 文档生成 -- `/think` - 高级思考和分析 +- `/think` - 高级分析 -## 🤝 贡献 - -这是一个Claude Code配置框架。欢迎贡献: - -1. **新智能体配置**: 特定领域的专业专家 -2. **工作流模式**: 新的自动化序列 -3. **质量指标**: 增强的评分维度 -4. **命令扩展**: 额外的开发阶段覆盖 +### 手动工作流示例 +```bash +/ask "实时消息的设计模式" +/code "实现 WebSocket 服务器" +/test "创建集成测试" +/review "验证安全性" +``` ## 📄 许可证 -MIT许可证 - 详见[LICENSE](LICENSE)文件。 +MIT 许可证 - 查看 [LICENSE](LICENSE) 文件 ## 🙋 支持 -- **文档**: 查看`/commands/`和`/agents/`获取详细规格 -- **问题**: 使用GitHub issues报告bug和功能请求 -- **讨论**: 分享工作流模式和定制化方案 +- **文档**:查看 `/commands/` 和 `/agents/` 目录 +- **问题**:GitHub issues 用于报告 bug 和功能请求 +- **Makefile 帮助**:运行 `make help` 查看所有部署选项 + +### 可用的 Make 命令 + +```bash +make install # 安装所有配置到 Claude Code +make deploy-bmad # 仅部署 BMAD 工作流 +make deploy-requirements # 仅部署 Requirements 工作流 +make deploy-commands # 部署所有斜杠命令 +make deploy-agents # 部署所有智能体配置 +make test-bmad # 测试 BMAD 工作流示例 +make test-requirements # 测试 Requirements 工作流示例 +make clean # 清理生成的文件 +make help # 显示所有可用命令 +``` --- -## 🎉 开始使用 +**使用 BMAD 转型您的开发** - 一条命令,完整敏捷工作流,质量保证。 -准备好转换你的开发工作流了吗?从这里开始: - -```bash -/requirements-pilot "在这里描述你的第一个功能" -``` - -看着你的一行请求变成完整、经过测试、生产就绪的实现,90%质量保证。 - -**记住**: 专业软件来自专业流程。需求驱动工作流为您提供一个永不疲倦、始终专业的虚拟开发团队。 - -*让专业的AI做专业的事 - 开发从此变得优雅而高效。* - ---- - -## 🌟 实战案例 - -### 用户管理系统开发 - -**需求**: 构建企业内部用户管理系统,500人规模,RBAC权限控制,集成OA系统 - -**传统方式** (1-2小时): -```bash -1. /ask 用户认证需求 → 手动澄清需求 -2. /code 实现认证逻辑 → 手动编写代码 -3. /test 生成测试用例 → 手动测试 -4. /review 代码审查 → 手动修复问题 -5. /optimize 性能优化 → 手动优化 -``` - -**Requirements-Driven方式** (30分钟自动): -```bash -/requirements-pilot "企业用户管理系统,500人规模,RBAC权限,OA系统集成" -``` - -**自动化执行结果**: -- 📋 **完整规格文档**: 需求分析、架构设计、实现计划 -- 💻 **生产级代码**: JWT最佳实践、完善异常处理、性能优化 -- 🧪 **全面测试覆盖**: 单元测试、集成测试、安全测试 -- ✅ **质量保证**: 97/100评分,所有维度均达标 - -### 微服务API网关 - -**场景**: 高并发微服务架构,需要API网关进行流量管理 - -**Step 1 - 需求理解**: -```bash -/ask "设计高性能微服务API网关,需要考虑哪些方面?" -``` - -AI会深入询问: -- 预期QPS和并发量 -- 路由策略和负载均衡 -- 限流和熔断机制 -- 监控和日志需求 - -**Step 2 - 需求驱动开发**: -```bash -/requirements-pilot "基于讨论,实现API网关完整功能" -``` - -自动化执行: -- **需求确认** - 交互式澄清和质量评估 -- **技术规格** - 考虑高并发的架构设计 -- **代码实现** - 详细的功能实现 -- **质量验证** - 多维度质量评估 -- **测试套件** - 功能和性能测试 - -## 💡 最佳实践 - -### 1. 需求澄清优先 - -**不要急于实现,先用/ask充分交流** - -```bash -# 错误做法:直接开始 -/requirements-pilot "用户管理系统" - -# 正确做法:先理解需求 -/ask "企业用户管理系统需要考虑哪些方面?" -# 经过3-5轮对话澄清需求后 -/requirements-pilot "基于讨论,实现企业用户管理系统" -``` - -### 2. 渐进式复杂度 - -从简单功能开始,逐步增加复杂性: - -```bash -# 第一阶段:基础功能 -/requirements-pilot "用户注册登录基础功能" - -# 第二阶段:权限管理 -/requirements-pilot "在现有基础上添加RBAC权限系统" - -# 第三阶段:系统集成 -/requirements-pilot "集成LDAP和SSO单点登录" -``` - -### 3. 质量优先策略 - -利用质量门控确保每个阶段的代码质量: - -```bash -# 设置更高质量要求 -先使用 requirements-pilot 实现功能, -然后用 review 验证质量, -如果评分 <98% 则继续优化, -达标后用 test 和 optimize 完善 -``` - -## 🔍 深度解析:为什么这样更有效? - -### 传统问题分析 - -**上下文污染**: 单一AI在不同角色间切换,质量逐步下降 -``` -AI扮演产品经理 → 架构师 → 开发者 → 测试工程师 → 优化专家 -随着对话长度增加,AI的专业度和准确性下降 -``` - -**手动管理开销**: 每个环节都需要人工判断和干预 -``` -是否需求已完整? → 设计是否合理? → 代码是否正确? → 测试是否充分? -每个决策点都可能中断,需要重新组织思路 -``` - -### Requirements-Driven解决方案 - -**专业化隔离**: 每个专家在独立上下文中工作 -``` -规格专家(独立) + 实现专家(独立) + 质量专家(独立) + 测试专家(独立) -专业深度最大化,角色混淆最小化 -``` - -**自动化决策**: 基于客观指标的自动流程控制 -``` -质量评分 ≥90% → 自动进入下一阶段 -质量评分 <90% → 自动返回优化,无需人工判断 -``` - -## 🚀 开始你的AI工厂 - -从手工作坊升级到自动化工厂,只需要: - -1. **配置一次**: 设置Requirements-Driven智能体和自定义命令 -2. **使用一生**: 每个项目都能享受专业AI团队服务 -3. **持续改进**: 工作流模式不断优化,开发效率持续提升 - -**记住**: 在AI时代,Requirements-Driven工作流让你拥有了一个永不疲倦、始终专业的虚拟开发团队。 - -*让专业的AI做专业的事,开发从此变得优雅而高效。* -### BMAD Pilot:产品 → 架构 → 冲刺 → 开发 → 测试 - -**输入**: -```bash -/bmad-pilot "企业级用户管理,支持RBAC与审计日志" -``` - -**阶段**: -- PO:交互式 PRD(≥90 分并确认) -- Architect:技术架构(≥90 分并确认) -- SM:冲刺计划(或用 --direct-dev 跳过) -- Dev:按文档实现 -- QA:按文档与实现测试(--skip-tests 跳过) - -**产出目录**(按 feature 保存): -``` -.claude/specs/{feature_name}/ - 00-repo-scan.md - 01-product-requirements.md - 02-system-architecture.md - 03-sprint-plan.md -``` +*让专业的 AI 智能体处理专业工作。* \ No newline at end of file diff --git a/README.md b/README.md index 9850c8b..640aba9 100644 --- a/README.md +++ b/README.md @@ -1,358 +1,236 @@ -# Claude Code Multi-Agent Workflow System +# Claude Code Multi-Agent Workflow System v3.1 [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Claude Code](https://img.shields.io/badge/Claude-Code-blue)](https://claude.ai/code) +[![Version](https://img.shields.io/badge/Version-3.1-green)](https://github.com/) -> Transform your development workflow from manual command chains to automated expert teams with 95% quality assurance. +> Enterprise-grade agile development workflow automation with multi-agent orchestration -## 🚀 From Manual Commands to Automated Workflows +## 🚀 BMAD Methodology: Agile Development Automation + +**BMAD (Business-Minded Agile Development)** transforms your development process into a fully automated agile workflow with role-based AI agents and quality gates. + +### One Command, Complete Workflow -**Before**: Manual command chains requiring constant oversight ```bash -/ask → /code → /test → /review → /optimize -# 1-2 hours of manual orchestration, context pollution, quality uncertainty +/bmad-pilot "Build e-commerce checkout system with payment integration" +# Automated: Product → Architecture → Sprint → Dev → Review → QA ``` -**After**: One-command automated expert workflows -```bash -/requirements-pilot "Implement JWT user authentication system" -# 30 minutes of automated execution, 90% quality gates, zero manual intervention +## 🎯 BMAD Workflow Architecture + +```mermaid +graph LR + PO[Product Owner] -->|PRD 90+| Architect + Architect -->|Design 90+| SM[Scrum Master] + SM -->|Sprint Plan| Dev + Dev -->|Code| Review + Review -->|Pass/Fail| QA + QA -->|Tests| Done ``` -## 🎯 Core Value Proposition +### Key Features -This repository provides a **meta-framework for Claude Code** that implements: +- **🤖 6 Specialized Agents**: PO, Architect, SM, Dev, Review, QA +- **📊 Quality Gates**: 90% thresholds with automatic optimization +- **✅ Approval Points**: User confirmation at critical phases +- **📁 Persistent Artifacts**: All documents saved to `./.claude/specs/` +- **🔄 Iterative Refinement**: Automatic improvement until quality met -- **🤖 Multi-Agent Orchestration**: Specialized AI teams working in parallel -- **⚡ Quality Gate Automation**: 95% threshold with automatic optimization loops -- **🔄 Workflow Automation**: From requirements to production-ready code -- **📊 Context Isolation**: Each agent maintains focused expertise without pollution +## 📋 BMAD Agents & Roles -## 📋 Two Primary Usage Patterns - -### 1. 🏭 Requirements-Driven Workflow (Automated Expert Teams) - -**Architecture**: Requirements-focused workflow with quality gates -``` -requirements-generate → requirements-code → requirements-review → (≥90%?) → requirements-testing - ↑ ↓ (<90%) - ←←←←←← Automatic optimization loop ←←←←←← -``` - -**Usage**: -```bash -# Complete development workflow in one command -/requirements-pilot "Build user management system with RBAC" - -# Advanced multi-stage workflow -First use requirements-generate, then requirements-code, then requirements-review, -then if score ≥90% use requirements-testing -``` - -**Quality Scoring** (Total 100%): -- Functionality (40%) -- Integration (25%) -- Code Quality (20%) -- Performance (15%) - -### 2. 🎛️ Custom Commands (Manual Orchestration) - -**Architecture**: Individual slash commands for targeted expertise -```bash -/ask # Technical consultation and architecture guidance -/code # Feature implementation with constraints -/debug # Systematic problem analysis using UltraThink -/test # Comprehensive testing strategy -/review # Multi-dimensional code validation -/optimize # Performance optimization coordination -/bugfix # Bug resolution workflows -/refactor # Code refactoring coordination -/docs # Documentation generation -/think # Advanced thinking and analysis -``` - -**Progression Example**: -```bash -# Step-by-step development with manual control -/ask "Help me understand microservices architecture requirements" -/code "Implement gateway with rate limiting" -/test "Create load testing suite" -/review "Validate security and performance" -/optimize "Enhance performance for production" -``` +| Agent | Role | Quality Gate | Output | +|-------|------|--------------|--------| +| **bmad-po** (Sarah) | Product requirements gathering | 90/100 PRD score | `01-product-requirements.md` | +| **bmad-architect** (Winston) | Technical design & architecture | 90/100 design score | `02-system-architecture.md` | +| **bmad-sm** (Mike) | Sprint planning & task breakdown | User approval | `03-sprint-plan.md` | +| **bmad-dev** (Alex) | Feature implementation | Code completion | Implementation files | +| **bmad-review** | Independent code review | Pass/Risk/Fail | `04-dev-reviewed.md` | +| **bmad-qa** (Emma) | Testing & quality assurance | Test execution | `05-qa-report.md` | ## 🚀 Quick Start -### 1. Setup Configuration - -Clone or copy the configuration structure: -```bash -# Your project directory -├── commands/ # 11 specialized slash commands -├── agents/ # 9 expert agent configurations -└── CLAUDE.md # Project-specific guidelines -``` - -### 2. Basic Usage - -**Complete Feature Development**: -```bash -/requirements-pilot "Implement OAuth2 authentication with refresh tokens" -``` - -**BMAD Pilot (product → architecture → sprint → dev → QA with approval gates)**: -```bash -/bmad-pilot "Add Kanban module with role-based permissions and mobile support" -# Options: --skip-tests | --direct-dev | --skip-scan -``` - -**Manual Development Flow**: -```bash -/ask "Design principles for scalable microservices" -/code "Implement OAuth2 with security best practices" -/test "Create comprehensive test suite" -/review "Validate implementation quality" -``` - -### 3. Expected Outputs - -**Automated Workflow Results**: -- ✅ Requirements confirmation with 90+ quality score -- ✅ Implementation-ready technical specifications -- ✅ Production-ready code with best practices -- ✅ Comprehensive test suite (unit + integration + functional) -- ✅ 90%+ quality validation score - -## 🏗️ Architecture Overview - -### Core Components - -#### **Commands Directory** (`/commands/`) -- **Consultation**: `/ask` - Architecture guidance (no code changes) -- **Implementation**: `/code` - Feature development with constraints -- **Quality Assurance**: `/test`, `/review`, `/debug` -- **Optimization**: `/optimize`, `/refactor` -- **Bug Resolution**: `/bugfix` - Systematic bug fixing workflows -- **Documentation**: `/docs` - Documentation generation -- **Analysis**: `/think` - Advanced thinking and analysis -- **Requirements**: `/requirements-pilot` - Complete requirements-driven workflow -- **BMAD Pilot**: `/bmad-pilot` - Multi-agent, quality-gated workflow (PO → Architect → SM → Dev → QA) - -#### **Agents Directory** (`/agents/`) -- **requirements-generate**: Technical specification generation optimized for code generation -- **requirements-code**: Direct implementation agent with minimal architectural overhead -- **requirements-review**: Pragmatic code review focused on functionality and maintainability -- **requirements-testing**: Practical testing agent focused on functional validation -- **bugfix**: Bug resolution specialist for analyzing and fixing software defects -- **bugfix-verify**: Fix validation specialist for objective assessment -- **code**: Development coordinator for direct implementation -- **debug**: UltraThink systematic problem analysis -- **optimize**: Performance optimization coordination - -### Multi-Agent Coordination System - -**4 Core Specialists**: -1. **Requirements Generator** - Implementation-ready technical specifications -2. **Code Implementer** - Direct, pragmatic code implementation -3. **Quality Reviewer** - Practical quality review with scoring -4. **Test Coordinator** - Functional validation and testing - -**Key Features**: -- **Implementation-First Approach**: Direct technical specs for code generation -- **Quality Gates**: 90% threshold for automatic progression -- **Iterative Improvement**: Automatic optimization loops -- **Practical Focus**: Working solutions over architectural perfection - -## 📚 Workflow Examples - -### Enterprise User Authentication System - -**Input**: -```bash -/requirements-pilot "Enterprise JWT authentication with RBAC, supporting 500 concurrent users, integrated with existing LDAP" -``` - -**Automated Process**: -1. **Requirements Confirmation** (Quality: 92/100) - Interactive clarification - - Functional clarity, technical specificity, implementation completeness - - **Decision**: ≥90%, proceed with implementation - -2. **Round 1** (Quality: 83/100) - Basic implementation - - Issues: Error handling incomplete, integration concerns - - **Decision**: <90%, restart with improvements - -3. **Round 2** (Quality: 93/100) - Production ready - - **Decision**: ≥90%, proceed to functional testing - -**Final Deliverables**: -- Requirements confirmation with quality assessment -- Implementation-ready technical specifications -- Pragmatic JWT implementation with RBAC -- LDAP integration with proper error handling -- Functional test suite focusing on critical paths - -### API Gateway Development - -**Input**: -```bash -/ask "Design considerations for high-performance API gateway" -# (Interactive consultation phase) - -/code "Implement microservices API gateway with rate limiting and circuit breakers" -# (Implementation phase) - -/test "Create comprehensive test suite for gateway" -# (Testing phase) -``` - -**Results**: -- Architectural consultation on performance patterns -- Detailed specifications with load balancing strategy -- Production-ready implementation with monitoring - -## 🔧 Advanced Usage Patterns - -### Custom Workflow Composition +### One-Command Installation ```bash -# Debug → Fix → Validate workflow -First use debug to analyze [performance issue], -then use code to implement fixes, -then use review to ensure quality +# Clone the repository +git clone https://github.com/your-repo/claude-code-workflows.git +cd claude-code-workflows -# Complete development + optimization pipeline -First use requirements-pilot for [feature development], -then use review for quality validation, -then if score ≥95% use test for comprehensive testing, -finally use optimize for production readiness +# Install everything with make +make install + +# Or deploy specific workflows +make deploy-bmad # Deploy BMAD workflow only +make deploy-requirements # Deploy Requirements workflow only +make deploy-all # Deploy all commands and agents ``` -### Quality-Driven Development +### Basic BMAD Workflow ```bash -# Iterative quality improvement -First use review to score [existing code], -then if score <95% use code to improve based on feedback, -repeat until quality threshold achieved +# Full agile workflow with all phases +/bmad-pilot "User authentication system with OAuth2 and MFA" + +# Skip testing for quick prototypes +/bmad-pilot "Admin dashboard" --skip-tests + +# Direct development (skip sprint planning) +/bmad-pilot "Bug fix for login issue" --direct-dev + +# Skip repository scanning (use existing context) +/bmad-pilot "Add feature" --skip-scan ``` -## 🎯 Benefits & Impact +### Workflow Artifacts -| Dimension | Manual Commands | Sub-Agent Workflows | -|-----------|----------------|-------------------| -| **Complexity** | Manual trigger for each step | One-command full pipeline | -| **Quality** | Subjective assessment | 90% objective scoring | -| **Context** | Pollution, requires /clear | Isolated, no pollution | -| **Expertise** | AI role switching | Focused specialists | -| **Error Handling** | Manual discovery/fix | Automatic optimization | -| **Time Investment** | 1-2 hours manual work | 30 minutes automated | +Each BMAD run creates structured documentation: -## 🔮 Key Innovations - -### 1. **Specialist Depth Over Generalist Breadth** -Each agent focuses on their domain expertise in independent contexts, avoiding the quality degradation of role-switching. - -### 2. **Intelligent Quality Gates** -90% objective scoring with automatic decision-making for workflow progression or optimization loops. - -### 3. **Complete Automation** -One command triggers end-to-end development workflow with minimal human intervention. - -### 4. **Continuous Improvement** -Quality feedback drives automatic specification refinement, creating intelligent improvement cycles. - -## 🛠️ Configuration - -### Setting Up Sub-Agents - -1. **Create Agent Configurations**: Copy agent files to your Claude Code configuration -2. **Configure Commands**: Set up workflow trigger commands -3. **Customize Quality Gates**: Adjust scoring thresholds if needed - -### Workflow Customization - -```bash -# Custom workflow with specific quality requirements -First use requirements-pilot with [strict security requirements and performance constraints], -then use review to validate with [90% minimum threshold], -continue optimization until threshold met +``` +.claude/specs/user-authentication/ +├── 00-repository-context.md # Repository analysis +├── 01-product-requirements.md # PRD with business goals +├── 02-system-architecture.md # Technical design +├── 03-sprint-plan.md # Sprint tasks +├── 04-dev-reviewed.md # Code review report (NEW v3.1) +└── 05-qa-report.md # Test results ``` -## 📖 Command Reference +## 🎨 BMAD Output Style -### Requirements Workflow -- `/requirements-pilot` - Complete requirements-driven development workflow -- Interactive requirements confirmation → technical specifications → implementation → testing +The BMAD workflow uses a specialized output style that: +- Creates phase-separated contexts +- Manages agent handoffs +- Tracks quality scores +- Handles approval gates +- Supports Codex CLI integration -### Development Commands -- `/ask` - Architecture consultation (no code changes) -- `/code` - Feature implementation with constraints -- `/debug` - Systematic problem analysis -- `/test` - Comprehensive testing strategy -- `/review` - Multi-dimensional code validation +## ⚡ v3.1 New Features -### Optimization Commands -- `/optimize` - Performance optimization coordination -- `/refactor` - Code refactoring with quality gates +### Independent Code Review Agent +- **bmad-review**: Automated review between Dev and QA +- **Dual Version Support**: + - Standard: Native Claude Code review + - Enhanced: GPT-5 via Codex CLI +- **Three-tier Status**: Pass / Pass with Risk / Fail -### Additional Commands -- `/bugfix` - Bug resolution workflows -- `/docs` - Documentation generation -- `/think` - Advanced thinking and analysis +### Enhanced Workflow +- Dev → Review → QA quality chain +- Automatic Sprint plan updates +- Targeted QA test recommendations -## 🤝 Contributing +## 📊 Quality Scoring Systems -This is a Claude Code configuration framework. Contributions welcome: +### PRD Quality (100 points) +- Business Value: 30 +- Functional Requirements: 25 +- User Experience: 20 +- Technical Constraints: 15 +- Scope & Priorities: 10 -1. **New Agent Configurations**: Specialized experts for specific domains -2. **Workflow Patterns**: New automation sequences -3. **Quality Metrics**: Enhanced scoring dimensions -4. **Command Extensions**: Additional development phase coverage +### Architecture Quality (100 points) +- Design Quality: 30 +- Technology Selection: 25 +- Scalability: 20 +- Security: 15 +- Feasibility: 10 -## 📄 License +### Review Status +- **Pass**: No issues, proceed to QA +- **Pass with Risk**: Non-critical issues +- **Fail**: Must return to Dev -MIT License - see [LICENSE](LICENSE) file for details. +## 🔧 Advanced Usage -## 🙋 Support +### Repository Context +BMAD automatically scans your repository to understand: +- Technology stack +- Project structure +- Existing patterns +- Dependencies +- Conventions -- **Documentation**: Check `/commands/` and `/agents/` for detailed specifications -- **Issues**: Use GitHub issues for bug reports and feature requests -- **Discussions**: Share workflow patterns and customizations +### Interactive Refinement +Each phase supports iterative improvement: +``` +PO: "Here's the PRD (Score: 75/100)" +User: "Add mobile support and offline mode" +PO: "Updated PRD (Score: 92/100) ✅" +``` + +### Approval Gates +Critical phases require explicit confirmation: +``` +Architect: "Technical design complete (Score: 93/100)" +System: "Ready to proceed? (yes/no)" +User: yes +``` --- -## 🎉 Getting Started +## 🏭 Requirements-Driven Workflow -Ready to transform your development workflow? Start with: +An alternative lightweight workflow for simpler projects: ```bash -/requirements-pilot "Your first feature description here" +/requirements-pilot "Implement JWT authentication" +# Automated: Requirements → Code → Review → Test ``` -Watch as your one-line request becomes a complete, tested, production-ready implementation with 90% quality assurance. +### Features +- 90% quality gates +- Automatic optimization loops +- Implementation-focused specs +- Pragmatic over architectural -**Remember**: Professional software comes from professional processes. Requirements-driven workflows give you a tireless, always-expert virtual development team. +## 🛠️ Other Commands -*Let specialized AI do specialized work - development becomes elegant and efficient.* -### BMAD Pilot: Product → Architecture → Sprint → Dev → QA +### Development Commands +- `/ask` - Technical consultation +- `/code` - Direct implementation +- `/debug` - Systematic debugging +- `/test` - Testing strategies +- `/review` - Code validation +- `/optimize` - Performance tuning +- `/bugfix` - Bug resolution +- `/refactor` - Code improvement +- `/docs` - Documentation +- `/think` - Advanced analysis -**Input**: +### Manual Workflow Example ```bash -/bmad-pilot "Enterprise-grade user management with RBAC and audit logs" +/ask "Design patterns for real-time messaging" +/code "Implement WebSocket server" +/test "Create integration tests" +/review "Validate security" ``` -**Phases**: -- PO: Interactive PRD with ≥90 score and approval -- Architect: Technical design with ≥90 score and approval -- SM: Sprint plan (or skip with --direct-dev) -- Dev: Implementation based on documents -- QA: Tests based on documents and implementation (skip with --skip-tests) +## 📄 License -**Artifacts** (saved per feature): -``` -.claude/specs/{feature_name}/ - 00-repo-scan.md - 01-product-requirements.md - 02-system-architecture.md - 03-sprint-plan.md +MIT License - see [LICENSE](LICENSE) file + +## 🙋 Support + +- **Documentation**: Check `/commands/` and `/agents/` directories +- **Issues**: GitHub issues for bugs and features +- **Makefile Help**: Run `make help` for all deployment options + +### Available Make Commands + +```bash +make install # Install everything to Claude Code +make deploy-bmad # Deploy BMAD workflow only +make deploy-requirements # Deploy Requirements workflow only +make deploy-commands # Deploy all slash commands +make deploy-agents # Deploy all agent configurations +make test-bmad # Test BMAD workflow sample +make test-requirements # Test Requirements workflow sample +make clean # Clean generated artifacts +make help # Show all available commands ``` + +--- + +**Transform your development with BMAD** - One command, complete agile workflow, quality assured. + +*Let specialized AI agents handle specialized work.* \ No newline at end of file