| name | git:commit |
| description | Create git commits with configurable numbering (issue-based or sequential). Analyzes staged changes and generates commit messages following project conventions. Optionally creates GitHub issues if no active story exists. |
| scope | project |
| author | @thesolutionarchitect |
| email | maksym.diabin@gmail.com |
| hooks | {"Stop":{"command":"#!/bin/bash\nCONFIG_FILE=\"$(dirname \"$0\")/config.yaml\"\nVALIDATION_ENABLED=$(yq e '.validation.enabled' \"$CONFIG_FILE\" 2>/dev/null || echo \"false\")\nif [ \"$VALIDATION_ENABLED\" != \"true\" ]; then\n echo \"Validation disabled - skipping\"\n exit 0\nfi\nif git log -1 --pretty=%B | grep -q \"^Merge\"; then\n echo \"Merge commit - skipping validation\"\n exit 0\nfi\nPREFIX=$(yq e '.numbering.prefix' \"$CONFIG_FILE\" 2>/dev/null || echo \"PROJ\")\nif ! git log -1 --pretty=%B | grep -E \"^${PREFIX}-[0-9]+[a-z]?:\"; then\n echo \"Error: Commit must follow '${PREFIX}-###:' format\" >&2\n exit 2\nfi\necho \"Commit format validated (${PREFIX})\"\n","description":"Validate commit format follows project conventions","timeout":10000}} |
Commit Automation
Category: Core Workflow
Priority: Tier 1 (Critical)
Purpose
Automates git commits with intelligent numbering, change analysis, and standardized commit message generation. Supports both issue-based (GitHub Issues) and sequential numbering modes.
Key Features
- Flexible numbering - Issue-based ({{PROJECT_PREFIX}}-{issueNumber}) or sequential ({{PROJECT_PREFIX}}-001)
- Auto-issue creation - Creates GitHub issues via
/create-story when no active story exists
- Smart grouping - Detects related commits and suggests suffixes (e.g., {{PROJECT_PREFIX}}-157a, 157b)
- Change analysis - Analyzes staged changes to generate descriptive commit messages
- Convention enforcement - Post-commit validation hook ensures format compliance
- Co-author attribution - Automatically adds Claude co-author line
Configuration
This skill requires the following configuration in config.yaml:
Required Variables
numbering:
prefix: {{PROJECT_PREFIX}}
mode: {{NUMBERING_MODE}}
repository:
slug: "{{REPO_SLUG}}"
issue:
source: "{{ACTIVE_STORY_FILE}}"
Optional Configuration
features:
create_if_missing: {{true/false}}
grouping_enabled: {{true/false}}
validation_enabled: {{true/false}}
grouping:
time_window: "4 hours ago"
confidence_threshold: 60
message:
max_summary_length: 72
include_co_author: true
Template Variables Reference
| Variable | Purpose | Example Value | Required |
|---|
{{PROJECT_PREFIX}} | Commit prefix identifier | MYAPP | Yes |
{{NUMBERING_MODE}} | Numbering strategy | issue-based | Yes |
{{REPO_SLUG}} | GitHub repository | owner/repo | Yes (issue mode) |
{{ACTIVE_STORY_FILE}} | Active story file path | $AGENT_DOCS_DIR/active-story.yaml | Yes (issue mode) |
{{CREATE_MISSING_ISSUES}} | Auto-create issues | true | No |
{{GROUPING_ENABLED}} | Enable grouping | true | No |
{{VALIDATION_HOOK_ENABLED}} | Enable validation | true | No |
Usage
Basic Usage
git add file1.ts file2.ts
/commit
Or in natural language:
Create a commit for these changes
Commit the staged files
Make a commit with these updates
The skill will:
- Verify staged changes exist
- Determine commit number (issue-based or sequential)
- Analyze your changes
- Generate descriptive message
- Create commit with co-author attribution
Advanced Usage
Example 1: Issue-Based Workflow
numbering:
mode: "issue-based"
prefix: MYAPP
issue:
create_if_missing: true
Workflow:
/play-story - Activate an issue (creates $AGENT_DOCS_DIR/active-story.yaml)
- Make code changes
git add .
/commit - Creates commit as MYAPP-157: description
If no active story exists and create_if_missing: true:
/commit automatically calls /create-story
- User describes the issue
- Issue is created and activated
- Commit proceeds with new issue number
Example 2: Sequential Workflow
numbering:
mode: "sequential"
prefix: MYAPP
Workflow:
- Make code changes
git add .
/commit - Finds highest MYAPP-### and increments (e.g., MYAPP-042)
Example 3: Grouped Commits
When working on the same files recently:
git add feature.ts
/commit
git add feature.ts tests.ts
/commit
Feature Flags
See @references/feature-flags.md.
Workflows
See @references/workflows.md.
Examples
See @references/examples.md.
Integration
With Other Skills
This skill integrates with:
- create-story - Auto-creates GitHub issues when missing
- fetch-story - Browse and select issues to work on
- play-story - Activate issue before committing
- mr - Pull requests reference commit numbers
Typical workflow:
/fetch-story
/play-story
/commit
/commit
/mr
With Hooks
This skill provides a post-commit validation hook. Configure in your project:
hooks:
post_commit:
- name: "validate-commit-format"
command: |
# Validation logic from SKILL.md hooks section
enabled: true
The hook automatically validates commit format based on your config.yaml prefix.
Troubleshooting
Issue: "No staged changes to commit"
Symptoms:
- Error message when running
/commit
- No files in
git diff --cached
Solution:
Stage your files first:
git add file1.ts file2.ts
git add .
Issue: "Failed to create GitHub issue"
Symptoms:
- Error during issue creation
- Falls back to sequential numbering
Solutions:
- Check GitHub CLI authentication:
gh auth status
gh auth login
- Verify repository slug in config:
repository:
slug: "correct-owner/correct-repo"
- Disable auto-creation and use manual issues:
numbering:
issue:
create_if_missing: false
Issue: Validation hook rejects commit
Symptoms:
- Commit created but validation fails
- Error: "Commit must follow '{{PREFIX}}-###:' format"
Solutions:
- Check config.yaml prefix matches commit:
numbering:
prefix: MYAPP
- Verify commit message format:
✓ Correct: MYAPP-123: Add new feature
✗ Wrong: MYAPP123: Add new feature
✗ Wrong: myapp-123: Add new feature
✗ Wrong: Add new feature
- Temporarily disable validation:
validation:
enabled: false
Issue: Grouping not suggesting suffixes
Symptoms:
- Making related commits
- No grouping suggestions appear
Solutions:
- Check grouping is enabled:
grouping:
enabled: true
- Verify time window:
grouping:
time_window: "4 hours ago"
- Check confidence threshold:
grouping:
confidence_threshold: 60
- Ensure file overlap exists:
git diff --cached --name-only
git log --since="4 hours ago" --name-only
Implementation Details
See @references/implementation.md for internals, customization, and migration notes.
See Also
Invoke: /commit
Configuration File: config.yaml
Example Configuration: config.example.yaml
References: references/