Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Creates Conventional Commits-format git commits by analyzing the diff, auto-detecting type/scope, and staging logical groups of files.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
SKILL.md
1---2name: git-commit3description: 'Execute git commit with conventional commit message analysis, intelligent staging, and message generation. Use when user asks to commit changes, create a git commit, or mentions "/commit". Supports: (1) Auto-detecting type and scope from changes, (2) Generating conventional commit messages from diff, (3) Interactive commit with optional type/scope/description overrides, (4) Intelligent file staging for logical grouping'4license: MIT5allowed-tools: Bash6---78# Git Commit with Conventional Commits910## Overview1112Create standardized, semantic git commits using the Conventional Commits specification. Analyze the actual diff to determine appropriate type, scope, and message.1314## Conventional Commit Format1516```17<type>[optional scope]: <description>1819[optional body]2021[optional footer(s)]22```2324## Commit Types2526| Type | Purpose |27| ---------- | ------------------------------ |28| `feat` | New feature |29| `fix` | Bug fix |30| `docs` | Documentation only |31| `style` | Formatting/style (no logic) |32| `refactor` | Code refactor (no feature/fix) |33| `perf` | Performance improvement |34| `test` | Add/update tests |35| `build` | Build system/dependencies |36| `ci` | CI/config changes |37| `chore` | Maintenance/misc |38| `revert` | Revert commit |3940## Breaking Changes4142```43# Exclamation mark after type/scope44feat!: remove deprecated endpoint4546# BREAKING CHANGE footer47feat: allow config to extend other configs4849BREAKING CHANGE: `extends` key behavior changed50```5152## Workflow5354### 1. Analyze Diff5556```bash57# If files are staged, use staged diff58git diff --staged5960# If nothing staged, use working tree diff61git diff6263# Also check status64git status --porcelain65```6667### 2. Stage Files (if needed)6869If nothing is staged or you want to group changes differently:7071```bash72# Stage specific files73git add path/to/file1 path/to/file27475# Stage by pattern76git add *.test.*77git add src/components/*7879# Interactive staging80git add -p81```8283**Never commit secrets** (.env, credentials.json, private keys).8485### 3. Generate Commit Message8687Analyze the diff to determine:8889- **Type**: What kind of change is this?90- **Scope**: What area/module is affected?91- **Description**: One-line summary of what changed (present tense, imperative mood, <72 chars)9293### 4. Execute Commit9495```bash96# Single line97git commit -m "<type>[scope]: <description>"9899# Multi-line with body/footer100git commit -m "$(cat <<'EOF'101<type>[scope]: <description>102103<optional body>104105<optional footer>106EOF107)"108```109110## Best Practices111112- One logical change per commit113- Present tense: "add" not "added"114- Imperative mood: "fix bug" not "fixes bug"115- Reference issues: `Closes #123`, `Refs #456`116- Keep description under 72 characters117118## Git Safety Protocol119120- NEVER update git config121- NEVER run destructive commands (--force, hard reset) without explicit request122- NEVER skip hooks (--no-verify) unless user asks123- NEVER force push to main/master124- If commit fails due to hooks, fix and create NEW commit (don't amend)125