Skip to content
Back to skills

Pr Merge

ASecurity

This skill should be used when the user asks to "merge a PR", "review and merge pull requests", "integrate external contributions", "handle PR conflicts", "cherry-pick from a PR", or needs to merge GitHub PRs while maximizing contributor attribution.

  • 7 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added May 27, 2026
data-aipythonbashtestinggit

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned May 27, 2026

npx -y skills add huangqianqian120/NexusAgent --skill pr-merge --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Pr Merge?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Pr Merge
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/huangqianqian120-pr-merge/badge)](https://www.skillsdirectory.com/skills/huangqianqian120-pr-merge)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: pr-merge
description: This skill should be used when the user asks to "merge a PR", "review and merge pull requests", "integrate external contributions", "handle PR conflicts", "cherry-pick from a PR", or needs to merge GitHub PRs while maximizing contributor attribution.
version: 0.1.0
---

# PR Merge — Contributor-First Pull Request Integration

Merge external pull requests while maximizing original author attribution. Core principle: **merge first, resolve conflicts after** — never rewrite a contributor's work from scratch.

## Core Principles

1. **Preserve authorship** — use `gh pr merge --squash` for clean PRs. For manual merges, use `--author="Name <email>"`.
2. **Merge first, fix after** — accept the PR's approach even if it differs from local style. Fix conflicts in a separate commit.
3. **Selective merge is OK** — exclude files with `--exclude` when a PR contains features already implemented locally. Document what was excluded.
4. **Never `git apply` + self-commit** — this loses author attribution entirely.

## Workflow

### 1. Triage Open PRs

```bash
gh pr list --repo OWNER/REPO --state open \
  --json number,title,author,additions,deletions,mergeable
```

Classify each PR: merge directly, merge with conflict resolution, selective merge, or close.

### 2. Merge Clean PRs via GitHub

Prefer `gh pr merge` — preserves author automatically:

```bash
gh pr merge NUMBER --repo OWNER/REPO --squash \
  --subject "feat: description (#NUMBER)"
```

### 3. Handle Conflicting PRs Locally

```bash
git fetch origin pull/NUMBER/head:pr-NUMBER
git merge pr-NUMBER --no-edit
# Resolve conflicts keeping both sides where possible
git add -A && git commit --no-edit
```

### 4. Selective Merge (Skip Some Files)

When a PR contains features already implemented locally:

```bash
gh pr diff NUMBER --repo OWNER/REPO | \
  git apply --exclude='path/to/skip.py' --exclude='CHANGELOG.md'
git commit --author="Author Name <author@email>" \
  -m "feat: description (#NUMBER)

Cherry-picked from PR #NUMBER. Excluded: file.py (already implemented)."
```

### 5. Close Duplicate/Superseded PRs

```bash
gh pr close NUMBER --repo OWNER/REPO \
  --comment "Fixed via PR #OTHER. Thank you for the contribution!"
```

### 6. Post-Merge Verification

```bash
python -m ruff check src/ tests/    # lint
python -m pytest tests/ -q          # unit tests
git push origin main                # push
```

Then run `harness-eval` for end-to-end verification on an unfamiliar codebase.

## Attribution Checklist

Before pushing a merged PR:

- [ ] Original author appears in `git log` (via `--author` or GitHub squash merge)
- [ ] Commit message references PR number (`#NUMBER`)
- [ ] If selectively merged, commit body explains exclusions
- [ ] Closed PRs have a comment thanking the contributor
- [ ] Duplicate PRs acknowledge the contributor's investigation

## Common Pitfalls

- `git apply` + self-commit loses author
- Rewriting from scratch instead of merging — merge their code, fix style after
- Force-pushing main after merge — may remove contributor commits
- Forgetting CHANGELOG conflicts — always exclude and handle manually
- Not testing after merge — clean merge doesn't mean working code

## Additional Resources

### Reference Files

- **`references/merge-scenarios.md`** — Detailed examples for each merge scenario (clean, conflicting, selective, duplicate)

Files in this skill

  • SKILL.md3.3 KB
  • references/merge-scenarios.md3.7 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.