Agent skill

git-pull-request

How to create and manage pull requests in github using gh CLI.

Stars 0
Forks 0

Install this agent skill to your Project

npx add-skill https://github.com/TheOutdoorProgrammer/dotfiles/tree/main/.config/opencode/skills/git-pull-request

SKILL.md

Git Pull Request Skill

Create GitHub pull requests using the gh CLI tool with parallel context gathering for efficiency.


PHASE 1: Parallel Context Gathering (MANDATORY FIRST STEP)

Execute ALL of the following commands IN PARALLEL to minimize latency:

Group 1: Repository State

bash
git status
git branch --show-current
git log --oneline -10

Group 2: Change Analysis

bash
git diff main...HEAD --stat
git diff main...HEAD
git log main..HEAD --format='%h %s%n%b'
git remote get-url origin

Capture these data points simultaneously:

  1. Working tree status (clean or dirty)
  2. Current branch name
  3. Recent commit history for context
  4. Files changed (diff stats)
  5. Full diff content
  6. Commits on this branch (hash, subject, body)
  7. Remote repository URL

PHASE 2: Branch Status Check

Check if branch is tracking remote and push status:

bash
git branch -vv | grep "<current-branch>"

Determine:

  • Is branch tracking a remote?
  • Is branch ahead/behind remote?
  • Does branch need to be pushed?

PHASE 3: Push Branch (If Needed)

If branch is not pushed or needs updating:

bash
git push -u origin <branch-name>

Notes:

  • Use -u flag to set upstream tracking
  • If already pushed and up-to-date, this is a no-op

PHASE 4: Create Pull Request

Use gh pr create with heredoc for the body to ensure proper formatting:

bash
gh pr create --title "<PR Title>" --body "$(cat <<'EOF'
## Summary

- <bullet point 1>
- <bullet point 2>
- <bullet point 3>

## Changes

<Description of what changed and why>

1. **Section 1**: <description>
2. **Section 2**: <description>
3. **Section 3**: <description>
EOF
)" --base main

Critical:

  • Use <<'EOF' (with quotes) to prevent variable expansion in the heredoc
  • The --base flag specifies the target branch (usually main)
  • Title should be concise and descriptive
  • Body uses markdown formatting

PR Body Structure

Summary Section

  • 1-3 bullet points capturing the high-level changes
  • Focus on what and why

Changes Section

  • Detailed description of modifications
  • Numbered list for multiple distinct changes
  • Use bold for section/file names
  • Use regular bullet points, never checkboxes

IMPORTANT: No Checkboxes

NEVER use checkboxes (- [ ] or - [x]) in PR bodies.

Checkboxes require manual updating after PR creation which is tedious and gets ignored. Use regular bullet points instead.


Error Handling

Branch not pushed

Branch needs to be pushed first:
git push -u origin <branch-name>

PR already exists

Check first:

bash
gh pr list --head <branch-name>

Not on a feature branch

You're on main/master. Checkout a feature branch first.

No commits ahead

Branch has no commits ahead of main. Nothing to create a PR for.

Quick Reference Commands

Action Command
Check status git status
Current branch git branch --show-current
Diff stats git diff main...HEAD --stat
Full diff git diff main...HEAD
Branch commits git log main..HEAD --format='%h %s%n%b'
Remote URL git remote get-url origin
Tracking status git branch -vv | grep "<branch>"
Push with tracking git push -u origin <branch>
Create PR gh pr create --title "..." --body "..." --base main
List PRs for branch gh pr list --head <branch>
View PR gh pr view

Trigger Phrases

Use this skill when user says:

  • "Create a PR"
  • "Open a pull request"
  • "Make a PR for this branch"
  • "Submit this for review"
  • "Create a pull request"
  • "PR this"

Example Workflow Execution

bash
# PHASE 1: Parallel context gathering
# Group 1
git status
git branch --show-current
git log --oneline -10

# Group 2 (parallel with Group 1)
git diff main...HEAD --stat
git diff main...HEAD
git log main..HEAD --format='%h %s%n%b'
git remote get-url origin

# PHASE 2: Check tracking
git branch -vv | grep "feature-branch"

# PHASE 3: Push if needed
git push -u origin feature-branch

# PHASE 4: Create PR
gh pr create --title "Add feature X" --body "$(cat <<'EOF'
## Summary

- Added feature X to improve Y
- Fixed issue with Z
- Updated documentation

## Changes

This PR implements feature X which allows users to do Y more efficiently.

1. **Component A**: Added new handler for X
2. **Component B**: Updated interface to support X
3. **Docs**: Added usage examples
EOF
)" --base main

Output: https://github.com/owner/repo/pull/123

Expand your agent's capabilities with these related and highly-rated skills.

TheOutdoorProgrammer/dotfiles

agent-slack

Slack automation CLI for AI agents. Use when: - Reading a Slack message or thread (given a URL or channel+ts) - Browsing recent channel messages / channel history - Downloading Slack attachments (snippets, images, files) to local paths - Searching Slack messages or files - Sending, editing, or deleting a message; adding/removing reactions - Listing channels/conversations; creating channels and inviting users - Fetching a Slack canvas as markdown - Looking up Slack users - Opening DM or group DM channels Triggers: "slack message", "slack thread", "slack URL", "slack link", "read slack", "reply on slack", "search slack", "channel history", "recent messages", "channel messages", "latest messages"

0 0
Explore
TheOutdoorProgrammer/dotfiles

find-skills

Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.

0 0
Explore
mattpocock/skills

handoff

Compact the current conversation into a handoff document for another agent to pick up.

111,310 9,758
Explore
mattpocock/skills

scaffold-exercises

Create exercise directory structures with sections, problems, solutions, and explainers that pass linting. Use when user wants to scaffold exercises, create exercise stubs, or set up a new course section.

111,310 9,758
Explore
mattpocock/skills

obsidian-vault

Search, create, and manage notes in the Obsidian vault with wikilinks and index notes. Use when user wants to find, create, or organize notes in Obsidian.

111,310 9,758
Explore
mattpocock/skills

setup-pre-commit

Set up Husky pre-commit hooks with lint-staged (Prettier), type checking, and tests in the current repo. Use when user wants to add pre-commit hooks, set up Husky, configure lint-staged, or add commit-time formatting/typechecking/testing.

111,310 9,758
Explore

Didn't find tool you were looking for?

Be as detailed as possible for better results