Nghi-NV

git-pr

0
0
# Install this skill:
npx skills add Nghi-NV/create-agent-skills --skill "git-pr"

Install specific skill from multi-skill repository

# Description

Guide for creating effective Pull Requests. Use when opening PRs, writing PR descriptions, requesting reviews, or managing PR workflow.

# SKILL.md


name: git-pr
description: Guide for creating effective Pull Requests. Use when opening PRs, writing PR descriptions, requesting reviews, or managing PR workflow.


Git Pull Requests

This skill provides guidance for creating clear, reviewable Pull Requests that facilitate efficient code review.

When to Use This Skill

  • Opening a new Pull Request
  • Writing PR titles and descriptions
  • Choosing merge strategy
  • Managing PR workflow

Branch Naming

Prefix Use Case Example
feature/ New features feature/user-auth
fix/ Bug fixes fix/login-crash
hotfix/ Urgent production fixes hotfix/security-patch
release/ Release preparation release/v2.1.0
docs/ Documentation docs/api-guide
refactor/ Code refactoring refactor/auth-module

Naming Rules:
- Lowercase with hyphens
- Include ticket number if available: feature/JIRA-123-user-auth
- Keep short but descriptive

PR Title

Follow the same format as commit messages:

<type>(<scope>): <description>

Examples:

feat(auth): add OAuth2 login support
fix(cart): resolve duplicate item bug
docs: update API documentation

PR Description Template

## Summary
Brief description of what this PR does.

## Changes
- Change 1
- Change 2
- Change 3

## Type of Change
- [ ] Bug fix (non-breaking change fixing an issue)
- [ ] New feature (non-breaking change adding functionality)
- [ ] Breaking change (fix or feature causing existing functionality to change)
- [ ] Documentation update

## Testing
- [ ] Unit tests pass
- [ ] Integration tests pass
- [ ] Manual testing completed

## Screenshots (if applicable)
[Add screenshots here]

## Related Issues
Closes #123

PR Size Guidelines

Size Lines Changed Review Time Recommendation
XS < 50 ~10 min βœ… Ideal
S 50-200 ~30 min βœ… Good
M 200-400 ~1 hour ⚠️ Consider splitting
L 400-800 ~2 hours ⚠️ Split if possible
XL > 800 Hours ❌ Split required

[!TIP]
Smaller PRs get reviewed faster and have fewer bugs. Aim for < 400 lines.

Draft vs Ready

State When to Use
Draft Work in progress, not ready for review
Ready Complete, tested, ready for review
# Create as draft
gh pr create --draft

# Mark ready for review
gh pr ready

Requesting Reviews

Choose reviewers who:
- Own the code area being changed
- Have context on the feature/issue
- Are available (check workload)

Minimum reviewers:
- Small changes: 1 reviewer
- Medium changes: 2 reviewers
- Large/critical changes: 2-3 reviewers

Merge Strategies

Strategy Use When Commit History
Merge commit Preserving full history All commits + merge commit
Squash and merge Many small commits Single commit
Rebase and merge Clean, linear history Individual commits, no merge

Recommendations:
- Default: Squash and merge for feature branches
- Use Rebase for clean, well-organized commits
- Use Merge commit when history matters

Resolving Conflicts

# Update your branch with target
git fetch origin
git rebase origin/main
# OR
git merge origin/main

# Resolve conflicts in files
# Then continue
git rebase --continue
# OR
git merge --continue

# Force push (if rebased)
git push --force-with-lease

Decision Tree

PR Workflow
β”œβ”€β”€ Create branch
β”‚   └── Use naming convention: feature/, fix/, etc.
β”œβ”€β”€ Make changes
β”‚   └── Commit using Conventional Commits
β”œβ”€β”€ Open PR
β”‚   β”œβ”€β”€ Work in progress β†’ Create as Draft
β”‚   └── Ready for review β†’ Create as Ready
β”œβ”€β”€ Get reviews
β”‚   β”œβ”€β”€ Changes requested β†’ Address feedback, re-request
β”‚   └── Approved β†’ Proceed to merge
└── Merge
    β”œβ”€β”€ Many small commits β†’ Squash and merge
    β”œβ”€β”€ Clean commit history β†’ Rebase and merge
    └── Need full history β†’ Merge commit

Common Mistakes

Mistake Solution
Huge PR (>500 lines) Split into smaller, focused PRs
Vague title "Fix stuff" Use descriptive title with type
No description Always explain what and why
Merging without review Wait for required approvals
Not resolving conflicts Update branch before merging

GitHub CLI Commands

# Create PR
gh pr create --title "feat: add feature" --body "Description"

# Create draft PR
gh pr create --draft

# View PR status
gh pr status

# Request review
gh pr edit --add-reviewer username

# Merge PR
gh pr merge --squash

# Close PR
gh pr close

Resources

  • PR Template - Copy to .github/PULL_REQUEST_TEMPLATE.md in your repo

# Supported AI Coding Agents

This skill is compatible with the SKILL.md standard and works with all major AI coding agents:

Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.