一键导入
coderabbit-review
Use when the pipeline needs a local CodeRabbit CLI review of a git diff during Phase 6.5
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when the pipeline needs a local CodeRabbit CLI review of a git diff during Phase 6.5
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when the pipeline needs an independent review of a spec, plan, or implementation via GLM (skipped when no Z.ai key is configured).
Use when setting up Claude Code for a new project — generates CLAUDE.md, real settings.json hooks, memory seeds, project skills, and an optional wiki, all adapted to the detected stack. Triggers: /bootstrap, setup project, initialise, configure claude code, nouveau projet
Use when the user asks to roll back or undo work from a CLoClo pipeline run (/rollback, 'undo pipeline', annule, reviens en arriere).
Use when the user asks to pause, resume, or check CLoClo (cloclo off/on/status).
LLM-maintained persistent project wiki. Use when the user invokes /wiki or asks to ingest a document into the project wiki, query accumulated project knowledge, or health-check it. Claude does the bookkeeping — summaries, cross-references, contradictions, index. Triggers: /wiki, /wiki init, /wiki ingest, /wiki query, /wiki lint, /wiki status
Use when the pipeline needs an independent review of a spec, plan, or implementation via the Codex CLI (falls back to a Claude subagent when Codex is unavailable).
| name | coderabbit-review |
| description | Use when the pipeline needs a local CodeRabbit CLI review of a git diff during Phase 6.5 |
| user-invocable | false |
Local CodeRabbit CLI review of committed changes. Complements Codex and GLM: CodeRabbit catches lint/security/style issues with static-analysis backing, the LLM reviewers catch architectural/spec-compliance issues.
The shared review policy — the 3 auto-integration gates, consensus,
[CONSENSUS] escalation, the Phase 6.5 enable condition, and the reviewer
roster — lives in ../pipeline/references/review-chain.md. This file only
covers the CodeRabbit-CLI-specific mechanics.
The calling skill (typically pipeline Phase 6.5) passes:
| Parameter | Description |
|---|---|
session_dir | Absolute path to session directory |
output_file | Where to write findings (e.g. 07b-coderabbit-review-impl.md) |
base_ref | Git SHA before implementation (Phase 5 base_ref) |
command -v coderabbit >/dev/null || CR_UNAVAILABLE=1
If coderabbit not found → skip review with warning: "CodeRabbit CLI unavailable. Install: curl -fsSL https://cli.coderabbit.ai/install.sh | sh" and return. Skipping never blocks the pipeline (see review-chain.md, Phase 6.5 enable condition).
Auth is managed by the CLI — do NOT check coderabbit auth state. If auth fails at runtime, the coderabbit review command prints a login hint; surface it to the user. The CodeRabbit free tier is rate-limited — a rate-limit or auth failure surfaces on the ERROR path below, not as a clean pass.
Pre-clear any stale output, short-circuit on an empty diff, then run the CLI.
cd "$(git rev-parse --show-toplevel)"
# Pre-clear a stale file so the post-run guard can't accept an old review as success.
rm -f "$output_file"
# Empty-diff pre-check: nothing to review between base_ref and HEAD.
if [ "$(git rev-list --count "$base_ref"..HEAD)" -eq 0 ]; then
echo "# CodeRabbit Review — impl ($(date -u +%Y-%m-%dT%H:%M:%SZ))" > "$output_file"
echo "" >> "$output_file"
echo "Base: $base_ref → HEAD" >> "$output_file"
echo "Type: committed changes" >> "$output_file"
echo "---" >> "$output_file"
echo "" >> "$output_file"
echo "(no changes) — no commits between base_ref and HEAD; review skipped." >> "$output_file"
# log to session.log and return
exit 0
fi
# Write the header FIRST, then append the CLI output.
# base_ref is a SHA from Phase 5; --base takes a branch name, so a SHA needs
# --base-commit. Verify the flag with `coderabbit review --help` on upgrade.
{
echo "# CodeRabbit Review — impl ($(date -u +%Y-%m-%dT%H:%M:%SZ))"
echo ""
echo "Base: $base_ref → HEAD"
echo "Type: committed changes"
echo "---"
echo ""
} > "$output_file"
# --agent findings appended to $output_file; process/progress/rate-limit/auth
# lines (stderr) go to the sibling runtime log, NEVER into the verbatim file.
# < /dev/null: coderabbit's default mode is interactive and can hang on
# inherited stdin / auth prompts. timeout 600 caps a wedged run.
timeout 600 coderabbit review \
--agent \
--type committed \
--base-commit "$base_ref" \
< /dev/null \
>> "$output_file" 2> "${output_file}.runtime.log"
CR_EXIT=$?
"CodeRabbit is reviewing... (typically 30-90 seconds)"if [ $CR_EXIT -eq 0 ] && [ -s "$output_file" ]; then
echo "[coderabbit-review] OK: $output_file"
else
# exit≠0, timeout (124), or empty file → tool produced nothing.
{
echo ""
echo "## ERROR"
echo ""
echo "CodeRabbit review did not complete (exit=$CR_EXIT). Possible causes:"
echo "auth/login required, free-tier rate limit, network, or a wedged run (timeout)."
echo ""
echo "Runtime log tail (see \`${output_file}.runtime.log\` for full):"
echo ""
tail -n 20 "${output_file}.runtime.log" 2>/dev/null | sed 's/^/ /'
} >> "$output_file"
echo "[coderabbit-review] FAIL: exit=$CR_EXIT — treated as SKIPPED, not a clean pass." >&2
fi
Guard semantics (do not conflate these three states):
exit==0 && [ -s "$output_file" ] → the run succeeded. If the CLI reported no
issues, that is a genuine clean pass — log (0 findings).exit==0 but the file is empty (only the header, so [ -s ] on the appended
body fails / tool wrote nothing) → the tool produced nothing. Treat as
skipped, NOT a clean pass.exit≠0 (including timeout 124) → failure; append the ## ERROR section and
treat as skipped. Name the rate-limit mode explicitly in the error text.CodeRabbit --agent mode emits structured findings: one block per issue with
file path, line range, severity, rule, and suggested fix. The calling skill
reads the file verbatim — no summarization. Only the findings file is verbatim;
stderr lives in ${output_file}.runtime.log and is never read as findings.
The output file is assembled in two steps (see §3): the header is written first, then the raw CLI output is appended. The final file looks like:
# CodeRabbit Review — impl (2026-07-02T10:00:00Z)
Base: <base_ref SHA> → HEAD
Type: committed changes
---
{raw coderabbit --agent output, or "(no changes)", or a ## ERROR section}
The header is a 4-line block (title, blank, Base:, Type:) followed by the
--- rule — not "3 lines". impl is the fixed review type for this skill (the
only caller is Phase 6.5); it is not a received parameter.
CodeRabbit's native levels map to the pipeline's P-scale (canonical map in
../pipeline/references/review-chain.md):
| CodeRabbit | Pipeline | Handling |
|---|---|---|
high | P0 | auto-integration candidate (3 gates) |
medium | P1 | auto-integration candidate (3 gates) |
low | P2 | auto-integration candidate (3 gates) |
nit | P2 (advisory) | never auto-applied — logged only |
The scale stops at P2 — there is no lower tier. nit maps to P2 as advisory:
surfaced and logged, but never auto-applied. The calling skill feeds these into
the 3-gate auto-integration model from review-chain.md.
This skill does not decide fixes — it only writes findings. The pipeline
applies them under the shared model in
../pipeline/references/review-chain.md:
file:line as an independent reviewer
(Codex or GLM) forms consensus → mark [CONSENSUS], escalate severity to
the highest, apply even if judgment-only.high, conflicting patches,
auth/payments/data-migration domain, etc.) are the shared list in
review-chain.md — escalate in the terminal, never on GitHub.There are no interactive review gates in this skill — the pipeline auto-integrates via review-chain.md.
--agent output, verbatim, in $output_file.${output_file}.runtime.log only.session.log: [timestamp] CodeRabbit review {complete|skipped|failed}: {output_file} ({N findings, severity breakdown} | (0 findings) | (no changes))[TOOL] (static analysis + AI) — highest evidence weight.