AgentSkillsCN

create-pr

生成标题格式规范、且能通过 check-pr-title CI 验证的 GitHub Pull Request。适用于创建 PR、提交变更以供审核,或当用户输入 /pr 命令,或主动提出创建 Pull Request 时使用。

SKILL.md
--- frontmatter
name: create-pr
description: Creates GitHub pull requests with properly formatted titles that pass the check-pr-title CI validation. Use when creating PRs, submitting changes for review, or when the user says /pr or asks to create a pull request.
allowed-tools: Bash(git:*) Bash(gh:*) Read Grep Glob

Create Pull Request

Creates GitHub PRs with titles following DAKIA Wiki Bot's Conventional Commits specification for proper changelog generation and CI validation.

PR Title Format

code
<type>(<scope>): <summary>

Types (required)

TypeDescriptionChangelogExample Use Case
featNew feature for usersYesAdd video player, new API endpoint
fixBug fix for usersYesFix login issue, resolve crash
perfPerformance improvementYesOptimize database queries
testAdding/correcting testsNoAdd unit tests, E2E tests
docsDocumentation onlyNoUpdate README, add comments
refactorCode refactoring (no functional change)NoSimplify logic, extract function
styleCode style/formatting changesNoFix indentation, format code
buildBuild system or dependency changesNoUpdate package.json, npm scripts
ciCI/CD configurationNoUpdate GitHub Actions
choreRoutine tasks, maintenanceNoUpdate gitignore, cleanup

Scopes (optional but recommended)

Feature-based scopes:

  • auth - Authentication and authorization
  • articles - Wiki article management and content
  • categories - Category management
  • admin - Admin panel functionality
  • api - API routes and endpoints
  • ui - User interface components
  • db - Database models and operations
  • markdown - Markdown processing and rendering
  • search - Search functionality

Area-based scopes:

  • client - Web Client (public wiki platform)
  • admin-panel - Admin Panel
  • shared - Shared components/utilities

Summary Rules

  • Use imperative present tense: "Add" not "Added"
  • Capitalize first letter
  • No period at the end
  • Keep it concise (50 chars or less recommended)
  • Add [skip ci] to skip CI checks (use sparingly)

Steps

  1. Check current state:

    bash
    git status
    git diff --stat
    git log origin/main..HEAD --oneline
    
  2. Analyze changes to determine:

    • Type: What kind of change is this? (feat, fix, refactor, etc.)
    • Scope: Which area/feature is affected? (auth, courses, api, etc.)
    • Summary: What does the change do? (imperative, capitalized)
  3. Push branch if needed:

    bash
    git push -u origin HEAD
    
  4. Create PR using gh CLI with the template from .github/pull_request_template.md:

    bash
    gh pr create --draft --title "<type>(<scope>): <summary>" --body "$(cat <<'EOF'
    ## Summary
    
    <Describe what the PR does and why. Include how to test the changes.>
    
    ## Screenshots/Videos (if applicable)
    
    <Add screenshots or videos for UI changes>
    
    ## Related Issues
    
    <!-- Use "closes #<issue-number>", "fixes #<issue-number>", or "resolves #<issue-number>" to auto-close issues -->
    <!-- Example: Closes #123 -->
    
    ## Type of Change
    
    - [ ] Bug fix (non-breaking change which fixes an issue)
    - [ ] New feature (non-breaking change which adds functionality)
    - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
    - [ ] Documentation update
    - [ ] Performance improvement
    - [ ] Code refactoring
    
    ## Checklist
    
    - [ ] My code follows the project's coding conventions (see `.github/copilot-instructions.md`)
    - [ ] I have performed a self-review of my code
    - [ ] I have commented my code, particularly in hard-to-understand areas
    - [ ] I have made corresponding changes to the documentation
    - [ ] My changes generate no new warnings or errors
    - [ ] I have added tests that prove my fix is effective or that my feature works
    - [ ] New and existing unit tests pass locally with my changes
    - [ ] Any dependent changes have been merged and published
    
    ## Testing Performed
    
    <Describe the testing you performed to verify your changes>
    
    - [ ] Unit tests
    - [ ] E2E tests
    - [ ] Manual testing
    
    ## Additional Notes
    
    <Any additional information that reviewers should know>
    EOF
    )"
    

PR Body Guidelines

Based on .github/pull_request_template.md:

Summary Section

  • What: Clearly describe what the PR does
  • Why: Explain the motivation behind the change
  • How: Briefly explain the approach taken
  • Include screenshots/videos for UI/UX changes

Related Issues Section

  • Link to GitHub issues using keywords to auto-close:
    • closes #123 / fixes #123 / resolves #123
  • Reference related PRs if applicable

Type of Change

Check all that apply:

  • Bug fix (non-breaking)
  • New feature (non-breaking)
  • Breaking change
  • Documentation
  • Performance
  • Refactoring

Checklist

All items should be checked before requesting review:

  • Code follows project conventions
  • Self-review completed
  • Comments added for complex logic
  • Documentation updated
  • No new warnings/errors
  • Tests added and passing
  • Dependencies merged

Testing Section

Describe testing performed:

  • Unit tests added/updated
  • E2E tests added/updated
  • Manual testing steps

Examples

Feature - Article functionality

code
feat(articles): add code syntax highlighting support

Bug fix - Authentication

code
fix(auth): resolve session timeout on page refresh

UI improvement

code
style(ui): improve article card responsive design

API change

code
feat(api): add endpoint for article search

Database update

code
refactor(db): simplify wiki article schema

Performance optimization

code
perf(search): optimize full-text search query

Breaking change (add exclamation mark before colon)

code
feat(api)!: change article response structure

Documentation

code
docs(readme): update installation instructions for Windows

Skip CI (use sparingly)

code
docs(readme): fix typo in example [skip ci]

No scope (affects multiple areas)

code
chore: update npm dependencies to latest versions

Admin panel feature

code
feat(admin): add article analytics dashboard

Markdown processing

code
fix(markdown): handle tables in wiki content

Validation

The PR title must follow Conventional Commits specification:

regex
^(feat|fix|perf|test|docs|refactor|style|build|ci|chore)(\([a-z-]+\))?!?: [A-Z].+[^.]$

Key validation rules:

  • Type: Must be one of the allowed types
  • Scope: Optional, lowercase with hyphens, in parentheses
  • Breaking change: Exclamation mark goes before the colon
  • Summary: Must start with capital letter, no period at end
  • Length: Keep title under 72 characters total

Tips for Good PRs

DO ✅

  • Keep PRs focused on a single change
  • Write clear, descriptive titles
  • Include context in the description
  • Add screenshots for UI changes
  • Write/update tests
  • Update documentation
  • Request review from relevant team members

DON'T ❌

  • Mix unrelated changes in one PR
  • Use vague titles like "Fix bug" or "Update code"
  • Skip the PR template
  • Leave commented-out code
  • Commit sensitive data or credentials
  • Ignore failing CI checks

Related Documentation