| name | commit |
| description | Prepares a git commit for react-gts-app by analyzing staged changes and detecting commit style from the repo's signals — user history, recent repo history, commit templates, and any commit-msg hook. Confirms with the user only when signals conflict. Use when the user wants to commit changes or asks to prepare a commit message.
|
| user-invocable | true |
| disable-model-invocation | true |
| argument-hint | [optional: what was done] |
Commit Changes
Detect, don't assume. Inspect the repo's signals before writing anything.
Steps
1. Check staged changes
git status
git diff --cached
If nothing is staged, tell the user to stage files first and stop. Do not stage automatically.
2. Detect style signals (parallel)
git config user.name
git log --author="$(git config user.name)" -5 --format="%B%n---%n" — user's personal style
git log -10 --format="%s" — repo's recent titles
git config --get commit.template — if set, read it
- Probe for enforced conventions, skip each missing:
.husky/commit-msg, .husky/_/commit-msg, commitlint.config.js, commitlint.config.cjs, .commitlintrc, .gitmessage, CONTRIBUTING.md
Remember: package.json has posttest: npm run lint, so npm test implies lint — no extra lint invocation in the body.
3. Analyze
From whichever signals were found, identify:
- Title — imperative vs past tense, capitalization, length cap, conventional commits (
feat:, fix:), optional scope (feat(App):).
- Body — present always / sometimes / never; "why" paragraph + bullet pattern.
- Bullets — granularity (behavior-level, file-level, summary).
- Trailers —
Co-Authored-By, Signed-off-by, Refs #NNN — include only if user history or template shows them.
- Emoji / icon prefixes — include only if user history shows them.
If user style and an enforced convention conflict, favor the convention and say so.
4. Draft the message
Match detected style exactly. If $ARGUMENTS is provided, use it as body context.
5. Create the commit
Use a heredoc to preserve formatting:
git commit -m "$(cat <<'EOF'
Title here
Body explaining why and what problem it solves.
- Specific change with detail
- Another specific change
EOF
)"
If a commit-msg hook rejects the message, read its feedback, adjust, and retry once. Never bypass with --no-verify.
Rules
- Match detected style exactly; do not impose a different format.
- Title: imperative mood ("Add" not "Added"), under 50 chars, unless detected style differs.
- Body: explain motivation and context, not just "what".
- Bullets: specific — include paths, identifiers, or behaviors.
- NEVER add "Generated with Claude Code" or
Co-Authored-By lines unless user history or template includes them.
- NEVER add emoji unless user history shows emoji usage.
- If nothing is staged, tell the user and stop — do not stage files automatically.
- If a commit-msg hook blocks the commit, fix the root cause; never
--no-verify.