home / skills / qwenlm / qwen-code-examples / auto-pr

auto-pr skill

/skills/auto-pr

This skill automates the full pull request workflow, including code review, documentation generation, and PR creation, saving time and ensuring consistency.

npx playbooks add skill qwenlm/qwen-code-examples --skill auto-pr

Review the files below or copy the command above to add this skill to your agents.

Files (7)
SKILL.md
3.1 KB
---
name: auto-pr
description: Automated PR submission assistant, including code review, documentation generation, and PR creation
---

# Auto PR - Automated PR Submission Assistant

## Overview

This skill helps you automate the complete Pull Request process, including code review, documentation generation, and PR creation.

## Core Functions

1. **Update Base Branch** - Sync remote main/master branch
2. **Code Review Analysis** - Compare differences between current and base branch
3. **PR Template Discovery** - Automatically scan for PR templates in the project
4. **English Documentation Generation** - Generate English PR description, waiting for user confirmation
5. **Automatic PR Submission** - Create PR using English description after user approval
6. **Cleanup Process** - Offer to remove temporary PR description files after submission

## Usage

```
/auto-pr [base-branch]
```

- `base-branch`: Optional, defaults to `main`

## Workflow

Please execute the following workflows in sequence:

1. [Branch Preparation](./workflows/01-branch-preparation.md) ⭐⭐⭐
2. [Code Review](./workflows/02-code-review.md) ⭐⭐⭐
3. [Documentation Generation](./workflows/03-doc-generation.md) ⭐⭐⭐
4. [PR Submission](./workflows/04-pr-submission.md) ⭐⭐⭐

### Key Interaction Points

During the documentation generation phase, the process will pause to wait for user confirmation:

```
Branch Preparation → Code Review → Generate English Documentation → [Wait for User Confirmation] → Submit PR → [Clean Up Temporary Files]
```

**User Confirmation Points**:
- After English documentation is generated, wait for user review and confirmation
- After PR is submitted, confirm deletion of temporary description files (PR_DESCRIPTION.md, etc.)

## Prerequisites

### Environment Check

Before executing the skill, run the check script:

```bash
node ./scripts/check-prerequisites.js
```

### Dependency Requirements

| Dependency | Required | Installation Method |
|------------|----------|---------------------|
| Git | Yes | System built-in or `brew install git` |
| GitHub CLI | Yes | `brew install gh` |
| Node.js | Yes | `brew install node` |

### GitHub CLI Authentication

Complete authentication for first use:

```bash
gh auth login
```

Select as prompted:
1. GitHub.com
2. HTTPS
3. Use browser for authentication

After authentication, verify:

```bash
gh auth status
```

### Project Requirements

- [ ] Git repository initialized
- [ ] Remote repository configured
- [ ] Current branch is not main/master
- [ ] Unpushed commits exist

## Script Tools

This skill includes the following scripts:

| Script | Description |
|--------|-------------|
| `scripts/check-prerequisites.js` | Prerequisites check |
| `scripts/create-pr.js` | Automatic PR creation |

### Quick Start

```bash
node ./scripts/create-pr.js \
  --title "feat: feature description" \
  --body-file ./PR_DESCRIPTION.md
```

## Notes

- Ensure all changes are committed before execution
- PR descriptions will automatically search for templates in the project
- Supports GitHub (requires gh CLI installation)
- Temporary description files will be offered for deletion after PR submission

Overview

This skill automates the full Pull Request workflow, from syncing the base branch to creating the PR on GitHub. It runs an automated code review diff, generates an English PR description (with template discovery), and submits the PR after your confirmation. After submission it can clean up temporary description files.

How this skill works

The skill first ensures the feature branch is up to date with the specified base branch (default: main). It computes diffs against the base, inspects changes for review notes, and scans the repository for PR templates. It generates an English PR description file and waits for your confirmation before using the GitHub CLI to create the PR, then offers to remove temporary files.

When to use it

  • When you want to quickly open a well-documented PR with minimal manual steps
  • After finishing a feature branch with unpushed commits that need review
  • When you want consistent PR descriptions that follow project templates
  • When you prefer to review an AI-generated PR description before submission

Best practices

  • Run the prerequisite check script before using the skill to validate environment and authentication
  • Ensure all changes are committed and the branch is not main or master
  • Confirm the generated English description and edit it if necessary before final submission
  • Install and authenticate gh (GitHub CLI) and verify gh auth status
  • Keep PR templates in the repo root or .github folder so the skill can discover them

Example use cases

  • Create a PR after finishing a feature branch; the skill updates the base, generates a description, and opens the PR
  • Batch-process small fixes: generate consistent descriptions and submit multiple PRs faster
  • Ensure PRs include template-specified sections (e.g., changelog, testing steps) by auto-filling descriptions
  • Use the code review diff output to surface potential issues before asking teammates to review

FAQ

What prerequisites are required?

Git, Node.js, and the GitHub CLI (gh) must be installed and gh must be authenticated (gh auth login). Run the included check script to validate.

Can I override the base branch?

Yes. The command accepts an optional base-branch argument; it defaults to main if not provided.

Will the skill push commits or only create the PR?

The skill expects changes to be committed and unpushed; it will create the PR via gh but ensure local commits are present and pushed as needed.