How this skill is triggered — by the user, by Claude, or both
Slash command
/compound-engineering:ce-brainstorm [功能描述] [P=3视角快速验证] [P+=全量12-14视角发散] [C=Codex] [G=Gemini] [R=历史检索][功能描述] [P=3视角快速验证] [P+=全量12-14视角发散] [C=Codex] [G=Gemini] [R=历史检索]The summary Claude sees in its skill listing — used to decide when to auto-load this skill
**Note: The current year is 2026.** Use this when dating requirements documents.
Note: The current year is 2026. Use this when dating requirements documents.
Brainstorming helps answer WHAT to build through collaborative dialogue. It precedes /ce:plan, which answers HOW to build it.
The durable output of this workflow is a requirements document. In other workflows this might be called a lightweight PRD or feature brief. In compound engineering, keep the workflow name brainstorm, but make the written artifact strong enough that planning does not need to invent product behavior, scope boundaries, or success criteria.
This skill does not implement code. It explores, clarifies, and documents decisions for later planning or execution.
IMPORTANT: All file references in generated documents must use repo-relative paths (e.g., src/models/user.rb), never absolute paths. Absolute paths break portability across machines, worktrees, and teammates.
AskUserQuestion in Claude Code, request_user_input in Codex, ask_user in Gemini). Otherwise, present numbered options in chat and wait for the user's reply before proceeding.src/models/user.rb), never absolute paths. Absolute paths make documents non-portable across machines and teammates.<feature_description> #$ARGUMENTS </feature_description>
If the feature description above is empty, ask the user: "What would you like to explore? Please describe the feature, problem, or improvement you're thinking about."
Do not proceed until you have a feature description from the user.
Parse $ARGUMENTS for the following optional tokens before entering the Execution Flow. Strip each recognized token from the arguments before using the remainder as the feature description.
| Token | Effect |
|---|---|
[P] | PARTY_MODE_ENABLED = true; PARTY_MODE_LEVEL = core. 显式调用 party-mode,使用 3 个核心视角(用户代言人 + 技术专家 + 魔鬼代言人)碰撞讨论,结束后自动收敛。 |
[P+] | PARTY_MODE_ENABLED = true; PARTY_MODE_LEVEL = full. 显式调用 party-mode,使用 12-14 个视角全量发散讨论,结束后自动收敛。 |
[C] | CODEX_ENABLED = true. Phase 2 结束后自动调用 Codex CLI 咨询,结果整合到 brainstorm 文档。 |
[G] | GEMINI_ENABLED = true. Phase 2 结束后自动调用 Gemini CLI 咨询,结果整合到 brainstorm 文档。 |
[R] | Run learnings-researcher before Phase 1. Inject results as historical reference in Phase 2. |
Execution contract: [P] and [P+] are hard workflow switches, not descriptive hints. When either token is present, strip it from the feature description, set the flags above, and invoke party-mode before normal Phase 1 dialogue. Describing Party Mode is insufficient; the workflow must explicitly execute it.
If the user references an existing brainstorm topic or document, or there is an obvious recent matching *-requirements.md file in docs/brainstorms/:
Before proceeding to Phase 0.2, classify whether this is a software task. The key question is: does the task involve building, modifying, or architecting software? -- not whether the task mentions software topics.
Software (continue to Phase 0.2) -- the task references code, repositories, APIs, databases, or asks to build/modify/debug/deploy software.
Non-software brainstorming (route to universal brainstorming) -- BOTH conditions must be true:
Neither (respond directly, skip all brainstorming phases) -- the input is a quick-help request, error message, factual question, or single-step task that doesn't need a brainstorm.
If non-software brainstorming is detected: Read references/universal-brainstorming.md and use those facilitation principles to brainstorm with the user naturally. Do not follow the software brainstorming phases below.
Clear requirements indicators:
If requirements are already clear: Keep the interaction brief. Confirm understanding and present concise next-step options rather than forcing a long brainstorm. Only write a short requirements document when a durable handoff to planning or later review would be valuable. Skip Phase 1.1 and 1.2 entirely — go straight to Phase 1.3 or Phase 3.
Use the feature description plus a light repo scan to classify the work:
If the scope is unclear, ask one targeted question to disambiguate and then proceed.
[R] 标志存在时)触发条件: $ARGUMENTS 包含 [R]。
跳过条件(不触发 learnings-researcher):
跳过时宣告:「⚠️ [R] 跳过:当前属于非软件探索/已有清晰需求场景,learnings-researcher 检索跳过」
从 feature description 提取关键词,运行 compound-engineering:research:learnings-researcher 检索 docs/solutions/ 历史方案:
Task compound-engineering:research:learnings-researcher(feature_description)
去重规则(当前 skill 内有效,跨 skill 不生效):
同一 session 内相同关键词(lowercase + trim + token sort)不重复搜索,维护 [session_searched_topics] 集合。
子代理派发时各子代理 in-memory 状态独立,跨子代理去重不生效(同一搜索词可能被多个子代理重复触发)。
跨 skill 去重不生效(如本 session 已在 ce:work [R] 中检索过相同关键词,ce:brainstorm [R] 仍会重新检索)。
结果处置:
No relevant learnings found — 本次为全新探索[P] 或 [P+] 标志存在时)触发时机:Phase 0.4 之后、Phase 1 之前。不使用 [P]/[P+] 时跳过,直接进入 Phase 1。
Step 0.5.1: 显式启动 Party Mode
If PARTY_MODE_ENABLED = true, invoke the party-mode skill before continuing. This is a hard execution requirement:
Execute: Skill("party-mode")
When invoking party-mode, pass the feature description and level guidance:
[P] / PARTY_MODE_LEVEL = core: use 3 core perspectives — user advocate, technical expert, devil's advocate. Keep the cast compact, but preserve emoji + persona names and natural cross-challenge.[P+] / PARTY_MODE_LEVEL = full: use 12-14 perspectives for high-ambiguity or high-risk decisions. Invite a broader cast across architecture, security, performance, QA, product, UX, minimalism, reverse thinking, infrastructure, and risk.Party Mode must produce dialog, not a parallel bullet list: at least one persona must explicitly agree, disagree, question, or build on a previous persona's point. Party Mode must also surface reuse opportunities and glue-code boundaries when the topic involves software.
Step 0.5.2: Party Mode Result Contract
Before returning control to ce-brainstorm, carry forward the Party Mode exit summary as working context:
Step 0.5.3: Post-Party Structured Convergence
After Party Mode ends, run a short two-role convergence pass before Phase 1.
视角数量由标志决定:
[P]:3 个核心视角(用户代言人 + 技术专家 + 魔鬼代言人)先完成 Party Mode,再进入探索者/挑战者收敛。[P+]:12-14 个视角先完成 Party Mode,再进入探索者/挑战者收敛。执行方式:以 2 个对立视角顺序输出(同一 agent 切换视角),不创建独立 teammate:
退出条件(满足任一即结束,继续 Phase 1):
[E]AskUserQuestion 展示核心分歧,让用户裁决方向(「1 轮」= 探索者 + 挑战者各回应一次)输出格式:
[探索者] <2-4 句:当前最有希望方向 + 验证路径>
[挑战者] <2-4 句:假设质疑 + 关键风险>
Scan the repo before substantive brainstorming. Match depth to scope:
Lightweight — Search for the topic, check if something similar already exists, and move on.
Standard and Deep — Two passes:
Constraint Check — Check project instruction files (AGENTS.md, and CLAUDE.md only if retained as compatibility context) for workflow, product, or scope constraints that affect the brainstorm. If these add nothing, move on.
Topic Scan — Search for relevant terms. Read the most relevant existing artifact if one exists (brainstorm, plan, spec, skill, feature doc). Skim adjacent examples covering similar behavior.
If nothing obvious appears after a short scan, say so and continue. Two rules govern technical depth during the scan:
Verify before claiming — When the brainstorm touches checkable infrastructure (database tables, routes, config files, dependencies, model definitions), read the relevant source files to confirm what actually exists. Any claim that something is absent — a missing table, an endpoint that doesn't exist, a dependency not in the Gemfile, a config option with no current support — must be verified against the codebase first; if not verified, label it as an unverified assumption. This applies to every brainstorm regardless of topic.
Defer design decisions to planning — Implementation details like schemas, migration strategies, endpoint structure, or deployment topology belong in planning, not here — unless the brainstorm is itself about a technical or architectural decision, in which case those details are the subject of the brainstorm and should be explored.
Slack context (opt-in, Standard and Deep only) — never auto-dispatch. Route by condition:
compound-engineering:research:slack-researcher with a brief summary of the brainstorm topic alongside Phase 1.1 work. Incorporate findings into constraint and context awareness.Before generating approaches, challenge the request to catch misframing. Match depth to scope:
Lightweight:
Standard:
Deep — Standard questions plus:
Follow the Interaction Rules above. Use the platform's blocking question tool when available.
Guidelines:
Exit condition: Continue until the idea is clear OR the user explicitly wants to proceed.
If multiple plausible directions remain, propose 2-3 concrete approaches based on research and conversation. Otherwise state the recommended direction directly.
Use at least one non-obvious angle — inversion (what if we did the opposite?), constraint removal (what if X weren't a limitation?), or analogy from how another domain solves this. The first approaches that come to mind are usually variations on the same axis.
Present approaches first, then evaluate. Let the user see all options before hearing which one is recommended — leading with a recommendation before the user has seen alternatives anchors the conversation prematurely.
When useful, include one deliberately higher-upside alternative:
For each approach, provide:
After presenting all approaches, state your recommendation and explain why. Prefer simpler solutions when added complexity creates real carrying cost, but do not reject low-cost, high-value polish just because it is not strictly necessary.
If one approach is clearly best and alternatives are not meaningful, skip the menu and state the recommendation directly.
If relevant, call out whether the choice is:
检查 Parameter Handling 阶段解析的 CODEX_ENABLED 和 GEMINI_ENABLED 标志。
如果两者都为 false,跳过此步骤,直接进入 Phase 3。
Step 2.5.1: 检查 Codex CLI 可用性
command -v codex || echo "Codex CLI 未安装,请运行: npm install -g @openai/codex"
如果未安装,提示用户安装并跳过 Codex 咨询(主流程不中断)。
Step 2.5.2: 构建方案咨询 Prompt 并调用
构建结构化 prompt(从当前对话上下文中提取):
## 项目背景
[技术栈、框架]
## 本轮头脑风暴的需求
[feature_description]
## Claude 提出的方案
[Phase 2 中提出的 2-3 个方案,包含各方案的描述、优缺点]
## 用户倾向的方向(如有)
[用户在 Phase 2 中选择的偏好]
## 请特别评估
1. 这些方案中是否有最优解?如果都不是,更好的方案是什么?
2. 有没有我们忽略的替代方案或开源库/框架?
3. 性价比方面:是否存在更简洁、更高效的实现路径?
4. 有没有潜在的坑或长期维护风险?
执行流程:
Step 1: 前台调用 Codex(不用 run_in_background)
- 使用 Bash 工具,设置 timeout=300000(5 分钟)
- 调用:
CODEX_OUTPUT="${TEMP:-/tmp}/codex-brainstorm-$(date +%s).md"
cat <<'PROMPT_EOF' | codex exec --output-last-message "$CODEX_OUTPUT" -
<构建好的prompt>
PROMPT_EOF
echo "---CODEX_EXIT: $?---"
cat "$CODEX_OUTPUT" 2>/dev/null
Step 2: 检查结果
- 如果退出码非 0 或输出为空:
→ 记录失败,继续主流程(不中断)
→ 在 brainstorm 文档中注明 Codex 咨询失败
- 如果成功:
→ 整合到后续 brainstorm 文档中
注意:使用前台调用而非后台,因为后台模式在 Windows 上的 heredoc + stdin 管道更易出问题。
不指定 -m 参数,使用 Codex 默认模型(见项目 CLAUDE.md Codex 模型策略)。
如果调用失败:
npm install -g @openai/codexcodex login 重新认证/ce:doctor 进行完整健康检查Step 2.5.4: 检查 Gemini CLI 可用性
command -v gemini || echo "Gemini CLI 未安装,请运行: npm install -g @google/gemini-cli"
如果未安装,提示用户安装并跳过 Gemini 咨询(主流程不中断)。
Step 2.5.5: 构建方案咨询 Prompt 并调用
使用与 Codex 相同的 prompt 结构,通过 Gemini CLI 调用:
Step 1: 后台启动 Gemini
- 使用 Bash 工具,设置 run_in_background=true
- 调用:
cat <<'PROMPT_EOF' | gemini -m gemini-3-pro-preview -p '' -o json
<构建好的prompt>
PROMPT_EOF
- 记录返回的 task_id
Step 2: 等待完成(最多 5 分钟)
Step 3: 读取结果,解析并整合
在 Phase 3 的 brainstorm 文档中生成三方对比:
## 外部咨询综合
| 评估维度 | Claude | Codex | Gemini | 共识度 |
|----------|--------|-------|--------|--------|
| 推荐方案 | [X] | [Y] | [Z] | 一致/分歧 |
| 替代建议 | ... | ... | ... | ... |
| 风险提示 | ... | ... | ... | ... |
**综合建议**:
1. 多方一致的观点(可信度最高)
2. 双方一致的建议(次优先)
3. 单方独特见解(供参考)
如果 Codex 或 Gemini 在 5 分钟内未完成:
## ⏱️ [Codex/Gemini] 咨询超时
咨询未在 5 分钟内完成。可手动运行:
- Codex:`/codex [你的问题]`
- Gemini:`/gemini [你的问题]`
brainstorm 主流程结果仍然有效。
将 Phase 2.5 的外部咨询结果写入 brainstorm 文档的「外部 AI 咨询结果」小节(使用上方三方对比表格格式)。
Write or update a requirements document only when the conversation produced durable decisions worth preserving. Read references/requirements-capture.md for the document template, formatting rules, visual aid guidance, and completeness checks.
For Lightweight brainstorms, keep the document compact. Skip document creation when the user only needs brief alignment and no durable decisions need to be preserved.
When a requirements document was created or updated, run the document-review skill on it before presenting handoff options. Pass the document path as the argument.
If document-review returns findings that were auto-applied, note them briefly when presenting handoff options. If residual P0/P1 findings were surfaced, mention them so the user can decide whether to address them before proceeding.
When document-review returns "Review complete", proceed to Phase 4.
Present next-step options and execute the user's selection. Read references/handoff.md for the option logic, dispatch instructions, and closing summary format.
npx claudepluginhub jerrylalala/compound-engineering --plugin compound-engineeringSets up isolated workspaces using native worktree tools or git worktree fallback. Use before starting feature work to protect the current branch.