--- name: git-atomic-commit description: Skill for analyzing git changes, grouping them into logical atomic commits, generating conventional commit messages, and guiding through the commit process. Use when committing changes with proper conventional commit format and maintaining atomic commits. --- # Git Atomic Commit ## Overview This skill enables crafting clean, atomic git commits with conventional commit messages by analyzing all changes in the repository, intelligently grouping them into logical commits, and guiding the user through the process. ## ⚠️ Critical: Project-Specific Types Are Mandatory **DO NOT default to general conventional commit types.** This project uses specialized commit types that must be applied based on file paths and change nature. Always use the project-specific mappings below - they override general conventional commit guidelines. ## File Path to Commit Type Mapping **MANDATORY STEP: Before any grouping or planning, assign a commit type to EACH changed file individually using this mapping. Files with different commit types MUST be in separate commits - this is non-negotiable for atomicity.** | File Path Pattern | Required Commit Type | Rationale | | ----------------------- | ----------------------- | -------------------------------------------- | | `.docs/issues/*` | `docs(issue)` | Issue documentation and tracking | | `.docs/changelogs/*` | `docs(changelog)` | Changelog files | | `instructions/*.md` | `copilot(instruction)` | Repository-level Copilot instructions | | `skills/*` | `ai(skill)` | Claude skill definitions and implementations | | `scripts/*.ps1` | `devtool(script)` | PowerShell helper scripts | | `*.agent.md` | `copilot(custom-agent)` | Custom agent definitions | | `**/AGENTS.md` | `ai(instruction)` | Standard AI agent custom instructions | | `*.prompt.md` | `copilot(prompt)` | Copilot prompt files | | `memory.json` | `copilot(memory)` | Knowledge graph memory systems | | `.codex/*` | `codex` | Codex-specific configuration and instructions| | `.vscode/mcp.json` | `copilot(mcp)` | MCP server configuration for Copilot | | `.vscode/settings.json` | `devtool(vscode)` | VS Code workspace settings | | `.vscode/tasks.json` | `devtool(vscode)` | VS Code workspace task configurations | **Critical Rules:** - **Different commit types = Different commits** - Even related files must be separated if they have different types - **No exceptions** - Atomicity requires type separation - **Check mapping first** - Assign types to individual files before considering relationships **Common Mistakes to Avoid:** - ❌ `feat(instructions)` → ✅ `copilot(instruction)` - ❌ `feat(skill)` → ✅ `ai(skill)` - ❌ `chore(issue)` → ✅ `docs(issue)` - ❌ `docs` (no scope) → ✅ `docs(issue)` or `docs(changelog)` - ❌ `feat(codex)` → ✅ `codex` - ❌ `copilot(agent-config)` → ✅ `ai(instruction)` - ❌ `docs(agents)` → ✅ `ai(instruction)` - ❌ Mixing `copilot(mcp)` + `devtool(vscode)` in one commit → ✅ Separate commits - ❌ Grouping files with different types → ✅ One type per commit ## Workflow ### 1. Analyze All Changes - Retrieve all changed files (both staged and unstaged) - If no changes exist, inform the user there's nothing to commit - Read relevant file diffs to understand the nature of each change ### 2. Assign Commit Types to Individual Files **MANDATORY: For each changed file, determine its exact commit type using the mapping table above. Document this assignment - it drives the entire commit strategy.** ### 3. Pre-Commit Verification Checklist **MANDATORY: Complete this checklist before presenting any commit plan:** - [ ] **Type Mapping**: Every file path mapped to correct project-specific type using the table above - [ ] **No Generic Types**: No commits using `feat`, `fix`, `docs` without project-specific scope - [ ] **Atomic Grouping**: Changes grouped by logical feature/module boundaries - [ ] **Dependency Order**: Commit order maintains buildable state - [ ] **Scope Accuracy**: Commit scopes match actual module/feature names **If any checklist item fails, revise the plan before proceeding.** ### 4. Group Changes into Logical Commits **CRITICAL CONSTRAINT: Files with different commit types CANNOT be grouped together - they must be in separate commits.** Group remaining related changes based on: - **Same commit type**: Only group files that share the same required commit type - **Feature scope**: Files related to the same feature/module (within same type) - **Change type**: Separate refactors from features from fixes (within same type) - **Domain boundaries**: Respect module/bounded context boundaries (within same type) - **Dependencies**: Ensure commits can be applied sequentially without breaking the build **If grouping would mix commit types, split into separate commits immediately.** Create a todo list tracking each planned commit with their assigned types. ### 5. Validate Commit Plan **MANDATORY VALIDATION: Review each planned commit to ensure:** - All files in a commit share the same commit type - No commit mixes different types - Each commit represents one logical change within its type - Commits can be applied in sequence without conflicts **If validation fails, revise the grouping immediately.** ### 6. Generate Conventional Commit Messages For each group, generate a commit message following **Conventional Commits** format: ```text ():