返回 Skill 列表
extension
分类: 开发与工程无需 API Key

commit-best-practices

创建遵循最佳实践的AI生成消息的git提交。当用户要求提交更改、提到“提交”、想要将工作保存到git,或已准备好要提交的更改时使用。调用/git-actions:commit命令,该命令会分析更改,生成符合仓库风格的简洁消息,并处理暂存/审批工作流程。

person作者: jakexiaohubgithub

Creating Commits with Best Practices

When the user needs to create a git commit, use the /git-actions:commit slash command. This command orchestrates the entire workflow with best practices built-in.

Usage

/git-actions:commit all      # Stage all changes and commit
/git-actions:commit staged   # Commit only staged changes
/git-actions:commit          # Auto-detect (staged if any, else all)

What the Command Does

  1. Stages files (if needed)
  2. Analyzes changes using git diff
  3. Reviews recent commit history to match repository style
  4. Generates a concise, information-dense commit message
  5. Presents the message for user approval
  6. Creates the commit after approval

The commit-writer Agent

The /git-actions:commit command invokes the commit-writer agent, which has commit best practices embedded:

  • Concise, information-dense messages (50-char subject limit)
  • Imperative mood ("Add" not "Added")
  • Explains WHAT and WHY, not HOW
  • Adapts to repository commit conventions
  • References issues when relevant
  • Atomic commits (one logical change)

Custom Instructions

You can pass additional context to override defaults:

/git-actions:commit all use conventional commits format
/git-actions:commit staged keep it under 40 chars
/git-actions:commit all emphasize performance improvements
/git-actions:commit staged no body

Examples

User: "I've updated the authentication logic, can you commit this?" You: Use /git-actions:commit all to stage all changes and create a commit with a well-crafted message.

User: "Commit my staged files" You: Use /git-actions:commit staged to commit only the staged changes.

User: "I need a brief commit message for this fix" You: Use /git-actions:commit all keep it under 40 chars to create a concise commit.