| name | pr-explainer |
| description | Explain a PR's purpose, motivation, and architectural context with ASCII diagrams. Use when the user wants to understand what a PR does, why it exists, how it fits into the system, or asks for a visual summary of changes. Triggers on "explain this PR", "what does this PR do", "summarize this branch", "show me what changed", or `/pr-explainer`. |
PR Explainer
Overview
Produce a first-principles explanation of a PR (or current branch diff) that
builds understanding incrementally. A reader who has never seen the codebase
should be able to follow the explanation and understand not just what
changed, but why each piece exists and how the pieces interact.
Output is structured top-down: problem first, then mechanism, then details.
All diagrams use ASCII box-and-arrow art so they render correctly in any
terminal. Do NOT use Mermaid — the primary consumer is the CLI, not GitHub.
Input Detection
- Argument is a PR number or URL → use
gh pr view <arg> --json title,body,baseRefName and gh pr diff <arg>
- No argument → diff the current branch against
main:
git log main..HEAD --oneline for commit history
git diff main...HEAD for the full diff
git diff main...HEAD --stat for a file summary
Workflow
Step 1: Gather the Diff
Collect the raw material:
git diff main...HEAD --stat
git diff main...HEAD
git log main..HEAD --oneline
gh view <number> --json title,body,baseRefName,headRefName
gh diff <number>