ワンクリックで
understand-pr
Guided interactive PR review — understand the history and context before forming opinions
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Guided interactive PR review — understand the history and context before forming opinions
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Orchestrate parallel Mastra Code headless instances to debug and fix multiple GitHub issues simultaneously
Collaboratively investigate a GitHub issue or bug — trace history, understand architecture, diagnose root cause
React performance optimization guidelines from Mastra Engineering. This skill should be used when writing, reviewing, or refactoring React code to ensure optimal performance patterns. Triggers on tasks involving React components, data fetching, bundle optimization, or performance improvements.
REQUIRED and PRIMARY testing approach for packages/playground and packages/playground-ui. Triggers on: adding or modifying hooks, pages, route components, data-fetching code, React Query interactions, or any test work in these packages. Generates Vitest tests that drive the real @mastra/client-js + React Query stack through MSW handlers and typed fixtures derived from @mastra/client-js response types. This is the #1 way to test the playground packages — ABOVE Playwright E2E. Use Playwright only for cross-page user journeys that MSW cannot model.
Interactive documentation quality review for Mastra docs. Use when auditing, reviewing, or critiquing Mastra documentation; checking docs against source code; validating code examples, API accuracy, or property completeness; checking whether docs follow the styleguide and deterministic linters; or evaluating whether a beginner or agent can follow a doc to complete a job. This skill keeps humans in the loop with ask_user and submit_plan, then always runs an agent-build eval after approved fixes.
How to build Mastra frontend interfaces with the @mastra/playground-ui design system. This skill should be used when creating or modifying any application UI — pages, components, styling, or tokens — in this repo or in an external consumer of the design system. The docs site has its own styling and is out of scope.
| name | understand-pr |
| description | Guided interactive PR review — understand the history and context before forming opinions |
| goal | true |
Guide a maintainer through understanding a pull request — its goal, whether it meets a quality bar, and then the history and context behind the changes. The reviewer should genuinely understand the PR before forming opinions or drafting comments.
Do not produce walls of text. Every response should be short, dense, and end with lettered options (A/B/C/D) so the user can type a single letter to continue. Minimize fluff. Be direct and information-dense.
Shell note: gh output often contains ANSI color codes that break jq. Use gh's built-in --jq flag instead of piping to jq, or prefix commands with NO_COLOR=1.
--working-file <path> from $ARGUMENTS.--working-file is present, verify the file exists and read it first. Treat it as caller-provided context, follow its handoff instructions, and update that same file with findings before returning to the caller. Do not treat the working file as the final user-facing output. If the file does not exist but --working-file argument was passed, tell the user and end.gh pr view --json title,body,commits,files,labels,number,headRefName,author to get PR metadata.gh pr diff to get the full diff.gh api user --jq .login.Figure out who's involved:
gh api repos/{owner}/{repo}/collaborators/{author} --silent (404 = not a collaborator).For each person discovered, check their merged PR count on this repo: gh pr list --author <login> --state merged --limit 100 --json number --jq length. For linked issue authors, also check their issue count: gh issue list --author <login> --state all --limit 100 --json number --jq length. This tells you how much context each person has — a first-time contributor needs different review attention than someone with 50+ merged PRs, and a prolific issue reporter's bug reports carry different weight than a first-time filer.
Note these relationships briefly — they inform how to read the PR. A maintainer fixing their own bug is different from a community member's first contribution addressing someone else's issue.
If the PR description or commits reference any issues (e.g. "fixes #1234", "closes #456", or just "#789"), read them now:
gh issue view <number> --json title,body,labels,comments,author,state for each linked issueThis is critical context for the PR Goal — the linked issues often explain why this PR exists better than the PR description itself.
Do not begin analysis yet. Move to the PR Goal phase.
Orient the user before anything else — they need to know what this PR is trying to do before history or quality checks make sense.
Present a concise summary of the PR's goal: what problem it solves, why it exists, and what the intended outcome is. Ground this in the PR description, commit messages, and linked issues. Be specific — "fixes a bug" is not enough.
If the PR changes any public API, exported interface, CLI command, configuration option, or user-facing behavior, show what the change looks like from a user's perspective — before and after. For example: how would a developer's code change, what new options are available, what would they import differently. Don't just describe the internal implementation; show the impact on someone using the thing that changed.
Then pause:
A) That matches my understanding — continue
B) I think the goal is actually different — let me explain
C) I'm not sure what this PR is solving — dig deeper
Only proceed to the quality gate after the user confirms understanding of the PR's purpose.
Now that the user understands the PR's goal, check whether this PR meets a minimum bar before investing time in history research. Run gh pr checks to get CI status, then evaluate:
.changeset/ directory), any PR that changes runtime behavior, fixes a bug, or adds a feature must have one. A missing changeset is a quality gate failure — flag it explicitly.If the PR doesn't meet the bar, tell the user directly:
This PR isn't ready for detailed review yet:
- [specific reasons]
A) Review it anyway — I want to understand what's here
B) Help me draft feedback to the author about what needs fixing
C) Stop here
If the PR passes the bar (or the user chooses to proceed anyway), move to history.
Now that the user knows the PR's goal and it's passed the quality bar, dig into the history to understand how we got here and whether the approach makes sense.
For each file changed in the PR:
git log --oneline -20 -- <file> to see recent commit historygit log --oneline --all -20 -- <file> to catch cross-branch activitygit blame on the specific changed regions (pre-PR state) to understand who wrote the current code and whenRead the code around the changed areas — not just the changed lines. Understand:
Examine the PR's test changes (or lack thereof) and the existing test patterns in the codebase:
Given the history and the PR's stated goal, does the approach make sense? Is it solving the problem the right way, or is it fighting the existing design? If a simpler or more consistent approach exists given the codebase's history, flag it.
If a working file was provided, update that same file with what you learned and any requested outputs from its handoff instructions. Otherwise, write .pr-review/HISTORY.md.
Capture what you learned:
Present the history to the user interactively — one file or logical area at a time. After each chunk, offer follow-up options:
A) Why was [specific thing] added originally?
B) Who else has changed this recently?
C) Show me the related code that depends on this
D) I understand this part — move on
Tailor the options to what's actually interesting or relevant. Do not use generic options. The point is to help the user fully and deeply understand the change being made and its implications.
Do not move to Phase 4 until the user has seen the history for all major changed areas and indicated they're ready.
Walk through the actual PR diff one piece at a time, grounded in the history context from Phase 3.
For each chunk:
A) What breaks if this change is wrong?
B) Are there tests covering this path?
C) Show me the surrounding code
D) Next change
Again — tailor the options to what's actually relevant. Be skeptical. If something looks suspicious, say so directly. If something looks solid, don't waste words praising it.
For large PRs with many files, group changes by logical area and let the user choose which area to explore next. Do not just go file-by-file in alphabetical order.
Once the walkthrough is complete, offer the user a choice:
We've been through all the changes. Want to:
A) Quick quiz to test your understanding
B) Revisit a specific area
C) I understand — let's move to opinions
If the user picks the quiz, ask 3-5 multiple-choice questions about the PR — what the code does, why specific decisions were made, what the risks are. These should be real questions that test understanding, not softballs. If the user gets something wrong, explain it clearly and offer to revisit that area.
Once the user understands the PR, ask for their opinion first:
I've formed my own opinion on this PR, but I'd like to hear yours first.
What do you think — is this ready to merge? Any concerns?
Wait for the user's response. Then share your opinion — be direct and honest. Agree where you agree, disagree where you disagree. Do not soften your position to match the user's. Call out:
If --working-file is present, do not offer a PR comment by default. Update the working file with Review findings and return to the caller so it can handle the lifecycle output.
Otherwise, after the opinion exchange, offer to draft a review comment:
Want me to draft a review comment? Options:
A) Draft a full review comment
B) Draft a short approval/comment
C) No comment needed
If the user wants a comment, draft it and present the full text directly in your message. Then:
A) Post this comment as-is
B) Make it shorter
C) Make it more detailed
D) Change the tone (specify)
E) I want to edit specific parts (tell me what)
F) Don't post anything
Iterate until the user is happy or decides not to post. Do not post unless the user explicitly asks.
When posting/updating comments from a file, pass the file contents as the body (as below), not @file as the literal body.
When posting, use the REST API to avoid GraphQL rate limits:
cat > /tmp/pr-comment.md <<'EOF'
Comment body here.
EOF
body=$(jq -Rs . /tmp/pr-comment.md)
gh api repos/:owner/:repo/issues/<PR_NUMBER>/comments \
-X POST \
-H 'Content-Type: application/json' \
--input - <<EOF
{"body":$body}
EOF
If the wrong body is posted, patch with:
body=$(jq -Rs . /tmp/pr-comment.md)
gh api repos/:owner/:repo/issues/comments/<COMMENT_ID> \
-X PATCH \
-H 'Content-Type: application/json' \
--input - <<EOF
{"body":$body}
EOF
Use gh api rate_limit --jq '.rate' to check REST quota if you hit errors.