Pr

From Takazudo/claude-resources · View interactive version

Pr is an AI agent skill from the GitHub repository Takazudo/claude-resources. Create a pull request with automatic base-branch detection. Use for 'create pr', 'make pr', 'open pr', or when a feature branch is ready for a PR.

How to use this skill

Skill file

PR Command

Create a pull request with automatic base branch detection from conversation history, git log, or repository default.

Usage

Steps

1. Verify Current State

git status
git branch --show-current

Ensure you're on a feature branch (not main/master/develop).

2. Determine Base Branch

Priority order for base branch detection:

  1. Explicit argument: If <target-branch> is provided, use it directly
  2. Conversation context: Search conversation history for mentions of:
  1. Git history: Auto-detect from git log and merge-base
  2. Repository default: Use the default branch as fallback
Conversation History Check

Search the current conversation for clues about the base branch:

Git History Detection
# Fetch latest remote refs
git fetch origin

# Find merge-base with candidate branches
for branch in main master develop staging; do
  git merge-base HEAD origin/$branch 2>/dev/null && echo "Found: $branch"
done

# Check which branch has the closest merge-base
# The branch with most recent common ancestor is likely the parent
Repository Default Fallback
# Get the default branch
gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name'

3. Check for Existing PR

gh pr list --head $(git branch --show-current)

If PR exists, ask user if they want to view or update it.

4. Analyze Changes

# Get commits
git log origin/<base-branch>..HEAD --oneline

# Get file changes
git diff origin/<base-branch>..HEAD --stat

5. Confirm with User

Before creating, confirm:

6. Push and Create PR

# Push if needed
git push -u origin $(git branch --show-current)

# Create PR
gh pr create \
  --base <base-branch> \
  --title "<title>" \
  --body "$(cat <<'EOF'
## Summary
<description>

## Changes
- <change 1>
- <change 2>

## Test Plan
<testing instructions>
EOF
)"

7. Report Result

Display:

Detection Logic

The command uses this logic to find the base branch:

  1. User-specified: Highest priority - use the argument directly
  2. Conversation analysis: Check conversation for branch context
  3. Git merge-base: Find closest common ancestor with candidate branches
  4. Default branch: Ultimate fallback using gh repo view

If detection is ambiguous, ask the user to clarify before creating the PR.

Important Notes

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.