Github pr best practices

From aiskillstore/marketplace · View interactive version

Github pr best practices is an AI agent skill from the GitHub repository aiskillstore/marketplace. Best practices for creating GitHub pull requests including conventional commits, PR formatting, and multi-language support (en/ja). Use when creating PRs, writing PR descriptions, or formatting commit messages.

How to use this skill

Skill file

GitHub Pull Request Best Practices

This Skill provides comprehensive guidance for creating high-quality pull requests following industry best practices and conventional commit standards.

Capabilities

When to Use

Use this Skill when you need to:

PR Title Format

Conventional Commits Standard

PR titles must follow Conventional Commits format:

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

Important: NO emojis in PR titles or descriptions.

Common Types

Scope (Optional but Recommended)

The scope should indicate what part of the codebase is affected:

Description

Examples

Good:

feat(auth): add OAuth2 authentication
fix(api): resolve timeout on large requests
docs(readme): update installation instructions
refactor(database): optimize query performance
test(auth): add integration tests for login flow
chore(deps): update dependencies to latest versions

Bad:

✨ Add new feature  (has emoji)
Fixed bug  (not following format, wrong tense)
Update.  (vague, has period)
FEAT: NEW STUFF  (all caps, vague)

PR Description Structure

Standard Template

## Summary
- Brief description of changes (1-3 bullet points)
- Focus on what and why, not how
- Keep each point concise

## Test plan
- [ ] Test case 1
- [ ] Test case 2
- [ ] Verified no regressions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Key Principles

  1. Summary Section
  1. Test Plan Section
  1. Signature

Detailed Explanation (When Needed)

For complex PRs, add additional sections before the signature:

## Summary
- Main changes

## Background
Context or motivation for changes

## Implementation Details
High-level overview of approach

## Test plan
- [ ] Tests

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Multi-Language Support

English (Default)

Use English when no language is specified or when language is en:

## Summary
- Add user authentication with OAuth2
- Implement token refresh mechanism
- Add comprehensive error handling

## Test plan
- [ ] Test OAuth2 login flow
- [ ] Test token refresh
- [ ] Test error scenarios

Japanese

Use Japanese when language is ja:

## 概要
- OAuth2によるユーザー認証を追加
- トークンリフレッシュ機能を実装
- 包括的なエラーハンドリングを追加

## テスト計画
- [ ] OAuth2ログインフローのテスト
- [ ] トークンリフレッシュのテスト
- [ ] エラーシナリオのテスト

Language Selection Guidelines

PR Template Integration

Using Project Templates

If the project has a PR template at .github/pull_request_template.md:

  1. Read the template file
  2. Follow its structure exactly
  3. Don't modify section headers
  4. Don't add custom sections
  5. Fill in all required sections (use "N/A" if not applicable)

Template Best Practices

GitHub CLI Best Practices

Creating PRs with gh

Basic command structure:

gh pr create --draft --title "feat(scope): description" --body "$(cat <<'EOF'
## Summary
- Changes

## Test plan
- [ ] Tests

🤖 Generated with [Claude Code](https://claude.com/claude-code)
EOF
)"

Important notes:

  1. Use HEREDOC format for multi-line descriptions
  2. Start with --draft flag for work in progress
  3. Use cat <<'EOF' (with quotes) to prevent variable expansion
  4. gh pr create automatically pushes the branch (no manual push needed)

Draft vs Ready

Start as draft when:

Convert to ready when:

gh pr ready <PR-NUMBER>

Common Mistakes to Avoid

  1. Manual Push Before PR Creation
  1. Including Emojis
  1. Incorrect Conventional Commit Format
  1. Vague Descriptions
  1. Ignoring Language Argument
  1. Modifying Template Structure

Analyzing Commits for PR

Use All Commits, Not Just Latest

When creating a PR, analyze ALL commits from the merge base:

# Get merge base
MERGE_BASE=$(git merge-base origin/main HEAD)

# Get ALL commits from merge base
git log $MERGE_BASE..HEAD

Why this matters:

Extracting PR Content from Commits

# Get commit messages for summary
git log --format="- %s" $MERGE_BASE..HEAD

# Get changed files for context
git diff --name-only $MERGE_BASE..HEAD

# Get commit count
git log --oneline $MERGE_BASE..HEAD | wc -l

Quality Checklist

Before creating a PR, verify:

Related Skills

Additional Resources

See REFERENCE.md for:

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.