Get the FREE Ultimate OpenClaw Setup Guide →

commit-msg

npx machina-cli add skill nmoinvaz/speedy-gonzales/commit-msg --openclaw
Files (1)
SKILL.md
1.3 KB

Analyze the staged changes and generate commit message options:

  1. Get the staged diff for analysis:

    git diff --cached
    
  2. Check previous commit message format in the repository:

    git log --oneline -10
    
  3. Search staged changes for ticket IDs (patterns like PROJ-123, D4T-123, etc.)

  4. Generate 3 commit message options. Each option should have:

    • Title:
      • Clear and concise summary
      • Under 72 characters
    • Body:
      • 1-3 sentences providing non-obvious value
      • Elaborate on the changes beyond what the title conveys
      • Each sentence should add depth or highlight a distinct aspect of the change
      • Explain the "why" or technical context not evident from the title
      • Word-break wrapped at 80 characters max per line
  5. Follow these guidelines:

    • Match the format used in previous commits in the repository
    • If a ticket ID was found, include it in the title (typically as a prefix)
    • Do not add Claude as a co-author in the commit message
  6. Present the options to the user for selection using AskUserQuestion

  7. Create the commit with the selected title and body:

    git commit -m "<title>" -m "<body>"
    

Source

git clone https://github.com/nmoinvaz/speedy-gonzales/blob/main/skills/commit-msg/SKILL.mdView on GitHub

Overview

Analyzes the current staged changes (git diff --cached) to propose three commit message options. It checks the repository history for formatting patterns and scans for ticket IDs (such as PROJ-123) to keep messages trackable and consistent.

How This Skill Works

Using Bash, it retrieves the staged diff, reviews recent commits for style, detects ticket IDs, and generates three title/body options. It then presents these options with AskUserQuestion for user selection and completes the commit with the chosen title and body.

When to Use It

  • When finalizing a feature after staging changes and you want clear, policy-compliant commit messages
  • When multiple small changes touch one ticket and you want consistent granularity
  • When you need to align commit history with an issue-tracking system by including ticket IDs
  • When preparing a commit that should explain the why and what beyond the code
  • When you want a quick, user-assisted choice instead of drafting messages manually

Quick Start

  1. Step 1: Run git diff --cached to inspect staged changes
  2. Step 2: Review prior commit formats with git log --oneline -10
  3. Step 3: Choose one of the generated options and commit with git commit -m "<title>" -m "<body>"

Best Practices

  • Include a ticket ID in the title when detected
  • Keep the title under 72 characters for readability
  • Use the body to explain why the change was made and any technical context
  • Limit the body to 1-3 sentences with 80-character line wraps
  • Review and choose the option before running the final git commit

Example Use Cases

  • PROJ-123: Implement user login with OAuth Adds OAuth flow, updates user model, and extends tests to cover the new authentication path.
  • D4T-456: Fix data serialization edge case Resolves an edge case where special characters caused serialization failures and adds regression tests.
  • PROJ-321: Update API surface for v2 Refactors the API surface to support v2 endpoints, updates client usage docs, and adds deprecation notes for older paths.
  • BUG-42: Resolve race condition in worker pool Fixes a race condition in the worker pool by introducing synchronization and safer task queuing.
  • PROJ-999: Improve logging and metrics Enhances observability with structured logs and new metrics to track request latency and error rates.

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers