AgentSkillsCN

commit-workflow

采用 Conventional Commits 规范,创建逻辑清晰、原子化的 Git 提交,并撰写明确的提交信息。适用于用户要求提交更改、将工作拆分为多个提交,或从暂存区与未暂存区的差异中整理提交信息时使用。

SKILL.md
--- frontmatter
name: commit-workflow
description: Create logical, atomic git commits with Conventional Commits and clear commit messages. Use when the user asks to commit changes, split work into multiple commits, or prepare commit messages from staged and unstaged diffs.

Commit Workflow

Create focused commits that each represent one coherent change.

Workflow

  1. Inspect the full repo state:
  • git status --short
  • git diff --cached
  • git diff
  • git log --oneline -5
  1. Identify logical groups:
  • Group files by one intent per commit.
  • Prefer small commits over mixed commits.
  • Call out risky or unclear hunks before committing.
  1. Stage and commit each group separately:
  • Stage only files for that group.
  • Use Conventional Commit format (feat:, fix:, docs:, refactor:, chore:, etc.).
  • Keep messages concise and explain intent.
  • Run a secret scan on staged changes before each commit.

Rules

  • Never create one large commit when multiple logical groups exist.
  • Never commit secrets, tokens, credentials, private keys, .env contents, or similar sensitive values.
  • If a potential secret is detected, stop and remove it from the commit before proceeding.
  • Never add AI attribution lines.
  • Never push unless explicitly requested.
  • If changes look unsafe or incomplete, ask before committing.