一键导入
review-memory
Distill PR review comments into reusable lessons and save them to Claude Code memory for automatic recall in future sessions.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Distill PR review comments into reusable lessons and save them to Claude Code memory for automatic recall in future sessions.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | review-memory |
| description | Distill PR review comments into reusable lessons and save them to Claude Code memory for automatic recall in future sessions. |
| license | MIT |
| allowed-tools | Bash, Read, Write, AskUserQuestion |
Note: This skill is designed for Claude Code. The memory written here is surfaced automatically by the Claude Code harness as context in future sessions. Other agents will not benefit from the memory step.
You are an expert at distilling PR review feedback into generalized lessons that prevent repeat mistakes.
Determine which PR to process:
/review-memory <PR number or URL> — use that PR directly/review-memory (no args) — detect the PR for the current branch:
git branch --show-current
gh pr list --head <branch> --json number,url,state
If no PR is found, use AskUserQuestion to ask which PR to process.Resolve {owner}/{repo} from the PR URL, or fall back to:
gh repo view --json nameWithOwner --jq .nameWithOwner
Run these in parallel:
# Inline review comments (carry body / path / line / diff_hunk)
gh api repos/{owner}/{repo}/pulls/{n}/comments --paginate
# Review-level summaries (body + state: APPROVED / CHANGES_REQUESTED / COMMENTED)
gh pr view {n} --json reviews --repo {owner}/{repo}
Also resolve your own login for filtering:
gh api user --jq .login
Keep only comments that meet all of these criteria:
user.login ≠ your own login (exclude your replies)state == "APPROVED" with empty body)body is non-empty and not just "LGTM", "Looks good", ":+1:", "👍", or similarDiscard the rest silently.
If no comments pass the filter, report that and stop.
For each filtered comment, produce a draft lesson. Apply these rules:
Keep (generalizable patterns):
Discard (one-off nits):
Each lesson draft must include:
description (used by the harness to decide relevance at recall time — make it specific enough to trigger on related work, not so broad it fires on everything)**Why:** — what the reviewer's concern was (quote or paraphrase the original comment with PR #{n}, {path})**How to apply:** — concrete action to take in future codePresent the draft lessons via AskUserQuestion with multiSelect: true:
If the user selects nothing, stop cleanly.
For each selected lesson, write a memory file following the Claude Code memory protocol.
Determine the memory directory from the <system-reminder> context (the harness injects the path at session start — look for the Memory section describing ~/.claude/projects/<encoded>/memory/).
Check for duplicates first: read MEMORY.md in the memory directory. If an existing entry covers the same lesson, update that file rather than creating a new one.
For each new lesson, create <slug>.md:
---
name: <slug>
description: <one-line summary — used to decide relevance during recall>
metadata:
type: feedback
---
<lesson body>
**Why:** <reviewer's concern; cite PR #n and file path>
**How to apply:** <concrete action for future code>
Then append one line to MEMORY.md:
- [<Title>](<slug>.md) — <description>
AskUserQuestion.