sd0xdev/sd0x-dev-flow/create-pr
Claude Code and agent skill by sd0xdev/sd0x-dev-flow
- community
Checking that the SKILL.md file is still in the repository.
Create or update GitHub PR with gh CLI. Auto-extracts ticket ID from branch name, generates title/summary from commits. Auto-detects existing PR and switches to update mode. Supports --stack for stacked PR chains (per-layer PRs with chained bases; never executes push/rebase). Default: --dry-run (show command, don't execute). Use when: user asks to open/create/update a PR, says /create-pr, wants a stacked PR chain, wants to refresh PR description after new commits, or says 'update pr', 'update PR title', 'refresh PR body'.
Install
npx vskill@latest install sd0xdev/sd0x-dev-flow/create-prSKILL.md
The same SKILL.md was published earlier as sd0xdev/sd0x-dev-flow/create-pr.
Create PR
Input
/create-pr [--head <branch>] [--base <branch>] [--title <title>] [--stack <branch...>] [--update] [--execute] [--dry-run] [--draft] [--goal-publish]
--head: Source branch (default: current branch)--base: Target branch (default:{TARGET_BRANCH}ormain)--title: Override auto-generated title (rejected with--stack)--stack: Stacked PR chain mode, bottom layer first (mutually exclusive with--head; the bottom layer's base follows the same--base/{TARGET_BRANCH}/mainresolution as normal mode) — see Stacked PR Mode--update: Force update mode (re-generate title/body for existing PR)--dry-run: Show command without executing (default). Scopes to mutatingghcalls — the Step 1git fetch --prune originstill runs, so the preview reflects the server's real refs--execute: Actually create/update the PR (requires user confirmation — except under--goal-publish, § Goal publish)--draft: Create the PR as a draft. Never applied to an existing PR: a ready PR is never turned back into a draft. Rejected with--stack— a stacked chain's readiness belongs to its own publishers (/gh-stack --openmarks drafts ready), so the combination stops before mode dispatch--goal-publish: The goal delivery sequence's call (§ Goal publish) — execute without the confirmation, as a draft, after a verified push. Rejected with--stack, for the same reason- No args: use current branch → default target, dry-run mode. Auto-detects existing PR → update mode
Workflow
0. Mode Dispatch (first, before anything else)
When `--stack` is present: read references/stack-mode.md and run Phases A, B, D0, then either the native delegation (D1) or Phase C — never both. Skip generic Steps 1, 5, 6 and 7 entirely — Phase A must run git fetch --prune origin and classify sync state before any PR planning, so the generic ls-remote / local base..head path must not run first. What is reused, per layer, exactly as Phase C directs:
| Reused | Skipped | |
|---|---|---|
| Steps 2–4 content generation (ticket ID, title, body) | Step 1 gather — Phase A replaces it | |
| Step 4b sanitization, Step 7b post-creation verify | Step 5 pre-flight + mode detection — Phase A/B replace it | |
| Step 5a's smart-diff update logic — the routing decision is Phase B's, the diff-and-update mechanics are Step 5a's | Steps 6–7 single-PR output/execute — Phase C emits per-layer commands instead |
Otherwise continue with Step 1 below.
1. Gather Info
The fetch runs first and alone — the ref-range reads below it (git log and git diff over refs/remotes/origin/*) depend on the remote-tracking refs it refreshes, so it cannot join the parallel batch. It runs even in --dry-run (the dry-run promise at the top scopes to mutating gh calls; refreshing and pruning local remote-tracking refs is how the preview describes the commits that would actually ship). ls-remote in the next fence only LISTS the server's refs — it never updates refs/remotes/* — so without this fetch they can be missing or stale (another clone pushed, or this one never fetched) and the PR body would describe old commits. Same exact form and same discipline as stack mode's Phase A: the explicit exit keeps a failed fetch from being followed by reads of stale refs.
Emit this line in the turn that runs the fetch, before the fence — rules/git-workflow.md lists status | diff | log | branch | rev-parse as allowed and git fetch is in neither that list nor the forbidden one, which makes it a Default-tier deviation, and a deviation is declared per run, not once during development (same shape as stack-mode.md § Phase A; the stated reason differs because the fetch serves PR-body range generation here, sync classification there):
The rest are independent — run them in parallel:
2. Extract Ticket ID
From branch name, extract ticket ID using {TICKET_PATTERN} (default: [A-Z]+-\d+):
| Branch Pattern | Ticket ID | |
|---|---|---|
fix/PROJ-520 | PROJ-520 | |
fix/PROJ-520-2 | PROJ-520 | |
feat/PROJ-123-some-desc | PROJ-123 | |
refactor/PROJ-999 | PROJ-999 |
Regex: first match of {TICKET_PATTERN} — take first match. Strip trailing -N suffixes.
3. Generate Title
Format: <type>: [<TICKET>] <concise summary>
<type>: from branch prefix (fix/→fix,feat/→feat,docs/→docs,refactor/→refactor)<TICKET>: extracted ticket ID (omit if none found)<concise summary>: summarize commits in <60 chars, focus on main changes
4. Generate Body
Rules:
- No AI-generated tags — enforced by Step 4b sanitization (see below)
- Keep summary factual, based on actual commits
- Use imperative mood in bullet points
- Omit Ticket section if no ticket ID or
{ISSUE_TRACKER_URL}not configured
Forbidden patterns (case-insensitive ERE with \b word boundaries — canonical source: scripts/commit-msg-guard.sh):
| Pattern Category | Regex | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Co-Authored-By AI | `Co-Authored-By:.*(Claude\ | Anthropic\ | \bAI\b\ | GPT\ | OpenAI\ | Copilot\ | Codex\ | Gemini\ | noreply@anthropic)` | |
| Generated-by tag | `Generated[ -](by\ | with).*(Claude\ | Anthropic\ | \bAI\b\ | GPT\ | OpenAI\ | Copilot\ | Codex\ | Gemini)` | |
| Emoji robot tag | `🤖.*(Claude\ | Anthropic\ | \bAI\b\ | GPT\ | OpenAI\ | Copilot\ | Codex\ | Gemini)` |
Note:\|in the table above is Markdown table escaping. Actual ERE uses unescaped|. OnlyAIis\b-bounded — it prevents bareAIfrom matching inside ordinary words ("maintainer", "domain") under-i.GPTandOpenAIare intentionally left unbounded so they still match insideChatGPT/GPT-4(no English word contains "gpt").Generated[ -]covers the hyphenatedGenerated-by:form, which the earlier space-only version accepted.
4b. AI Content Sanitization
After generating title and body (Step 3-4), scan for forbidden patterns and sanitize before any output or execution. Applies to all modes: dry-run/execute, create/update, --title override.
Sanitization is executed, not paraphrased — skills/create-pr/scripts/sanitize-pr-content.sh is the implementation, and it reads the three forbidden patterns out of scripts/commit-msg-guard.sh at runtime so the two can never drift. The path is resolved from the script's own location, after following any symlink chain, and from nothing else — `PLUGIN_ROOT` is deliberately not consulted, even though run-skill.sh exports it to exactly that value, because an environment variable that selects the policy source lets a caller swap in a guard declaring three never-matching patterns and get exit 0 on a real trailer. What self-location cannot cover is an invocation whose path is not the file's real location — a copy or a hardlink into a planted tree; the script says so in its own comment rather than implying otherwise, and run-skill.sh building an absolute target from its own location — after physically resolving its own symlink chain, without which a symlink to the wrapper planted in an attacker's tree selected that tree's copy of the policy script — is what closes that for the documented entrypoint. The documented invocation spells the interpreter absolutely (/bin/bash -p) for the same reason one layer earlier: a bare bash is resolved in the caller's shell, so an exported bash function answered the whole command with exit 0 and neither script ever started. A pattern set that reads as empty, as fewer entries than the guard declares, or as a line this parser cannot fully read aborts with exit 2 rather than reporting content clean.
The run directory is allocated before this step, in every mode — including dry-run. Sanitization operates on files, so a mode that writes no file cannot sanitize; a dry-run that skipped it would render an unsanitized body into its own report, which is precisely the text a user copies into gh. What dry-run must not do is leave the files behind or run a mutating gh call, and § Command Rendering's teardown fence is what guarantees the first. "No gh at all" would be the wrong contract and the wrong claim: stack mode's Phase B reads gh pr list and Phase D reads gh extension list — both read-only — in order to decide what to print. The line is gh pr create / gh pr edit: those are never run in dry-run. The lifecycle below is one sequence with one owner, and every exit from it — including a sanitizer failure — passes through the same teardown:
| # | Step | On failure | |
|---|---|---|---|
| 1 | Allocate the run directory (mktemp -d, § Command Rendering step 1) | Nothing was created; stop | |
| 2 | Write pr-title.txt and pr-body-N.md out of band (Write tool) — stack mode writes one of each per layer (pr-title-N.txt), see references/stack-mode.md | Run the teardown fence, then stop | |
| 3 | title mode on the title file | Exit 3 → regenerate once; still 3 → teardown, then hard fail | |
| 4 | body-inplace mode on each body file | Exit 2 → teardown, then hard fail | |
| 5 | Operate (gh) — execute mode only; dry-run renders the report instead. The --title value is read back from the file step 3 scanned, not from the generator's copy | The guarded block already cleans and re-raises | |
| 6 | Teardown (§ Command Rendering) — in dry-run this is a step of its own, run after the report is rendered | — |
Why step 5 reads the title back. --body-file names the very artifact body-inplace rewrote, so nothing in this workflow re-renders the body between the verdict and the send. gh has no --title-file, so the title is the one field this workflow could make diverge by itself: scan pr-title.txt, then render --title from a string the generator still holds, and the verdict belongs to bytes that were never published. Regenerating the title after the scan (step 3's "regenerate once" path) is exactly when that happens. The file is the artifact of record: re-scan it after any regeneration, and render the flag from what it holds.
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 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/create-pr/SKILL.md
Popularity
- Repository stars
- 188
- Repository forks
- 24
- 7-day trend score
- 26
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 21 May 2026, 6 months ago.
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/sd0xdev/sd0x-dev-flow/create-pr)