AgentSkillsCN

pr-creator

为 wouterwisse.com 创建 GitHub Pull Request,并为其拟定恰当的标题与描述。 在任务成功完成后,由编排器自动执行此操作。 触发条件:“创建 PR”、“创建拉取请求”、“打开 PR”、“提交 PR”

SKILL.md
--- frontmatter
name: pr-creator
description: |
  Create GitHub Pull Requests with proper titles and descriptions.
  Used by the orchestrator after successful task completion.

  Triggers: "create pr", "create pull request", "open pr", "submit pr"
metadata:
  clawdbot:
    requiredTools:
      - gh

PR Creator Skill

Create well-formatted GitHub Pull Requests with intelligent title and description generation.

Prerequisites

  • GitHub CLI (gh) installed and authenticated
  • Changes committed to a feature branch
  • Remote branch pushed

PR Title Generation

Generate concise, descriptive PR titles based on the task:

Rules

  1. Start with action verb: "Add", "Fix", "Update", "Refactor", "Remove", "Improve"
  2. Keep under 70 characters
  3. Be specific about what changed
  4. Use imperative mood

Examples

TaskGenerated Title
"Fix the login timeout bug"Fix login timeout by increasing session duration
"Add user authentication"Add JWT-based user authentication
"Refactor database queries"Refactor database layer for better performance
"Update the API error handling"Update API error handling with proper status codes
"Remove deprecated functions"Remove deprecated legacy API functions

PR Body Template

markdown
## Summary
<!-- 1-3 bullet points of key changes -->
- <change 1>
- <change 2>
- <change 3>

## Task
> <Original task description>

## Changes

### Files Modified
<!-- List of changed files with brief explanation -->
- `path/to/file.js` - <what changed>
- `path/to/other.js` - <what changed>

### Key Implementation Details
<!-- Technical details worth noting -->
- <detail 1>
- <detail 2>

## Testing

### Automated Tests
- [ ] Unit tests pass
- [ ] Integration tests pass
- [ ] No new warnings

### Manual Testing
- [ ] <test case 1>
- [ ] <test case 2>

## Codex Review

**Status**: ✅ Approved

**Summary**: <brief review summary>

## Metadata

| Field | Value |
|-------|-------|
| Implementer | OpenCode (GLM 4.7) / Claude Code (Opus 4.5) |
| Reviewer | Codex (GPT-5.2-Codex) |
| Iterations | <N> |
| Task ID | <task_id> |

---
🦞 Generated by [Clawdbot Intelligent Implementer](https://github.com/clawdbot/clawdbot)

Usage

From Shell Script

bash
# Basic usage
./lib/gh-pr.sh \
  --title "Fix login timeout issue" \
  --task "Fix the login timeout bug that causes users to be logged out" \
  --base main \
  --head ai/fix-login-timeout \
  --state-file /path/to/state.json

# With additional options
./lib/gh-pr.sh \
  --title "Add user authentication" \
  --task "Implement JWT-based user authentication" \
  --base develop \
  --head ai/add-user-auth \
  --state-file /path/to/state.json \
  --draft \
  --reviewer username

From Orchestrator

The orchestrator automatically calls the PR creator after successful task completion:

bash
# The orchestrator does this internally:
PR_URL=$(./skills/pr-creator/lib/gh-pr.sh \
  --title "$GENERATED_TITLE" \
  --task "$TASK_DESCRIPTION" \
  --base "$BASE_BRANCH" \
  --head "$BRANCH_NAME" \
  --state-file "$LOG_DIR/state.json")

Commands Reference

Create PR

bash
gh pr create \
  --title "$PR_TITLE" \
  --body "$PR_BODY" \
  --base "$BASE_BRANCH" \
  --head "$BRANCH_NAME"

Get PR URL

bash
gh pr view --json url -q '.url'

Add Labels

bash
gh pr edit --add-label "ai-generated,needs-review"

Request Reviewers

bash
gh pr edit --add-reviewer "username1,username2"

Create as Draft

bash
gh pr create --draft \
  --title "$PR_TITLE" \
  --body "$PR_BODY"

Error Handling

  1. Branch not pushed: Auto-push before creating PR
  2. PR already exists: Return existing PR URL
  3. Auth issues: Prompt to run gh auth login
  4. Rate limiting: Wait and retry

Configuration

In ~/.clawdbot-orchestrator.env:

bash
# PR defaults
PR_DEFAULT_LABELS=ai-generated
PR_AUTO_DRAFT=false
PR_AUTO_REVIEWERS=

# Template customization
PR_TEMPLATE_PATH=.github/PULL_REQUEST_TEMPLATE.md