Commandpython
/commit Command
Stage files and create conventional commit with AI-generated message
šÆ ACTION: Create Conventional Commit
Run linting and pre-commit checks, stage changes, generate a conventional commit message, and commit.
See @CONSTITUTION.md for project-specific commit conventions and pre-commit requirements.
š STEPS
- Run linting and formatting - Execute project's lint and format commands to ensure code quality
- Run pre-commit checks - Execute any pre-commit hooks or validation scripts
- Stage all changes - Run
git add -Ato stage all modified, deleted, and new files - Check for changes - Verify there are staged changes with
git diff --cached --quiet - Show what will be committed - Display
git status --shortandgit diff --cached --stat - Analyze changes - Review diff to determine commit type and scope
- Generate commit message - Create conventional commit message following format
- Present for approval - Show message and ask user to proceed, edit, or cancel
- Validate message - Ensure format matches
type(scope): descriptionortype: description - Execute commit - Use HEREDOC format for multi-line commit
- Update PLAN.md - Ask if @PLAN.md should be updated to reflect these changes
- Suggest next step - Recommend pushing or making additional changes
š” CONTEXT
Conventional commit types:
feat- New features or capabilitiesfix- Bug fixesdocs- Documentation onlyrefactor- Code restructuring without behavior changetest- Test changeschore- Maintenance tasks (dependencies, tooling, config)ci- CI/CD changesperf- Performance improvementsstyle- Code style changes (formatting, linting)build- Build system changessecurity- Security improvements
Commit message rules:
- Use imperative mood: "add" not "added"
- Start with lowercase
- No period at the end
- Keep under 72 characters
- Be specific and descriptive
Scope detection:
- Extract primary directory or module being changed
- Omit scope if changes span multiple unrelated areas
- Keep scope short (1-2 words max)
HEREDOC commit format:
git commit -m "$(cat <<'EOF'
type(scope): description
š¤ [Your signature and fun comment!]
EOF
)"
š Follow-up Commands
/plan- Update the project plan/learn- Extract lessons from the work- Push changes when ready
Related
- @.claude/standards/conventional-commits.md - Commit message format
- @.claude/standards/precommit-workflow.md - Pre-commit checks
- @.claude/standards/git-workflow.md - Git workflow
- @.claude/commands/test.md - Run tests before committing
- @.claude/commands/plan.md - Update project plan
- @.claude/INDEX.md - Command directory