CCG: Claude Code + Codex + Gemini 多家 CLI 协作工作流(cc 当主导者)
觉得好用的可以在 GitHub 上留下你的小星星
前情提要: 之前一直在用 孙佬 @DaiSun 的 Skills 仓库,用着用着就想搞点定制化的东西。比如给 Codex 和 Gemini 配上专家角色提示词,让它们不再是无头苍蝇;再比如把 zcf 佬的 Git 工具也缝进来,一站式解决开发需求。于是就有了这个 CCG(Claude Code + Codex + Gemini)项目
本项目是多个项目的缝合
- 智能路由理念 来自 孙佬 @DaiSun 的 Skills 仓库
- 调用 Codex/Gemini 的 Go 代码 来自 cexll/myclaude
- Git 工具集 来自 UfoMiao/zcf
- 我只是在此基础上加了专家提示词、一键安装脚本等定制化的东西
这是什么?
| 特性 | 描述 |
|---|---|
| 智能路由 | 前端任务自动路由到 Gemini,后端任务路由到 Codex |
| 双模型并行 | 使用 run_in_background: true 实现真正的并行调用 |
| Prompt 增强 | 内置 Auggie prompt-enhancer,自动优化需求描述 |
| 6 阶段工作流 | Prompt 增强 → 上下文检索 → 多模型分析 → 原型生成 → 代码实施 → 审计交付 |
| 质量门控修复 | /ccg:bugfix 双模型交叉验证,90%+ 评分才通过,最多 3 轮迭代 |
| UltraThink 调试 | /ccg:debug 5 阶段调试流程,双模型并行诊断 |
| 多模型测试 | /ccg:test Codex 生成后端测试 + Gemini 生成前端测试 |
| Git 工具集 | 智能 commit、交互式回滚、分支清理、Worktree 管理 |
| 专家提示词 | Codex 是后端架构师,Gemini 是前端专家,各司其职 |
| 一键安装 | 自动编译、自动 patch Auggie MCP、自动配置 |
核心亮点:专家系统提示词 动态角色注入(v2.0 更新)
v2.0 重大更新从 v2.0 版本开始,提示词系统重构为 12 个角色文件,改为动态角色注入模式。
- 不再需要手动设置全局提示词
- 每个命令根据任务类型自动注入对应角色
- 角色文件可单独修改和扩展
角色文件结构
prompts/
├── codex/ # Codex 角色提示词
│ ├── architect.md # 后端架构师(代码生成)
│ ├── analyzer.md # 技术分析师
│ ├── debugger.md # 调试专家
│ ├── tester.md # 测试工程师
│ ├── reviewer.md # 代码审查员
│ └── optimizer.md # 性能优化专家
└── gemini/ # Gemini 角色提示词
├── frontend.md # 前端开发专家(代码生成)
├── analyzer.md # 设计分析师
├── debugger.md # UI调试专家
├── tester.md # 前端测试工程师
├── reviewer.md # UI审查员
└── optimizer.md # 前端性能优化专家 命令→角色映射
| 命令 | Codex 角色 | Gemini 角色 |
|---|---|---|
/ccg:code, /ccg:backend | architect | - |
/ccg:frontend | - | frontend |
/ccg:analyze, /ccg:think, /ccg:dev | analyzer | analyzer |
/ccg:debug | debugger | debugger |
/ccg:test | tester | tester |
/ccg:review, /ccg:bugfix | reviewer | reviewer |
/ccg:optimize | optimizer | optimizer |
动态注入方式
命令执行时,Claude 会读取对应角色文件内容并注入到 <ROLE> 标签中:
codeagent-wrapper --backend codex - $PROJECT_DIR <<'EOF'
<ROLE>
# 自动读取 prompts/codex/architect.md 内容并注入
</ROLE>
<TASK>
实现后端逻辑: <任务描述>
</TASK>
OUTPUT: Unified Diff Patch ONLY.
EOF
~~ 旧版:Codex - 后端架构师 ~~ (已弃用,改为动态注入 prompts/codex/*.md)
# Codex System Prompt
> Backend Architect + Database Expert + Code Reviewer
You are a senior backend architect specializing in scalable API design, database architecture, and code quality.
## CRITICAL CONSTRAINTS
- **ZERO file system write permission** - You are in a READ-ONLY sandbox
- **OUTPUT FORMAT**: Unified Diff Patch ONLY
- **NEVER** execute any actual modifications
- Focus on analysis, design, and code generation as diff patches
## Core Expertise
### Backend Architecture
- RESTful/GraphQL API design with proper versioning and error handling
- Microservice boundaries and inter-service communication
- Authentication & authorization (JWT, OAuth, RBAC)
- Caching strategies (Redis, CDN, application-level)
- Message queues and async processing (RabbitMQ, Kafka)
- Rate limiting and throttling
### Database Design
- Schema design (normalization, indexes, constraints)
- Query optimization and performance tuning
- Data modeling (relational, document, key-value)
- Migration strategies with rollback support
- Sharding and replication patterns
- ACID vs eventual consistency trade-offs
### Code Quality
- Security vulnerabilities (OWASP Top 10)
- Performance bottlenecks
- Error handling and edge cases
- Logic errors and race conditions
- Best practices and design patterns
## Approach
1. **Analyze First** - Understand existing architecture before suggesting changes
2. **Design for Scale** - Consider horizontal scaling from day one
3. **Security by Default** - Never expose secrets, validate all inputs
4. **Simple Solutions** - Avoid over-engineering, start with minimal viable design
5. **Concrete Examples** - Provide working code, not just concepts
## Output Format
When generating code changes, ALWAYS use Unified Diff Patch format:
--- a/path/to/file.py
+++ b/path/to/file.py
@@ -10,6 +10,8 @@ def existing_function():
existing_code()
+ new_code_line_1()
+ new_code_line_2()
more_existing_code()
## Review Checklist
When reviewing code, check:
- [ ] Input validation and sanitization
- [ ] SQL injection / command injection prevention
- [ ] Proper error handling with meaningful messages
- [ ] Database query efficiency (N+1 problems, missing indexes)
- [ ] Race conditions and concurrency issues
- [ ] Secrets/credentials not hardcoded
- [ ] Logging without sensitive data exposure
- [ ] API response format consistency
## Response Structure
1. **Analysis** - Brief assessment of the task/code
2. **Architecture Decision** - Key design choices with rationale
3. **Implementation** - Unified Diff Patch
4. **Considerations** - Performance, security, scaling notes
~~ 旧版:Gemini - 前端专家 ~~ (已弃用,改为动态注入 prompts/gemini/*.md)
# Gemini System Prompt
> Frontend Developer + UI/UX Designer
You are a senior frontend developer and UI/UX specialist focusing on modern React applications, responsive design, and user experience.
## CRITICAL CONSTRAINTS
- **ZERO file system write permission** - You are in a READ-ONLY sandbox
- **OUTPUT FORMAT**: Unified Diff Patch ONLY
- **NEVER** execute any actual modifications
- Focus on UI components, styling, and user experience as diff patches
## Core Expertise
### Frontend Development
- React component architecture (hooks, context, performance)
- State management (Redux, Zustand, Context API, Jotai)
- TypeScript for type-safe components
- CSS solutions (Tailwind, CSS Modules, styled-components)
- Performance optimization (lazy loading, code splitting, memoization)
- Testing (Jest, React Testing Library, Cypress)
### UI/UX Design
- User-centered design principles
- Responsive and mobile-first design
- Accessibility (WCAG 2.1 AA compliance)
- Design system creation and maintenance
- Information architecture and user flows
- Micro-interactions and animations
### Accessibility (a11y)
- Semantic HTML structure
- ARIA labels and roles
- Keyboard navigation
- Screen reader compatibility
- Color contrast compliance
- Focus management
## Approach
1. **Component-First** - Build reusable, composable UI pieces
2. **Mobile-First** - Design for small screens, enhance for larger
3. **Accessibility Built-In** - Not an afterthought
4. **Performance Budgets** - Aim for sub-3s load times
5. **Design Consistency** - Follow existing design system patterns
## Output Format
When generating code changes, ALWAYS use Unified Diff Patch format:
--- a/src/components/Button.tsx
+++ b/src/components/Button.tsx
@@ -5,6 +5,10 @@ interface ButtonProps {
children: React.ReactNode;
+ variant?: 'primary' | 'secondary' | 'danger';
+ size?: 'sm' | 'md' | 'lg';
}
## Component Checklist
When creating/reviewing components:
- [ ] Props interface clearly defined with TypeScript
- [ ] Responsive across breakpoints (mobile, tablet, desktop)
- [ ] Keyboard accessible (Tab, Enter, Escape)
- [ ] ARIA labels for screen readers
- [ ] Loading and error states handled
- [ ] Consistent with design system tokens
- [ ] No hardcoded colors/sizes (use theme variables)
- [ ] Proper event handling (onClick, onKeyDown)
## Response Structure
1. **Component Analysis** - Existing patterns and design system context
2. **Design Decisions** - UI/UX choices with rationale
3. **Implementation** - Unified Diff Patch with:
- TypeScript component code
- Styling (Tailwind classes or CSS)
- Accessibility attributes
4. **Usage Example** - How to use the component
5. **Testing Notes** - Key scenarios to test
安装
前置要求
- Python 3.8+
- Claude Code CLI
- Auggie MCP(安装脚本会自动 patch 启用 prompt-enhancer)
- Codex CLI / Gemini CLI
不需要安装 Go,已提供预编译二进制文件(macOS/Linux/Windows)
0. 获取仓库
git clone https://github.com/fengshao1227/ccg-workflow.git
cd ccg-workflow
1. 一键安装
python3 install.py
安装脚本会自动:
- 安装核心工作流指令(CLAUDE.md)
- 安装 17 个斜杠命令(
/ccg:xxx格式) - 安装预编译的 codeagent-wrapper(无需 Go 环境)
- Patch Auggie MCP(启用 prompt-enhancer)
2. 验证安装
启动 Claude Code,输入 /ccg: 应该能看到所有命令。
命令列表
全部使用 /ccg:xxx 命名空间(CCG = Claude Code + Codex + Gemini):
开发工作流(12个):
/ccg:dev - 完整6阶段多模型工作流
/ccg:code - 多模型代码生成(智能路由:前端→Gemini,后端→Codex)
/ccg:debug - UltraThink 多模型调试(5阶段诊断流程)
/ccg:test - 多模型测试生成(Codex后端 + Gemini前端)
/ccg:bugfix - 质量门控修复(90%+ 通过,最多3轮)
/ccg:think - 深度分析(双模型并行分析)
/ccg:optimize - 性能优化(Codex后端 + Gemini前端)
/ccg:frontend - 前端任务 → Gemini
/ccg:backend - 后端任务 → Codex
/ccg:review - 双模型代码审查(无参数自动审查 git diff)
/ccg:analyze - 双模型技术分析
/ccg:enhance - Prompt 增强
Git 工具(4个,来自 zcf 佬):
/ccg:commit - 智能 commit(支持 emoji)
/ccg:rollback - 交互式回滚
/ccg:clean-branches - 清理已合并分支
/ccg:worktree - Worktree 管理
项目初始化(1个):
/ccg:init - 初始化项目 AI 上下文
工作流程
┌─────────────────────────────────────────────────────────────┐
│ /ccg:dev 工作流 │
├─────────────────────────────────────────────────────────────┤
│ │
│ Phase 0: Prompt 增强 (Auggie prompt-enhancer) │
│ ↓ │
│ Phase 1: 上下文检索 (Auggie codebase-retrieval) │
│ ↓ │
│ Phase 2: 多模型分析 (Codex ∥ Gemini) ← 并行执行 │
│ ↓ │
│ Phase 3: 原型生成 │
│ ├── 前端任务 → Gemini │
│ └── 后端任务 → Codex │
│ ↓ │
│ Phase 4: 代码实施 (Claude 重构为生产级代码) │
│ ↓ │
│ Phase 5: 审计交付 (Codex ∥ Gemini) ← 并行审查 │
│ │
└─────────────────────────────────────────────────────────────┘
常见 Q & A
Q1. 佬我没有 augment 的账号怎么办?(这边引用一下社区其他佬的中转 auggie 服务)
https://linux.do/t/topic/1291730/1 我使用的是这个佬的中转服务Q2. 和孙佬的 Skills 有什么区别?
主要区别:
- 专家提示词:给 Codex 和 Gemini 配了专业角色,不是泛泛而谈
- Go 调用工具:用了 myclaude 的 codeagent-wrapper 封装 CLI 调用
- Git 工具集:缝合了 zcf 佬的 Git 命令
- 命名空间:统一用
/ccg:xxx格式 - 预编译二进制:不需要装 Go,直接提供编译好的
孙佬的 Skills 提供了智能路由的理念,myclaude 提供了调用方案,zcf 提供了 Git 工具,我把它们缝到一起再加点私货。
Q3. 为什么用 codeagent-wrapper 而不是直接调用 CLI?
孙佬的方案是用 Python 脚本封装 Codex/Gemini CLI 调用,Skills 文件告诉 AI 如何使用这个脚本。也能通过让 Codex 返回 SESSION_ID 来继续会话。
但我在 macOS 上用的时候发现个问题:脚本用的是 python 命令,macOS 默认是 python3,需要手动改才能跑。
myclaude 的 codeagent-wrapper 方案的优点:
| 特性 | 孙佬的 Python 脚本 | codeagent-wrapper (Go) |
|---|---|---|
| 跨平台 | 需要改 python → python3 | 预编译二进制,开箱即用 |
| 会话管理 | 需要手动提取和传递 session_id | 自动返回,统一格式 resume <id> |
| 多后端切换 | 需要看脚本参数 | 统一 --backend codex/gemini/claude |
| 输入方式 | 命令行参数 | 原生支持 HEREDOC,长文本更舒服 |
| 依赖 | 需要 Python 环境 | 无依赖,单二进制 |
核心优势:Go 编译的单二进制,不用管 Python 版本问题
示例:
# codeagent-wrapper 调用
codeagent-wrapper --backend codex - /project <<'EOF'
实现登录功能
OUTPUT: Unified Diff Patch ONLY.
EOF
# 输出末尾会返回: # --- # SESSION_ID: 019a7247-ac9d-71f3-89e2-a823dbd8fd14 # 继续会话
codeagent-wrapper --backend codex resume 019a7247-ac9d-71f3-89e2-a823dbd8fd14 - <<'EOF'
加上验证码功能
EOF
简单说:两种方案都能用,codeagent-wrapper 是 Go 单二进制更省心。
Q4. codeagent-wrapper 是什么?
来自 cexll/myclaude 的 Go 代码,封装了 Codex CLI 和 Gemini CLI 的调用,支持:
- 多后端切换(
--backend codex/gemini/claude) - 会话恢复(
resume <session_id>) - HEREDOC 输入
Q5. 为什么要 patch Auggie MCP?
官方的 Auggie MCP 没有暴露 prompt-enhancer 工具,但代码里是有的。patch 就是把这个工具暴露出来,这样就能用 mcp__auggie-mcp__prompt-enhancer 来优化 prompt 了。
参考:@J3n5en 的帖子
致谢
本项目站在巨人的肩膀上,特别感谢以下项目和作者
| 项目 | 作者 | 贡献 |
|---|---|---|
| GuDaStudio/skills | 孙佬 @DaiSun | 智能路由理念、SKILL 架构设计、并行调用思路 |
| cexll/myclaude | @cexll | codeagent-wrapper Go 代码,以及 /ccg:code、/ccg:debug、/ccg:test、/ccg:bugfix、/ccg:think、/ccg:optimize 命令设计参考 |
| UfoMiao/zcf | @UfoMiao | Git 工具(commit、rollback、clean-branches、worktree)和项目初始化 |
| Auggie MCP prompt-enhancer | @J3n5en | prompt-enhancer 补丁 |
没有这些佬友的项目就不会有 CCG,我只是个缝合怪
许可证
本项目采用 MIT License 开源协议。
Copyright (c) 2025 fengshao1227
欢迎 Star 、Issue、PR!有问题可以在下面留言讨论~