Skip to content
Back to skills

Create Pr

BSecurity

Create evidence-backed pull requests to the GitHub main branch with strict preflight, quality, and security gates. Use when users ask to create/submit/open/update a PR to main (including private repos), decide draft vs ready state, and provide reviewer-ready context for team review.

  • 32 stars
  • 0 votes
  • 0 copies
  • 6 views
  • Added September 19, 2026
ai-agentspythongoshellbashawsgitapisecurityperformancedocumentation

Works with

  • cli
  • api

Security analysis

B75/100
  • criticalReads or references SSH private keys

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

Scanned December 4, 2026

npx -y skills add johnqtcg/awesome-skills --skill create-pr --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Create Pr?

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

Security grade badge for Create Pr
[![Security: B — Skills Directory](https://www.skillsdirectory.com/api/skills/johnqtcg-create-pr/badge)](https://www.skillsdirectory.com/skills/johnqtcg-create-pr)

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: create-pr
description: Create evidence-backed pull requests to the GitHub main branch with strict preflight, quality, and security gates. Use when users ask to create/submit/open/update a PR to main (including private repos), decide draft vs ready state, and provide reviewer-ready context for team review.
disable-model-invocation: true
allowed-tools: Read, Grep, Glob, Bash(git rev-parse*), Bash(git status*), Bash(git remote -v), Bash(git remote get-url*), Bash(git fetch*), Bash(git merge-base*), Bash(git diff*), Bash(git log*), Bash(git show*), Bash(git rev-list*), Bash(git ls-remote*), Bash(git config --get*), Bash(gh auth status*), Bash(gh repo view*), Bash(gh pr view*), Bash(gh pr list*), Bash(make test), Bash(make lint), Bash(make build), Bash(go test*), Bash(go build*), Bash(go vet*), Bash(golangci-lint*), Bash(gosec*), Bash(govulncheck*), Bash(pytest*), Bash(npm test), Bash(npm run test), Bash(npm run lint), Bash(npm run build), Bash(cargo test*), Bash(cargo build*), Bash(cargo clippy*)
---

# Create PR

Create a high-quality PR to `main` that is easy to review, safe to merge, and explicit about risk.

## Canonical Implementation

The bundled `scripts/create_pr.py` is the **preferred execution path** for Gates A–H: when Python 3 is available, run the gates through it (`references/bundled-script-guide.md`) instead of hand-executing the prose commands below. The prose workflow — this file plus `references/quality-evidence-rules.md`, which carries Gate D's per-tool detail — serves two roles: the **specification** the script must implement, and the **fallback** for environments without Python. If the two ever disagree, the prose specification wins and the script is the side to fix. Shared constants (size thresholds, confidence levels, gate statuses, secret-scan semantics) are consistency-tested in `scripts/tests/test_skill_contract.py` — update both sides together.

The script distinguishes `blocks_publish` from `blocks_ready`. Repository identity/auth failures, publishing from `main`, unsafe branch state, incomplete diff/security evidence, high-confidence secret findings, and invalid PR titles are hard publication blockers: stop before `git push`. Quality, documentation, narrative, or compatibility gaps — and a branch that is behind `main` — may still publish a draft, but never a ready PR.

## Quick Reference

| Step | Gate | What it checks | Blocker? |
|------|------|---------------|----------|
| 1 | — | Scope the change | — |
| 2 | **A** | GitHub auth, remote, base branch, branch protection | Yes |
| 3 | **B** | Not on `main`, branch naming, no conflicts, synced with `origin/main` | Yes (behind `main`: draft only) |
| 4 | **C** | High-risk areas, change size (≤400 / 401-800 / >800 lines) | Warn |
| 5 | **D** | Tests, lint, build — graded per dimension | Yes |
| 6 | **E** | Secret scan over the whole pushed range, gosec, govulncheck | Yes (high-confidence) |
| 7 | **F** | Docs/changelog, backward compatibility, breaking changes | Yes |
| 8 | **G** | Conventional Commits (commits + PR title), scope confirmation, self-review | Yes |
| 9 | — | Compose PR title/body | — |
| 10 | — | If no hard blocker: `git push -u` + `gh pr create` | — |
| 11 | **H** | Assert base/head, title/body render, open state, draft/ready state | Yes |

**Confidence → State**: `confirmed` → ready | `likely` → ready only for low-residual-risk suppressions | `likely` → draft when a suppression can hide a merge-blocking defect | `suspected` → draft. A hard publication blocker creates no PR.

## Non-Negotiables

- Never open a PR from `main` as the head branch.
- Never push secrets, credentials, or local-only configuration.
- Never claim a gate passed without command or code evidence.
- Never call `git push`, `gh pr create`, or `gh pr edit` after a hard publication blocker.
- Fail closed: if a mandatory gate cannot run, keep the PR as `draft` and record the gap.
- Prefer non-interactive commands for reproducibility.
- **One PR = one problem.** A single feature, a single bug fix, or a single refactor. Do not mix unrelated changes.
- **PR title must follow Conventional Commits format** (`<type>(<scope>): <subject>`, subject ≤ 50 chars, imperative, no period). Under Squash-and-merge the PR title is what GitHub pre-fills for a 2+-commit PR; a single-commit PR pre-fills that commit's own subject instead, so validate both (see `references/merge-strategy-guide.md`).
- **Verify every write target, not just the read target.** `git push origin` uses `remote.origin.pushurl` when set, git keeps it independent of the fetch URL, and a remote may have more than one — a single push then writes to all of them. Every one must resolve to the repository `gh` reports.
- **Secret evidence covers every commit being pushed**, not only the net diff. A credential added in one commit and deleted in a later commit still reaches the remote.
- **A missing check is an uncovered risk, never a pass.** Test, lint, and build are graded separately; "every discovered command succeeded" is not evidence that all three ran.
- **The publishing step is never auto-approved.** `allowed-tools` covers evidence gathering only — read-only `git`/`gh` queries and the Gate D/E tools **in their check forms**: `make test`, not `make*`, which would also approve `make release`; `npm run lint`, not `npm*`, which would approve `npm publish`. It approves no file writes either. `git push`, `gh pr create`, `gh pr edit`, and `gh api` are deliberately absent, so the outward-facing write always reaches the user as a permission prompt. **`scripts/create_pr.py` is absent for the same reason**: with `--create-pr` it runs `git push` and `gh pr edit` itself, and an `allowed-tools` pattern is a prefix match that cannot require `--dry-run`, so auto-approving the script would auto-approve the publish it performs. Run the script explicitly; approve the prompt once you have read the gate report.

## PR Granularity Guidelines

- Target **200–400 changed lines** per PR. Beyond 400 lines, review quality drops sharply.
- Large features should be split into serial PRs; use feature flags to hide incomplete work.
- Do not sneak formatting, import reordering, or unrelated refactors into a feature PR — submit them as separate PRs.
- Before creating the PR, perform a **self-review** of your own diff (`git diff origin/main...HEAD`). Fix obvious issues before requesting others' time.

## Readiness Confidence (Mandatory)

Label final PR readiness with one confidence level:

- `confirmed`: all mandatory gates executed and passed, no unresolved high-risk item.
- `likely`: one non-blocking gate could not run, with explicit follow-up owner.
- `suspected`: multiple gates unverified or key evidence missing.

Do not mark a PR `ready` with `suspected` confidence.

## Suppression Rules

Suppress a gate only when: (1) gate is N/A for changed files, (2) tooling unavailable, or (3) equivalent upstream check proves the condition (cite check name/URL).
Any suppression must be recorded in `Uncovered Risk List` with residual risk. Keep PR as `draft` if the uncovered area can hide merge-blocking defects.

## Fixed Process + Mandatory Gates

Run the following process in order.

1. Scope the change.
2. Run `Gate A`: authentication and repository preflight.
3. Run `Gate B`: branch hygiene and sync with `origin/main`.
4. Run `Gate C`: change-risk classification.
5. Run `Gate D`: quality evidence (tests/lint/build).
6. Run `Gate E`: security and secret-leak checks.
7. Run `Gate F`: documentation and compatibility checks.
8. Run `Gate G`: commit hygiene and commit message quality.
9. Prepare PR title/body with structured evidence.
10. If no hard publication blocker exists, push branch and create PR to `main`; otherwise stop before push.
11. Run `Gate H`: post-create verification.
12. Decide `draft` vs `ready` from gate results.
13. Report findings first, then PR link, then follow-up actions.

If a mandatory gate cannot execute, explicitly mark it as uncovered and do not claim full readiness.

> **Fast path (≤100 changed lines, no high-risk area):** Gates C and F may be combined into a single step — confirm change size is small, no breaking changes, no doc updates needed, then proceed.

### Gate A: Authentication and Repository Preflight (Mandatory)

```bash
git rev-parse --is-inside-work-tree
git remote -v
git remote get-url origin
git remote get-url --push --all origin   # EVERY write target; --push alone returns only the first
gh auth status -h github.com
gh repo view --json nameWithOwner,isPrivate,viewerPermission,defaultBranchRef
git ls-remote --heads origin main
# Best-effort — may 404/403 on repos without protection rules; suppress if so.
gh api repos/{owner}/{repo}/branches/main/protection
```

Blocker: not authenticated, no `origin` remote, no permission, `main` missing on remote, or repository identity mismatch. The `origin` repository identity must match `gh repo view`'s `nameWithOwner`; normalize SSH/HTTPS GitHub URLs before comparing.
**The push URLs are the identities that matter for writes.** A remote may carry several push URLs, and one `git push` writes to **all** of them; `git remote get-url --push origin` returns only the first, so `--push --all` is the only complete answer (it also covers the case where no `pushurl` is set and several fetch `url` entries are used for writing). Require one distinct identity across the fetch slug, **every** push slug, and the `gh repo view` slug — compare all of them in a single check, since pairwise comparisons mask each other. Any unparseable or mismatching value is a hard publication blocker, and the evidence line must name every source it compared.
If branch protection query fails (404/403), record in Uncovered Risk List and continue.

### Gate B: Branch Hygiene and Sync (Mandatory)

- Ensure head branch is not `main`:
  - `git rev-parse --abbrev-ref HEAD`
- If `--head` is supplied, require it to equal the checked-out branch; `git push origin HEAD` must never target a different branch than `gh pr create --head`.
- **Branch naming check**: verify the branch name matches `<type>/<short-description>` (e.g. `feature/oauth-login`, `fix/nil-pointer-getuser`, `refactor/db-pool`).
  - Type prefixes: `feature`, `fix`, `refactor`, `hotfix`, `release`, `docs`, `chore`, `test`, `perf`, `ci`.
  - If the name does not match, report as a **warning** (non-blocking) suggesting the user rename with `git branch -m <new-name>`.
- Ensure no unresolved conflicts or conflict markers:
  - `git status --porcelain`
  - `git diff --name-only -z --diff-filter=ACMR origin/main...HEAD | xargs -0 -r git grep --no-color -naE '^(<<<<<<<|>>>>>>>)( |$)' --`
  - This reads every file the branch changes, whatever its extension or size. `-a` matters: `-I` would skip a file marked `-diff` in `.gitattributes` (a lockfile, say), which git treats as binary although a merge writes markers into it. `--no-color` keeps `color.ui=always` from wrapping paths in escapes. A lone `=======` is not checked because Markdown and reStructuredText use it as a heading underline, and a real conflict always carries the `<<<<<<<` / `>>>>>>>` pair. Keep `-r`: with no changed file, GNU `xargs` would otherwise run `git grep` once over the whole tree.
  - `.create-pr.yaml` `conflict_scan.scan_changed_files_only: false` widens the scan to every tracked file (plain `git grep --no-color -naE …`); `conflict_scan.exclude_paths` (default `^vendor/`, `^third_party/`) drops matching paths.
- Sync with latest main:
  - `git fetch origin main`
  - `git merge-base --is-ancestor origin/main HEAD` to verify branch includes latest main (exit 1 = behind; any other non-zero exit = the comparison failed).
  - If behind, the PR may be opened only as a draft — the user must rebase or merge before it is marked ready.
    Do NOT auto-rebase; an unattended rebase can leave the tree in a conflicted state.

Publication blockers (no push, no PR):

- Current branch is `main`.
- Requested head does not match the checked-out branch.
- Working tree is not clean (uncommitted changes).
- Unresolved merge entries or conflict markers detected.
- `origin/main` cannot be fetched or compared with `HEAD`.

Ready blocker (draft only):

- Branch is behind `origin/main` (rebase or merge required). The PR diff and the pushed range `origin/main..HEAD` stay exact, so a draft is safe; the gate evidence, though, was produced against an older `main`.

### Gate C: Change-Risk Classification (Mandatory)

Summarize changed files and flag high-risk areas:

- auth/authz, payment, migration, concurrency, public API, infra config, secrets.
- If high-risk areas are touched, require explicit risk and rollback notes in PR body.

**Change-size check**: compute total added+removed lines from `git diff --stat origin/main...HEAD`.
- **≤ 400 lines**: normal.
- **401–800 lines**: warn the user that review quality may suffer; suggest splitting if feasible.
- **> 800 lines**: strong warning; recommend splitting into smaller PRs unless the change is inherently atomic (e.g. auto-generated code, large migration).

Use:

- `git diff --name-status origin/main...HEAD`
- `git diff --stat origin/main...HEAD`

> **Monorepo**: If multiple `go.mod` exist, scope gates D/E to changed modules only (walk up from each changed file to find its nearest `go.mod`).

### Gate D: Quality Evidence (Mandatory)

Run project-standard checks first; fallback to language defaults.

Preferred order:

1. repo-defined check target (`make test`, `make lint`, etc.)
2. language checks (for Go: `go test ./...`, `golangci-lint run`)

Grade **test**, **lint**, and **build** as three independent dimensions. A command earns a dimension only when all three hold, whatever its source:

1. **It is for that dimension.** Declared (`quality.<dimension>_cmd`, `--test-cmd` / `--lint-cmd` / `--build-cmd`), or recognised from its **argv** — never from its text: a known tool and subcommand (`go test`, `cargo clippy`, `golangci-lint run`) or a task-runner target (`make test`, `npm run lint`). Wrappers (`make ci`, `./scripts/verify.sh`) and shell chains stay unclassified and must be declared.
2. **Its run mode executes a check.** Dry-run, list-only, skip, help, and version modes earn nothing, whether they arrive as arguments (`make -n`, `make -sn`, `pytest --collect-only`, `mvn -DskipTests`) or through the environment the checks inherit (`MAKEFLAGS=n`). This is **applied to every source, including explicit per-dimension declarations**: a declaration states intent; it is never a substitute for execution.
3. **For test, its output shows that a test ran.** Exit status 0 is not enough: on a suite whose only test fails, `go test -run '^$' ./...` and `go test -skip . ./...` exit 0 with `[no tests to run]`. A direct `go test` must report at least one test that ran (under `-bench`, `-fuzz`, or `-exec` only `-v` / `-json` output counts); any other command loses the credit when its output reports zero (`1 skipped, 3 deselected`, `Ran 0 tests`).

The checks run under `/bin/sh -c` with the environment the script inherited, so what they see is what the run-mode check reads; no login profile is re-read. Per-tool detail — which flags are dry runs, bundled short options, `MAKEFLAGS` precedence, which runner summaries are read, and what they cannot tell — is in `references/quality-evidence-rules.md`, which is part of this specification. Load it before running Gate D by hand.

Under-crediting is the safe direction: the dimension stays uncovered and the PR stays draft until the author declares the command per dimension, or declares the dimension not applicable with `quality.not_applicable` / `--quality-na`.

Rules:

- Record exact command and pass/fail result.
- Do not hide failures; include top failure cause.
- If a command is unavailable, mark uncovered risk.
- Report one verdict per dimension: `executed: <cmd>` / `N/A (declared)` / `uncovered: <reason>`. `executed` must mean a command whose documented purpose is that dimension actually ran and exited 0 — and, for test, reported a test that ran — not that a command mentioning it was accepted.
- A dimension with no executed evidence keeps Gate D at `SUPPRESSED` (draft), even when every command that did run passed. Never report `PASS` because the only discovered command succeeded.
- The rendered PR body carries the same per-dimension coverage table, so reviewers see the gap instead of inferring coverage from the command list.

### Gate E: Security and Secret Checks (Mandatory)

```bash
# Filename risk scan (added/copied/modified/renamed files; do not flag deletions)
git diff --name-only --diff-filter=ACMR origin/main...HEAD | grep -Ei '(^|/)(\.env(\..*)?|id_(rsa|dsa|ecdsa|ed25519)|[^/]+\.(pem|key|p12|pfx))$'
# Content risk scan — ADDED LINES ONLY (same semantics as the bundled script:
# removed lines are already in history and are a history-rewrite concern, not a PR gate)
git diff origin/main...HEAD | grep '^+[^+]' | grep -En '(AKIA[0-9A-Z]{16}|-----BEGIN ([A-Z0-9]+ )*PRIVATE KEY|gh[pousr]_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,}|xox[baprs]-|AIza[0-9A-Za-z_-]{35}|password[[:space:]]*[:=]|secret[[:space:]]*[:=]|token[[:space:]]*[:=])'
# SAME content scan over every commit the push would transmit. The net diff above
# cancels out a secret that one commit adds and a later commit deletes, but
# `git push` still sends the first commit and the credential lands in remote history.
for sha in $(git rev-list origin/main..HEAD); do
  git show --format= --unified=0 "$sha" | grep '^+[^+]' | grep -En '(AKIA[0-9A-Z]{16}|-----BEGIN ([A-Z0-9]+ )*PRIVATE KEY|gh[pousr]_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,}|xox[baprs]-|AIza[0-9A-Za-z_-]{35}|password[[:space:]]*[:=]|secret[[:space:]]*[:=]|token[[:space:]]*[:=])' \
    && echo "^ found in commit $sha"
  # The message is pushed too. Structural patterns only: "password: reset flow" in a
  # commit message is a description, not a credential.
  git log -1 --format=%B "$sha" | grep -En '(AKIA[0-9A-Z]{16}|-----BEGIN ([A-Z0-9]+ )*PRIVATE KEY|gh[pousr]_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,}|xox[baprs]-|AIza[0-9A-Za-z_-]{35})' \
    && echo "^ found in the message of commit $sha"
  # Filenames come from git's own path list, NOT from the patch text: a binary
  # patch, an empty new file, and a pure rename carry no +++ header at all.
  git -c core.quotePath=false show --name-only --format= -z --diff-filter=ACMR "$sha" \
    | tr '\0' '\n' | grep -Ei '(^|/)(\.env(\..*)?|id_(rsa|dsa|ecdsa|ed25519)|[^/]+\.(pem|key|p12|pfx))$'
done
# Go-specific (when available)
gosec ./...
govulncheck ./...
```

The canonical script scans added lines in all changed text diffs by default, including docs, comments, extensionless files, `.env` variants, and `.pem`/`.key`/`.p12`/`.pfx` files. Its structural patterns cover every armored private key (`-----BEGIN … PRIVATE KEY-----`: PKCS#8, RSA, EC, DSA, OPENSSH, ENCRYPTED, PGP), AWS access key IDs, GitHub classic (`ghp_`, `gho_`, …) and fine-grained (`github_pat_`) tokens, Slack tokens and Google API keys. The typed private-key headers put the type *before* `PRIVATE KEY`, so a pattern listing `RSA|EC|OPENSSH` in place of the word `PRIVATE` matches only PKCS#8 — that was this skill's pattern until 2026-12-04, and an RSA key pasted into a `.txt` passed. It does not skip alphabetic-only assigned values merely because they lack digits or symbols. Filename checks run independently of content-extension filtering.

**Scan scope is the push range, not the net diff.** The union of (a) added lines and `ACMR` paths in `origin/main...HEAD` and (b) added lines and `ACMR` paths of every commit in `git rev-list origin/main..HEAD`.

**Commit messages are part of the push.** Every message in `git rev-list origin/main..HEAD` is scanned with the structural patterns — not the generic `password=`/`token:` rule, which would flag ordinary descriptions — and a match is a hard publication blocker like any other.

**The secret policy comes from the base branch.** `.create-pr.yaml` is a file in the branch being pushed, so a commit in that branch could disable the scan or allow-list everything for its own push. The script therefore reads the `secret_scan` section from `origin/main` (built-in defaults when the file is not there), reports when the branch's copy differs, and applies the branch's change only once it is merged. An explicit `--config <path>` or `--no-secret-scan` is the user's own decision and is honoured.

**Enumerate paths with git, parse patches only for text.** Path lists come from `--name-only -z --diff-filter=ACMR` (NUL-separated, with `-c core.quotePath=false`); the patch body is read only to collect added *lines*. Deriving paths from `+++` headers loses every file whose patch has no header — binary blobs (`Binary files ... differ`), empty new files, and pure renames — which is exactly how a `.p12` or `id_rsa` slips through. `core.quotePath=false` matters for the same reason: git's default renders a non-ASCII path as an escaped display form (`"\351\205\215.go"`) that never matches the path parsed from the patch, so the file drops out of the content scan entirely. If the commit range cannot be enumerated or exceeds the script's commit cap, the secret evidence is incomplete — fail closed as a hard publication blocker; do not report a pass. A finding that exists only inside the history is reported with its commit, and remediation is a history rewrite (`git rebase -i` / filter-repo), not another deletion commit.

Triage matches with the same exemptions the bundled script applies: environment/config **references** (`os.Getenv(...)`, `process.env.*`, `${VAR}`) are not leaks; placeholder values (`example`, `dummy`, `changeme`, `redacted`) are not leaks; patterns listed in `.create-pr.yaml` `secret_scan.allow_patterns` are exempt. **Allow patterns and placeholder checks apply to the matched credential itself — the token or the assigned value — never to the whole line.** A real token is not exempt because the words `example` or `sample` appear elsewhere on the same line; path-level exemptions belong in `secret_scan.exclude_paths`. Structural high-signal matches (AWS key ID, private-key header, GitHub PAT, Slack token) are exempt only when the allow pattern matches the token text itself. Any surviving high-confidence filename or content match is a hard publication blocker: do not push it, even as a draft.

The built-in scan is a high-signal heuristic, not a complete secret-scanning engine. If the repository provides a dedicated scanner such as Gitleaks or secretlint, run it as a project security check and record the command/result.

### Gate F: Documentation and Compatibility (Mandatory)

- Ensure docs/changelog/readme updates for externally visible behavior changes.
- Check backward compatibility and migration impact.
- If breaking change exists, mark clearly in PR title/body and include rollout/rollback notes.
- `compat_status` has three values and `unknown` is not a pass: Gate F stays `SUPPRESSED` and the generated body must render `Breaking change: unknown — not assessed`, `Compatibility: unknown (not assessed)`, and the list of still-unconfirmed questions. Never render an unassessed change as `non-breaking`.
- Require concrete `Problem/Context` and `Why This Approach` content. For high-risk changes, require change-specific risk and rollback text. For breaking changes, require executable migration notes; never substitute generic “revert and redeploy” guidance.

### Gate G: Commit Hygiene and PR Title (Mandatory)

- Ensure commit set matches the scoped change only — no unrelated commits in the range.
- All commits should use **Conventional Commit** format: `<type>(<scope>): <subject>`.
  - Subject ≤ 50 characters, imperative mood, no trailing period.
  - Every body line must be ≤ 72 characters and explain **why** when a body is present.
  - Footer (when present): `BREAKING CHANGE:`, `Closes #`, `Refs:`.
- **PR title** must also follow Conventional Commits format. Under Squash-and-merge, GitHub pre-fills the PR title for a 2+-commit PR and the single commit's own subject for a 1-commit PR — so both are release-quality artifacts and both are validated.
- Validate the effective PR title, including a user-supplied `--title`; never validate only commit subjects.
- Warn when the branch does not match `<type>/<short-description>`.
- Do not amend existing commits unless user explicitly asks.
- If no commit exists, create one before PR creation.
- Perform a self-review of the full diff: run `git diff --check origin/main...HEAD`, inspect the changed-path list and full diff, and confirm every commit belongs to the scoped change. Pass `--confirm-self-review` only after that semantic review. Without this explicit confirmation, Gate G is `SUPPRESSED` and the PR remains draft.

### Gate H: Post-Create Verification (Mandatory)

After creation:

- Confirm PR points to `base=main` and `head=<feature branch>`.
- Confirm title/body rendered correctly.
- Confirm draft/ready state matches gate outcomes.
- Optionally check CI status with `gh pr checks` (non-blocking; reported as informational).
  CI results are logged but do not change the gate verdict — CI may still be running.

Use and assert every expected value:

- `gh pr view --json number,url,state,isDraft,baseRefName,headRefName,title,body`
- `gh pr checks <pr-number>` (optional, informational)

## Draft vs Ready Decision

Mark `ready` only when all mandatory gates pass or are suppressed with low residual risk.

Keep `draft` when:

- any mandatory gate failed,
- important evidence is missing,
- unresolved design/security/performance questions remain.

Do not publish at all when any gate has a hard publication blocker. A draft is not a safe destination for secrets, an invalid repository identity, `main` as the head, an unsafe branch state (dirty tree, conflicts, head mismatch, failed comparison with `origin/main`), an unavailable secret patch, or an invalid effective PR title. A branch that is merely behind `main` is the exception: it publishes as a draft.

## Required PR Body Structure

Use the template in `references/pr-body-template.md`.

Supply real content with `--problem`, `--approach`, `--risk`, `--rollback`, `--monitoring`, and (for breaking changes) `--migration-notes`. Missing mandatory narrative prevents ready state; generated text must expose the gap instead of inventing a generic rationale or rollback.

Minimum sections:

1. Problem/Context
2. What Changed
3. Why This Approach
4. Risk and Rollback Plan
5. Test Evidence (commands + key outputs)
6. Security Notes
7. Breaking Changes / Migration Notes
8. Reviewer Checklist

## Command Playbook

Use this baseline workflow and adapt to repo conventions:

```bash
# Preflight (repo=., base=main, head=current branch)
git rev-parse --is-inside-work-tree
gh auth status -h github.com
git rev-parse --abbrev-ref HEAD

# Sync
git fetch origin main
git merge-base --is-ancestor origin/main HEAD  # fails if behind

# Evidence
git diff --name-status origin/main...HEAD
go test ./...
golangci-lint run

# Push + PR (optional: --issue, --reviewer, --label)
git push -u origin HEAD
gh pr create --base main --head "$(git rev-parse --abbrev-ref HEAD)" \
  --title "<type(scope): subject>" --body-file /tmp/pr_body.md
gh pr edit <pr-number> --add-reviewer <user1>,<user2> --add-label <label>
gh pr view --json number,url,state,isDraft,baseRefName,headRefName,title,body
```

## Output Contract

Return a concise report in this order:

1. Gate results (`PASS/FAIL/SUPPRESSED/N/A`) with one-line evidence.
2. `Uncovered Risk List` (if any): gap, impact, owner, follow-up.
3. PR metadata: number, URL, draft/ready, base/head.
4. Next actions needed from user/reviewers.

## Load References Selectively

When executing preflight, quality, or security gate checks:
→ Load `references/create-pr-checklists.md` for the per-gate checklists (preflight, scope and risk, quality evidence, security, publication, compatibility) and the uncovered-risk entry format.

When running Gate D by hand, or changing what counts as quality evidence:
→ Load `references/quality-evidence-rules.md` for how commands are classified, which run modes execute nothing (per tool, including bundled short options and `MAKEFLAGS`), and which runner reports show that a test ran.

When composing the PR body:
→ Load `references/pr-body-template.md` for the 8-section Markdown template (Problem/Context, What Changed, Why This Approach, Risk and Rollback, Test Evidence, Security Notes, Breaking Changes, Reviewer Checklist).

When deciding squash vs. merge vs. rebase strategy:
→ Load `references/merge-strategy-guide.md` for merge strategy selection table, PR title conventions per strategy, and commit message landing rules.

When running the automated gate + PR creation workflow in one command:
→ Load `references/bundled-script-guide.md` for `scripts/create_pr.py` usage, flags, and output contract.

When the repo uses a `.create-pr.yaml` config file or you need to create one:
→ Load `references/create-pr-config.example.yaml` for all supported config keys and their defaults.

Files in this skill

  • SKILL.md29.4 KB
  • references/bundled-script-guide.md5.4 KB
  • references/create-pr-checklists.md7.3 KB
  • references/create-pr-config.example.yaml2.6 KB
  • references/merge-strategy-guide.md3.8 KB
  • references/pr-body-template.md1.7 KB
  • scripts/run_regression.sh1.9 KB
  • scripts/tests/COVERAGE.md8.3 KB
  • scripts/tests/golden/001_ready_small_change.json685 B
  • scripts/tests/golden/002_branch_protection_suppressed.json822 B
  • scripts/tests/golden/003_behind_main_blocker.json720 B
  • scripts/tests/golden/004_high_risk_auth_change.json686 B
  • scripts/tests/golden/005_oversized_pr_warning.json668 B
  • scripts/tests/golden/006_quality_gap_keeps_draft.json728 B
  • scripts/tests/golden/007_existing_pr_update.json786 B
  • scripts/tests/golden/008_squash_merge_title_priority.json792 B
  • scripts/tests/golden/009_secret_leak_blocker.json663 B
  • scripts/tests/test_create_pr.py73.7 KB
  • scripts/tests/test_golden_scenarios.py6.3 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.

View all in ai-agents →

Comments

Loading comments…

Newsletter

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