pull-request
npx skills add https://github.com/arcblock/agent-skills --skill pull-request
Agent 安装分布
Skill 文档
Pull Request Skill
Generate standardized Pull Requests by analyzing the diff between current branch and main branch.
Step 0: Check for Project PR Template (IMPORTANT)
CRITICAL: Before generating PR content, ALWAYS check if the project has a custom PR template:
# Check for PR template in common locations
ls -la .github/PULL_REQUEST_TEMPLATE.md 2>/dev/null || \
ls -la .github/PULL_REQUEST_TEMPLATE/ 2>/dev/null || \
ls -la docs/PULL_REQUEST_TEMPLATE.md 2>/dev/null
If a PR template exists:
- Read the template file using the Read tool
- Use that template’s structure for the PR body
- Fill in each section according to the template’s format and comments
- Keep any checkboxes or structured lists from the template
If no PR template exists: Use the default template defined below.
PR Template (Default – Use only if no project template exists)
Based on analysis of high-quality PRs, use this template:
Title Format
<type>(<scope>): <description>
Types (same as Conventional Commits):
| Type | Description |
|---|---|
feat |
New feature |
fix |
Bug fix |
docs |
Documentation only |
style |
Code style changes |
refactor |
Code refactoring |
perf |
Performance improvement |
test |
Add or modify tests |
chore |
Build process or tools |
ci |
CI/CD configuration |
build |
Build system changes |
Scope: Optional, indicates affected module (e.g., devflow, blocklet, auth)
Description:
- Imperative mood (“add” not “added”)
- Lowercase first letter
- No period at end
- Under 72 characters
Body Format
## Summary
<1-5 bullet points describing key changes>
## Motivation / Context
<Why this change is needed - the problem being solved>
## Changes
<Detailed list of what was changed, organized by area>
## Test Plan
<How to verify the changes work correctly>
- [ ] Step 1
- [ ] Step 2
---
Generated with [Claude Code](https://claude.com/claude-code)
Workflow
Step 1: Gather Branch Information
# Get current branch name
git branch --show-current
# Get main branch (usually 'main' or 'master')
git remote show origin | grep 'HEAD branch' | cut -d' ' -f5
# Check if branch is pushed to remote
git status -sb
Step 2: Analyze All Commits and Changes
IMPORTANT: Analyze ALL commits from branch divergence point, not just the latest commit.
# Get the merge base (where current branch diverged from main)
git merge-base main HEAD
# View all commits since diverging from main
git log main..HEAD --oneline
# Get comprehensive diff statistics
git diff main...HEAD --stat
# Get full diff for content analysis
git diff main...HEAD
Step 3: Generate PR Content
Based on the diff analysis:
-
Determine type: Look at the nature of changes
- New files/features â
feat - Bug fixes â
fix - Only .md files â
docs - Only test files â
test - Configuration/tooling â
chore
- New files/features â
-
Identify scope: Look at which module/area is most affected
-
Use project template if exists: If Step 0 found a PR template:
- Read the template file
- Fill in each section according to the template’s structure
- Keep all checkboxes from the template (check appropriate ones based on changes)
- Respect the template’s language (Chinese/English)
- Follow any instructions in HTML comments
-
Otherwise use default template:
- Write summary: Capture the essence of ALL commits, not just one
- Document motivation: Explain why these changes are needed
- List changes: Organize by logical groupings
- Create test plan: Practical verification steps
Step 4: Present PR Draft and Ask User
Display the generated PR title and body to the user, then use AskUserQuestion to determine next action:
{
"questions": [{
"question": "How would you like to proceed with this PR?",
"header": "PR Action",
"options": [
{"label": "Save as PR.md (Recommended)", "description": "Save PR content to PR.md file in project root (will overwrite if exists)"},
{"label": "Submit via gh", "description": "Create PR directly using GitHub CLI"}
],
"multiSelect": false
}]
}
Step 5A: If “Save as PR.md”
Write the PR content to ./PR.md in the project root:
# PR Title
<type>(<scope>): <description>
---
## Summary
...
## Motivation / Context
...
## Changes
...
## Test Plan
...
---
Generated with [Claude Code](https://claude.com/claude-code)
Inform user that PR.md has been created (or overwritten if it existed).
Step 5B: If “Submit via gh”
5B.1: Check gh CLI availability
which gh
If gh is not found:
GitHub CLI (gh) is not installed. Please install it:
- macOS: brew install gh
- Linux: See https://github.com/cli/cli/blob/trunk/docs/install_linux.md
- Windows: winget install --id GitHub.cli
After installation, run: gh auth login
5B.2: Check gh authentication
gh auth status
If not authenticated or token lacks permissions:
GitHub CLI is not authenticated or lacks permissions. Please run:
gh auth login
Select:
- GitHub.com
- HTTPS
- Authenticate with browser (recommended)
Ensure you grant 'repo' scope for creating PRs.
5B.3: Check if branch is pushed
git status -sb
If branch is not pushed to remote:
# Push current branch to origin
git push -u origin $(git branch --show-current)
5B.4: Create the PR
gh pr create --base main --title "<title>" --body "$(cat <<'EOF'
<body content>
EOF
)"
5B.5: Report Success
Display the PR URL and summary to the user.
Example Output
Title
feat(devflow): add PR generation skill
Body
## Summary
- Add new `pull-request` skill for generating standardized Pull Requests
- Analyze diff between current branch and main branch
- Support both gh CLI submission and PR.md file generation
- Include comprehensive PR template based on best practices
## Motivation / Context
Creating consistent, well-documented PRs is important for code review efficiency.
This skill automates PR generation by analyzing git diff and following established patterns.
## Changes
### New Files
- `.claude/skills/pull-request/SKILL.md` - Pull Request generation skill definition
### Workflow
- Step 1: Gather branch and diff information
- Step 2: Analyze all commits since branch divergence
- Step 3: Generate PR content following template
- Step 4: Ask user for submission method
- Step 5: Execute chosen action (gh submit or save to file)
## Test Plan
- [ ] Run `/pull-request` on a feature branch with changes
- [ ] Verify PR title follows conventional commit format
- [ ] Verify summary captures all changes
- [ ] Test gh submission flow
- [ ] Test PR.md generation flow
Example Output (With Project Template)
When project has .github/PULL_REQUEST_TEMPLATE.md, fill in that template instead:
Title
feat(test): add coverage merge and reporting support
Body (following project template structure)
### å
³è Issue
related: https://github.com/example/repo/issues/123
### ä¸»è¦æ¹å¨
1. æ°å¢ `--coverage` åæ°æ¯ææµè¯è¦ççæ¶é
2. å建 `merge-coverage.js` èæ¬åå¹¶ææåå
çè¦ççæ¥å
3. éæ°å¯ç¨ CI è¦ççæ¥ååè½
4. æé¤ç¼è¯ååèªå¨çæçæä»¶ä»¥è·å¾åç¡®çè¦ççç»è®¡
### ç颿ªå¾
N/A (æ UI åæ´)
### æµè¯æ¸
å
- [x] æ¬æ¬¡åæ´çå°æ¹å·²ç»ææµè¯è¦ç
- [ ] æ¬æ¬¡åæ´çå°æ¹è°æ´äºæµè¯è¦ç
- [x] æ¬æ¬¡åæ´çå°æ¹æ°å¢äºæµè¯è¦ç
- [ ] æ¬æ¬¡åæ´çå
¼å®¹æ§æµè¯è¦çäºæ¡é¢ç«¯ Chrome
- [ ] æ¬æ¬¡åæ´çå
¼å®¹æ§æµè¯è¦çäºæ¡é¢ç«¯ Safari
- [ ] æ¬æ¬¡åæ´çå
¼å®¹æ§æµè¯è¦çäºç§»å¨ç«¯ï¼ArcSphere + DID Wallet
- [ ] æ¬æ¬¡åæ´ææ°å¢çé¢ï¼ä¸ææ£æ¥äº light 模å¼ä¸çå±ç¤ºææ
- [ ] æ¬æ¬¡åæ´ææ°å¢çé¢ï¼ä¸ææ£æ¥äº dark 模å¼ä¸çå±ç¤ºææ
- [ ] å¦æä¿®æ¹ domain ç¸å
³ issue, è¯·æ£æ¥ server / service / è´ä¹°å¯å¨ä¸ æ¯å¦æ£å¸¸
### æ£æ¥æ¸
å
- [x] è¿æ¬¡åæ´å
å« breaking changeï¼æä¸º breaking change ç¼åäº migration scriptã妿䏿¯ breaking change å¯ä»¥å¾éã
- [ ] æ¬æ¬¡åæ´éè¦æ´æ°ææ¡£ï¼å¹¶ä¸ææ´æ°äºç¸å
³ææ¡£ï¼å¦æè¿æ²¡æ´æ°ææ¡£ï¼è¯·æ°å»ºææ¡£æ´æ°ç Issue å¹¶å
³è䏿¥
- [x] æ¬æ¬¡åæ´ä¸æç¨æ·è¾å
¥çé»è¾ï¼ç¨æ·è¾å
¥çå端ãå端é½å¢å äºæ ¡éªãé误æç¤º
- [ ] æ¬æ¬¡åæ´ä¸æ°å¢äºä¿®æ¹åç«¯æ°æ®ç APIï¼æç»è¿ä¸ª API å¢å äº AuditLog
- [x] æ¬æ¬¡åæ´ä¸æ°å¢äºä¿®æ¹åç«¯æ°æ®ç APIï¼ä¸è¯¥æ¥å£è¿åçæ°æ®ä¸ä¸å
嫿æä¿¡æ¯
- [x] æ¬æ¬¡åæ´æ°å¢äºæä»¶ï¼å¯¹åº package.json ç files åæ®µå
æ¬äºè¿äºæ°å¢çæä»¶
- [ ] æ¬æ¬¡åæ´å¢å äºä¾èµï¼å¹¶ä¸ core/blocklet-services å core/webapp çå端ä¾èµææ¾å¨äº devDependencies éé¢
- [ ] æ¬æ¬¡åæ´å¢å äº blocklet/sdk çä¾èµï¼ä¸ä¼å¯¼è´ bundle 失败
- [ ] æ¬æ¬¡åæ´ä¸ææ·»å ææ´æ° npm ä¾èµï¼å¹¶ä¸æ²¡æå¯¼è´å 1 个ä¾èµåºç°å¤ä¸ªçæ¬
- [x] æ¬æ¬¡åæ´æå·²ç»æ ArcBlock çä¾èµå级å°äºææ°
- [ ] (merge master 忣æµ) æå `make build`, `blocklet server init`, `blocklet server start`
- [ ] (merge master 忣æµ) æå `bn dev`, `bn dev --app-id xxx`
- [ ] (merge master 忣æµ) æå·²é
读并çè§£äºåå¸ beta ç Server çæå
---
Generated with [Claude Code](https://claude.com/claude-code)
Rules
- Always check for project PR template first – Look for
.github/PULL_REQUEST_TEMPLATE.mdbefore generating content - Use project template if exists – Follow the project’s PR template structure, language, and checkboxes
- Always analyze ALL commits from branch divergence point, not just HEAD
- Follow Conventional Commits format for title
- Keep title under 72 characters
- Include test plan with actionable verification steps
- Base PR on main branch (or project’s default branch)
- Check gh auth before attempting to create PR
- Push branch first if not already pushed to remote
- Preserve user’s intent – ask before overwriting existing PR.md
- Respect template language – If project template is in Chinese, write PR body in Chinese