Create Commit with Conventional Format
Analyzes changes and creates atomic commits with conventional commit messages and appropriate emoji. Automatically runs pre-commit checks and suggests splitting large changes into multiple commits when appropriate.
🎯 Purpose & Scope
What this command does NOT do:
- •Push commits to remote repository
- •Create merge commits
- •Modify commit history
- •Add any co-authorship footer
When to REJECT:
- •No changes to commit
- •Working directory has merge conflicts
- •Pre-commit checks fail (unless --no-verify)
- •Uncommitted changes would be lost
🔄 Workflow
ultrathink: you'd perform the following steps
Step 1: Planning
- •
Analyze Requirements
- •Check for --no-verify flag
- •Identify files to commit
- •Determine project scripts available from package metadata such as package.json
- •Determine pre-commit checks needed
- •
Pre-commit Verification
- •Run linting script (if any) to ensure code quality
- •Run build script (if any) to verify build succeeds
- •Run document geneation script (if any) to update documentation
- •Skip if --no-verify flag present
- •
Change Analysis
- •Review git diff for all changes
- •Identify logical groupings
- •Determine if split needed
- •
Risk Assessment
- •Check for uncommitted changes
- •Verify no merge conflicts
- •Ensure build stability
Step 2: Execution
- •
File Staging
- •Check git status for staged files
- •If no staged files, add all modified/new files
- •Confirm files ready for commit
- •
Commit Splitting (if needed)
- •Group related changes
- •Stage files for each logical commit
- •Create separate commits for each group
- •
Commit Message Generation
- •Analyze changes for commit type for each commit group
- •Generate message suggestions following the
Commit Guidelinesbelow
- •
Commit Creation
- •Execute git commit with message and signature
- •Verify commit succeeded
- •Report completion status
Step 3: Verification
- •
Post-commit Validation
- •Verify commit created successfully
- •Check git log for new commit
- •Confirm working directory clean
- •
Quality Assurance
- •Message follows conventional format
- •Description is clear and concise
Step 4: Reporting
Output Format:
text
[✅/❌] Command: commit ## Summary - Files committed: [count] - Commits created: [count] - Pre-commit checks: [PASS/SKIP/FAIL] ## Actions Taken 1. [Pre-commit check results] 2. [Staging actions] 3. [Commit creation] ## Commit Messages - [Emoji Type: Description] ## Next Steps (if applicable) - [Push to remote] - [Create pull request]
📝 Examples
Simple Commit
bash
/commit # Runs pre-commit checks and creates single commit
Skip Verification
bash
/commit --no-verify # Skips pre-commit checks for quick commits
Suggested Split Example
bash
/commit # Detects multiple logical changes: # Commit 1: feat: add user authentication # Commit 2: docs: update API documentation # Commit 3: fix: resolve memory leak
Error Case Handling
bash
/commit # Error: No changes to commit # Suggestion: Make changes first or check git status
Pre-commit Check Failure
bash
/commit # Pre-commit checks failed: # - Lint errors: 5 # - Build failed: TypeScript compilation errors # Options: Fix issues or use --no-verify to skip
Commit Guidelines
Message Format:
- •First line must be under 70 characters, with a soft limit of 50 characters
- •Present tense, imperative mood
- •No period at end of subject line
- •Follow conventional format:
- •
<type>: <description>for global or non-project/feature specific changes - •
<type>(scope): <description>for project or feature specific changes (check git log for historic usages on scope)
- •
Atomic Commits:
- •Each commit serves single purpose
- •Related changes grouped together
- •Unrelated changes split into separate commits
Split Criteria:
- •Different concerns or modules
- •Mixed change types (feat/fix/docs)
- •Large changes needing breakdown
- •Different file patterns