agentleFS
blamechrisblamechris/chroxy/.claude/skills/create-pr/SKILL.md

create-pr

Skill8 starsChanged 8 days agoMITView on GitHub

Create a pull request with auto-detected issue closures and proper formatting.

196 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use update-pr, act-on-feedback and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • MicrosoftSkill

    update-pr

    Update the pull request for the current session. Use when the user wants to push new changes to an existing PR.

    Also in 9 projects that use this

  • MicrosoftSkill

    act-on-feedback

    Act on user feedback attached to the current session. Use when the user submits feedback on the session's changes via the Submit Feedback button.

    Also in 3 projects that use this

  • ModelEngine-GroupSkill

    create-release-note

    从 PR/commit 中自动生成结构化的 Release Notes,并可选创建 GitHub Draft Release。支持 x.y.0 版本合并前一 minor 系列的 release notes。当用户要求生成发布说明、创建 release notes 时触发。参数为版本号和可选的上一版本号。

    Also in 3 projects that use this

  • frostneySkill

    native-nostalgia-stack

    Applies the user's FreePascal toolchain and its build, formatting, hook, and test contracts while leaving project-specific mechanics local. Use when scaffolding or working in a FreePascal project that follows this toolchain.

    Also in 3 projects that use this

  • frostneySkill

    software-engineering-excellence

    Applies the user's engineering standards during substantial technical work: preserve scope, use current evidence, delegate independent parts, and complete authorized outcomes. Use during substantial implementation, debugging, refactoring, or multi-part delivery work.

    Also in 3 projects that use this

  • parkchuSkill

    start-mission

    넥스트스텝(NextStep) 미션을 처음 시작할 때, 미션 저장소를 fork·clone하고 최초 작업 브랜치(step1 등)까지 만들어 준다. gh CLI로 fork하고 clone까지 이어서 처리하며, gh가 없거나 인증이 안 돼 있으면 브라우저 Fork 안내로 폴백한다. 이미 fork/clone돼 있으면 재사용하고 이어서 진행한다(재실행 안전). 사용자가 "미션 시작하려는데 저장소 세팅해줘", "새 미션 시작할래", "fork부터 해줘", "/nextstep:start-mission" 등으로 요청할 때 사용한다.

    Also in 3 projects that use this

  • +1 more from microsoft

The file

We split this skill into the rules it gives an agent

8 rules. 0 are common, 5 are distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 179 edited versions we read keep these.

  • 5

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Create a pull request with auto-detected issue closures and proper formatting.

    line 7
  2. Distinctive:

    For each candidate issue: Verify it's open and the PR's changes actually address it.

    line 61
  3. Very specific:

    If branch has commit messages referencing issues (#NNN) but NONE of those issues appear closable, warn the user: "Commits reference #X but …

    line 69
  4. Distinctive:

    When closing multiple issues in one PR (common for from-review batches):

    line 97
  5. Very specific:

    PR Title: Keep under 70 characters. Use conventional commit format: type(scope): summary

    line 120
  6. Distinctive:

    Before creating the PR, verify:

    line 128
  7. Distinctive:

    After PR creation, confirm the Closes tags were recognized:

    line 169
  8. Very specific:

    If any expected issues are missing from closingIssuesReferences, the Closes #N syntax may have been malformed.

    line 178

“Common” is measured: kept by at least 6 in 10 of the 179 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

/create-pr

Create a pull request with auto-detected issue closures and proper formatting.

Arguments

  • $ARGUMENTS - Optional: PR title override, or "batch" to use batch-fix template

Instructions

1. Verify Branch State

BRANCH=$(git branch --show-current)
REPO=$(gh repo view --json nameWithOwner -q .nameWithOwner)

# Ensure we're not on main
if [ "$BRANCH" = "main" ] || [ "$BRANCH" = "master" ]; then
  echo "ERROR: Cannot create PR from main branch. Create a feature branch first."
  exit 1
fi

# The branch this PR is for. Record it now; step 5 re-asserts it before pushing.
SESSION_BRANCH="${BRANCH}"
PR_HEAD=$(git rev-parse HEAD)

git status
git log main..HEAD --oneline
git diff main --stat

Review the commits and changed files. Understand the full scope of work before drafting the PR.

Assert the branch before you write. Everything below — the diff you summarize, the issues you detect, the branch you push — is derived from HEAD at this moment. HEAD is global to the working copy, so a concurrent session can move it while you are drafting, and a PR body written from one branch's diff pushed onto another is silently wrong. Re-check git branch --show-current against SESSION_BRANCH immediately before any edit to the working tree and again immediately before the push in step 5. Re-check, never remember.

If this skill amends the branch at all (a fixup commit, a rebase, a README touch-up before opening the PR), stage explicit paths: git status --short, then git add the files you changed by name. Never git add -A, git add ., git add -u, git add <dir>/, or git commit -a — a bulk add sweeps another session's file into the PR you are about to open. -u is not the safe one: it restages every tracked file whose worktree copy differs, including files a clean/smudge filter rewrote without you touching them — that is how git add -u turned a tracked 21KB .docx into a git-lfs pointer and committed it as an edit.

2. Detect Closable Issues

Scan for issues this PR should close. Check THREE sources:

# Source 1: Issue numbers referenced in commit messages (#NNN)
git log main..HEAD --format='%s %b' | grep -oE '#[0-9]+' | sort -u

# Source 2: Issue numbers in branch name (e.g., fix/auth-rate-limit-434 → #434)
echo "$BRANCH" | grep -oE '[0-9]+' | while read num; do
  # Verify it's a real open issue
  gh issue view "$num" --json state,title -q 'select(.state == "OPEN") | "#\(.number // empty): \(.title // empty)"' 2>/dev/null
done

# Source 3: Open from-review issues whose title/body matches changed files
CHANGED_FILES=$(git diff main --name-only | head -20)
gh issue list --label "from-review" --state open --json number,title,body --limit 50

For each candidate issue: Verify it's open and the PR's changes actually address it. Don't claim to close an issue the commits don't fix.

Build the CLOSES_LINES list — one Closes #N per confirmed issue:

Closes #434
Closes #447

If branch has commit messages referencing issues (#NNN) but NONE of those issues appear closable, warn the user: "Commits reference #X but the issue is already closed / not found. Proceeding without Closes tags."

3. Draft PR Content

Based on the commits, changed files, and detected issues, draft the PR.

If $ARGUMENTS contains "batch" OR the PR closes 3+ issues, use Batch Fix template. Otherwise use Default template.

Default Template

## Summary

- Change 1
- Change 2
- Change 3

${CLOSES_LINES}

## Test Plan

- [ ] Server tests pass
- [ ] App type-checks clean
- [ ] Manual smoke test

Batch Fix Template

When closing multiple issues in one PR (common for from-review batches):

## Summary

Brief overview of the batch.

| Issue | What changed | Files |
|-------|-------------|-------|
| #434 | Added auth rate limiting | `ws-server.js` |
| #447 | Added deploy rollback tests | `supervisor.test.js` |
| #433 | Auto mode confirmation handshake | `ws-server.js`, `connection.ts`, `SettingsBar.tsx` |

${CLOSES_LINES}

## Test Plan

- [ ] Server tests pass
- [ ] App type-checks clean
- [ ] Dashboard tests pass
- [ ] Manual smoke test

PR Title: Keep under 70 characters. Use conventional commit format: type(scope): summary

For batch-fix PRs: fix: batch from-review fixes (#N, #M, #P) or similar.

Write the exact drafted Markdown body to a task-specific scratch file using the file-writing tool. Also write a task-specific JSON request with repo, branch, head, base, title and body_file (absolute path). Preserve the repository, branch and full head SHA observed in step 1; do not replace them with a later checkout. This durable request carries the verified inputs between tool calls without assuming shell variables survive. Review its title, body and issue closures in step 4.

4. Validate Scope and Authorization

Before creating the PR, verify:

  1. Title (proposed)
  2. Body (proposed, including Closes tags)
  3. Issues to close (list with titles)
  4. Branch and base (main)

Creating the PR is part of delegated implementation and an explicit /create-pr request. Proceed within that scope without another routine confirmation. A planning-only request or an explicit user publication hold requires the concrete title/body to be presented before requesting the missing authorization. Never add unrelated work or close an issue whose acceptance this PR does not satisfy.

5. Push and Create PR

Run the following with the actual scratch request path from step 3. It re-asserts the recorded branch and head immediately before pushing, pushes that exact commit, and passes the body file unchanged to GitHub. If either assertion fails, reconcile ownership and redraft from the intended branch before trying again; never silently adopt the new checkout.

python3 - /absolute/path/to/pr-request.json <<'PYTHON'
import json
from pathlib import Path
import subprocess
import sys

request = json.loads(Path(sys.argv[1]).read_text())
required = ("repo", "branch", "head", "base", "title", "body_file")
if any(not isinstance(request.get(key), str) or not request[key].strip() for key in required):
    raise SystemExit("STOP: incomplete PR request")
body = Path(request["body_file"])
if not body.is_absolute() or not body.is_file() or not body.read_text().strip():
    raise SystemExit("STOP: missing or empty PR body file")
branch = subprocess.check_output(["git", "branch", "--show-current"], text=True).strip()
head = subprocess.check_output(["git", "rev-parse", "HEAD"], text=True).strip()
if branch != request["branch"] or head != request["head"]:
    raise SystemExit("STOP: branch or HEAD changed since the PR draft; reconcile before pushing")
subprocess.run(["git", "push", "-u", "origin",
                request["head"] + ":refs/heads/" + request["branch"]], check=True)
subprocess.run(["gh", "pr", "create", "--repo", request["repo"],
                "--head", request["branch"], "--base", request["base"],
                "--title", request["title"], "--body-file", str(body)], check=True)
PYTHON

6. Verify Issue Links

After PR creation, confirm the Closes tags were recognized:

PR_NUM=$(gh pr view --json number -q .number)

# Verify linked issues appear in PR metadata
gh pr view ${PR_NUM} --json closingIssuesReferences -q '.closingIssuesReferences[].number'

If any expected issues are missing from closingIssuesReferences, the Closes #N syntax may have been malformed. Edit the PR body to fix.

7. Report to User

Output a summary table — this is the PRIMARY output:

| PR | Branch | Closes | Changes |
|----|--------|--------|---------|
| #XX | feat/branch-name | #434, #447, #433 | rate limiting, rollback tests, auto mode confirm |

Then below the table:

  • PR URL
  • List of issues that will auto-close on merge
  • "Ready for review" or next steps

Critical Rules

  1. NO attribution — No Co-Authored-By, no "Generated with Claude", no AI mentions. Zero Attribution Policy.
  2. Auto-detect issues — Always scan commits, branch name, and from-review issues. Never skip detection.
  3. Reuse publication authority — Delegated implementation and an explicit /create-pr request include PR creation; verify scope and proceed without another routine confirmation. Honor explicit publication holds and request only genuinely missing authority with the concrete title/body ready.
  4. Closes tags go in the body — Use Closes #N on its own line in the PR body. GitHub only auto-closes from the body, not the title.
  5. Verify after creation — Check that closingIssuesReferences matches expected issues.
  6. Target main — Always create PRs against main unless the user specifies otherwise.
  7. Don't fabricate — Only add Closes #N for issues the PR's changes actually address. If unsure, ask.
  8. Assert the branch before you write — record the branch as SESSION_BRANCH in step 1 and re-check git branch --show-current against it before any working-tree edit and again before the push. HEAD is global to the working copy; a concurrent session can move it while you draft.
  9. Explicit-path staging — if you stage anything at all, git status --short then git add the changed files by name. Never git add -A, git add ., git add -u, git add <dir>/, or git commit -a. -u is not the safe one: it restages tracked files a clean/smudge filter rewrote behind your back, which is how a tracked 21KB .docx was committed as a git-lfs pointer.

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.