---
name: commit
description: Automatically generate meaningful commit messages and commit changes
---

# Git Auto-Commit Skill

## Description

This skill provides intelligent git commit assistance. It analyzes your changes, categorizes them, and generates meaningful commit messages following conventional commit standards.

## When to Use

- When you've made changes and want to commit them
- When you need help writing a descriptive commit message
- When you want to see a summary of your current changes
- After completing a coding task that should be committed

## Commands

Use `/commit` to invoke this skill with various options:

### Basic Usage

```
/commit                    # Auto-generate message and commit all staged changes
/commit "message"          # Commit with a custom message
/commit --status           # Show git status without committing
/commit --diff             # Show diff of changes
/commit --suggest          # Only suggest a commit message, don't commit
```

## How to Use

### Step 1: Check Current Status

First, verify what changes will be included:

```bash
git status
git diff --stat
```

### Step 2: Stage Changes (if needed)

Stage the files you want to commit:

```bash
git add <files>           # Stage specific files
git add -A                # Stage all changes
```

### Step 3: Generate and Review Message

The skill will analyze your changes and suggest a message:

- **Category Detection**: Automatically detects if changes are features, fixes, docs, etc.
- **Scope Detection**: Identifies the module/component being changed
- **Summary Generation**: Creates a concise description of what changed

### Step 4: Commit

Review the suggested message and confirm the commit.

## Commit Message Format

Messages follow the Conventional Commits specification:

```
<type>(<scope>): <description>

[optional body]

[optional footer]
```

### Types

| Type | Description |
|------|-------------|
| `feat` | New feature |
| `fix` | Bug fix |
| `docs` | Documentation changes |
| `style` | Code style changes (formatting, etc.) |
| `refactor` | Code refactoring |
| `test` | Adding or modifying tests |
| `chore` | Maintenance tasks |
| `perf` | Performance improvements |
| `build` | Build system changes |
| `ci` | CI configuration changes |

### Examples

```
feat(auth): add OAuth2 login support
fix(api): handle null response from server
docs(readme): update installation instructions
refactor(utils): simplify date formatting logic
test(user): add unit tests for UserService
```

## Best Practices

1. **Commit Often**: Make small, focused commits
2. **Be Descriptive**: The message should explain WHY, not just WHAT
3. **Use Imperative Mood**: "add feature" not "added feature"
4. **Keep First Line Short**: Under 72 characters
5. **Reference Issues**: Include issue numbers when applicable

## Workflow Example

### Example 1: Feature Implementation

**User Request:** "Commit my changes after implementing the login feature"

**Approach:**
1. Run `git status` to see all changes
2. Review `git diff` to understand the modifications
3. Analyze file patterns (auth/, login.py, etc.)
4. Generate message: `feat(auth): implement user login functionality`
5. Execute commit after user confirmation

### Example 2: Bug Fix

**User Request:** "/commit"

**Analysis:**
- Files changed: `api/handlers.py`, `tests/test_handlers.py`
- Content shows error handling fixes
- Test file updated

**Generated Message:** `fix(api): handle edge case in request validation`

## Integration with IEUM

This skill integrates with IEUM's file tracking to:

- Track files modified during the session
- Suggest which files to include in the commit
- Generate context-aware commit messages
- Warn about uncommitted sensitive files (.env, credentials)

## Notes

- Always review the suggested message before committing
- The skill won't push to remote - use `git push` separately
- For complex changes, consider breaking into multiple commits
- Use `--amend` cautiously to modify the last commit
