create-pull-request
Skill này làm gì
Skill này hướng dẫn các bước mở pull request trên GitHub, từ kiểm tra nhánh tới viết mô tả. Nó dành cho lập trình viên muốn thay đổi của họ được rà soát.
Khi nào nên dùng
- ✓Khi ai đó yêu cầu mở pull request hoặc gửi thay đổi để rà soát.
- ✓Khi một nhánh có các commit cần tóm tắt rõ ràng cho người rà soát.
- ✓Khi dự án có template pull request cần theo.
Liên kết skill
https://github.com/cline/cline/blob/main/.agents/skills/create-pull-request/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Thay đổi của tôi đang nằm trên một nhánh. Bạn có thể mở pull request trên GitHub với mô tả rõ ràng không?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent kiểm tra GitHub CLI đã được cài và đăng nhập chưa, rà soát các commit trên nhánh, rồi điền template pull request của dự án. Sau đó nó tạo pull request bằng công cụ gh.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Create Pull Request
This skill guides you through creating a well-structured GitHub pull request that follows project conventions and best practices.
Prerequisites Check
Before proceeding, verify the following:
1. Check if gh CLI is installed
gh --version
If not installed, inform the user:
The GitHub CLI (
gh) is required but not installed. Please install it:
- macOS:
brew install gh- Other: https://cli.github.com/
2. Check if authenticated with GitHub
gh auth status
If not authenticated, guide the user to run gh auth login.
3. Verify clean working directory
git status
If there are uncommitted changes, ask the user whether to:
- Commit them as part of this PR
- Stash them temporarily
- Discard them (with caution)
Gather Context
1. Identify the current branch
git branch --show-current
Ensure you're not on main or master. If so, ask the user to create or switch to a feature branch.
2. Find the base branch
git remote show origin | grep "HEAD branch"
This is typically main or master.
3. Analyze recent commits relevant to this PR
git log origin/main..HEAD --oneline --no-decorate
Review these commits to understand:
- What changes are being introduced
- The scope of the PR (single feature/fix or multiple changes)
- Whether commits should be squashed or reorganized
4. Review the diff
git diff origin/main..HEAD --stat
This shows which files changed and helps identify the type of change.
Information Gathering
Before creating the PR, you need the following information. Check if it can be inferred from:
- Commit messages
- Branch name (e.g.,
fix/issue-123,feature/new-login) - Changed files and their content
If any critical information is missing, use ask_followup_question to ask the user:
Required Information
- Related Issue Number: Look for patterns like
#123,fixes #123, orcloses #123in commit messages - Description: What problem does this solve? Why were these changes made?
- Type of Change: Bug fix, new feature, breaking change, refactor, cosmetic, documentation, or workflow
- Test Procedure: How was this tested? What could break?
Example clarifying question
If the issue number is not found:
I couldn't find a related issue number in the commit messages or branch name. What GitHub issue does this PR address? (Enter the issue number, e.g., "123" or "N/A" for small fixes)
Git Best Practices
Before creating the PR, consider these best practices:
Commit Hygiene
- Atomic commits: Each commit should represent a single logical change
- Clear commit messages: Follow conventional commit format when possible
- No merge commits: Prefer rebasing over merging to keep history clean
Branch Management
Rebase on latest main (if needed):
git fetch origin git rebase origin/mainSquash if appropriate: If there are many small "WIP" commits, consider interactive rebase:
git rebase -i origin/mainOnly suggest this if commits appear messy and the user is comfortable with rebasing.
Push Changes
Ensure all commits are pushed:
git push origin HEAD
If the branch was rebased, you may need:
git push origin HEAD --force-with-lease
Create the Pull Request
IMPORTANT: Read and use the PR template at .github/pull_request_template.md. The PR body format must strictly match the template structure. Do not deviate from the template format.
When filling out the template:
- Replace
#XXXXwith the actual issue number, or keep as#XXXXif no issue exists (for small fixes) - Fill in all sections with relevant information gathered from commits and context
- Mark the appropriate "Type of Change" checkbox(es)
- Complete the "Pre-flight Checklist" items that apply
Create PR with gh CLI
Use a temporary file for the PR body to avoid shell escaping issues, newline problems, and other command-line flakiness:
Write the PR body to a temporary file:
/tmp/pr-body.mdCreate the PR using the file:
gh pr create --title "PR_TITLE" --body-file /tmp/pr-body.md --base mainClean up the temporary file:
rm /tmp/pr-body.md
For draft PRs:
gh pr create --title "PR_TITLE" --body-file /tmp/pr-body.md --base main --draft
Why use a file?
Câu hỏi thường gặp
Cần thiết lập gì trước?
Skill yêu cầu GitHub CLI, tức gh, phải được cài đặt và đăng nhập.
Nếu còn thay đổi chưa commit thì sao?
Skill yêu cầu hỏi xem nên commit, stash hay bỏ chúng trước khi tiếp tục.
Có thể mở pull request từ main không?
Không. Skill yêu cầu chuyển sang một nhánh tính năng nếu bạn đang ở main.
Chi tiết
Mô tả gốc của tác giả
Create a GitHub pull request following project conventions. Use when the user asks to create a PR, submit changes for review, or open a pull request. Handles commit analysis, branch management, PR template usage, and PR creation using the gh CLI tool.
repo: cline/cline
Độ phổ biến
- Sao GitHub
- 71k
- Vị trí xếp hạng
- #3106
- Giấy phép
- Apache-2.0
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
cline-sdk
71kDạy agent của bạn xây dựng AI agent bằng Cline SDK, bao gồm tool, phiên làm việc, sự kiện, nhà cung cấp mô hình và các đội nhiều agent.
opentui
71kGiúp agent của bạn xây giao diện người dùng terminal bằng OpenTUI, bao gồm bố cục, xử lý bàn phím, thành phần, hoạt ảnh và kiểm thử.
tuistory
71kDạy agent của bạn điều khiển và kiểm thử ứng dụng terminal trong một phiên chạy nền, gõ lệnh và đọc màn hình, ngay cả khi không có màn hình hiển thị.
Skill tương tự
diffs
394kGiúp agent của bạn tạo một diff có thể chia sẻ về các chỉnh sửa, dưới dạng liên kết xem hoặc file ảnh, thay vì một bản tóm tắt viết tay.
coding-agent
394kGiúp agent của bạn giao một việc lập trình lớn cho Codex, Claude Code hoặc OpenCode chạy nền, rồi theo dõi tiến độ của nó.
gh-issues
394kGiúp agent của bạn tìm issue trên GitHub, chọn những issue cần xử lý và mở pull request với bản sửa, kể cả theo dõi nhận xét đánh giá.