agentleFS
mir-ammir-am/skills-agents-ai-coding/skills/gh-pr/SKILL.md

gh-pr

Skill2 starsChanged 43 days agoMITView on GitHub

Create GitHub pull requests with smart title and description from branch commits

  • Commits and pushes

4 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

52 rules. 0 are common, 27 are distinctive, and 25 are very specific to this project.

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 27

    Distinctive

    This author's own choices. Worth a look.

  • 25

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Create concise PR description with summary and 3-5 key changes

    line 16
  2. Very specific:

    Create GitHub PR using gh CLI and self-assign it to the authenticated GitHub user

    line 18
  3. Very specific:

    Update root CHANGELOG.md when present with one PR-linked unreleased bullet using the PR URL, then commit and push that changelog update …

    line 19
  4. Distinctive:

    Use this skill when the user asks to create a GitHub pull request from the current feature branch.

    line 23
  5. Distinctive:

    Must be on a feature branch (not master/main)

    line 27
  6. Very specific:

    If gh not installed → error: "GitHub CLI not found.

    line 30
  7. Distinctive:

    Check current branch: git branch --show-current

    line 34
  8. Distinctive:

    If on master or main → error message and exit

    line 35
  9. Distinctive:

    Check for commits ahead of base:

    line 36
  10. Distinctive:

    If no commits ahead → warn user and exit

    line 39
  11. Very specific:

    Check if branch exists on remote: git ls-remote --heads origin <branch-name>

    line 43
  12. Very specific:

    If not on remote: git push -u origin <branch-name>

    line 44
  13. Distinctive:

    If exists on remote: git push

    line 45
  14. Very specific:

    If a follow-up changelog sync creates a new CHANGELOG.md commit after PR creation, push that commit to the same branch as well

    line 46
  15. Very specific:

    If commits use conventional format (feat:, fix:), strip type prefixes

    line 53
  16. Distinctive:

    Always self-assign the PR to the authenticated GitHub CLI account

    line 85
  17. Very specific:

    Use --assignee @me with gh pr create

    line 86
  18. Distinctive:

    Do not derive the assignee from local git config such as git config user.name or email

    line 87
  19. Distinctive:

    If the agent is working on a GitHub issue in the current session:

    line 91
  20. Distinctive:

    Check session context for issue number (e.g., working on issue #123)

    line 92
  21. Distinctive:

    Add issue reference to PR body footer:

    line 93
  22. Very specific:

    If working on an issue, append Closes #<issue-number> to the description

    line 106
  23. Very specific:

    Always include --assignee @me so the PR is assigned to the signed-in gh user

    line 107
  24. Very specific:

    After the PR is created, optionally sync the repository root CHANGELOG.md.

    line 113
  25. Very specific:

    Only if CHANGELOG.md exists at the repository root

    line 117
  26. Very specific:

    Only if ## [Unreleased] exists exactly once

    line 118
  27. Distinctive:

    Only if the unreleased section already contains the target subsection heading

    line 119
  28. Distinctive:

    If any of the above checks fail, skip changelog editing without failing PR creation

    line 120
  29. Distinctive:

    After the PR exists and its number is known:

    line 124
  30. Distinctive:

    Update or insert the single PR-linked unreleased bullet using the PR number and PR URL

    line 126
  31. Very specific:

    If CHANGELOG.md is unchanged after the sync logic, stop here

    line 127
  32. Very specific:

    If CHANGELOG.md changed, stage only that file:

    line 128
  33. Very specific:

    Verify the staged set contains only CHANGELOG.md before committing:

    line 132
  34. Very specific:

    If any staged path other than CHANGELOG.md appears, warn and skip the changelog commit rather than risking unrelated files in the commit.

    line 136
  35. Distinctive:

    Create a dedicated changelog commit:

    line 137
  36. Distinctive:

    If the skill updated an existing bullet rather than adding a new one, use:

    line 141
  37. Very specific:

    Only create the follow-up changelog commit when CHANGELOG.md actually changed

    line 152
  38. Very specific:

    Verify the staged set contains only CHANGELOG.md before git commit.

    line 154
  39. Distinctive:

    Keep the changelog commit dedicated to the changelog sync so the PR history is easy to understand

    line 155
  40. Very specific:

    If CHANGELOG.md already has unrelated local edits that make the sync unsafe or ambiguous, skip changelog editing and warn the user instead …

    line 156
  41. Distinctive:

    Do not fail PR creation just because changelog commit or push steps are skipped

    line 157
  42. Distinctive:

    Write exactly one bullet for the PR in this format:

    line 161
  43. Distinctive:

    Keep it to one line

    line 165
  44. Distinctive:

    Use changelog-style wording, not PR-body wording

    line 166
  45. Distinctive:

    Treat changelog state as one PR = one bullet

    line 183
  46. Very specific:

    Only move bullets within the ## [Unreleased] section (between its subsections) when the PR's high-level purpose is better represented …

    line 185
  47. Very specific:

    Never create duplicate bullets for the same PR number within ## [Unreleased]

    line 186
  48. Very specific:

    If multiple matching bullets for the same PR number exist within ## [Unreleased], or if matching bullets are found only outside ## …

    line 187
  49. Very specific:

    If an existing plain (#<pr-number>) suffix is found, rewrite it to the linked (#<pr-number>) form during the update

    line 188
  50. Very specific:

    If changelog sync succeeds and produces a file change, commit and push that CHANGELOG.md change to the same PR branch

    line 189
  51. Distinctive:

    Not on feature branch → "Error: Cannot create PR from master/main branch"

    line 193
  52. Distinctive:

    No commits ahead → "Warning: No commits to create PR for"

    line 194

“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

What I do

  • Validate feature branch has commits ahead of master/main
  • Push branch to remote if needed
  • Generate PR title summarizing all commits + session work (no type prefix)
  • Create concise PR description with summary and 3-5 key changes
  • Link GitHub issue if working on one in current session
  • Create GitHub PR using gh CLI and self-assign it to the authenticated GitHub user
  • Update root CHANGELOG.md when present with one PR-linked unreleased bullet using the PR URL, then commit and push that changelog update back to the same branch

When to use me

Use this skill when the user asks to create a GitHub pull request from the current feature branch.

Prerequisites

  • Must be on a feature branch (not master/main)
  • Branch must have commits ahead of base branch
  • GitHub CLI (gh) must be installed and authenticated
  • If gh not installed → error: "GitHub CLI not found. Install: https://cli.github.com/"

Validation Workflow

  1. Check current branch: git branch --show-current
  2. If on master or main → error message and exit
  3. Check for commits ahead of base:
    • Try: git log master..HEAD --oneline
    • Fallback: git log main..HEAD --oneline
  4. If no commits ahead → warn user and exit

Push Workflow

  1. Check if branch exists on remote: git ls-remote --heads origin <branch-name>
  2. If not on remote: git push -u origin <branch-name>
  3. If exists on remote: git push
  4. If a follow-up changelog sync creates a new CHANGELOG.md commit after PR creation, push that commit to the same branch as well

PR Title Generation

  • Analyze all commit messages in the branch
  • Analyze agent's session context and work completed
  • Summarize into one cohesive title (no type prefix)
  • If commits use conventional format (feat:, fix:), strip type prefixes
  • Capitalize first letter
  • Examples:
    • Add CSV export functionality and update documentation
    • Resolve NPE in call graph builder
    • Implement parallel test execution

PR Description Generation

  • Analyze commits, diffs, and session context
  • Summarize many commits into 3-5 key points (avoid listing every commit)
  • Format (only these sections):
    ## Summary
    <2-3 sentence overview of what was accomplished>
    
    ## Changes
    - <key change 1>
    - <key change 2>
    - <key change 3>
    - <key change 4 (if needed)>
    - <key change 5 (if needed)>

Base Branch Detection

  • Primary: master
  • Fallback: main (if master doesn't exist)
  • Check: git rev-parse --verify master 2>/dev/null && echo "master" || echo "main"

Assignee Resolution

  • Always self-assign the PR to the authenticated GitHub CLI account
  • Use --assignee @me with gh pr create
  • Do not derive the assignee from local git config such as git config user.name or email

Issue Linking

If the agent is working on a GitHub issue in the current session:

  1. Check session context for issue number (e.g., working on issue #123)
  2. Add issue reference to PR body footer:
    ---
    Closes #<issue-number>

Create PR

Execute the pull request creation:

gh pr create --base <master-or-main> --assignee @me --title "<title>" --body "<description>"
  • If working on an issue, append Closes #<issue-number> to the description
  • Always include --assignee @me so the PR is assigned to the signed-in gh user
  • Capture the created PR number and URL for any follow-up changelog sync, commit, and push
  • Return the PR URL to the user

CHANGELOG.md Sync

After the PR is created, optionally sync the repository root CHANGELOG.md.

When to sync

  • Only if CHANGELOG.md exists at the repository root
  • Only if ## [Unreleased] exists exactly once
  • Only if the unreleased section already contains the target subsection heading
  • If any of the above checks fail, skip changelog editing without failing PR creation

Changelog Commit and Push Workflow

After the PR exists and its number is known:

  1. Update or insert the single PR-linked unreleased bullet using the PR number and PR URL
  2. If CHANGELOG.md is unchanged after the sync logic, stop here
  3. If CHANGELOG.md changed, stage only that file:
    git add CHANGELOG.md
  4. Verify the staged set contains only CHANGELOG.md before committing:
    git diff --cached --name-only
    If any staged path other than CHANGELOG.md appears, warn and skip the changelog commit rather than risking unrelated files in the commit.
  5. Create a dedicated changelog commit:
    git commit -m "docs: add changelog entry for PR #<pr-number>"
    If the skill updated an existing bullet rather than adding a new one, use:
    git commit -m "docs: update changelog entry for PR #<pr-number>"
  6. Push that new changelog commit to the same branch that backs the PR:
    git push

Rules:

  • Only create the follow-up changelog commit when CHANGELOG.md actually changed
  • Stage only CHANGELOG.md; never use broad staging like git add .
  • Verify the staged set contains only CHANGELOG.md before git commit; otherwise warn and skip the changelog commit
  • Keep the changelog commit dedicated to the changelog sync so the PR history is easy to understand
  • If CHANGELOG.md already has unrelated local edits that make the sync unsafe or ambiguous, skip changelog editing and warn the user instead of guessing
  • Do not fail PR creation just because changelog commit or push steps are skipped

Changelog Entry Format

  • Write exactly one bullet for the PR in this format:
    - <high-level PR summary> ([#<pr-number>](<pr-url>))
  • Keep it to one line
  • Use changelog-style wording, not PR-body wording
  • Focus on the high-level thing the PR does, not an implementation checklist

Section Selection

Choose the best matching subsection under ## [Unreleased] based on the PR's high-level purpose:

  • ### Added for new user-facing capabilities or first-time integrations
  • ### Changed for meaningful behavior changes or enhancements to existing functionality
  • ### Deprecated when marking functionality as discouraged but still available
  • ### Removed when functionality is no longer available to users
  • ### Fixed for user-visible bug fixes
  • ### Security for security-relevant fixes or improvements
  • ### Misc only when the PR is notable but does not fit the standard Keep a Changelog sections

Update Rules

  • Treat changelog state as one PR = one bullet
  • Within the ## [Unreleased] section, if a bullet already references that PR number using either (#<pr-number>) or ([#<pr-number>](<pr-url>)), update that line instead of appending a second one
  • Only move bullets within the ## [Unreleased] section (between its subsections) when the PR's high-level purpose is better represented elsewhere
  • Never create duplicate bullets for the same PR number within ## [Unreleased]
  • If multiple matching bullets for the same PR number exist within ## [Unreleased], or if matching bullets are found only outside ## [Unreleased], treat the changelog as ambiguous and skip editing
  • If an existing plain (#<pr-number>) suffix is found, rewrite it to the linked ([#<pr-number>](<pr-url>)) form during the update
  • If changelog sync succeeds and produces a file change, commit and push that CHANGELOG.md change to the same PR branch

Error Handling

  • Not on feature branch → "Error: Cannot create PR from master/main branch"
  • No commits ahead → "Warning: No commits to create PR for"
  • gh not installed → "Error: GitHub CLI not found. Install: https://cli.github.com/"
  • gh not authenticated / gh auth status fails → "Error: GitHub CLI not authenticated. Run: gh auth login"
  • Self-assignment fails (for example, assignees unsupported or user not assignable) → surface the gh error clearly and do not claim the PR was self-assigned
  • CHANGELOG.md missing, malformed, ambiguous, or missing the needed unreleased subsection → skip changelog sync and continue
  • Staged set contains files other than CHANGELOG.md after sync → warn and skip the changelog commit to avoid committing unrelated staged changes
  • git commit for CHANGELOG.md fails → warn user but keep the PR: "Warning: PR created but changelog commit failed."
  • git push for the follow-up changelog commit fails → warn user but keep the PR: "Warning: PR created but changelog commit was not pushed."

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.