commit-helper
Commit Message Chronicler
⚠️ MANDATORY COMPLIANCE ⚠️
CRITICAL: The 4-step workflow outlined in this document MUST be followed in exact order for EVERY commit message generation. Skipping steps or deviating from the procedure will result in inaccurate or incomplete commit messages. This is non-negotiable.
File Structure
- SKILL.md (this file): Main instructions and MANDATORY workflow
- examples.md: Usage scenarios with different commit types and generated messages
- Memory: Project-specific memory accessed via
memoryStore.getSkillMemory("commit-helper", "{project-name}"). See MemoryStore Interface. - templates/:
commit_template.md: Standard commit message output format template
Focus Areas
Commit message crafting evaluates 7 critical dimensions:
- Change Classification: Categorize as feat, fix, refactor, docs, style, test, chore, perf, ci, build, or revert
- Scope Detection: Identify the module, component, or subsystem affected by the change
- Breaking Change Identification: Detect API changes, removed features, schema migrations, or interface modifications that break backward compatibility
- Message Clarity: Ensure the subject line is imperative, concise (≤72 chars), and descriptive of the what and why
- Convention Compliance: Follow Conventional Commits specification or project-specific commit conventions
- Context Preservation: Capture motivation, trade-offs, and related issue references in the commit body
- Narrative Quality: Craft messages that tell the story of the change — not just what changed, but why it matters
Note: The skill analyzes staged or diffed changes to generate messages. It does not execute git commit itself unless explicitly requested.
MANDATORY WORKFLOW (MUST FOLLOW EXACTLY)
⚠️ STEP 1: Analyze Changes (REQUIRED)
YOU MUST:
- Use the
get-git-diffskill or rungit diff --stagedto obtain the current changes - If no staged changes exist, check
git difffor unstaged changes and inform the user - Run
git diff --stat --stagedto get a high-level summary of affected files and line counts - Run
git diff --name-status --stagedto identify file operations (A/M/D/R) - Read the actual diff content to understand the substance of each change
DO NOT PROCEED WITHOUT UNDERSTANDING THE CHANGES
⚠️ STEP 2: Determine Context (REQUIRED)
YOU MUST:
- Classify the change type: Determine the primary Conventional Commits type:
feat: A new feature or capabilityfix: A bug fix or correctionrefactor: Code restructuring without behavior changedocs: Documentation-only changesstyle: Formatting, whitespace, or cosmetic changes (no logic change)test: Adding or updating testschore: Maintenance tasks, dependency updates, toolingperf: Performance improvementsci: CI/CD pipeline changesbuild: Build system or external dependency changesrevert: Reverting a previous commit
- Identify scope: Determine the affected module, component, or area (e.g.,
auth,api,parser,cli) - Detect breaking changes: Look for removed public APIs, changed function signatures, renamed exports, schema migrations, or configuration format changes
- Check project memory: Use
memoryStore.getSkillMemory("commit-helper", "{project-name}")to load project-specific commit conventions, preferred scopes, or style guidelines. See MemoryStore Interface for method details. - Gather additional context: If the change purpose is ambiguous, ask the user clarifying questions:
- What motivated this change?
- Is this related to a specific issue or ticket?
- Are there any breaking changes the diff doesn't make obvious?
DO NOT PROCEED WITHOUT CLASSIFYING THE CHANGE
⚠️ STEP 3: Craft Commit Message (REQUIRED)
YOU MUST:
- Compose the subject line following this format:
<type>(<scope>): <imperative description>- Use imperative mood ("add" not "added", "fix" not "fixes")
- Keep to 72 characters or fewer
- Do not end with a period
- Be specific: "fix null pointer in user lookup" not "fix bug"
- Write the body (if the change warrants explanation):
- Separate from subject with a blank line
- Wrap at 72 characters per line
- Explain what changed and why, not how (the diff shows how)
- Include motivation, context, and contrast with previous behavior
- Add footer (if applicable):
BREAKING CHANGE: <description>for breaking changesFixes #<issue>orCloses #<issue>for issue referencesRefs #<issue>for related but not closing references- Co-author trailers if applicable
- Use the template from
templates/commit_template.mdfor output formatting
DO NOT USE VAGUE OR GENERIC MESSAGES
⚠️ STEP 4: Review & Refine (REQUIRED)
YOU MUST validate the message against these criteria:
- Subject line check:
- Uses correct type prefix
- Scope is accurate and consistent with project conventions
- Imperative mood used
- 72 characters or fewer
- No trailing period
- Specific and descriptive
- Body check (if present):
- Explains motivation and context
- Wrapped at 72 characters
- Does not repeat the diff
- Footer check (if applicable):
- Breaking changes documented with
BREAKING CHANGE:prefix - Issue references use correct format
- Breaking changes documented with
- Present the final message to the user for approval
- Offer alternatives: If the change could be classified differently, present 1-2 alternative messages with explanation of the trade-offs
DO NOT SKIP VALIDATION
OPTIONAL: Update Project Memory
If project-specific conventions are discovered during the process, use memoryStore.update("commit-helper", "{project-name}", ...) to store insights:
- Preferred commit types and scopes
- Project-specific conventions (e.g., ticket number format, scope naming)
- Common patterns observed in existing commit history
See MemoryStore Interface for update() and append() method details.
Compliance Checklist
Before completing ANY commit message generation, verify:
- Step 1: Changes analyzed using git diff (staged or otherwise)
- Step 2: Change type classified, scope identified, breaking changes checked
- Step 3: Commit message crafted following Conventional Commits format with template
- Step 4: Message validated against all quality criteria and presented to user
FAILURE TO COMPLETE ALL STEPS INVALIDATES THE COMMIT MESSAGE
Output File Naming Convention
Format: commit_msg_{short_hash}.md
Where:
{short_hash}= First 7 characters of the current HEAD commit hash
Examples:
commit_msg_a1b2c3d.md(for changes based on HEAD a1b2c3d)commit_msg_staged.md(when generating for staged but uncommitted changes)
Alternative: If the user requests the message be applied directly, use git commit -m with the generated message instead of file output.
Conventional Commits Quick Reference
Format
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]
Types
| Type | Description |
|---|---|
feat |
A new feature |
fix |
A bug fix |
docs |
Documentation only changes |
style |
Changes that do not affect meaning of code |
refactor |
Code change that neither fixes a bug nor adds a feature |
perf |
A code change that improves performance |
test |
Adding missing tests or correcting existing tests |
build |
Changes to build system or external dependencies |
ci |
Changes to CI configuration files and scripts |
chore |
Other changes that don't modify src or test files |
revert |
Reverts a previous commit |
Breaking Changes
feat(api)!: remove deprecated /users/search endpoint
BREAKING CHANGE: The /users/search endpoint has been removed.
Use /users?q=<query> instead.
Further Reading
Refer to official documentation:
- Commit Conventions:
- Conventional Commits: https://www.conventionalcommits.org/
- Angular Commit Guidelines: https://github.com/angular/angular/blob/main/CONTRIBUTING.md#commit
- Best Practices:
- How to Write a Git Commit Message: https://cbea.ms/git-commit/
- Pro Git Book: https://git-scm.com/book/en/v2
Version History
- v1.1.0 (2026-02-10): Migrated to interface-based memory access
- Replaced hardcoded memory paths with MemoryStore interface calls
- Added references to MemoryStore interface documentation
- v1.0.0 (2025-01-XX): Initial release
- Mandatory 4-step workflow for commit message generation
- Conventional Commits compliance
- Breaking change detection
- Project memory integration for convention persistence
- Template-based output formatting