Agent Skill
2/7/2026

commit-msg

Use this skill when the user wants to generate a commit message. Contains workflow for branch checking, ticket ID extraction, and message formatting.

C
conte777
0GitHub Stars
1Views
npx skills add Conte777/config_for_claude_code

SKILL.md

Namecommit-msg
DescriptionUse this skill when the user wants to generate a commit message. Contains workflow for branch checking, ticket ID extraction, and message formatting.

name: commit-msg description: Use this skill when the user wants to generate a commit message. Contains workflow for branch checking, ticket ID extraction, and message formatting. allowed-tools: Bash(git branch *), Bash(git diff *), Read

Commit Message Generator

This skill generates commit messages with proper ticket ID extraction and formatting.

When to Use

  • User runs /commit command (called by commit command)
  • User asks to generate a commit message
  • User needs help with commit message format

Workflow Steps

Step 1: Get Branch Name

git branch --show-current

Step 2: Extract Ticket ID

Extract ticket ID from branch name using pattern CUS-\d+ (case insensitive).

Examples:

  • CUS-1234/add-featureCUS-1234
  • feature/CUS-5678-fix-bugCUS-5678
  • cus-9999-update-docsCUS-9999

Step 3: Analyze Changes

Review the staged changes:

git diff --staged

Identify:

  1. Type of change (new feature or bug fix)
  2. Key files and components affected
  3. Main purpose of the changes

Step 4: Determine Prefix

If ticket ID found → use CUS-XXXX:

If no ticket ID → determine prefix from diff analysis:

PrefixUse when changes...
fix:Fix bugs, errors, null checks, edge cases, error handling, typos, broken logic
feat:Add new functionality, files, endpoints, components, capabilities

Analyze the nature of changes — don't ask the user.

Step 5: Generate Commit Message

Create a commit message following the strict format:

Format Rules

Prefix (one of):

  • CUS-XXXX: — when ticket ID is available
  • feat: — new functionality (only when no ticket ID)
  • fix: — bug fix (only when no ticket ID)

Constraints:

  • Maximum 50 characters total
  • Single line (header only, no body)
  • Lowercase description
  • No period at the end
  • Use abbreviations when needed: &, |, impl, auth, config, upd, del

Examples:

CUS-1234: add user auth endpoint
CUS-5678: fix null check in payment service
feat: impl login & signup forms
fix: handle empty response in api client

Step 6: Return Message

Return the generated commit message to the caller.

File References

Error Handling

  • If git is not initialized, inform the user
  • If detached HEAD state, use short commit hash as reference
Skills Info
Original Name:commit-msgAuthor:conte777