Git commit helper

From adrielp/ai-engineering-harness · View interactive version

Git commit helper is an AI agent skill from the GitHub repository adrielp/ai-engineering-harness. Creates well-structured git commits by analyzing changes, drafting messages, and executing commits. Use when the user asks to commit changes, save work, create a commit, or mentions committing their code.

How to use this skill

Skill file

Git Commit Helper

When to Use This Skill

Activate this skill when the user:

Core Process

Step 1: Analyze Current State

Run these commands in parallel to understand the changes:

git status                    # See all changed files
git diff                      # View modifications
git diff --staged            # View staged changes
git log --oneline -n 5       # Check recent commit style

Step 2: Plan Your Commits

Think about:

Consider whether changes should be:

Step 3: Present Your Plan

Show the user a clear plan before executing:

I plan to create [N] commit(s) with these changes:

Commit 1:
Files: [list specific files]
Message: [proposed commit message in imperative mood]

[Commit 2, 3, etc. if multiple...]

Shall I proceed?

Important:

Step 4: Execute Upon Confirmation

Once the user approves:

# Add specific files (NEVER use -A or .)
git add path/to/file1.js path/to/file2.ts

# Create commit with planned message
git commit -m "Your planned message here"

# Show the result
git log --oneline -n [number of commits you created]

Never use:

Always add files explicitly by path.

Commit Message Guidelines

Format

[Imperative verb] [what] [optional: why/context]

[Optional detailed explanation]

Examples

Good:

Bad:

Imperative Mood

Write as if commanding: "Add this", "Fix that", "Update those"

Focus on Why

When the "what" isn't obvious from the code, explain the "why":

Critical Rules

Attribution

The commits should be authored solely by the user with no AI attribution.

Grouping Strategy

Context Awareness

Common Patterns

Single Feature Implementation

If everything accomplished relates to one feature:

git add src/feature.ts src/feature.test.ts docs/feature.md
git commit -m "Add new feature for user analytics

- Implement tracking service
- Add unit tests
- Update documentation"

Multiple Logical Changes

If there are distinct changes:

# Commit 1: Refactoring
git add src/old-code.ts
git commit -m "Refactor authentication logic for clarity"

# Commit 2: New feature
git add src/new-feature.ts src/new-feature.test.ts
git commit -m "Add social login support"

Bug Fix

git add src/buggy-file.ts tests/regression.test.ts
git commit -m "Fix race condition in event handler

Adds synchronization lock to prevent concurrent access"

Edge Cases

No Changes to Commit

If git status shows no changes:

There are no changes to commit. The working directory is clean.

Already Staged Changes

If changes are already staged (git diff --staged shows content):

Conflicts or Issues

If git operations fail:

Notes

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.