返回技能列表

create-pull-request

pjt222
更新于 2 days ago
7 次查看
17
2
17
在 GitHub 上查看
wordaiautomation

关于

This skill automates GitHub pull request creation and management using GitHub CLI, handling branch setup, PR descriptions, and review workflows. It's designed for proposing feature/fix branches for review, merging work, and documenting changes. Key capabilities include structured PR creation, feedback handling, and post-merge cleanup.

快速安装

Claude Code

推荐
主要方式
npx skills add pjt222/agent-almanac -a claude-code
插件命令备选方式
/plugin add https://github.com/pjt222/agent-almanac
Git 克隆备选方式
git clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/create-pull-request

在 Claude Code 中复制并粘贴此命令以安装该技能

技能文档

Create Pull Request

Create a GitHub pull request with a clear title, structured description, and proper branch setup.

When to Use

  • Proposing changes from a feature or fix branch for review
  • Merging completed work into the main branch
  • Requesting code review from collaborators
  • Documenting the purpose and scope of a set of changes

Inputs

  • Required: Feature branch with committed changes
  • Required: Base branch to merge into (usually main)
  • Optional: Reviewers to request
  • Optional: Labels or milestone
  • Optional: Draft status

Procedure

Step 1: Ensure Branch Is Ready

Verify the branch is up to date with the base branch and all changes are committed:

# Check for uncommitted changes
git status

# Fetch latest from remote
git fetch origin

# Rebase on latest main (or merge)
git rebase origin/main

Got: Branch is ahead of origin/main with no uncommitted changes and no conflicts.

If fail: If rebase conflicts occur, resolve them (see resolve-git-conflicts skill), then git rebase --continue. If the branch has diverged significantly, consider git merge origin/main instead.

Step 2: Review All Changes on the Branch

Examine the full diff and commit history that will be included in the PR:

# See all commits on this branch (not on main)
git log origin/main..HEAD --oneline

# See the full diff against main
git diff origin/main...HEAD

# Check if branch tracks remote and is pushed
git status -sb

Got: All commits are relevant to the PR. The diff shows only intended changes.

If fail: If unrelated commits are present, consider interactive rebase to clean up history before creating the PR.

Step 3: Push the Branch

# Push branch to remote (set upstream tracking)
git push -u origin HEAD

Got: Branch appears on GitHub remote.

If fail: If push is rejected, pull first with git pull --rebase origin <branch> and resolve any conflicts.

Step 4: Write PR Title and Description

Keep the title under 70 characters. Use the body for details:

gh pr create --title "Add weighted mean calculation" --body "$(cat <<'EOF'
## Summary
- Implement `weighted_mean()` with NA handling and zero-weight filtering
- Add input validation for mismatched vector lengths
- Include unit tests covering edge cases

## Test plan
- [ ] `devtools::test()` passes with no failures
- [ ] Manual verification with example data
- [ ] Edge cases: empty vectors, all-NA weights, zero-length input

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

For draft PRs:

gh pr create --title "WIP: Add authentication" --body "..." --draft

Got: PR created on GitHub with a URL returned. Description clearly communicates what changed and how to test.

If fail: If gh is not authenticated, run gh auth login. If the base branch is wrong, specify with --base main.

Step 5: Handle Review Feedback

Respond to review comments and push updates:

# View PR comments
gh api repos/{owner}/{repo}/pulls/{number}/comments

# View PR review status
gh pr checks

# After making changes, commit and push
git add <files>
git commit -m "$(cat <<'EOF'
fix: address review feedback on input validation

EOF
)"
git push

Got: New commits appear on the PR. Review comments are addressed.

If fail: If CI checks fail after pushing, read the check output with gh pr checks and fix the issues before requesting re-review.

Step 6: Merge and Clean Up

After approval:

# Merge the PR (squash merge keeps history clean)
gh pr merge --squash --delete-branch

# Or merge with all commits preserved
gh pr merge --merge --delete-branch

# Or rebase merge (linear history)
gh pr merge --rebase --delete-branch

After merge, update local main:

git checkout main
git pull origin main

Got: PR is merged, remote branch is deleted, local main is updated.

If fail: If merge is blocked by failing checks or missing approvals, address those first. Do not force-merge without resolving blockers.

Validation

  • PR title is concise (under 70 characters) and descriptive
  • PR body includes summary of changes and test plan
  • All commits on the branch are relevant to the PR
  • CI checks pass
  • Branch is up to date with base branch
  • Reviewers are assigned (if required by repository settings)
  • No sensitive data in the diff

Pitfalls

  • PR too large: Keep PRs focused on a single feature or fix. Large PRs are harder to review and more likely to have merge conflicts.
  • Missing test plan: Always describe how the changes can be verified, even for documentation PRs.
  • Stale branch: If the base branch has moved ahead significantly, rebase before creating the PR to minimize merge conflicts.
  • Force-pushing during review: Avoid force-pushing to a branch with open review comments. Push new commits so reviewers can see incremental changes.
  • Not reading CI output: Check gh pr checks before asking for re-review. Failing CI wastes reviewers' time.
  • Forgetting to delete branch: Use --delete-branch with merge to keep the remote clean.

Related Skills

  • commit-changes - creating commits for the PR
  • manage-git-branches - branch creation and naming conventions
  • resolve-git-conflicts - handling conflicts during rebase/merge
  • create-github-release - releasing after merge

GitHub 仓库

pjt222/agent-almanac
路径: i18n/caveman-lite/skills/create-pull-request
0
agentsagentskillsai-assisted-developmentclaude-codeskillsteams

相关推荐技能

content-collections

Content Collections 是一个 TypeScript 优先的构建工具,可将本地 Markdown/MDX 文件转换为类型安全的数据集合。它专为构建博客、文档站和内容密集型 Vite+React 应用而设计,提供基于 Zod 的自动模式验证。该工具涵盖从 Vite 插件配置、MDX 编译到生产环境部署的完整工作流。

查看技能

polymarket

这个Claude Skill为开发者提供完整的Polymarket预测市场开发支持,涵盖API调用、交易执行和市场数据分析。关键特性包括实时WebSocket数据流,可监控实时交易、订单和市场动态。开发者可用它构建预测市场应用、实施交易策略并集成实时市场预测功能。

查看技能

creating-opencode-plugins

该Skill帮助开发者创建OpenCode插件,用于接入命令、文件、LSP等25+种事件。它提供了插件结构、事件API规范和JavaScript/TypeScript实现模式,适合需要拦截操作、扩展功能或自定义事件处理的场景。开发者可通过它快速构建响应式模块来增强OpenCode AI助手的能力。

查看技能

sglang

SGLang是一个专为LLM设计的高性能推理框架,特别适用于需要结构化输出的场景。它通过RadixAttention前缀缓存技术,在处理JSON、正则表达式、工具调用等具有重复前缀的复杂工作流时,能实现极速生成。如果你正在构建智能体或多轮对话系统,并追求远超vLLM的推理性能,SGLang是理想选择。

查看技能