CommandOpen
commit
Analyze all staged git changes and generate an intelligent conventional commit message.
Front matter
name: commit
description: Analyze all staged git changes and generate an intelligent conventional commit message./smart-commit:commit
Analyze all staged git changes and generate an intelligent conventional commit message.
Process
- Run
git diff --cached --statto identify all staged files and their change magnitudes. - Run
git diff --cachedto read the full diff of staged changes. - Determine the primary commit type based on the nature of changes:
feat- New functionality, new files introducing features, new endpoints or UI componentsfix- Bug corrections, error handling improvements, null checks, edge case fixesrefactor- Code restructuring without behavior change, renaming, extraction of functionsdocs- Documentation-only changes, comments, README updates, docstringstest- Adding or modifying tests, test fixtures, test utilitieschore- Build config, dependency updates, CI changes, tooling, linting rulesperf- Performance improvements, caching, query optimization, lazy loadingstyle- Formatting, whitespace, semicolons, code style (no logic change)ci- CI/CD pipeline changes, workflow files, deployment configs
- Derive the scope from the most affected directory or module:
- Use the top-level directory name if changes span one area (e.g.,
auth,api,ui) - Use a broader scope if changes span multiple areas (e.g.,
core,app) - Omit scope if changes are truly cross-cutting or trivial
- Write the commit subject line (max 72 characters):
- Use imperative mood ("add" not "added", "fix" not "fixes")
- Focus on WHY the change was made, not WHAT files changed
- Be specific: "fix race condition in websocket reconnect" not "fix bug"
- Do not end with a period
- Determine if a body is needed (skip for obvious single-line changes):
- Explain the motivation behind the change
- Describe the approach taken and why alternatives were rejected
- Keep each line under 80 characters
- Add footers when applicable:
BREAKING CHANGE: <description>if the change breaks existing APIs or behaviorCloses #<number>if the change resolves a tracked issueRefs: <context>for related PRs, issues, or discussions
- Present the commit message for review, then execute
git commitwith the approved message.
Output Format
type(scope): concise imperative description
Optional body explaining the motivation and approach.
Optional footers.Rules
- Never fabricate issue numbers or references
- If multiple types apply equally, prefer the one with the largest behavioral impact
- When in doubt between
featandrefactor, ask: does the user-visible behavior change? - Run
git log --oneline -10first to match the repository's existing commit style - If nothing is staged, inform the user and suggest what to stage
Author: rohitg00, Claude Code toolkit (rohitg00). License: Apache-2.0.
Shown here with formatting for the web. Keep the author and license notice when you reuse it.
Related entries
There are more like this in the members library
The Codex library holds 7,009 entries. Members can search all of them by meaning and read every one in full.