workflow

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Workflow Setup

工作流安装

Installs the development workflow layer. Requires an existing
.claude/
directory — run the greenfield or brownfield skill first.

安装开发工作流层。需要已存在的
.claude/
目录 ——请先运行greenfield或brownfield技能。

Step 1 — Preflight

步骤1 — 预检

Check that prerequisites exist:
bash
ls .claude/ 2>/dev/null || echo "MISSING"
ls .claude/hooks/stop-quality-gate.sh 2>/dev/null && echo "GATE_EXISTS" || echo "GATE_MISSING"
cat .claude/settings.json 2>/dev/null | grep -q "AGENT_TEAMS" && echo "TEAMS_ENABLED" || echo "TEAMS_DISABLED"
If
.claude/
is missing, stop:
"No .claude/ directory found. Run the greenfield or brownfield skill first, then re-run /workflow."
If
.claude/commands/
or
.claude/agents/
already have files, warn:
"Existing commands/agents will be overwritten. Continue? (yes/no)"

检查是否存在必要条件:
bash
ls .claude/ 2>/dev/null || echo "MISSING"
ls .claude/hooks/stop-quality-gate.sh 2>/dev/null && echo "GATE_EXISTS" || echo "GATE_MISSING"
cat .claude/settings.json 2>/dev/null | grep -q "AGENT_TEAMS" && echo "TEAMS_ENABLED" || echo "TEAMS_DISABLED"
如果缺少
.claude/
目录,请停止:
"未找到.claude/目录。请先运行greenfield或brownfield技能, 然后重新运行/workflow。"
如果
.claude/commands/
.claude/agents/
已存在文件,请发出警告:
"现有commands/agents将被覆盖。是否继续?(是/否)"

Step 2 — Check for Previous Configuration

步骤2 — 检查先前配置

Before starting the interview, check if this skill has been run before:
bash
SKILL_NAME="workflow" \
bash "${CLAUDE_SKILL_DIR}/scripts/load-config.sh"
If the output is a non-empty JSON object (not
{}
), previous answers exist. Present them:
Previous workflow configuration found:

  Orchestration: [ORCHESTRATION]
  Commands:      [COMMANDS]
  Gitleaks:      [GITLEAKS]
  Semgrep:       [SEMGREP]

Would you like to:
  a) Update — reinstall all commands and agents using these settings
  b) Reconfigure — start the interview from scratch
Use
AskUserQuestion
and wait for the response.
  • If Update: load all saved values into environment variables and skip to Step 3.
  • If Reconfigure: proceed to the full interview below.
If no previous config exists, proceed directly to the interview.

开始交互前,检查此技能是否已运行过:
bash
SKILL_NAME="workflow" \
bash "${CLAUDE_SKILL_DIR}/scripts/load-config.sh"
如果输出为非空JSON对象(不是
{}
),说明存在先前的配置答案。展示这些内容:
找到先前的工作流配置:

  编排模式: [ORCHESTRATION]
  命令:      [COMMANDS]
  Gitleaks:      [GITLEAKS]
  Semgrep:       [SEMGREP]

您希望:
  a) 更新 — 使用这些设置重新安装所有命令和Agent
  b) 重新配置 — 从头开始进行交互配置
使用
AskUserQuestion
并等待响应。
  • 如果选择更新:将所有保存的值加载到环境变量中,并跳至步骤3
  • 如果选择重新配置:继续进行以下完整的交互配置。
如果没有先前的配置,则直接进入交互配置环节。

Step 2b — Interview

步骤2b — 交互配置

Ask each question using
AskUserQuestion
and wait for the response before proceeding to the next question.
使用
AskUserQuestion
逐个提问,等待每个问题的响应后再进行下一个问题。

Question 1 — Orchestration Mode

问题1 — 编排模式

Use
AskUserQuestion
with this prompt:
Setting up your development workflow.

Orchestration mode — How should /breakdown, /spec, and /work orchestrate agents?

  a) Subagents — parallel (recommended) — parallel workers in isolated git
     worktrees, merged by the git-expert agent. Stable, works everywhere.

  b) Subagents — PEE loop — sequential Planner → Executor → Evaluator loop
     per spec on a shared branch, with one full quality pass at the end.
     One-shot subagents (no team infrastructure). Optimized for spec-compliance
     correctness, not raw speed. Uses opus for planner/evaluator and sonnet
     for the executor.

  c) Agent teams (experimental) — teammates work on parallel domains of the
     codebase on a shared branch. Requires CC v2.1.32+ and
     CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS enabled.
Map the answer to the internal
ORCHESTRATION
value: a →
subagents
, b →
loop
, c →
teams
.
使用
AskUserQuestion
并传入以下提示:
正在设置您的开发工作流。

编排模式 — /breakdown、/spec和/work应如何编排Agent?

  a) 子Agent — 并行(推荐)—— 在独立的git工作树中并行处理,由git-expert Agent合并。稳定,适用于所有场景。

  b) 子Agent — PEE循环 — 在共享分支上按规格依次执行规划器→执行器→评估器循环,
     最后进行一次完整的质量检查。单次调用子Agent(无需团队基础设施)。针对规格合规性优化,
     而非追求速度。规划器/评估器使用opus模型,执行器使用sonnet模型。

  c) Agent团队(实验性)—— 团队成员在共享分支上并行处理代码库的不同领域。需要CC v2.1.32+版本,
     且需启用CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS。
将答案映射为内部
ORCHESTRATION
值:a →
subagents
,b →
loop
,c →
teams

Question 2 — Commands

问题2 — 命令选择

Use
AskUserQuestion
with this prompt:
Which commands would you like installed? (default: all)

  a) /breakdown, /spec, /work  — feature planning and implementation   ✓
  b) /commit                   — conventional commit message generator  ✓
  c) /review                   — code review of current changes         ✓
  d) /pr, /squash-pr, /address-pr-comments — pull request workflow      ✓
  e) /fix-issue                — implement a GitHub issue end-to-end    ✓
  f) /security-scan            — on-demand deep security scan           ✓
  g) /triage                   — GitHub issue analysis (requires gh)    ✓
  h) /update-skills            — find and install skills for your deps  ✓

Enter "all" or list letters to include (e.g. "a, b, d"):

使用
AskUserQuestion
并传入以下提示:
您希望安装哪些命令?(默认:全部)

  a) /breakdown、/spec、/work  — 功能规划与实现   ✓
  b) /commit                   — 规范化提交消息生成器  ✓
  c) /review                   — 当前变更的代码评审         ✓
  d) /pr、/squash-pr、/address-pr-comments — 拉取请求工作流      ✓
  e) /fix-issue                — 端到端实现GitHub问题    ✓
  f) /security-scan            — 按需深度安全扫描           ✓
  g) /triage                   — GitHub问题分析(需要gh)    ✓
  h) /update-skills            — 为项目依赖查找并安装技能  ✓

输入"all"或列出要包含的选项字母(例如"a, b, d"):

Step 2c — Save Configuration

步骤2c — 保存配置

After the interview (or after loading previous config for an update), save the current answers:
bash
SKILL_NAME="workflow" \
CONFIG_JSON='{"ORCHESTRATION":"[val]","COMMANDS":"[val]","GITLEAKS":"[val]","SEMGREP":"[val]"}' \
bash "${CLAUDE_SKILL_DIR}/scripts/save-config.sh"
Replace
[val]
with actual values. This writes to
.claude/skill-config.json
so future runs can reuse these answers.

完成交互配置(或加载先前配置进行更新)后,保存当前答案:
bash
SKILL_NAME="workflow" \
CONFIG_JSON='{"ORCHESTRATION":"[val]","COMMANDS":"[val]","GITLEAKS":"[val]","SEMGREP":"[val]"}' \
bash "${CLAUDE_SKILL_DIR}/scripts/save-config.sh"
[val]
替换为实际值。此操作会将配置写入
.claude/skill-config.json
,以便后续运行时可以复用这些答案。

Step 3 — Detect Quality Tools

步骤3 — 检测质量工具

bash
bash scripts/detect-tools.sh
For any missing tools, list what they do and how to install them. Do NOT offer to install them automatically.
Recommended tools:

  gitleaks — Scans for accidentally committed secrets
    https://github.com/gitleaks/gitleaks#installing
    brew install gitleaks

  semgrep — SAST security scanner (injection, OWASP Top 10)
    https://semgrep.dev/docs/getting-started/
    pip install semgrep  /  brew install semgrep

  gh CLI — Required for /triage, /pr, /squash-pr, /address-pr-comments
    https://cli.github.com/
    brew install gh

The quality gate will skip checks for tools that aren't installed.

bash
bash scripts/detect-tools.sh
对于任何缺失的工具,列出其功能和安装方法。请勿自动安装这些工具。
推荐工具:

  gitleaks — 扫描意外提交的敏感信息
    https://github.com/gitleaks/gitleaks#installing
    brew install gitleaks

  semgrep — SAST安全扫描器(检测注入攻击、OWASP Top 10等)
    https://semgrep.dev/docs/getting-started/
    pip install semgrep  /  brew install semgrep

  gh CLI — /triage、/pr、/squash-pr、/address-pr-comments命令所需
    https://cli.github.com/
    brew install gh

对于未安装的工具,质量门会跳过相应检查。

Step 4 — Install Commands and Agents

步骤4 — 安装命令和Agent

Run in parallel if subagents are available, otherwise sequential:
bash
ORCHESTRATION="[subagents|teams|loop]" \
COMMANDS="[comma-separated approved list]" \
bash scripts/install-commands.sh

ORCHESTRATION="[subagents|teams|loop]" \
bash scripts/install-agents.sh
If gh CLI is available and /triage was approved:
bash
bash scripts/install-triage-skill.sh

如果支持子Agent则并行运行,否则顺序运行:
bash
ORCHESTRATION="[subagents|teams|loop]" \
COMMANDS="[逗号分隔的已批准列表]" \
bash scripts/install-commands.sh

ORCHESTRATION="[subagents|teams|loop]" \
bash scripts/install-agents.sh
如果gh CLI已安装且/triage命令已获批:
bash
bash scripts/install-triage-skill.sh

Step 5 — Verify Quality Gate

步骤5 — 验证质量门

Confirm the installed
.claude/hooks/stop-quality-gate.sh
is the scoped, stack-aware template (gitleaks and semgrep are now built into the hook's shared security block and run only on changed files — no patching needed):
bash
bash scripts/patch-quality-gate.sh
The script is a no-op when the hook is already the scoped template. If it detects an older unscoped hook, it prints instructions to re-run greenfield/brownfield to regenerate.

确认已安装的
.claude/hooks/stop-quality-gate.sh
是支持作用域、感知栈的模板(gitleaks和semgrep现已内置到钩子的共享安全模块中,仅针对变更文件运行——无需补丁):
bash
bash scripts/patch-quality-gate.sh
如果钩子已经是作用域模板,该脚本不会执行任何操作。如果检测到旧版非作用域钩子,它会打印说明,提示重新运行greenfield/brownfield技能以重新生成。

Step 6 — Patch Settings for Agent Teams (if chosen)

步骤6 — 为Agent团队修补设置(若选择该模式)

If orchestration =
teams
only (the PEE loop mode uses one-shot subagents and does not need team infrastructure):
bash
bash scripts/patch-settings-teams.sh
Adds
TaskCompleted
hook to
.claude/settings.json
that runs
format.sh
and
task-summary.sh
. Quality gates are handled by the dedicated Quality Gate agent between groups — no
teammate-quality-gate.sh
is created.
Note to developer after patching:
VS Code may show schema warnings on
TaskCompleted
. This is a known schema lag — agent teams hooks are newer than the schema. The hooks work correctly at runtime. To suppress the warning add this to
.vscode/settings.json
:
{ "json.schemas": [{ "fileMatch": ["**/.claude/settings.json"], "schema": {} }] }

仅当编排模式为
teams
时执行此步骤(PEE循环模式使用单次调用子Agent,不需要团队基础设施):
bash
bash scripts/patch-settings-teams.sh
.claude/settings.json
中添加
TaskCompleted
钩子,该钩子会运行
format.sh
task-summary.sh
。质量检查由专门的Quality Gate Agent在各组之间处理——不会创建
teammate-quality-gate.sh
修补后给开发者的提示:
VS Code可能会对
TaskCompleted
显示架构警告。 这是已知的架构滞后问题——Agent团队钩子比架构更新。钩子在运行时可以正常工作。要抑制警告,请将以下内容添加到
.vscode/settings.json
中:
{ "json.schemas": [{ "fileMatch": ["**/.claude/settings.json"], "schema": {} }] }

Step 7 — Commit

步骤7 — 提交

bash
git add .claude/
git commit -m "chore(claude): install development workflow"

bash
git add .claude/
git commit -m "chore(claude): install development workflow"

Step 8 — Completion

步骤8 — 完成

✅ Workflow Setup Complete

Commands installed:
  /breakdown + /spec + /work  — [subagents parallel | subagents PEE loop | agent teams] orchestration
  /commit                     — conventional commit message generator
  /review                     — code review of current changes
  /pr + /squash-pr            — pull request workflow
  /address-pr-comments        — address GitHub review comments
  /fix-issue                  — implement a GitHub issue end-to-end
  /security-scan              — on-demand deep security scan
  /triage                     — GitHub issue analysis and planning
  /update-skills              — find and install skills for project dependencies

Agents installed:
  architect                                       — plans features and architecture
  [implementer | domain-implementer | planner+executor+evaluator]  — implement specs
  quality                                         — 8-gate quality review
  git-expert                                      — worktrees, merges, verification

Quality tools:
  gitleaks: [✅ active in quality gate | ⚠️ not installed]
  semgrep:  [✅ active in quality gate | ⚠️ not installed]
  gh CLI:   [✅ installed | ⚠️ not installed — /triage, /pr, /squash-pr need this]

Agent teams hooks: [added to settings.json | not needed for this orchestration mode]

⚠️ Restart Claude Code to load the new commands and agents.

Typical workflow once restarted:
  /breakdown my-feature     — decompose into tasks
  /spec my-feature          — generate implementation specs
  /work my-feature --all    — implement with agents
  /squash-pr my-feature     — create PR

✅ 工作流安装完成

已安装的命令:
  /breakdown + /spec + /work  — [子Agent并行 | 子Agent PEE循环 | Agent团队] 编排模式
  /commit                     — 规范化提交消息生成器
  /review                     — 当前变更的代码评审
  /pr + /squash-pr            — 拉取请求工作流
  /address-pr-comments        — 处理GitHub评审意见
  /fix-issue                  — 端到端实现GitHub问题
  /security-scan              — 按需深度安全扫描
  /triage                     — GitHub问题分析与规划
  /update-skills              — 为项目依赖查找并安装技能

已安装的Agent:
  architect                                       — 规划功能与架构
  [implementer | domain-implementer | planner+executor+evaluator]  — 实现规格要求
  quality                                         — 8关卡质量评审
  git-expert                                      — 工作树管理、合并、验证

质量工具状态:
  gitleaks: [✅ 在质量门中激活 | ⚠️ 未安装]
  semgrep:  [✅ 在质量门中激活 | ⚠️ 未安装]
  gh CLI:   [✅ 已安装 | ⚠️ 未安装 — /triage、/pr、/squash-pr命令需要此工具]

Agent团队钩子:[已添加到settings.json | 此编排模式不需要]

⚠️ 请重启Claude Code以加载新的命令和Agent。

重启后的典型工作流:
  /breakdown my-feature     — 拆解任务
  /spec my-feature          — 生成实现规格
  /work my-feature --all    — 通过Agent实现功能
  /squash-pr my-feature     — 创建PR

Reference Files

参考文件

  • Commands:
    references/commands/
  • Agents:
    references/agents/
  • Triage skill:
    references/triage-skill.md
  • 命令:
    references/commands/
  • Agent:
    references/agents/
  • 问题分类技能:
    references/triage-skill.md