AgentSkillsCN

pr-description-generator

根据常规提交规范,从 Git 更改中自动生成专业的 Pull Request 标题与描述。

SKILL.md
--- frontmatter
name: pr-description-generator
description: Generate professional Pull Request titles and descriptions from git changes following conventional commits format.

PR Description Generator

Transform your git changes into professional PR descriptions in seconds.

When to Use

  • Creating a Pull Request on GitHub
  • Writing commit messages
  • Documenting branch changes
  • Preparing release notes

Commit Types

  • feat: A new feature
  • fix: A bug fix
  • docs: Documentation only changes
  • chore: Changes to build process, dependencies, or tools
  • refactor: Code change that neither fixes a bug nor adds a feature
  • test: Adding or updating tests

Guidelines

Title Rules

Format: <type>: <brief description>

  • Start with type (feat, fix, docs, etc.)
  • Add colon and space: :
  • Follow with brief description
  • Max 50 characters total
  • Use imperative mood ("add" not "added")
  • Lowercase after type
  • No period at end

Good Examples:

  • feat: add authentication system
  • fix: resolve login validation bug
  • docs: update API documentation

Bad Examples:

  • add authentication system (missing type)
  • feat: Added authentication (wrong mood)
  • Feat: add authentication (wrong case)

Description Rules

  • Summary: 1-2 sentences explaining what and why
  • Key Features: 2-5 bullet points of main changes
  • Focus on value, not implementation details
  • Skip trivial changes

Output Format

markdown
Title:
<type>: <brief description>

Description:
## Summary
<what this PR does and why>

## Key Features
- Change #1
- Change #2
- Change #3

How to Use

Method 1: Direct Commit List

bash
python scripts/main.py --commits "feat: add search functionality" "feat: implement filter options" "fix: resolve search result sorting bug"

Method 2: From Git Repository

bash
git log main..HEAD --oneline > commits.txt
python scripts/main.py --from-file commits.txt

Method 3: From Git Log Output

bash
git log --oneline -n 10 > commits.txt
python scripts/main.py --from-file commits.txt

Output

The generated PR description will be saved to:

code
pr_description.md

Copy the content to your GitHub Pull Request description.

Example

Input:

code
feat: add search functionality
feat: implement filter options
fix: resolve search result sorting bug
docs: update search API documentation

Command:

bash
python scripts/main.py --commits "feat: add search functionality" "feat: implement filter options" "fix: resolve search result sorting bug" "docs: update search API documentation"

Output:

markdown
Title:
feat: add search functionality with filters

Description:
## Summary
Implement comprehensive search feature with filtering and sorting capabilities.

## Key Features
- Add full-text search across content
- Implement advanced filter options
- Fix sorting issues in search results
- Update API documentation for search endpoints