pull-request
Pushes the current branch to the remote and creates a GitHub Pull Request, auto-filling any detected PR template from commit context and linked Issues. On first run, interviews the user about target branch, draft policy, and template selection, storing config in `docs/agents/pull-requests.md`. Use when the user wants to open a PR, says "create a pull request", "push this branch", "open a PR", "submit for review", or runs /pull-request.
How do I install this agent skill?
npx skills add https://github.com/dnd-mapp/agent-skills --skill pull-requestIs this agent skill safe to install?
- Gen Agent Trust Hubpass
This skill is a well-structured tool for managing GitHub Pull Requests. It utilizes standard version control and GitHub CLI commands, incorporates a configuration interview to establish user preferences, and includes a validation script to ensure PR quality. Security is maintained through mandatory user confirmation for code pushes and PR creation.
- Socketpass
No alerts
- Snykpass
Risk: LOW · No issues
What does this agent skill do?
Pull Request
Pushes the current branch and creates a GitHub Pull Request via gh pr create, auto-filling any detected PR template from commit context and linked Issues.
Modes
Check first: does docs/agents/pull-requests.md exist?
- No → Init: run the interview (see INTERVIEW.md), write config, then proceed to pre-flight.
- Yes → Proceed: load config, run pre-flight.
Pre-flight checks
Run all four in parallel:
git remote get-url origin— remote URL (fails if no remote)git log --oneline -1— confirms at least one commit existsgit status --short— uncommitted changesgit status -sb— remote tracking state and branch name
Then, in order — abort early if any check fails:
-
No remote — if
git remote get-url originfails: abort. "No remote namedoriginis configured. Add one withgit remote add origin <url>then re-run." -
No commits — if
git logreturns empty: abort. "No commits found. Make at least one commit before opening a Pull Request." -
Uncommitted changes — if dirty and the user has not already indicated what to do: ask. Suggest
/commitif available, otherwise suggest committing manually. Do not proceed until the working tree is clean. -
Current branch — if on the configured target branch and
allow-direct-pushisfalse: abort with guidance. Example: "You're onmain. Create a feature branch first (/create-branch)." -
Remote tracking state:
- Branch not yet pushed → push in step 1 of the workflow.
- Branch already pushed, no PR open → skip to PR creation.
- Branch already pushed, PR already open → report the existing PR URL and stop.
Workflow
-
Push branch (if not yet pushed) — run
git push -u origin <branch>. Never force-push. -
Load PR template — read the template value from config:
none: check for newly added templates (.github/PULL_REQUEST_TEMPLATE.md,.github/PULL_REQUEST_TEMPLATE/*.md; org-level viagh api repos/<org>/.github/contents/.github/PULL_REQUEST_TEMPLATE.md). If found, ask the user whether to use one and update config. Otherwise skip to step 4b.- Repo-level (
Level: repo): read the file at the storedPathfrom the working tree. If the file is missing, warn ("PR template at<path>not found — proceed without template, or fix config first?") and act on the user's choice. - Org-level (
Level: org): fetch withgh api repos/<Repo>/contents/<Path>— decode thecontentfield from base64. If the response is not 200, warn ("PR template fetch failed —gh api repos/<Repo>/contents/<Path>returned<status>. Proceed without template, or fix config first?") and act on the user's choice.
-
Build PR title — infer from commit subjects:
- Single commit → use its subject line directly.
- Multiple commits → derive a one-line summary that captures the shared intent.
-
Build PR body:
Treat commit messages and the diff as source material for understanding what changed — not as text to copy into the PR body. Synthesize a description of the changes in your own words.
- Template found (4a): synthesize content for each section of the template from the commit messages and diff context. Shape the language to fit the intent of each section — a "Summary" section gets a prose overview, a "Test plan" section gets a checklist of what to verify, and so on. Extract the Issue Number from the branch name (
<type>/<issue>-<slug>). If the template contains a section for issue references (e.g. "Closes", "Fixes", "Related issues"), injectCloses #<n>there. Do not append it outside the template. - No template (4b): synthesize a short prose description of the changes. Append
Closes #<n>on its own line at the end if an Issue Number is present in the branch name.
- Template found (4a): synthesize content for each section of the template from the commit messages and diff context. Shape the language to fit the intent of each section — a "Summary" section gets a prose overview, a "Test plan" section gets a checklist of what to verify, and so on. Extract the Issue Number from the branch name (
-
Validate and fix body — run validate.sh:
- If exit 0: body is valid, continue.
- If exit 1: read the
VIOLATION:lines from stderr. Apply fixes using your own judgment, then re-run the script on the corrected body. Repeat until exit 0.
Never present a body that has not passed validation.
-
Present and confirm — show the proposed title, body, target branch, and draft status. Allow the user to edit any field. Do not call
gh pr createuntil the user confirms. -
Create PR — run:
gh pr create \ --title "<title>" \ --body "<body>" \ --base <target-branch> \ [--draft]Report the PR URL when done.
Key rules
- Never force-push.
- Never call
gh pr createwithout explicit user confirmation of title and body. A prior approval from another skill in the same chain does not carry over. ghCLI is the only interface for GitHub operations. Do not use the REST API directly.- If
ghis not authenticated, pause and guide the user throughgh auth loginbefore continuing. allow-direct-pushapplies only to the configured target branch. Any other branch may be pushed freely.- Write all generated PR body prose as unwrapped lines — do not insert hard line breaks within paragraphs or list items. Commit message bodies are hard-wrapped at 72 chars for
git log; reflow them (collapse single newlines into spaces, preserve double newlines as paragraph breaks) before including them in the PR body.
How can the creator link this skill?
Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.
<a href="https://skillzs.dev/skills/dnd-mapp/agent-skills/pull-request">View pull-request on skillZs</a>