From ravn-ai-toolkit
Analyzes git diffs and commit history to fill PR templates and create pull requests via gh CLI. Use when creating PRs, filling templates, or needing description help.
npx claudepluginhub ravnhq/ai-toolkitThis skill is limited to using the following tools:
Analyze git diffs and commit history to intelligently fill PR templates and create pull requests via `gh` CLI. This skill walks through detecting the base branch, analyzing changes, reading the project's PR template, filling it with context from commits and diffs, and creating the PR.
Creates GitHub Pull Requests using GitHub CLI: detects existing PRs for branches, pushes changes, generates titles/bodies from commits. Handles monorepos/submodules. Use for /create-pr or PR/review requests.
Creates GitHub pull requests from branch changes using git analysis and gh CLI, with conventional commit titles and standardized templated descriptions including summary, changes, testing, and checklists.
Creates GitHub pull requests from conversation context and git changes with standardized markdown formatting, testing notes, related issues, and tags from docs/git-msg-tags.md.
Share bugs, ideas, or general feedback.
Analyze git diffs and commit history to intelligently fill PR templates and create pull requests via gh CLI. This skill walks through detecting the base branch, analyzing changes, reading the project's PR template, filling it with context from commits and diffs, and creating the PR.
Determine what base branch this PR will target:
# Check if develop exists; fall back to main
git rev-parse --verify develop 2>/dev/null && echo "develop" || echo "main"
# Current branch
git branch --show-current
Check if a PR already exists for the current branch:
gh pr list --head $(git branch --show-current) --json number,url,title
If a PR exists, stop and inform the user. Ask if they want to update the description with gh pr edit instead.
Gate: If there are uncommitted changes or the branch is behind remote, warn the user and stop:
# Check for uncommitted changes
git status --porcelain
# Check if branch is behind remote
git rev-parse @{u} 2>/dev/null && git log --oneline @..@{u}
If the branch has no remote tracking, push with -u before creating the PR:
git push -u origin $(git branch --show-current)
Gather the full context of changes since the base branch:
# Get the base branch
BASE=$(git rev-parse --verify develop 2>/dev/null && echo "develop" || echo "main")
# Changed files
git diff ${BASE}...HEAD --name-only
# Commit log with oneline format
git log --oneline ${BASE}..HEAD
# Diff stats (file-level changes)
git diff ${BASE}...HEAD --stat
# Full diff for review (optional, context-dependent)
git diff ${BASE}...HEAD
Analyze the changes to understand:
Locate and read the project's PR template:
# Standard locations
ls -la .github/PULL_REQUEST_TEMPLATE.md .github/pull_request_template.md PULL_REQUEST_TEMPLATE.md pull_request_template.md 2>/dev/null | head -1
If found, read the entire template to understand:
If no template is found, create a minimal PR with just title and description.
Fill each section of the template based on the changes:
Title: Use conventional commit format
feat:, fix:, refactor:, docs:, test:, chore: based on the majority of commits<type>: <short description>feat: add authentication service integrationDescription:
PUL3-34, #123)Type of Change:
feat → New Feature, fix → Bug Fix, refactor → Code Refactoring, test → Tests, docs → Documentation, chore/build → Build/Config[x] for selected, [ ] for unselectedBreaking Changes:
POST /api/auth/login now requires oauth_provider field. Existing calls without this field will return 400. Migrate by updating client-side auth code to specify the provider."Screenshots / Videos:
src/components/, pages/, app/, or file extensions like .jsx, .tsx, .vue): add placeholder <!-- Please attach screenshots/videos of UI changes -->N/A — No UI changesAdditional Notes / Checklist:
N/A or leave empty per template styleUse gh pr create with the filled template and title:
gh pr create \
--base ${BASE} \
--title "<type>: <short description>" \
--body "<filled template body as HEREDOC or string>"
Example:
gh pr create --base develop \
--title "feat: add authentication service integration" \
--body $'## Description\nAdds OAuth 2.0 support for third-party integrations.\n\n## Type of Change\n- [x] New Feature\n- [ ] Bug Fix\n\n## Breaking Changes\n- [ ] Yes\n- [x] No\n\n## Screenshots\nN/A'
Important: Preserve markdown formatting from the template. Use shell HEREDOC ($'...') or multi-line strings to maintain section separators and formatting.
After gh pr create succeeds, output:
https://github.com/owner/repo/pull/456)Example output:
PR created: https://github.com/ravn/ai-toolkit/pull/123
Type: feat (New Feature)
Changes: 3 files, 156 additions
Affected areas: Authentication service, OAuth integration tests
Ready for review.
User: "fill the PR template and create a pull request for my branch"
Expected behavior: Use agent-pr-creator workflow to analyze git history, read the PR template, fill all sections intelligently based on the changes, and create the PR via gh pr create.
User: "I need to open a pull request with a good description"
Expected behavior: Use agent-pr-creator to gather context from commits and diffs, analyze the change type (feat/fix/refactor), detect breaking changes, and create a comprehensive PR with proper title and body following conventions.
User: "Make a PR to main"
Expected behavior: Use agent-pr-creator to detect the base branch, analyze all changes since branching, fill the template following project conventions, and create the PR.
User: "Review this pull request: https://github.com/org/repo/pull/123"
Expected behavior: Do not use agent-pr-creator. The user wants to review an existing PR, not create one. Use gh pr view or a review skill instead.
User: "What changes are in my branch?"
Expected behavior: Do not use agent-pr-creator. The user wants to see changes, not create a PR. Use git diff or git log directly.
.github/PULL_REQUEST_TEMPLATE.md or similar..github/ and common root locations. If none exist, create a minimal PR with just title and description using the conventional commit format.gh pr create fails because a PR already exists for this branch.gh pr edit <PR> instead of creating a new one./commit or stashing first. For branch behind: pull and rebase before creating the PR.gh pr create fails because branch has no upstream tracking.git push -u origin <branch-name>, then create the PR.gh commands fail with "not authenticated" or "token expired" error.gh auth login to re-authenticate, then retry the skill.