AgentSkillsCN

git-workflow

当用户提出“提交更改”“创建分支”“发起 PR”“推送代码”“审查代码”“合并分支”“撰写提交信息”,或进行任何与 Git 相关的操作时,可使用此技能。

SKILL.md
--- frontmatter
name: git-workflow
description: "This skill should be used when the user asks to \"commit changes\", \"create a branch\", \"make a PR\", \"push code\", \"review code\", \"merge branches\", \"write a commit message\", or is performing any git-related operations."
version: 1.0.0

Git Workflow Standards

Overview

Git workflow conventions for consistent version control practices. Covers branch naming, commit messages, PR creation, and code review standards.

Branch Naming Convention

Format: <type>/<short-description>

TypeUsageExample
feature/New featurefeature/add-dark-mode
fix/Bug fixfix/login-redirect-loop
chore/Maintenancechore/update-dependencies
hotfix/Urgent production fixhotfix/payment-crash
refactor/Code restructurerefactor/auth-module
docs/Documentationdocs/api-endpoints

Rules:

  • Lowercase, kebab-case
  • Short but descriptive (3-5 words max)
  • No issue numbers in branch name

Commit Message Format (Conventional Commits)

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

[optional body]

[optional footer]

Types

TypeWhen to Use
featNew feature for the user
fixBug fix
choreMaintenance (deps, config, scripts)
docsDocumentation changes
styleFormatting, no logic change
refactorCode restructure, no behavior change
testAdding/fixing tests
perfPerformance improvement
ciCI/CD configuration

Rules

  • Header: max 50 characters, imperative mood ("add" not "added")
  • Scope: module or component name (auth, dashboard, api)
  • Body: explain WHAT and WHY, not HOW
  • Footer: reference issues (Closes #123), breaking changes
  • Language: English

Examples

code
feat(auth): add Google OAuth login

Implement Google OAuth using Supabase auth provider.
Users can now sign in with their Google account.

Closes #42
code
fix(dashboard): resolve chart rendering on mobile

Charts were overflowing on screens < 768px due to
fixed width container. Switched to responsive container.
code
chore(deps): update Next.js to v15.1

BREAKING CHANGE: params is now async in route handlers.
Updated all dynamic routes to await params.

Pull Request Standards

Title

  • Max 70 characters
  • Follows same convention as commits: type(scope): description
  • No period at end

Body Template

markdown
## Summary
- Brief description of changes (2-3 bullet points)

## Changes
- Specific files/modules changed and why

## Test Plan
- [ ] Manual testing steps
- [ ] Unit tests pass
- [ ] Build succeeds
- [ ] Lint passes

PR Checklist (Before Requesting Review)

  1. pnpm lint passes
  2. pnpm build succeeds
  3. No console.log left
  4. No any types
  5. No hardcoded secrets
  6. Self-reviewed the diff
  7. Updated docs if needed

Pre-Commit Verification

Before every commit, verify:

  1. No .env files staged
  2. No console.log statements
  3. No commented-out code blocks
  4. No any types
  5. TypeScript compiles without errors
  6. All imports are used

Workflow

code
1. Create branch from main
   git checkout -b feature/my-feature

2. Make changes and commit (small, atomic commits)
   git add specific-files
   git commit -m "feat(scope): description"

3. Push and create PR
   git push -u origin feature/my-feature
   gh pr create

4. After review approval
   Squash and merge via GitHub UI
   Delete branch after merge