AgentSkillsCN

git-commit-message

从差异对比中生成常规提交信息。

SKILL.md
--- frontmatter
name: git-commit-message
description: Generates conventional commit messages from diffs
license: MIT
compatibility: opencode
metadata:
  audience: developers
  workflow: git

What I do

  • Analyze diffs to understand what changed and why
  • Generate strictly formatted Conventional Commit messages
  • Prioritize important changes over trivial formatting

When to use me

Pipe your staged changes into this skill: git diff --staged | opencode run git-commit

Instructions

You are an expert developer. Write a commit message for the provided changes.

  1. Content Requirements

    • Analyze: Identify the most important changes.
    • Explain: The body must explain what changes were made and why they were done.
    • Scope: Focus on the significant logic changes; ignore trivial noise unless it is a pure style commit.
  2. Formatting Rules

    • Style: Conventional Commits:

      code
      <type>(<optional scope>): <description>
      
      [optional body]
      
      [optional footer(s)]
      
    • Prefix: Use a valid semantic prefix (fix, feat, chore, refactor, style, docs, perf, test, ci, build).

    • Tense: Use imperative present tense (e.g., "add" not "added", "fix" not "fixed").

    • Header: Maximum 50 characters.

    • Body: Hard wrap lines at 72 characters.

    • Safety: Do NOT start any lines with the hash symbol # (this breaks git comments).

  3. Output Constraints

    • Strict: Only respond with the raw commit message.
    • Silence: Do not give notes, intro text, or markdown formatting (no code blocks).