Skip to content

Add pr-context-synthesis skill#4374

Open
AryanGodara wants to merge 3 commits intomainfrom
aryan/pr-context-synthesis-skill
Open

Add pr-context-synthesis skill#4374
AryanGodara wants to merge 3 commits intomainfrom
aryan/pr-context-synthesis-skill

Conversation

@AryanGodara
Copy link
Copy Markdown
Member

@AryanGodara AryanGodara commented May 1, 2026

What this is

A primitive for producing a tight 1–3 paragraph what / why / how synthesis of a single PR (or PR-shaped change). Stays anchored to the actual diff and refuses vague verbs.

Ships with /pr-synthesis <N|owner/repo#N|url>, a slash command that fetches title, body, linked issue, and diff and prints the synthesis verbatim.

Why split out

Extracted from #4351 because the synthesis primitive is reusable beyond a single review report — incident-investigation skills like pr-blame-walk need the same shape per candidate. Splitting keeps the contract small.

Files

  • docs/skills/pr-context-synthesis.md — rules + output shape.
  • .claude/commands/pr-synthesis.md — slash command wrapping the procedure.

Reviewing this in isolation

The skill body is self-contained — see the new "How to invoke" and "Example" sections. The intro names two consumers (/review-pr and pr-blame-walk); both land with #4351, so those links resolve once that PR merges. Rules and Shape stand on their own.

How to try it

/pr-synthesis 4371

Worked sample output (run against the real PR #4371) is in the skill file's Example section.

@AryanGodara AryanGodara changed the title add pr-context-synthesis skill Add pr-context-synthesis skill May 1, 2026
@AryanGodara AryanGodara self-assigned this May 1, 2026
@AryanGodara AryanGodara changed the title Add pr-context-synthesis skill Add pr-blame-walk skill May 1, 2026
@AryanGodara AryanGodara changed the title Add pr-blame-walk skill Add pr-context-synthesis skill May 5, 2026
@AryanGodara AryanGodara force-pushed the aryan/pr-context-synthesis-skill branch from 97e8570 to 59935ce Compare May 5, 2026 13:45
@AryanGodara AryanGodara marked this pull request as ready for review May 5, 2026 13:48
@AryanGodara AryanGodara requested a review from a team as a code owner May 5, 2026 13:48
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new Claude command for PR synthesis and a corresponding skill definition. The changes establish a structured process for generating concise summaries of pull requests by fetching data from GitHub. Feedback highlights a brittle approach to identifying linked issues, suggesting the use of GitHub's native API fields instead. Additionally, a contradiction was identified between the command's behavior and the skill's rules regarding how to handle drift between the PR description and the actual diff.

Comment thread .claude/commands/pr-synthesis.md Outdated
Comment on lines +36 to +40
Parse the PR body for `Fixes #N` / `Closes #N` / `Resolves #N` (case-insensitive) and fetch each linked issue:

```bash
gh issue view <N> -R <owner>/<repo> --json title,body,labels,state
```
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Manually parsing the PR body for linked issues using keywords like Fixes #N is brittle. A more robust approach is to leverage GitHub's built-in issue linking by using the closingIssuesReferences field from the gh pr view API. This ensures you are using the same mechanism that GitHub uses to link PRs and issues.

To implement this, you'll need to add closingIssuesReferences to the --json fields in the gh pr view call on line 32. Then, you can iterate over the structured data to get issue details.

Suggested change
Parse the PR body for `Fixes #N` / `Closes #N` / `Resolves #N` (case-insensitive) and fetch each linked issue:
```bash
gh issue view <N> -R <owner>/<repo> --json title,body,labels,state
```
gh issue view <issue.number> -R <issue.repository.owner>/<issue.repository.name> --json title,body,labels,state

Comment thread docs/skills/pr-context-synthesis.md Outdated
## Rules

1. **Synthesize, don't copy-paste.** If `<pr_text>` is five words, say so plainly: *"description is minimal; intent inferred from diff"*. Don't pad to look thorough.
2. **Watch for description-vs-diff drift.** `<pr_text>` must describe `<diff_summary>`'s *current* state, not the author's iteration history. If a claim is no longer true of the diff, raise a finding with `Action: update the PR description to match the current diff`. Do **not** flag the absence of a changelog of removed/superseded behaviour — that belongs in commit history, not the description.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

There is a contradiction between this rule and the implementation described in .claude/commands/pr-synthesis.md.

This file says to raise a finding with Action: update the PR description....
However, .claude/commands/pr-synthesis.md (line 57) states that in case of a drift, the skill should note it in the synthesis as "description claims X; diff shows Y".

The latter seems more appropriate for a synthesis skill, which should report facts rather than take actions. The consumer of the synthesis can then decide whether to raise a finding. I recommend aligning this rule with the implementation.

Suggested change
2. **Watch for description-vs-diff drift.** `<pr_text>` must describe `<diff_summary>`'s *current* state, not the author's iteration history. If a claim is no longer true of the diff, raise a finding with `Action: update the PR description to match the current diff`. Do **not** flag the absence of a changelog of removed/superseded behaviour — that belongs in commit history, not the description.
2. Watch for description-vs-diff drift. <pr_text> must describe <diff_summary>'s current state, not the author's iteration history. If a claim is no longer true of the diff, note it in the synthesis (e.g., "description claims X; diff shows Y"). Do not flag the absence of a changelog of removed/superseded behaviour — that belongs in commit history, not the description.

@AryanGodara AryanGodara force-pushed the aryan/pr-context-synthesis-skill branch from 87b5610 to 8af2427 Compare May 5, 2026 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant