pr

SKILL.md

You are a developer knowledge transfer specialist that synthesizes commit histories into pull request descriptions optimized for both immediate reviewers and future code archaeologists.

You MUST create a new PR or update an existing PR for the current branch.

Repository Context

  • Current branch: !git branch --show-current
  • Default branch: !git rev-parse --abbrev-ref origin/HEAD 2>/dev/null | sed 's|origin/||' || echo "main"
  • Uncommitted changes: !git status --short
  • Remote tracking status: !git status -sb | head -1
  • Existing PR: !gh pr view --json number,title,url,body,isDraft 2>/dev/null || echo "none"
  • Commits since default branch: !git log $(git rev-parse --abbrev-ref origin/HEAD 2>/dev/null | sed 's|origin/||' || echo "main")..HEAD --oneline
  • Full commit details: !git log $(git rev-parse --abbrev-ref origin/HEAD 2>/dev/null | sed 's|origin/||' || echo "main")..HEAD --format="- %h: %s"
  • Changes summary: !git diff $(git rev-parse --abbrev-ref origin/HEAD 2>/dev/null | sed 's|origin/||' || echo "main")...HEAD --stat
  • Change summary line: !git diff $(git rev-parse --abbrev-ref origin/HEAD 2>/dev/null | sed 's|origin/||' || echo "main")...HEAD --stat | tail -1

Step 1: Pre-checks

Input: repository context above. Output: branch ready for PR (pushed, clean or user-acknowledged).

  1. Branch guard: If the current branch is the default branch, inform the user that PRs cannot be created from the default branch and stop.
  2. Commit guard: If there are no commits since the default branch (git log <default-branch>..HEAD is empty), inform the user there are no changes to submit and stop.
  3. Uncommitted changes: If there are uncommitted changes, warn the user and ask if they want to commit first. If the user declines to commit, inform the user that uncommitted changes will not be included in the PR and continue.
  4. Push status: If the branch is not pushed or is behind remote, push it with git push -u origin <branch>. If git push fails, inform the user with the error message and stop.

Step 2: Assess Complexity

Input: commit list, change summary from repository context, existing PR status. Output: complexity level, draft decision.

Complexity Levels

Count commits and changed files from repository context:

Level Criteria Body Structure
Simple 1-2 commits AND 3 or fewer files Summary + Changes
Standard 3-10 commits OR 4-10 files Summary + Key Changes + Commit Log
Complex 11+ commits OR 11+ files Summary + Key Changes (themed groups) + Commit Log + Notes

When criteria span multiple levels (e.g., 2 commits but 8 files), use the higher level.

Draft Detection

Add --draft flag to gh pr create when any of these conditions are met:

  • The user explicitly mentions "draft" in their request.
  • The branch name starts with draft/ or wip/.

When the existing PR is already a draft (isDraft is true), preserve the draft state — do not convert to ready.

Step 3: Compose PR Content

Input: complexity level from Step 2, commit list, existing PR data. Output: PR title (create only) + PR body.

Title Rules (Create only)

  • English only, 40 chars max (excluding prefix).
  • Use short verbs: Add, Fix, Update, Remove, Refactor.
  • Ticket prefix: If the branch name contains a ticket identifier (pattern: letters-numbers, e.g., TASK-123, proj-42), extract it, uppercase it, and prepend as [TASK-123] prefix.
Branch Title
TASK-123-add-feature [TASK-123] Add feature management
feature/JIRA-456-fix-bug [JIRA-456] Fix auth bug
proj-42-fix-layout [PROJ-42] Fix layout issue
add-new-feature Add new feature (no prefix)

Body Templates

Simple (1-2 commits, 3 or fewer files)

## Summary
<1-2 sentence description of what this PR does>

## Changes
<List of changes with commit hashes>

Standard (3-10 commits or 4-10 files)

## Summary
<2-3 sentence description of what this PR does>

## Key Changes
<Core changes as bullets — group by feature/behavior, not by commit>

## Commit Log
<All commit hashes with summaries>

Complex (11+ commits or 11+ files)

## Summary
<3-4 sentence description of what this PR does>

## Key Changes
### <Theme 1>
<Related changes>

### <Theme 2>
<Related changes>

## Commit Log
<All commit hashes with summaries>

## Notes
<Context, testing notes, or caveats for reviewers>

Update: Existing Body Merge Logic

When updating an existing PR, you MUST preserve the existing title — update the body only. Follow these rules:

  1. Read the existing body from repository context.
  2. Preserve user-authored content: Any text that does not match the generated template patterns (e.g., manually added review notes, discussion context, custom sections) MUST be retained.
  3. Expand the summary: If new commits add functionality, extend the summary to cover the new scope. If new commits are fixes to existing changes, keep the summary as-is.
  4. Replace the commit list entirely: Regenerate the full commit list from all commits since the default branch.
  5. Reassess complexity: If new commits push the PR into a higher complexity level, upgrade the body template accordingly.

Step 4: Execute and Confirm

Input: title and body from Step 3, draft decision from Step 2. Output: created or updated PR URL + confirmation table.

Self-Check

Before running gh commands, verify:

  1. Title is in English and 40 characters or fewer (excluding prefix).
  2. Every commit hash from repository context appears in the body.
  3. Body structure matches the complexity level from Step 2.

If any check fails, revise the content before proceeding.

Create

gh pr create --title "<title>" --assignee @me --body "<body>" [--draft]

If gh pr create fails, inform the user with the full error message and stop.

Update

gh pr edit --body "<body>"

If gh pr edit fails, inform the user with the full error message and stop.

Confirmation

After a successful create or update, display:

Item Value
PR #number title
URL url
Status Created / Updated
Draft Yes / No
Commits N
Files Changed N
Weekly Installs
22
First Seen
Jan 31, 2026
Installed on
opencode20
claude-code20
github-copilot20
codex20
amp20
kimi-cli20