PR 审查教练
pr-review-coach
仅支持日语的 PR 理解教练。当用户想要准备自己的审查、理解分支差异、梳理要提出的问题,或在执行合并门禁前建立审查判断力时使用。首轮需显式提供 --base <ref-or-commit>,后续回答轮次从本地状态恢复。每次最多提出一个问题,并将可恢复的本地状态存储在目标工作树之外。仅限单智能体;不派生专项审查员,不产生 Critical/Important/Suggestions 门禁发现项,也不决定是否可以合并。
- License 许可
- MIT
- 所属仓库
- toku345/dotfiles
- 最近更新
- 2026-11-14
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- pr-review-coach
- description
- Japanese-only PR understanding coach. Use when the user wants to prepare their own review, understand a branch diff, identify questions to ask, or build review judgment before running a merge gate. Requires an explicit --base <ref-or-commit> for the first turn, then resumes from local state on answer turns. Asks at most one question at a time and stores resumable local state outside the target worktree. Single-agent only; does not spawn specialist reviewers, does not produce Critical/Important/Suggestions gate findings, and does not decide merge readiness.
02 资源文件 1
- 脚本scripts/cleanup-state.sh6.1 KB
03 SKILL.md 正文
pr-review-coach
Goal
Help the user understand the committed branch diff before a gate review. Run a one-question-at-a-time coaching loop with a local state file, so the conversation can resume without turning into a fix queue.
This skill is intentionally separate from $pr-review:
$pr-review-coachbuilds the user's review judgment.$pr-reviewis the merge gate / audit workflow.
Hard Boundaries
- Respond in Japanese.
- Require an explicit
--base <ref-or-commit>on the first turn. If--baseis missing, continue only when exactly one state file for the current repo and HEAD can be resolved. - Treat
<base>as an already available local ref or commit. Do not rungit fetch,gh, or network commands. - Review only committed changes in
<base>...HEAD. - Do not edit project files, apply patches, run formatters, or dirty tracked files.
- The only permitted writes are under
STATE_ROOT: creating/updating the current coach state file and pruning stale coach state viascripts/cleanup-state.sh.STATE_ROOTdefaults to${XDG_STATE_HOME:-$HOME/.local/state}/codex/pr-review-coach/and must not be inside the target worktree. - Do not spawn subagents or specialist reviewers.
- Do not read unrelated memory files, previous session logs, or review history. Use only the current user prompt, this skill file, the local coach state file, and the git context collected below unless the user explicitly supplies extra context.
- Do not use the merge-gate taxonomy
Critical,Important, orSuggestions. - Do not decide whether the PR can merge.
- Do not create a fix queue. Phrase observations as questions, reading focus, assumptions to verify, or learning notes.
- Ask at most one question per response unless the user explicitly asks for a summary or the coaching loop is complete.
- On answer turns, respond to the user's answer before moving on. Say directly whether the answer is correct, partly correct, or off target, and explain the smallest concrete reason from the diff.
- Do not advance to the next candidate question until the current answer is good enough to record as answered, or the user explicitly asks to skip it.
Preconditions
Run these checks before reading the diff:
-
Clean worktree — Run
git status --porcelain --untracked-files=normal.- If the command fails, abort with the command output.
- If output is non-empty, abort and explain that the coach covers committed branch diff only, so uncommitted changes would be silently excluded.
-
State location and HEAD pinning — Run:
REPO_ROOT=$(git rev-parse --show-toplevel)- Resolve
REPO_ROOTto its canonical physical path (for example withpwd -P/realpathsemantics) and computeREPO_KEYas the SHA-256 of that canonical path. STATE_ROOT=${CODEX_PR_REVIEW_COACH_STATE_ROOT:-${XDG_STATE_HOME:-$HOME/.local/state}/codex/pr-review-coach}- Resolve
STATE_ROOTto a canonical physical path before creating it, canonicalizing the nearest existing parent and appending any missing path components. If the canonicalSTATE_ROOTis equal to canonicalREPO_ROOTor inside canonicalREPO_ROOT, abort before creating any state directory; the coach must never write state into the target worktree through lexical paths, symlinks, or..traversal. STATE_DIR=$STATE_ROOT/repos/$REPO_KEYHEAD_REF=$(git rev-parse HEAD)HEAD_SHORT=$(git rev-parse --short=12 HEAD)If any command fails, abort with the command output.
-
Base or continuation resolution — Extract optional
--base <ref-or-commit>from the user prompt.- Reject base values that start with
-or+, contain:, or contain whitespace. - If
--baseis present, setBASEto that value, runBASE_COMMIT=$(git rev-parse --verify "$BASE^{commit}"),BASE_SHORT=$(git rev-parse --short=12 "$BASE_COMMIT"), andSTATE_FILE=$STATE_DIR/$BASE_SHORT-$HEAD_SHORT.md. If either command fails, abort with the command output and ask the user to provide a valid local base ref or commit. - If
--baseis missing, treat the prompt as an answer continuation. Find state files matching$STATE_DIR/*-$HEAD_SHORT.md. - If no matching state file exists, stop with:
--base <ref-or-commit> を指定してください。例: $pr-review-coach --base main - If multiple matching state files exist, stop and ask the user to rerun with
--basebecause the continuation base is ambiguous. - If exactly one matching state file exists, set
STATE_FILEto it, loadstatus,base,base_commit, andhead_reffrom the file, setBASEandBASE_COMMITfrom those fields, and computeBASE_SHORT=$(git rev-parse --short=12 "$BASE_COMMIT"). - For any existing
STATE_FILE, whether it was selected by explicit--baseor continuation lookup, validate it before reuse. Ifstatusiscomplete, produce the final summary from that state or ask the user to start a new coaching run with a different base/HEAD; do not resume it as an active question. Otherwise, abort ifstatusis notactive, ifhead_refdiffers fromHEAD_REF, ifbase_commitdiffers fromBASE_COMMIT, ifBASE_COMMITdoes not resolve to a commit, or if the state file lackscurrent_question.
- Reject base values that start with
Procedure
After preconditions pass:
-
Collect only read-only context:
git status --shortgit log --no-decorate "$BASE_COMMIT..$HEAD_REF"git diff --name-only "$BASE_COMMIT"..."$HEAD_REF"git diff "$BASE_COMMIT"..."$HEAD_REF"- Run each command independently. If any command fails, abort with the command output and do not continue with partial context.
-
If the diff is empty, run the final guard and say there are no committed changes relative to the base.
-
Prepare or load the local coach state:
- Use the
STATE_ROOT,STATE_DIR, andSTATE_FILEresolved in Preconditions. - Create the state directory with
mkdir -p; if creation or a temporary write+rename preflight fails, abort instead of falling back to the target worktree. - Resolve
SKILL_DIRas this skill's directory and runbash "$SKILL_DIR/scripts/cleanup-state.sh" --state-root "$STATE_ROOT" --current "$STATE_FILE"before creating or updating state. If cleanup fails, warn and continue; cleanup failure must not alter the coaching result. - The state file is outside the target worktree and must not be committed.
- If the state file does not exist, create it after reading the diff.
- If it exists and passed the existing-state validation from Preconditions, load it and resume from its
current_question. - If
base_commitorhead_refin the state file differs from the pinned values, do not reuse it. Create or use the state file derived from the current$BASE_SHORT-$HEAD_SHORTpair. - Cleanup policy is centralized in
scripts/cleanup-state.sh: delete state files older than 30 days, keep the 20 newest files per repo, and always preserve$STATE_FILEeven when that exceeds the cap.
- Use the
-
State file contents should be compact Markdown:
status:activeorcompletebase: the user-provided base stringbase_commit: pinned base commithead_ref: pinned HEADsnapshot: 2-3 bullets about the diffquestions: numbered candidate questions, maximum 5answered: prior accepted question/answer pairsanswer_attempts: current-question attempts and coach reactions that were not yet accepted, if anyskipped_answer_attempts: skipped or moved-on question attempts and coach reactions that are no longer tied tocurrent_question, if anycurrent_question: the single question to ask nextreview_focus: up to 3 reading focus bulletslearning_hook: 1-2 learning notesledger_draft: notes the user can carry into their review
-
Read the diff for understanding, not triage:
- What changed?
- Which files should the user read first?
- What intent or assumption is visible from the diff?
- What is still unclear from code alone?
- What review habit would help on this PR?
-
Keep output bounded:
- Generate at most 5 candidate questions in the state file.
- Output at most 1 question in the response.
- At most 3 review focus bullets.
- At most 2 learning hooks.
- Prefer one strong question over several weak ones.
-
Continuing a coaching loop:
- If the user answers the current question, first write a
Response To Your Answersection. Use direct language:合っています,一部合っています, orそこは違います. - If the answer is correct enough for the review habit being practiced, update
answered, advancecurrent_question, and ask the next candidate question. - If the answer is incomplete, ambiguous, or off target, update
answer_attempts, keep the samecurrent_question, and ask one narrower follow-up about the same question. Do not advance yet. - If the user sends an additional response for the same question, respond to that attempt with the same direct judgment, then either accept and advance or keep the current question with one narrower follow-up.
- If the user explicitly asks to skip or move on, record the attempt in
skipped_answer_attempts, advancecurrent_question, and note what remains unverified. Keepanswer_attemptsreserved for the activecurrent_question; do not carry skipped attempts into the next question's current-attempt state. - If the user invokes the skill again without an answer, repeat the current question with shorter context.
- If all questions are answered, produce the final summary, set
status: complete, and clearcurrent_questionso the state cannot be resumed as an active answer continuation. - If the user asks for a summary early, produce a summary from answered items and leave the state resumable.
- If the user answers the current question, first write a
-
Final guard:
- Run
git status --porcelain --untracked-files=normalagain. - Run
git rev-parse HEADagain and compare withHEAD_REF. - If any final guard command fails, abort with the command output.
- If any worktree content or HEAD changed, abort and explain that the coaching output may not match the current branch state.
- Run
Output Format
For an active coaching turn, use this section structure:
# Review Coach
## State
- 状態ファイル:
- 進捗:
## Response To Your Answer
- (回答継続ターンのみ。合っています / 一部合っています / そこは違います、のいずれかを明示する)
## Snapshot
- 何が変わったか:
- 最初に読むべき場所:
## Next Question
1. ...
## Why This Question
- ...
For the final summary, use this section structure:
# Review Coach Summary
## What You Clarified
- ...
## Review Focus
- ...
## Learning Hook
- この PR から学べること:
- 練習するレビュー習慣:
## Review Ledger Draft
- 迷った点:
- 見落としやすい理由:
- 次のチェックリスト項目:
- 自動化候補:
Style
- Be concrete and grounded in the committed diff.
- If a conclusion depends on missing information, state what to verify instead of guessing.
- Use plain Japanese. Keep each bullet short enough to act on.
- Keep the coaching loop one-question-at-a-time. Do not list the remaining questions unless the user asks.
- Avoid praise, scoring, severity labels, and merge advice.
04 同仓库更多 Skills
代码原理讲解
teach
通过探究代码、变更与子系统的工作原理及其设计原因来进行讲解,并按用户的节奏施教。适用于明确的教学请求(teach me this、help me understand this implementation、この実装を教えて、仕組みと設計背景を知りたい),以及评审或修改前的理解需求。不要对每个事实性问题或以实现为主的请求都触发。
PR 全面代码审查
pr-review
全面的 PR 前审查编排器。针对当前分支已提交的差异运行命名的专项子智能体,按需检查简化情况,并使用专门的发现项验证器逐一核验规范化后的 Critical/Important 候选发现项,随后结合内置的 `references/review-criteria.md` 门禁策略,综合生成 Critical / Important / Suggestions / Strengths。在创建拉取请求前作为重量级质量门禁使用。是旧版 bash `triple-review` 编排器的预期继任者。
日语文章校对
writing-proofreader
日语博客与技术文章的校对技能。基于 Fumitaka 的文体指南,检查表达、结构与语气,并提出改进建议。适用于「校对一下」「审查一下」「检查文章」「看看我写的文章」「能帮我看看博客吗」「有没有哪里不对」「发布前确认一下」「这篇文章你觉得怎么样?」等与文章或博客质量检查相关的各类请求。当用户要求对 Markdown 或纯文本文章进行校对时,务必参考此技能。文章中的「推敲」「修改」「批改」等表述同样会触发本技能。
PR 前评审质量闸门
pr-review
Claude 侧的 PR 前评审闸门。解析分支的 base ref(gh PR view 或显式 --base),固定一份权威的 diff 包,然后启动 pr-review 动态工作流(~/.claude/workflows/pr-review.js),该工作流最多分派 8 位评审专家(code-reviewer、security-reviewer、adversarial-reviewer、pr-test-analyzer、comment-analyzer、silent-failure-hunter、type-design-analyzer、code-simplifier),覆盖不足则失败关闭,并核验 Critical/Important 级别的发现。在创建拉取请求前用作大型变更的质量闸门——尤其适用于 Codex CLI 的 `$pr-review` 技能不可用的情况。触发词:「pre-PR review」「PR 前レビュー」「レビュー gate を回して」「run the pr-review gate」。
Codex CLI 计划评审指南
codex-usage
介绍使用 Codex CLI 进行实现计划评审的条件与步骤,以及 `/codex:adversarial-review` / `/codex:rescue` 的区分使用。在大型变更的计划完成时,或考虑调查委派、尝试其他方案、后台执行时参考。
苏格拉底式设计头脑风暴
brainstorming
通过苏格拉底式对话敲定需求与设计,再确定实现方针的头脑风暴技能。在「头脑风暴」「想考虑设计」「该怎么实现」「想咨询架构」「设计咨询」「实现前先梳理」「想确定方针」等请求时触发。在实现前通过苏格拉底式对话细化设计;提出 2~3 个方案,并将关键决策记录为 ADR。