| name | create-pull-request |
| description | Creates a Pull Request using GitHub CLI with a PR summary file. Generates PR-summary.md in the feature-specs folder to avoid terminal pasting issues. |
Create Pull Request Skill
Purpose
This skill creates a GitHub Pull Request using the gh CLI tool. To avoid issues with pasting large text into the terminal, it first creates a PR-summary.md file in /docs/feature-specs/${featureName}/, then must commit and push that summary file, and only then runs gh pr create with that file as the PR body.
Prerequisites
- GitHub CLI (
gh) must be installed and authenticated
- Current branch must be pushed to the remote
- There must be commits to create a PR from
- The executing agent must have terminal execution tools (see Terminal Handoff if you don't)
Terminal Handoff
If you don't have terminal execution tools, hand off to the Coder agent with the following scope constraint:
Scope constraint: Execute ONLY the git and gh CLI commands provided below. Do NOT edit code, fix warnings, refactor, or take any action beyond running these commands and reporting their output. If a command fails, report the error — do not attempt autonomous fixes.
Include in your handoff:
- The exact commands to run (from Steps 2, 6, and 7)
- The PR title (from Step 4)
- The path to the PR summary file (from Step 5)
- This scope constraint verbatim
Workflow
Step 1: Determine Feature Name and Base Branch
Extract the feature name from the current branch name:
feature/my-feature → my-feature
bugfix/fix-description → fix-description
Determine the base branch by checking which remote branches exist:
- Default to
main if it exists
- Fall back to
develop or master if main doesn't exist
Step 2: Analyze Changes
Gather all context automatically:
BASE_BRANCH="main"
MERGE_BASE=$(git merge-base HEAD origin/${BASE_BRANCH})
git log --oneline ${MERGE_BASE}..HEAD
git log --pretty=format:"%s%n%n%b" ${MERGE_BASE}..HEAD
git diff --stat ${MERGE_BASE}
git diff --name-only ${MERGE_BASE}
Step 3: Check Existing Documentation
Look for existing feature documentation:
/docs/feature-specs/${featureName}/implementation-plan.md - for planned changes
/docs/feature-specs/${featureName}/implementation-progress.md - for completed work
/docs/feature-specs/${featureName}/low-level-design-*.md - for design context
/docs/feature-specs/${featureName}/user-stories.md - for requirements
Step 4: Generate PR Title
Auto-generate the PR title based on:
- If single commit: Use the commit message subject
- If multiple commits: Summarize the overall change based on:
- The feature name from the branch
- The types of files changed (e.g., "Add meter component" if UI components added)
- Commit message patterns (e.g., "fix:", "feat:", "refactor:")
Examples:
- Branch
feature/meter-improvements with perf commits → "Improve meter performance and accuracy"
- Branch
bugfix/slider-crash → "Fix slider crash on invalid input"
- Branch
cs-1234-add-reverb → "CS-1234: Add reverb effect"
Step 5: Create PR Summary File
⚠️ Use the edit tool to create this file - DO NOT use terminal commands like echo.
Create the file at /docs/feature-specs/${featureName}/PR-summary.md using the template from assets/PR-summary-template.md.
Tool usage:
- Use the
edit tool or equivalent file creation capability
- Never use
echo, cat, or other terminal commands for file creation
- The file editor ensures proper formatting and allows immediate editing if needed
Fill in the auto-generated content for each section:
- Summary: Based on commit messages and changed files
- Changes: Grouped by area (Engine/DSP, UI, Build/Config, Documentation)
- Commits: List from
git log --oneline
- Related Documentation: Auto-link existing feature-spec files
- Testing: Based on types of changes made
- Checklist: Standard quality checks
Step 6: Commit and Push PR Summary (Mandatory)
This step is required. Always stage and commit docs/feature-specs/${featureName}/PR-summary.md before creating the PR to avoid leaving an unstaged summary file behind.
Run the following commands:
git add docs/feature-specs/${featureName}/PR-summary.md
git diff --cached --quiet || git commit -m "docs: add PR summary for ${featureName}"
git push -u origin HEAD
Step 7: Create the Pull Request
Run this only after Step 6 succeeds.
Run the following commands:
gh pr create \
--title "${PR_TITLE}" \
--body-file "docs/feature-specs/${featureName}/PR-summary.md" \
--base "${BASE_BRANCH}"
Step 8: Confirm Success
After successful PR creation:
- Display the PR URL to the user
- Optionally open the PR in the browser with
gh pr view --web
Error Handling
- If
gh is not installed: Instruct user to install with brew install gh
- If not authenticated: Run
gh auth login
- If branch not pushed: Push with
git push -u origin HEAD
- If PR already exists: Inform user and provide link to existing PR
Example Usage
User says: "Create a PR for my changes"
Agent workflow:
- Determine feature name from branch:
feature/meter-improvements → meter-improvements
- Analyze commits: 3 commits about performance improvements
- Check changed files:
ui/src/components/Meter.tsx, ui/src/lib/audio-math.ts
- Auto-generate title: "Improve meter performance and accuracy"
- Create
docs/feature-specs/meter-improvements/PR-summary.md with auto-generated content
- Run:
git add docs/feature-specs/meter-improvements/PR-summary.md, then git diff --cached --quiet || git commit -m "docs: add PR summary for meter-improvements", then git push -u origin HEAD
- Run:
gh pr create --title "Improve meter performance and accuracy" --body-file "docs/feature-specs/meter-improvements/PR-summary.md" --base main
- Return: "✅ PR created: https://github.com/owner/repo/pull/123"
Notes
- Committing and pushing
docs/feature-specs/${featureName}/PR-summary.md before gh pr create is mandatory
- If the feature-specs folder doesn't exist for this feature, create it
- Always use relative paths from the repository root in the
--body-file argument
- All PR details (title, description) are auto-generated from branch changes - no user input required