andreybegma/claude-code-plugin/pr-merge
Claude Code and agent skill by andreybegma/claude-code-plugin
- community
Checking that the SKILL.md file is still in the repository.
Extract generalizable rules from PR comments and open a PR updating CLAUDE.md instructions
Install
npx vskill@latest install andreybegma/claude-code-plugin/pr-mergeSKILL.md
The same SKILL.md was published earlier as andreybegma/claude-code-plugin/pr-merge.
PR Prepare Merge
You are a senior engineering standards curator. Given a PR number, you review all human comments, extract feedback that can be generalized into reusable CLAUDE.md rules, and open a PR against the source PR's branch with the updates.
Inputs
$ARGUMENTS — the PR number to process (required).
Step 1: Gather Context
Run these commands one at a time (do not chain):
- Get repo info:
``bash gh repo view --json owner,name ``
Parse the JSON to extract owner.login and name. Use these as OWNER and REPO below.
- Get PR details:
``bash gh pr view $ARGUMENTS --json title,body,author,baseRefName,headRefName ``
- Get all review comments (inline code comments):
``bash gh api repos/OWNER/REPO/pulls/$ARGUMENTS/comments --paginate ``
- Get all issue-level comments (general discussion):
``bash gh api repos/OWNER/REPO/issues/$ARGUMENTS/comments --paginate ``
- Get all review bodies (approve/request-changes comments):
``bash gh api repos/OWNER/REPO/pulls/$ARGUMENTS/reviews --paginate ``
Step 2: Filter Comments
From all collected comments, keep ONLY comments that:
- Come from humans — skip bot comments (author association:
NONEwith bot-like names, orlogincontaining[bot]) - Contain actionable feedback — skip approvals like "LGTM", "looks good", emoji-only reactions
- Are generalizable — the feedback applies beyond this single PR. Skip comments that are purely about this PR's specific logic (e.g., "rename this variable to X", "this should be
userIdnotid")
What IS generalizable (extract these):
- Coding patterns: "always use early returns", "prefer
constoverlet" - Architecture rules: "services should not import from controllers", "use DTOs for API responses"
- Security practices: "never log request bodies", "always validate file upload types"
- Convention decisions: "use arrow functions for service methods", "use
findUniqueOrThrowinstead of null checks" - Process rules: "add migration for schema changes", "update OpenAPI spec when changing endpoints"
- Domain rules: "use Decimal.js for monetary values", "vessel types must use Prisma enum"
What is NOT generalizable (skip these):
- One-off fixes: "this variable name is wrong", "missing semicolon here"
- PR-specific logic: "this query should filter by orgId too"
- Questions: "why did you use X here?" (unless the answer establishes a rule)
- Nitpicks with no pattern: "typo in comment"
Step 3: Read Current Rules
Read CLAUDE.md and .claude/skills/**/*.md to avoid duplicates. Do not read the analyzer plugin's own skill files.
If no CLAUDE.md exists, create one with this structure:
Step 4: Draft Updates
For each generalizable comment:
- Check if the rule already exists in
CLAUDE.mdor project-local skills — if yes, skip it - Determine the best section to place it (create a new section if needed)
- Write the rule as a concise, imperative instruction (e.g., "Use
findUniqueOrThrowinstead offindUnique+ null check")
Rule format:
- Imperative mood: "Use X", "Always Y", "Never Z", "Prefer A over B"
- Include "why" only if not obvious; include a code example only if the pattern is non-trivial
Step 5: Show Extracted Rules
Output the list of extracted rules, then automatically include ALL of them:
If no generalizable rules were found, report "No generalizable feedback found. No PR created." and stop.
Step 6: Create PR
Run these commands one at a time:
- Switch to the source PR's branch (
headRefNamefrom Step 1) and update:
``bash git checkout <HEAD_REF_NAME> ``
``bash git pull origin <HEAD_REF_NAME> ``
- Create new branch from the PR's branch:
``bash git checkout -b claude-instructions-from-pr-<PR_NUMBER> ``
- Apply the CLAUDE.md changes using the Edit tool.
- Stage and commit:
``bash git add CLAUDE.md ``
``bash git commit -m "Update CLAUDE.md with rules from PR #<PR_NUMBER>" --no-gpg-sign ``
- Push the branch:
``bash git push -u origin claude-instructions-from-pr-<PR_NUMBER> ``
Important: Do NOT add Co-Authored-By, Signed-off-by, or any AI/Claude attribution to commits.
- Show the PR preview, then automatically create it with
gh pr create --base <HEAD_REF_NAME>(targeting the source PR's branch):
`` Creating PR: Title: Update CLAUDE.md with rules extracted from PR #18 Base: <HEAD_REF_NAME> (PR #$ARGUMENTS branch) ``
- Add label (run separately):
``bash gh label create "claude-rules" --description "Auto-extracted rules from PR comments" --color "1d76db" --force ` `bash gh pr edit --add-label "claude-rules" ``
Use the following structure for the body (replace placeholders with actual values):
- Base:
<HEAD_REF_NAME>(the source PR's branch) - Title:
Update CLAUDE.md with rules extracted from PR #<PR_NUMBER> - Body:
Important
- Read-only on the target PR — do not modify, comment on, or merge the original PR
- Only modify CLAUDE.md — do not touch any other files
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/pr-merge/SKILL.md
Popularity
- Repository stars
- 1
- Repository forks
- 1
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/andreybegma/claude-code-plugin/pr-merge)