--- description: Create a pull request with auto-generated summary from commits argument-hint: [base-branch] - Optional base branch (defaults to main/master) --- # Create Pull Request ## Pre-computed Context **Current Branch:** !`git branch --show-current` **Base Branch:** !`if [ -n "$ARGUMENTS" ]; then echo "$ARGUMENTS"; else git remote show origin 2>/dev/null | grep "HEAD branch" | cut -d: -f2 | tr -d ' ' || echo "main"; fi` **Remote Tracking:** !`git rev-parse --abbrev-ref --symbolic-full-name @{u} 2>/dev/null || echo "No upstream branch"` **Commits for PR:** !`BASE=$(if [ -n "$ARGUMENTS" ]; then echo "$ARGUMENTS"; else git remote show origin 2>/dev/null | grep "HEAD branch" | cut -d: -f2 | tr -d ' ' || echo "main"; fi); git log --oneline origin/$BASE...HEAD 2>/dev/null || git log --oneline $BASE...HEAD 2>/dev/null | head -20` **Files Changed:** !`BASE=$(if [ -n "$ARGUMENTS" ]; then echo "$ARGUMENTS"; else git remote show origin 2>/dev/null | grep "HEAD branch" | cut -d: -f2 | tr -d ' ' || echo "main"; fi); git diff --stat origin/$BASE...HEAD 2>/dev/null || git diff --stat $BASE...HEAD 2>/dev/null` **Diff Summary:** !`BASE=$(if [ -n "$ARGUMENTS" ]; then echo "$ARGUMENTS"; else git remote show origin 2>/dev/null | grep "HEAD branch" | cut -d: -f2 | tr -d ' ' || echo "main"; fi); git diff origin/$BASE...HEAD --shortstat 2>/dev/null || git diff $BASE...HEAD --shortstat 2>/dev/null` **Working Tree Clean:** !`git status --porcelain | wc -l | xargs -I{} sh -c 'if [ {} -eq 0 ]; then echo "Yes"; else echo "No - {} uncommitted changes"; fi'` --- ## Instructions You are creating a pull request for the current branch. ### 1. Pre-flight Checks Verify before creating PR: - [ ] Working tree is clean (no uncommitted changes) - [ ] Branch is pushed to remote - [ ] There are commits to include in the PR If branch is not pushed: ```bash git push -u origin $(git branch --show-current) ``` ### 2. Analyze All Commits Review ALL commits that will be in the PR (not just the latest). Understanding the full scope: - What feature/fix does this PR implement? - What are the key changes? - Are there any breaking changes? ### 3. Generate PR Title Create a concise title following the pattern: - `feat: Add user authentication flow` - `fix: Resolve race condition in data sync` - `refactor: Simplify error handling logic` ### 4. Generate PR Body Use this format: ```markdown ## Summary - [1-3 bullet points describing what this PR does] ## Changes - [List key changes made] ## Test Plan - [ ] [How to test this PR] - [ ] [Additional verification steps] --- Generated with [Claude Code](https://claude.ai/claude-code) ``` ### 5. Create PR ```bash gh pr create --title "