---
name: commit
description: Use when committing code changes - enforces commit message format, safety checks, and prohibits AI signatures
---

# Commit

Automatically generate a commit message and submit the code.

## Workflow

1. **Check status**: run `git status` to inspect changes (do not use `-uall`)
2. **Review diff**: run `git diff --staged` and `git diff` to inspect the exact changes
3. **Check style**: run `git log --oneline -10` to review recent commit style
4. **Generate message**: create a commit message that follows the rules below
5. **Commit**: stage the files and commit

## Commit Message Rules

### Format
```text
<type>: <description>

[optional body]
```

### Type Values
- `feat`: new feature
- `fix`: bug fix
- `docs`: documentation update
- `refactor`: refactor with no functional change
- `test`: test-related change
- `chore`: build / tooling / configuration
- `perf`: performance optimization
- `ci`: CI/CD related

### Rules
- The description must be written in English
- Keep it under 72 characters
- Use the imperative mood, for example "add user authentication" instead of "added user authentication"

## Safety Rules

> [!CAUTION]
> **Never** add any AI signature to a commit message:
> - Do not add `Co-Authored-By: Claude`
> - Do not add `🤖 Generated with...`
> - Do not add any AI signature or marker

## Sensitive File Check

Before committing, check whether any of the following files were accidentally added:
- `.env` / `.env.*`
- `credentials.json`
- `*_secret*`
- `*.pem` / `*.key`

If sensitive files are found, **warn the user** and wait for confirmation.

## Examples

```bash
# Auto-generate a message
/commit

# Specify a message
/commit "feat: add user login"
```
