一键导入
pr
Format, lint, test, commit, push, and create a pull request. The single "I'm done" command.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Format, lint, test, commit, push, and create a pull request. The single "I'm done" command.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when looking for the next ticket to work on. Detects the project's ticket system (GitHub Issues, Jira, GitLab Issues, Azure Boards, etc.), fetches actionable open tickets that are unassigned or assigned to you, scores by severity/simplicity/value/blocking-power/dependencies, picks the best candidate, claims it by self-assigning (team-safe), branches, implements, tests, formats, and waits for review with a UI testing tip. Accepts an optional ticket ID argument (e.g., `/next-ticket 42`, `/next-ticket PROJ-42`) to skip evaluation and pick up a specific ticket directly.
Compress markdown files into concise prose to save input tokens. Default mode reduces verbosity without losing information. With deep, verifies each section against the codebase first, removing stale or incorrect content before compressing. Trigger: /compress-markdown [deep] <filepath>
Craft a well-researched, well-structured ticket from a user-provided idea. Explores project context when available, researches prior art, asks clarifying questions only when options are too nuanced to auto-resolve, deduplicates against the existing backlog, and files one world-class ticket. Works for new or mature codebases.
Read PR review comments, validate against code, fix valid ones, push, resolve addressed threads, and explain unresolved ones.
Use when completing tasks, implementing major features, or before merging to verify work meets requirements
Convert a git worktree into a local branch. Rebase onto latest default branch, clean up project resources, remove worktree, checkout branch in main workspace. Use when finishing work in a worktree.
| name | pr |
| model | sonnet |
| effort | high |
| description | Format, lint, test, commit, push, and create a pull request. The single "I'm done" command. |
| disable-model-invocation | true |
Single command to go from "I'm done" to "PR is open."
Resolve default branch (shared branch lifecycle contract from AGENTS.md):
First check the PR cache (see the PR Cache section below for its worktree-safe path). If it has a baseBranch, use it. Otherwise resolve it with the snippet and write it back to the cache:
BASE_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's|refs/remotes/origin/||')
if [ -z "$BASE_BRANCH" ]; then
git rev-parse --verify main >/dev/null 2>&1 && BASE_BRANCH=main || BASE_BRANCH=master
fi
Verify not on default branch: if the current branch (from the step 2 preflight read) equals $BASE_BRANCH, stop and tell the user to create a feature branch first.
Inventory working tree and commit implementation work:
git branch --show-current, which also answers step 1), working-tree state (git status --porcelain), and the untracked path list (git ls-files --others --exclude-standard). Label each section so one call covers steps 1 and 2.git diff --cached for staged content and git diff for unstaged content. For untracked files, do not read each one in full. Skip binary files entirely (never read binary content). For text files, use judgment about signal value: low-signal generated files (lockfiles, golden or snapshot fixtures, vendored or generated code, large data fixtures) get a light skim or no content read, then stage by path; genuine source files get read normally. You may git add -N the intended text paths to view them inside a single git diff instead of reading each separately, but still stage content explicitly by path.feat: for new functionality, fix: for bugfixes, refactor: for restructuring without behavior change, docs: for documentation, style: for formatting, test: for tests, perf: for performance, build: for build-system changes, ci: for CI configuration, chore: for everything else. Only feat: and fix: drive a release-please bump, so misclassifying functional work as chore: silently skips its release. Do not use a wip: placeholder. Do not run git add -A blindly; stage by explicit path so untracked files are added intentionally..gitignore or stash it before /pr continues. The skill does not stash silently.$BASE_BRANCH (verified in step 6).Format and lint (check CLAUDE.md for the project's commands):
Run tests (check CLAUDE.md for the project's test command):
Stage and commit auto-fixed files:
git status for changes from formattingstyle: auto-format and lint fixes. This is a separate commit from the implementation commit in step 2.Pre-push gate (build the publication inventory before any push). Run the read-only checks below in a single shell call with labeled sections, re-resolving BASE_BRANCH at the top of that call since shell state does not persist between Bash invocations:
BASE_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's|refs/remotes/origin/||')
if [ -z "$BASE_BRANCH" ]; then
git rev-parse --verify main >/dev/null 2>&1 && BASE_BRANCH=main || BASE_BRANCH=master
fi
git rev-list --count "$BASE_BRANCH..HEAD". If zero, stop and report "nothing to publish". This is the only valid no-op exit.git status --porcelain must be empty. If anything remains, stop and report which paths are still uncommitted. The skill never pushes a branch while staged, unstaged, or untracked work remains.git diff --name-status "$BASE_BRANCH"...HEAD lists every committed path the push will publish. Read this list..env, .env.*, *.pem, *.key, id_rsa*, *.p12, *.pfx, *credential*, *secret*, or *.sqlite*. The user must explicitly confirm or remove the path before push.Push to remote:
git ls-remote --heads origin $(git branch --show-current)git push -u origin $(git branch --show-current)git pushExtract issue number from branch name:
<category>/<number>-<desc> → #<number>fix/224-streaming-upload-size-check → 224Create or update PR:
gh pr view --json number,url 2>/dev/nullUnderstand scope from commit messages and file-level stats, not a re-read of the full content diff: git log "$BASE_BRANCH"..HEAD (messages) plus git diff --stat "$BASE_BRANCH"...HEAD (changed paths). If the diff content was already captured earlier in this conversation and no commits were added since, reuse it. Read full hunks only for commits whose messages do not explain the change.
Resolve PR template: if the PR cache (see the PR Cache section below) has a prTemplatePath and that file still exists, use it. Otherwise discover it by checking these paths in order, using the first that exists, then write the result to the cache:
PR_TEMPLATE=""
for candidate in \
.github/pull_request_template.md \
.github/PULL_REQUEST_TEMPLATE.md \
pull_request_template.md \
PULL_REQUEST_TEMPLATE.md \
docs/pull_request_template.md \
docs/PULL_REQUEST_TEMPLATE.md; do
if [ -f "$candidate" ]; then
PR_TEMPLATE="$candidate"
break
fi
done
Build PR body:
If template found (PR_TEMPLATE is non-empty): Read the template file. Use it as the skeleton for the PR body:
- [ ] / - [x]) based on what the branch actually contains (tests added, docs updated, breaking changes present, etc.)Closes #<number> after the last sectionIf no template found (or the template file is empty): Use the default body:
## Summary
<3-5 bullet points on what and why>
## Changes
<Key technical changes as bullet list>
## Testing
<What was tested locally>
Closes #<number>
Concise title (under 70 chars, conventional commit style)
Create PR with gh pr create passing the title and built body
Transition ticket to In Review (non-blocking):
<category>/<ticket-id>-<desc>, where the ticket ID may be a bare number (42) or a prefixed key (PROJ-42). If no ticket ID is extractable, skip.next-ticket-config.json from the system temp directory. If the file does not exist or has no ticket-system entry for the current project root, skip.states key yet) or has no states.in_review entry, discover the state. If it has a cached states.in_review entry, skip to applying.
next-ticket Step 4.6 for the schema) if needed, then write the result under states.in_review. Store enough system-specific detail to replay mechanically on future runs.$BASE_BRANCH): Inform user there's nothing to PR and stopgit pull --rebase origin <branch>gh not authenticated: Detect with gh auth status, show clear errorCache stable, structural repo facts in $(git rev-parse --git-dir)/agents/pr-cache.json. Always resolve the path with git rev-parse --git-dir so worktrees are handled, and create the agents/ directory if it is absent. The cache is local, uncommitted, and disposable.
Cache shape:
{
"schemaVersion": 1,
"baseBranch": "main",
"prTemplatePath": ".github/pull_request_template.md"
}
These entries are structural configuration, not drifting policy, so there is no TTL and no time-based invalidation. Read them and trust them.
Repair only on failure: if a cached value stops working (the prTemplatePath file no longer exists, or baseBranch fails to resolve or yields an empty diff range), re-derive that one entry and overwrite it. Do not invalidate the whole cache.
Do not cache the format, lint, or test commands. Read those from the project instructions each run.
# The only command you need
/pr
# Typical workflow:
# 1. Make changes on feature branch
# 2. /pr (does everything: inventory, commit, format, lint, test, push, PR)
# 3. Review PR in GitHub