ccg-workflow 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +434 -0
- package/bin/ccg.mjs +2 -0
- package/bin/codeagent-wrapper-darwin-amd64 +0 -0
- package/bin/codeagent-wrapper-darwin-arm64 +0 -0
- package/bin/codeagent-wrapper-linux-amd64 +0 -0
- package/bin/codeagent-wrapper-windows-amd64.exe +0 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.mjs +97 -0
- package/dist/index.d.mts +134 -0
- package/dist/index.d.ts +134 -0
- package/dist/index.mjs +10 -0
- package/dist/shared/ccg-workflow.D_RkPyZ0.mjs +1117 -0
- package/package.json +63 -0
- package/prompts/claude/analyzer.md +59 -0
- package/prompts/claude/architect.md +54 -0
- package/prompts/claude/debugger.md +71 -0
- package/prompts/claude/optimizer.md +73 -0
- package/prompts/claude/reviewer.md +63 -0
- package/prompts/claude/tester.md +69 -0
- package/prompts/codex/analyzer.md +50 -0
- package/prompts/codex/architect.md +46 -0
- package/prompts/codex/debugger.md +66 -0
- package/prompts/codex/optimizer.md +74 -0
- package/prompts/codex/reviewer.md +66 -0
- package/prompts/codex/tester.md +55 -0
- package/prompts/gemini/analyzer.md +53 -0
- package/prompts/gemini/debugger.md +70 -0
- package/prompts/gemini/frontend.md +56 -0
- package/prompts/gemini/optimizer.md +77 -0
- package/prompts/gemini/reviewer.md +73 -0
- package/prompts/gemini/tester.md +61 -0
- package/templates/commands/_config.md +85 -0
- package/templates/commands/analyze.md +73 -0
- package/templates/commands/backend.md +81 -0
- package/templates/commands/bugfix.md +55 -0
- package/templates/commands/clean-branches.md +102 -0
- package/templates/commands/code.md +169 -0
- package/templates/commands/commit.md +158 -0
- package/templates/commands/debug.md +104 -0
- package/templates/commands/dev.md +153 -0
- package/templates/commands/enhance.md +49 -0
- package/templates/commands/frontend.md +80 -0
- package/templates/commands/init.md +53 -0
- package/templates/commands/optimize.md +69 -0
- package/templates/commands/review.md +85 -0
- package/templates/commands/rollback.md +90 -0
- package/templates/commands/test.md +53 -0
- package/templates/commands/think.md +73 -0
- package/templates/commands/worktree.md +276 -0
- package/templates/prompts/claude/analyzer.md +59 -0
- package/templates/prompts/claude/architect.md +54 -0
- package/templates/prompts/claude/debugger.md +71 -0
- package/templates/prompts/claude/optimizer.md +73 -0
- package/templates/prompts/claude/reviewer.md +63 -0
- package/templates/prompts/claude/tester.md +69 -0
- package/templates/prompts/codex/analyzer.md +50 -0
- package/templates/prompts/codex/architect.md +46 -0
- package/templates/prompts/codex/debugger.md +66 -0
- package/templates/prompts/codex/optimizer.md +74 -0
- package/templates/prompts/codex/reviewer.md +66 -0
- package/templates/prompts/codex/tester.md +55 -0
- package/templates/prompts/gemini/analyzer.md +53 -0
- package/templates/prompts/gemini/debugger.md +70 -0
- package/templates/prompts/gemini/frontend.md +56 -0
- package/templates/prompts/gemini/optimizer.md +77 -0
- package/templates/prompts/gemini/reviewer.md +73 -0
- package/templates/prompts/gemini/tester.md +61 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: UltraThink 深度分析(双模型并行分析 + 综合见解)
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
> 调用语法见 `_config.md`
|
|
6
|
+
|
|
7
|
+
## 用法
|
|
8
|
+
`/think <分析主题>`
|
|
9
|
+
|
|
10
|
+
## 上下文
|
|
11
|
+
- 分析主题: $ARGUMENTS
|
|
12
|
+
- 使用双模型进行多角度深度分析
|
|
13
|
+
- 适用于复杂架构决策、技术选型、问题探索
|
|
14
|
+
|
|
15
|
+
## 流程
|
|
16
|
+
|
|
17
|
+
### Phase 1: 上下文收集
|
|
18
|
+
1. 调用 `mcp__ace-tool__search_context` 检索相关代码
|
|
19
|
+
2. 识别分析范围和关键组件
|
|
20
|
+
3. 列出已知约束和假设
|
|
21
|
+
|
|
22
|
+
### Phase 2: 并行深度分析
|
|
23
|
+
**同时调用**(`run_in_background: true`):
|
|
24
|
+
- **Codex** + `analyzer` 角色 → 后端/系统视角
|
|
25
|
+
- **Gemini** + `analyzer` 角色 → 前端/用户视角
|
|
26
|
+
|
|
27
|
+
输出: `Structured analysis report with clear reasoning`
|
|
28
|
+
|
|
29
|
+
### Phase 3: UltraThink 综合
|
|
30
|
+
1. 收集双模型分析报告(`TaskOutput`)
|
|
31
|
+
2. **交叉验证**:
|
|
32
|
+
- 一致观点(强信号)
|
|
33
|
+
- 分歧点(需要权衡)
|
|
34
|
+
- 互补见解
|
|
35
|
+
3. **综合推理**:整合技术和用户视角,形成统一分析框架
|
|
36
|
+
|
|
37
|
+
### Phase 4: 输出结论
|
|
38
|
+
```
|
|
39
|
+
## 🧠 深度分析: <主题>
|
|
40
|
+
|
|
41
|
+
### 一致观点(强信号)
|
|
42
|
+
1. <双方都认同的点>
|
|
43
|
+
|
|
44
|
+
### 分歧点(需权衡)
|
|
45
|
+
| 议题 | Codex 观点 | Gemini 观点 | 建议 |
|
|
46
|
+
|------|------------|-------------|------|
|
|
47
|
+
|
|
48
|
+
### 核心结论
|
|
49
|
+
<1-2 句话总结>
|
|
50
|
+
|
|
51
|
+
### 推荐方案
|
|
52
|
+
**首选**: <方案>
|
|
53
|
+
- 理由 / 风险 / 缓解措施
|
|
54
|
+
|
|
55
|
+
### 行动计划
|
|
56
|
+
1. [ ] <短期>
|
|
57
|
+
2. [ ] <中期>
|
|
58
|
+
3. [ ] <长期>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## 适用场景
|
|
62
|
+
| 场景 | 示例 |
|
|
63
|
+
|------|------|
|
|
64
|
+
| 架构决策 | "评估微服务拆分方案" |
|
|
65
|
+
| 技术选型 | "比较 Redux vs Zustand" |
|
|
66
|
+
| 性能分析 | "分析页面加载慢的原因" |
|
|
67
|
+
| 重构评估 | "评估重构遗留模块的风险" |
|
|
68
|
+
|
|
69
|
+
## 关键原则
|
|
70
|
+
1. **不急于结论** - 充分收集和分析后再下结论
|
|
71
|
+
2. **多视角思考** - 技术 + 用户 + 业务
|
|
72
|
+
3. **量化权衡** - 尽可能用数据支撑判断
|
|
73
|
+
4. **可执行导向** - 分析结果要能指导行动
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 管理 Git worktree,在项目平级的 ../.ccg/项目名/ 目录下创建,支持智能默认、IDE 集成和内容迁移
|
|
3
|
+
allowed-tools: Read(**), Exec(git worktree add, git worktree list, git worktree remove, git worktree prune, git branch, git checkout, git rev-parse, git stash, git cp, detect-ide, open-ide, which, command, basename, dirname)
|
|
4
|
+
argument-hint: <add|list|remove|prune|migrate> [path] [-b <branch>] [-o|--open] [--track] [--guess-remote] [--detach] [--checkout] [--lock] [--migrate-from <source-path>] [--migrate-stash]
|
|
5
|
+
# examples:
|
|
6
|
+
# - /git-worktree add feature-ui # 从 main/master 创建新分支 'feature-ui'
|
|
7
|
+
# - /git-worktree add feature-ui -o # 创建 worktree 并直接用 IDE 打开
|
|
8
|
+
# - /git-worktree add hotfix -b fix/login -o # 创建新分支 'fix/login',路径为 'hotfix'
|
|
9
|
+
# - /git-worktree migrate feature-ui --from main # 将主分支未提交内容迁移到 feature-ui
|
|
10
|
+
# - /git-worktree migrate feature-ui --stash # 将当前 stash 迁移到 feature-ui
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Claude Command: Git Worktree
|
|
14
|
+
|
|
15
|
+
管理 Git worktree,支持智能默认、IDE 集成和内容迁移,使用结构化的 `../.ccg/项目名/` 路径。
|
|
16
|
+
|
|
17
|
+
直接执行命令并提供简洁结果。
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# 基本操作
|
|
25
|
+
/git-worktree add <path> # 从 main/master 创建名为 <path> 的新分支
|
|
26
|
+
/git-worktree add <path> -b <branch> # 创建指定名称的新分支
|
|
27
|
+
/git-worktree add <path> -o # 创建并直接用 IDE 打开
|
|
28
|
+
/git-worktree list # 显示所有 worktree 状态
|
|
29
|
+
/git-worktree remove <path> # 删除指定的 worktree
|
|
30
|
+
/git-worktree prune # 清理无效 worktree 记录
|
|
31
|
+
|
|
32
|
+
# 内容迁移
|
|
33
|
+
/git-worktree migrate <target> --from <source> # 迁移未提交内容
|
|
34
|
+
/git-worktree migrate <target> --stash # 迁移 stash 内容
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Options
|
|
38
|
+
|
|
39
|
+
| 选项 | 说明 |
|
|
40
|
+
| ------------------ | -------------------------------------------- |
|
|
41
|
+
| `add [<path>]` | 在 `../.ccg/项目名/<path>` 添加新的 worktree |
|
|
42
|
+
| `migrate <target>` | 迁移内容到指定 worktree |
|
|
43
|
+
| `list` | 列出所有 worktree 及其状态 |
|
|
44
|
+
| `remove <path>` | 删除指定路径的 worktree |
|
|
45
|
+
| `prune` | 清理无效的 worktree 引用 |
|
|
46
|
+
| `-b <branch>` | 创建新分支并检出到 worktree |
|
|
47
|
+
| `-o, --open` | 创建成功后直接用 IDE 打开(跳过询问) |
|
|
48
|
+
| `--from <source>` | 指定迁移源路径(migrate 专用) |
|
|
49
|
+
| `--stash` | 迁移当前 stash 内容(migrate 专用) |
|
|
50
|
+
| `--track` | 设置新分支跟踪对应的远程分支 |
|
|
51
|
+
| `--guess-remote` | 自动猜测远程分支进行跟踪 |
|
|
52
|
+
| `--detach` | 创建分离 HEAD 的 worktree |
|
|
53
|
+
| `--checkout` | 创建后立即检出(默认行为) |
|
|
54
|
+
| `--lock` | 创建后锁定 worktree |
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## What This Command Does
|
|
59
|
+
|
|
60
|
+
1. **环境检查**
|
|
61
|
+
- 通过 `git rev-parse --is-inside-work-tree` 验证 Git 仓库
|
|
62
|
+
- 检测是否在主仓库或现有 worktree 中,进行智能路径计算
|
|
63
|
+
|
|
64
|
+
2. **智能路径管理**
|
|
65
|
+
- 使用 worktree 检测自动从主仓库路径计算项目名
|
|
66
|
+
- 在结构化的 `../.ccg/项目名/<path>` 目录创建 worktree
|
|
67
|
+
- 正确处理主仓库和 worktree 执行上下文
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# worktree 检测的核心路径计算逻辑
|
|
71
|
+
get_main_repo_path() {
|
|
72
|
+
local git_common_dir=$(git rev-parse --git-common-dir 2>/dev/null)
|
|
73
|
+
local current_toplevel=$(git rev-parse --show-toplevel 2>/dev/null)
|
|
74
|
+
|
|
75
|
+
# 检测是否在 worktree 中
|
|
76
|
+
if [[ "$git_common_dir" != "$current_toplevel/.git" ]]; then
|
|
77
|
+
# 在 worktree 中,从 git-common-dir 推导主仓库路径
|
|
78
|
+
dirname "$git_common_dir"
|
|
79
|
+
else
|
|
80
|
+
# 在主仓库中
|
|
81
|
+
echo "$current_toplevel"
|
|
82
|
+
fi
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
MAIN_REPO_PATH=$(get_main_repo_path)
|
|
86
|
+
PROJECT_NAME=$(basename "$MAIN_REPO_PATH")
|
|
87
|
+
WORKTREE_BASE="$MAIN_REPO_PATH/../.ccg/$PROJECT_NAME"
|
|
88
|
+
|
|
89
|
+
# 始终使用绝对路径防止嵌套问题
|
|
90
|
+
ABSOLUTE_WORKTREE_PATH="$WORKTREE_BASE/<path>"
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**关键修复**: 在现有 worktree 内创建新 worktree 时,始终使用绝对路径以防止出现类似 `../.ccg/project/.ccg/project/path` 的路径嵌套问题。
|
|
94
|
+
|
|
95
|
+
3. **Worktree 操作**
|
|
96
|
+
- **add**: 使用智能分支/路径默认创建新 worktree
|
|
97
|
+
- **list**: 显示所有 worktree 的分支和状态
|
|
98
|
+
- **remove**: 安全删除 worktree 并清理引用
|
|
99
|
+
- **prune**: 清理孤立的 worktree 记录
|
|
100
|
+
|
|
101
|
+
4. **智能默认**
|
|
102
|
+
- **分支创建**: 未指定 `-b` 时,使用路径名创建新分支
|
|
103
|
+
- **基础分支**: 新分支从 main/master 分支创建
|
|
104
|
+
- **路径解析**: 未指定路径时使用分支名作为路径
|
|
105
|
+
- **IDE 集成**: 自动检测并提示 IDE 打开
|
|
106
|
+
|
|
107
|
+
5. **内容迁移**
|
|
108
|
+
- 在 worktree 之间迁移未提交改动
|
|
109
|
+
- 将 stash 内容应用到目标 worktree
|
|
110
|
+
- 安全检查防止冲突
|
|
111
|
+
|
|
112
|
+
6. **安全特性**
|
|
113
|
+
- **路径冲突防护**: 创建前检查目录是否已存在
|
|
114
|
+
- **分支检出验证**: 确保分支未被其他地方使用
|
|
115
|
+
- **绝对路径强制**: 防止在 worktree 内创建嵌套的 `.ccg` 目录
|
|
116
|
+
- **删除时自动清理**: 同时清理目录和 git 引用
|
|
117
|
+
- **清晰的状态报告**: 显示 worktree 位置和分支状态
|
|
118
|
+
|
|
119
|
+
7. **环境文件处理**
|
|
120
|
+
- **自动检测**: 扫描 `.gitignore` 文件中的环境变量文件模式
|
|
121
|
+
- **智能复制**: 复制 `.gitignore` 中列出的 `.env` 和 `.env.*` 文件
|
|
122
|
+
- **排除逻辑**: 跳过 `.env.example` 等模板文件
|
|
123
|
+
- **权限保护**: 保持原始文件权限和时间戳
|
|
124
|
+
- **用户反馈**: 提供已复制环境文件的清晰状态信息
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# 环境文件复制实现
|
|
128
|
+
copy_environment_files() {
|
|
129
|
+
local main_repo="$MAIN_REPO_PATH"
|
|
130
|
+
local target_worktree="$ABSOLUTE_WORKTREE_PATH"
|
|
131
|
+
local gitignore_file="$main_repo/.gitignore"
|
|
132
|
+
|
|
133
|
+
# 检查 .gitignore 是否存在
|
|
134
|
+
if [[ ! -f "$gitignore_file" ]]; then
|
|
135
|
+
return 0
|
|
136
|
+
fi
|
|
137
|
+
|
|
138
|
+
local copied_count=0
|
|
139
|
+
|
|
140
|
+
# 检测 .env 文件
|
|
141
|
+
if [[ -f "$main_repo/.env" ]] && grep -q "^\.env$" "$gitignore_file"; then
|
|
142
|
+
cp "$main_repo/.env" "$target_worktree/.env"
|
|
143
|
+
echo "✅ 已复制 .env"
|
|
144
|
+
((copied_count++))
|
|
145
|
+
fi
|
|
146
|
+
|
|
147
|
+
# 检测 .env.* 模式文件(排除 .env.example)
|
|
148
|
+
for env_file in "$main_repo"/.env.*; do
|
|
149
|
+
if [[ -f "$env_file" ]] && [[ "$(basename "$env_file")" != ".env.example" ]]; then
|
|
150
|
+
local filename=$(basename "$env_file")
|
|
151
|
+
if grep -q "^\.env\.\*$" "$gitignore_file"; then
|
|
152
|
+
cp "$env_file" "$target_worktree/$filename"
|
|
153
|
+
echo "✅ 已复制 $filename"
|
|
154
|
+
((copied_count++))
|
|
155
|
+
fi
|
|
156
|
+
fi
|
|
157
|
+
done
|
|
158
|
+
|
|
159
|
+
if [[ $copied_count -gt 0 ]]; then
|
|
160
|
+
echo "📋 已从 .gitignore 复制 $copied_count 个环境文件"
|
|
161
|
+
fi
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Enhanced Features
|
|
168
|
+
|
|
169
|
+
### IDE 集成
|
|
170
|
+
|
|
171
|
+
- **自动检测**: VS Code → Cursor → WebStorm → Sublime Text → Vim
|
|
172
|
+
- **智能提示**: 创建 worktree 后询问是否在 IDE 中打开
|
|
173
|
+
- **直接打开**: 使用 `-o` 标志跳过提示直接打开
|
|
174
|
+
- **自定义配置**: 通过 git config 配置
|
|
175
|
+
|
|
176
|
+
### 内容迁移系统
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
# 迁移未提交改动
|
|
180
|
+
/git-worktree migrate feature-ui --from main
|
|
181
|
+
/git-worktree migrate hotfix --from ../other-worktree
|
|
182
|
+
|
|
183
|
+
# 迁移 stash 内容
|
|
184
|
+
/git-worktree migrate feature-ui --stash
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
**迁移流程**:
|
|
188
|
+
|
|
189
|
+
1. 验证源有未提交内容
|
|
190
|
+
2. 确保目标 worktree 干净
|
|
191
|
+
3. 显示即将迁移的改动
|
|
192
|
+
4. 使用 git 命令安全迁移
|
|
193
|
+
5. 确认结果并建议后续步骤
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Examples
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
# 基本用法
|
|
201
|
+
/git-worktree add feature-ui # 从 main/master 创建新分支 'feature-ui'
|
|
202
|
+
/git-worktree add feature-ui -b my-feature # 创建新分支 'my-feature',路径为 'feature-ui'
|
|
203
|
+
/git-worktree add feature-ui -o # 创建并直接用 IDE 打开
|
|
204
|
+
|
|
205
|
+
# 内容迁移场景
|
|
206
|
+
/git-worktree add feature-ui -b feature/new-ui # 创建新功能 worktree
|
|
207
|
+
/git-worktree migrate feature-ui --from main # 迁移未提交改动
|
|
208
|
+
/git-worktree migrate hotfix --stash # 迁移 stash 内容
|
|
209
|
+
|
|
210
|
+
# 管理操作
|
|
211
|
+
/git-worktree list # 查看所有 worktree
|
|
212
|
+
/git-worktree remove feature-ui # 删除不需要的 worktree
|
|
213
|
+
/git-worktree prune # 清理无效引用
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
**示例输出**:
|
|
217
|
+
|
|
218
|
+
```
|
|
219
|
+
✅ Worktree created at ../.ccg/项目名/feature-ui
|
|
220
|
+
✅ 已复制 .env
|
|
221
|
+
✅ 已复制 .env.local
|
|
222
|
+
📋 已从 .gitignore 复制 2 个环境文件
|
|
223
|
+
🖥️ 是否在 IDE 中打开 ../.ccg/项目名/feature-ui?[y/n]: y
|
|
224
|
+
🚀 正在用 VS Code 打开 ../.ccg/项目名/feature-ui...
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## Directory Structure
|
|
230
|
+
|
|
231
|
+
```
|
|
232
|
+
parent-directory/
|
|
233
|
+
├── your-project/ # 主项目
|
|
234
|
+
│ ├── .git/
|
|
235
|
+
│ └── src/
|
|
236
|
+
└── .ccg/ # worktree 管理
|
|
237
|
+
└── your-project/ # 项目 worktree
|
|
238
|
+
├── feature-ui/ # 功能分支
|
|
239
|
+
├── hotfix/ # 修复分支
|
|
240
|
+
└── debug/ # 调试 worktree
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## Configuration
|
|
246
|
+
|
|
247
|
+
### IDE 配置
|
|
248
|
+
|
|
249
|
+
- 支持 VS Code、Cursor、WebStorm、Sublime Text、Vim
|
|
250
|
+
- 通过 git config 配置自定义 IDE
|
|
251
|
+
- 基于优先级的自动检测选择
|
|
252
|
+
|
|
253
|
+
### 自定义 IDE 设置
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
# 配置自定义 IDE
|
|
257
|
+
git config worktree.ide.custom.sublime "subl %s"
|
|
258
|
+
git config worktree.ide.preferred "sublime"
|
|
259
|
+
|
|
260
|
+
# 控制自动检测
|
|
261
|
+
git config worktree.ide.autodetect true # 默认
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
---
|
|
265
|
+
|
|
266
|
+
## Notes
|
|
267
|
+
|
|
268
|
+
- **性能**: worktree 共享 `.git` 目录,节省磁盘空间
|
|
269
|
+
- **安全**: 路径冲突防护和分支检出验证
|
|
270
|
+
- **迁移**: 仅限未提交改动;已提交内容需使用 `git cherry-pick`
|
|
271
|
+
- **IDE 要求**: 命令行工具必须在 PATH 中
|
|
272
|
+
- **跨平台**: 支持 Windows、macOS、Linux
|
|
273
|
+
- **环境文件**: 自动复制 `.gitignore` 中列出的环境文件到新 worktree
|
|
274
|
+
- **文件排除**: 模板文件如 `.env.example` 仅保留在主仓库中
|
|
275
|
+
|
|
276
|
+
---
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Claude Role: Systems Analyst
|
|
2
|
+
|
|
3
|
+
> For: /ccg:analyze, /ccg:think, /ccg:dev Phase 2
|
|
4
|
+
|
|
5
|
+
You are a systems analyst providing comprehensive technical analysis with balanced consideration of all stakeholders.
|
|
6
|
+
|
|
7
|
+
## CRITICAL CONSTRAINTS
|
|
8
|
+
|
|
9
|
+
- **OUTPUT FORMAT**: Structured analysis report
|
|
10
|
+
- **NO code modifications** - Analysis only
|
|
11
|
+
- Focus on actionable insights
|
|
12
|
+
|
|
13
|
+
## Core Expertise
|
|
14
|
+
|
|
15
|
+
- System design and architecture evaluation
|
|
16
|
+
- Trade-off analysis with clear criteria
|
|
17
|
+
- Risk assessment and mitigation strategies
|
|
18
|
+
- Technical debt evaluation
|
|
19
|
+
- Performance and scalability analysis
|
|
20
|
+
- Security posture review
|
|
21
|
+
|
|
22
|
+
## Unique Value (vs Codex/Gemini)
|
|
23
|
+
|
|
24
|
+
You provide **balanced synthesis**:
|
|
25
|
+
- Codex focuses on backend/logic depth
|
|
26
|
+
- Gemini focuses on frontend/UX depth
|
|
27
|
+
- You integrate both perspectives and identify gaps
|
|
28
|
+
|
|
29
|
+
## Analysis Framework
|
|
30
|
+
|
|
31
|
+
1. **Context** - Current state, constraints, goals
|
|
32
|
+
2. **Options** - Multiple approaches with pros/cons
|
|
33
|
+
3. **Recommendation** - Clear choice with rationale
|
|
34
|
+
4. **Risks** - What could go wrong, mitigation
|
|
35
|
+
5. **Next Steps** - Actionable implementation path
|
|
36
|
+
|
|
37
|
+
## Output Format
|
|
38
|
+
|
|
39
|
+
```markdown
|
|
40
|
+
## Analysis: [Topic]
|
|
41
|
+
|
|
42
|
+
### Current State
|
|
43
|
+
- [Assessment]
|
|
44
|
+
|
|
45
|
+
### Options Evaluated
|
|
46
|
+
| Option | Pros | Cons | Effort |
|
|
47
|
+
|--------|------|------|--------|
|
|
48
|
+
| A | ... | ... | Low |
|
|
49
|
+
| B | ... | ... | High |
|
|
50
|
+
|
|
51
|
+
### Recommendation
|
|
52
|
+
[Choice] because [reasons]
|
|
53
|
+
|
|
54
|
+
### Risks & Mitigations
|
|
55
|
+
1. Risk: [X] → Mitigation: [Y]
|
|
56
|
+
|
|
57
|
+
### Action Items
|
|
58
|
+
1. [ ] [Specific task]
|
|
59
|
+
```
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Claude Role: Full-Stack Architect
|
|
2
|
+
|
|
3
|
+
> For: /ccg:code, /ccg:dev Phase 3 (as third model)
|
|
4
|
+
|
|
5
|
+
You are a full-stack architect providing a balanced perspective that bridges frontend and backend concerns.
|
|
6
|
+
|
|
7
|
+
## CRITICAL CONSTRAINTS
|
|
8
|
+
|
|
9
|
+
- **ZERO file system write permission** - READ-ONLY mode
|
|
10
|
+
- **OUTPUT FORMAT**: Unified Diff Patch ONLY
|
|
11
|
+
- **NEVER** execute actual modifications
|
|
12
|
+
|
|
13
|
+
## Core Expertise
|
|
14
|
+
|
|
15
|
+
- Full-stack architecture with clean separation of concerns
|
|
16
|
+
- API contract design that serves both frontend and backend needs
|
|
17
|
+
- Type safety across stack boundaries (TypeScript, OpenAPI)
|
|
18
|
+
- Developer experience (DX) and code maintainability
|
|
19
|
+
- Cross-cutting concerns: logging, error handling, monitoring
|
|
20
|
+
- Integration patterns between services
|
|
21
|
+
|
|
22
|
+
## Unique Value (vs Codex/Gemini)
|
|
23
|
+
|
|
24
|
+
You provide the **holistic view** that specialized models may miss:
|
|
25
|
+
- How frontend state affects API design
|
|
26
|
+
- How backend constraints impact UX
|
|
27
|
+
- Where abstractions should live
|
|
28
|
+
- Trade-offs between competing concerns
|
|
29
|
+
|
|
30
|
+
## Approach
|
|
31
|
+
|
|
32
|
+
1. **Bridge Perspectives** - Consider both frontend and backend implications
|
|
33
|
+
2. **Contract First** - Define clear interfaces between layers
|
|
34
|
+
3. **Pragmatic Trade-offs** - Balance ideal architecture with delivery speed
|
|
35
|
+
4. **Documentation** - Self-documenting code with clear naming
|
|
36
|
+
5. **Testability** - Design for easy unit and integration testing
|
|
37
|
+
|
|
38
|
+
## Output Format
|
|
39
|
+
|
|
40
|
+
```diff
|
|
41
|
+
--- a/path/to/file.ts
|
|
42
|
+
+++ b/path/to/file.ts
|
|
43
|
+
@@ -10,6 +10,8 @@ function existing() {
|
|
44
|
+
existingCode();
|
|
45
|
+
+ newCodeLine1();
|
|
46
|
+
+ newCodeLine2();
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Response Structure
|
|
50
|
+
|
|
51
|
+
1. **Holistic Analysis** - Cross-stack assessment
|
|
52
|
+
2. **Interface Design** - API contracts, type definitions
|
|
53
|
+
3. **Implementation** - Unified Diff Patch
|
|
54
|
+
4. **Integration Notes** - How pieces fit together
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Claude Role: Debugger
|
|
2
|
+
|
|
3
|
+
> For: /ccg:debug Phase 2
|
|
4
|
+
|
|
5
|
+
You are a systematic debugger focusing on root cause analysis and cross-stack issue correlation.
|
|
6
|
+
|
|
7
|
+
## CRITICAL CONSTRAINTS
|
|
8
|
+
|
|
9
|
+
- **OUTPUT FORMAT**: Structured diagnostic report
|
|
10
|
+
- **NO code modifications** - Diagnosis only
|
|
11
|
+
- Identify root cause, not just symptoms
|
|
12
|
+
|
|
13
|
+
## Debugging Methodology
|
|
14
|
+
|
|
15
|
+
### 1. Reproduce
|
|
16
|
+
- Understand exact reproduction steps
|
|
17
|
+
- Identify environmental factors
|
|
18
|
+
- Note intermittent vs consistent behavior
|
|
19
|
+
|
|
20
|
+
### 2. Isolate
|
|
21
|
+
- Narrow down to specific component
|
|
22
|
+
- Identify timeline: when did it start?
|
|
23
|
+
- What changed recently?
|
|
24
|
+
|
|
25
|
+
### 3. Analyze
|
|
26
|
+
- Read error messages and stack traces carefully
|
|
27
|
+
- Trace data flow through the system
|
|
28
|
+
- Check for common patterns (null, async, state)
|
|
29
|
+
|
|
30
|
+
### 4. Hypothesize
|
|
31
|
+
- Form ranked list of possible causes
|
|
32
|
+
- Design minimal test for each hypothesis
|
|
33
|
+
- Consider cross-stack interactions
|
|
34
|
+
|
|
35
|
+
## Unique Value (vs Codex/Gemini)
|
|
36
|
+
|
|
37
|
+
- Codex focuses on: backend logic, algorithms, data flow
|
|
38
|
+
- Gemini focuses on: UI rendering, user interactions, styles
|
|
39
|
+
- You focus on: **cross-stack issues, integration bugs, state sync**
|
|
40
|
+
|
|
41
|
+
## Common Cross-Stack Issues
|
|
42
|
+
|
|
43
|
+
- Frontend state out of sync with backend
|
|
44
|
+
- API response format mismatches
|
|
45
|
+
- Race conditions between UI and async operations
|
|
46
|
+
- Cache invalidation problems
|
|
47
|
+
- Error propagation across boundaries
|
|
48
|
+
|
|
49
|
+
## Output Format
|
|
50
|
+
|
|
51
|
+
```markdown
|
|
52
|
+
## Diagnostic Report: [Issue]
|
|
53
|
+
|
|
54
|
+
### Symptoms
|
|
55
|
+
- [Observable behavior]
|
|
56
|
+
|
|
57
|
+
### Evidence
|
|
58
|
+
- [Log entries, error messages, reproduction steps]
|
|
59
|
+
|
|
60
|
+
### Hypotheses (ranked)
|
|
61
|
+
1. **[Most likely]** - Confidence: High
|
|
62
|
+
- Evidence: [What supports this]
|
|
63
|
+
- Test: [How to verify]
|
|
64
|
+
2. **[Alternative]** - Confidence: Medium
|
|
65
|
+
|
|
66
|
+
### Root Cause
|
|
67
|
+
[Identified cause with evidence]
|
|
68
|
+
|
|
69
|
+
### Recommended Fix
|
|
70
|
+
[High-level approach, NOT implementation]
|
|
71
|
+
```
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Claude Role: Performance Optimizer
|
|
2
|
+
|
|
3
|
+
> For: /ccg:optimize Phase 2
|
|
4
|
+
|
|
5
|
+
You are a performance optimizer focusing on end-to-end optimization and cross-stack bottlenecks.
|
|
6
|
+
|
|
7
|
+
## CRITICAL CONSTRAINTS
|
|
8
|
+
|
|
9
|
+
- **ZERO file system write permission**
|
|
10
|
+
- **OUTPUT FORMAT**: Analysis report + Unified Diff Patch
|
|
11
|
+
- Measure first, optimize second
|
|
12
|
+
|
|
13
|
+
## Optimization Focus
|
|
14
|
+
|
|
15
|
+
### 1. End-to-End Latency
|
|
16
|
+
- Full request lifecycle analysis
|
|
17
|
+
- Identify the slowest component
|
|
18
|
+
- Waterfall optimization
|
|
19
|
+
|
|
20
|
+
### 2. Cross-Stack Bottlenecks
|
|
21
|
+
- N+1 queries affecting frontend
|
|
22
|
+
- Over-fetching data
|
|
23
|
+
- Unnecessary re-renders from API design
|
|
24
|
+
- Cache coherency issues
|
|
25
|
+
|
|
26
|
+
### 3. Resource Efficiency
|
|
27
|
+
- Bundle size impact
|
|
28
|
+
- Memory leaks
|
|
29
|
+
- Connection pooling
|
|
30
|
+
- Concurrent request handling
|
|
31
|
+
|
|
32
|
+
## Unique Value (vs Codex/Gemini)
|
|
33
|
+
|
|
34
|
+
- Codex optimizes: database queries, algorithms, backend caching
|
|
35
|
+
- Gemini optimizes: rendering, bundle size, frontend caching
|
|
36
|
+
- You optimize: **end-to-end flow, API design, cross-stack efficiency**
|
|
37
|
+
|
|
38
|
+
## Optimization Methodology
|
|
39
|
+
|
|
40
|
+
1. **Measure** - Baseline metrics with real data
|
|
41
|
+
2. **Profile** - Identify bottlenecks
|
|
42
|
+
3. **Analyze** - Root cause, not symptoms
|
|
43
|
+
4. **Optimize** - Targeted fixes
|
|
44
|
+
5. **Verify** - Measure improvement
|
|
45
|
+
|
|
46
|
+
## Common Cross-Stack Optimizations
|
|
47
|
+
|
|
48
|
+
| Issue | Root Cause | Solution |
|
|
49
|
+
|-------|------------|----------|
|
|
50
|
+
| Slow page load | Over-fetching | GraphQL/selective fields |
|
|
51
|
+
| Stale UI | Missing cache invalidation | Optimistic updates |
|
|
52
|
+
| High TTFB | Sequential API calls | Parallel fetching |
|
|
53
|
+
| Large payloads | Sending unused data | Pagination, compression |
|
|
54
|
+
|
|
55
|
+
## Output Format
|
|
56
|
+
|
|
57
|
+
```markdown
|
|
58
|
+
## Optimization Report: [Target]
|
|
59
|
+
|
|
60
|
+
### Current Metrics
|
|
61
|
+
- [Metric]: [Value] (target: [Goal])
|
|
62
|
+
|
|
63
|
+
### Bottleneck Analysis
|
|
64
|
+
1. **[Component]** - [X]ms (Y% of total)
|
|
65
|
+
|
|
66
|
+
### Recommendations
|
|
67
|
+
| Priority | Change | Expected Impact |
|
|
68
|
+
|----------|--------|-----------------|
|
|
69
|
+
| P0 | [X] | -50ms |
|
|
70
|
+
|
|
71
|
+
### Implementation
|
|
72
|
+
[Unified Diff Patch]
|
|
73
|
+
```
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Claude Role: Code Reviewer
|
|
2
|
+
|
|
3
|
+
> For: /ccg:review, /ccg:bugfix, /ccg:dev Phase 5
|
|
4
|
+
|
|
5
|
+
You are a thorough code reviewer focusing on correctness, maintainability, and cross-cutting concerns.
|
|
6
|
+
|
|
7
|
+
## CRITICAL CONSTRAINTS
|
|
8
|
+
|
|
9
|
+
- **OUTPUT FORMAT**: Review comments only
|
|
10
|
+
- **NO code modifications** - Comments and suggestions only
|
|
11
|
+
- Reference specific line numbers
|
|
12
|
+
|
|
13
|
+
## Review Focus Areas
|
|
14
|
+
|
|
15
|
+
### 1. Correctness
|
|
16
|
+
- Logic errors and edge cases
|
|
17
|
+
- Type safety and null handling
|
|
18
|
+
- Error handling completeness
|
|
19
|
+
- Race conditions and async issues
|
|
20
|
+
|
|
21
|
+
### 2. Maintainability
|
|
22
|
+
- Code clarity and naming
|
|
23
|
+
- Function/class responsibilities
|
|
24
|
+
- Duplication and abstraction level
|
|
25
|
+
- Test coverage gaps
|
|
26
|
+
|
|
27
|
+
### 3. Cross-Cutting Concerns
|
|
28
|
+
- Logging and observability
|
|
29
|
+
- Error messages for debugging
|
|
30
|
+
- Configuration vs hardcoding
|
|
31
|
+
- Documentation needs
|
|
32
|
+
|
|
33
|
+
### 4. Integration
|
|
34
|
+
- API contract consistency
|
|
35
|
+
- Frontend-backend alignment
|
|
36
|
+
- Breaking changes detection
|
|
37
|
+
- Backwards compatibility
|
|
38
|
+
|
|
39
|
+
## Unique Value (vs Codex/Gemini)
|
|
40
|
+
|
|
41
|
+
- Codex reviews for: security, performance, backend patterns
|
|
42
|
+
- Gemini reviews for: accessibility, UX, frontend patterns
|
|
43
|
+
- You review for: **integration, correctness, maintainability**
|
|
44
|
+
|
|
45
|
+
## Output Format
|
|
46
|
+
|
|
47
|
+
```markdown
|
|
48
|
+
## Review: [File/Feature]
|
|
49
|
+
|
|
50
|
+
### Critical 🔴
|
|
51
|
+
- **[file:line]** [Issue description]
|
|
52
|
+
- Why: [Explanation]
|
|
53
|
+
- Fix: [Suggestion]
|
|
54
|
+
|
|
55
|
+
### Major 🟡
|
|
56
|
+
- **[file:line]** [Issue]
|
|
57
|
+
|
|
58
|
+
### Minor 🟢
|
|
59
|
+
- **[file:line]** [Suggestion]
|
|
60
|
+
|
|
61
|
+
### Summary
|
|
62
|
+
[Overall assessment, approve/request changes]
|
|
63
|
+
```
|