AgentSkillsCN

pr-writing

在创建 PR、撰写提交信息、管理分支,或为代码合并做准备时,此功能同样不可或缺。

SKILL.md
--- frontmatter
name: pr-writing
description: Use when creating PRs, writing commit messages, managing branches, or preparing code for merge

PR Writing

Announce at start: "Following the pr-writing skill for this submission."

Commit Messages

Use Conventional Commits format:

text
<type>(<scope>): <description>

[Optional body with context]

[Optional footer with references]

Commit Types

TypeWhenExample
featNew functionalityfeat(auth): add password reset flow
fixBug fixesfix(api): handle null user in profile endpoint
refactorCode changes (no behavior change)refactor(db): extract query builder
testAdding/modifying teststest(auth): add edge cases for token expiry
docsDocumentation changesdocs: update API reference
choreMaintenancechore(deps): update express to 4.19

Commit Rules

  • One logical change per commit
  • Imperative mood ("Add validation" not "Added validation")
  • Reference issues when applicable ("Fixes #123")
  • Separate refactors from feature changes

PR Template

markdown
## Summary
[One paragraph: what this PR does and why]

## Changes
- [Key change 1]
- [Key change 2]

## Testing
- [ ] Unit tests added/updated
- [ ] Integration tests pass
- [ ] Manually tested: [scenarios]

## Evidence
[Test output, screenshots, or other proof]

## Risks and Rollback
- Risk: [What could go wrong]
- Rollback: [How to undo]

Attribution Rules

RuleRationale
Human is always the authorHumans are accountable; AI is a tool
Never set AI as commit co-authorAI should not appear in git authorship
Never include "Generated with [AI tool]" in PR descriptionsUnless the PR directly relates to that tool
Note AI usage in PR body if significantTransparency for reviewers

Branch Naming

text
<type>/<short-description>
BranchPurpose
feat/user-authNew feature
fix/login-null-checkBug fix
refactor/api-layerCode cleanup
chore/deps-updateMaintenance

When to Squash

ScenarioAction
Multiple iteration commitsSquash into one logical commit
Failed experimentsDrop entirely
Independent fixesKeep separate
WIP "save work" commitsSquash

Related Skills

WhenInvoke
PR needs teststesting
PR needs code reviewcode-review
PR has security implicationssecure-coding

Deep Reference

For principles, rationale, anti-patterns, and examples: guides/git-workflows-ai/git-workflows-ai.md