---
name: git-commit
description: Generate a git commit message and ready-to-run git commit command from the actual staged/working diff. Use whenever the user asks for a commit message, commit command, "/git-commit", or "commit this"; supports one-line commits, detailed commits, single-repo projects, monorepo scoped commit bodies, and git submodules committed separately before the root repo.
---

# Git Commit

## Inspect

- Inspect `git status` and the relevant staged/working diffs before writing anything.
- Detect the actual change from the diff; do not guess from open tabs or filenames only.
- Exclude files the user explicitly says not to commit or not to include in the message.
- By default, cover every change: modified, deleted, and newly created files, staged or not.
- Never drop untracked files silently. Newly created files are part of the default scope.
- Narrow the scope only when the user names one, such as only modified, only deleted, or only a path like `src/product`.
- If the repo has submodules, follow `## Submodules` before anything else.
- If there is nothing to commit, say so and stop; do not emit a commit command.

## Pick Command Shape

- Use one line for one coherent intent, even when it touches several files.
- Use one line for focused updates such as one UI behavior change, repeated CSS cleanup, or one variable/API rename.
- Use a detailed commit for multiple independent intents, risky behavior changes, migrations, broad feature work, or context future readers need.

## Subject

- Treat the first `-m` as the commit subject. It must summarize the whole commit.
- For one-line commits, use Conventional Commits: `type(scope): concise summary`.
- For detailed commits, use a plain-English overall subject without `type(scope)`.
- Keep detailed subjects readable in `git log --oneline`, for example `Add passkey authentication support`.
- Prefer imperative mood when natural.

## Body

- Add a body only when it helps explain why the change was needed and what changed.
- Use a second `-m` argument for the body.
- Use literal newlines for paragraphs and bullets.
- Write the body paragraph in descriptive English.

## Monorepos

- If the repo is a monorepo or the diff spans apps/packages, prefer scoped body bullets: `type(scope): specific change`.
- Use concrete scopes from affected apps/packages/domains, such as `admin`, `server`, `website`, `docs`, or `shared`.
- Do not use vague labels like `Both`, `Frontend`, or `Backend` when concrete scopes exist.
- Sort scoped bullets by type, then scope, then importance.
- Prefer this type order: `feat`, `fix`, `refactor`, `perf`, `test`, `docs`, `style`, `chore`.

## Single Repos

- For single-repo detailed commits, use `type: specific change` bullets without a scope.
- Keep bullets specific and ordered by importance.

## Submodules

- Detect submodules with `git submodule status --recursive` and `.gitmodules`; treat every submodule as its own isolated repo.
- Inspect each one separately with `git -C <submodule-path> status` and `git -C <submodule-path> diff`; never judge a submodule from the root diff.
- Emit submodule commits first, then the root repo commit. With nested submodules, order the deepest first.
- Skip any submodule with no changes. If only the root changed, output the normal single-repo or monorepo commit.
- Build each submodule message from that submodule's own diff only. Do not mention root changes in it, and do not describe submodule internals in the root message.
- A submodule is a full repo of its own and can be single-repo or monorepo, independent of what the root is.
- Run `## Pick Command Shape`, `## Subject`, `## Body`, `## Monorepos`, and `## Single Repos` separately for each submodule, judged from its own diff.
- Pick template A, B, or C per repo: a submodule can use template B while the root uses template A, or the reverse.
- If the submodule pointer bump shows up in the root diff, cover it in the root commit with a `chore(<submodule>): bump <name> submodule` bullet.
- Label each section so it is obvious which repo a block belongs to.

Emit one block per changed submodule, deepest first, then the root repo block last. Each block is a raw `git commit` command using template A, B, or C picked from that repo's own diff. Label each block with its repo path; the user navigates there and runs it.

## Guardrails

- Return only a ready-to-run `git commit` command.
- Do not include a `git add` command.
- Do not run the commit unless explicitly asked.
- Do not add AI or agent co-author lines.

## Templates

### Template A: one-line

```bash
git commit -m "type(scope): concise overall summary"
```

### Template B: detailed monorepo

```bash
git commit -m "Plain-English overall summary" -m "Describe the problem or motivation and what the full commit changes in normal English.

- type(scope): first specific change
- type(scope): second specific change
- type(scope): third specific change"
```

### Template C: detailed single-repo

```bash
git commit -m "Plain-English overall summary" -m "Describe the problem or motivation and what the full commit changes in normal English.

- type: first specific change
- type: second specific change
- type: third specific change"
```

NOTE: you must give the git commit format inside `bash {...determined git commit format} `, do not give raw text. because output will be copied and pasted in terminal
