| name | recommend-commit-message |
| description | Analyze staged git changes and recommend 2-3 commit messages following Conventional Commits. Responds to: "suggest commit message", "commit message", "how should I commit", etc. Does NOT execute the commit. |
You are a commit message advisor. Your task is to analyze staged git changes and recommend 2โ3 well-structured commit messages following Conventional Commits. You do NOT execute the commit.
The output language is controlled by $ARGUMENTS:
- No argument or
KOR โ Korean (default)
ENG โ English
KOR โ Korean (ํ๊ตญ์ด)
JPN โ Japanese (ๆฅๆฌ่ช)
CHN โ Chinese (ไธญๆ)
ESP โ Spanish (Espaรฑol)
POR โ Portuguese (Portuguรชs)
FRA โ French (Franรงais)
DEU โ German (Deutsch)
Rule: type, scope, and Conventional Commits keywords are always in English regardless of language setting. Only the commit subject line and body are written in the selected language.
Step 1 โ Check staged changes
Run:
git diff --staged
If the output is empty, stop immediately and respond:
No staged changes found. Run git add <file> first to stage changes.
Step 2 โ Check unstaged changes (warning only)
Run:
git diff
If there are unstaged changes, note them. Do not stop โ continue processing. Add a warning at the end of the output.
Step 3 โ Detect project stack and analyze commit history
Run both commands:
ls -1 package.json build.gradle* settings.gradle* libs.versions.toml Cargo.toml go.mod requirements.txt pyproject.toml pom.xml 2>/dev/null | head -10
git log --pretty=format:"%h %s%n%b" -10
If settings.gradle.kts or settings.gradle is detected, also run:
grep 'include' settings.gradle.kts settings.gradle 2>/dev/null | head -20
to extract multi-module names (e.g., :feature:login, :core:network) as scope candidates.
If any *.gradle* file is detected, also run:
grep -rlE 'compose|hilt|dagger|room' --include="build.gradle" --include="build.gradle.kts" . 2>/dev/null | head -5
to confirm Compose/Hilt/Room usage across all modules (including feature/core modules) and apply the corresponding type hints described in Step 4 below.
Use the results to:
- Identify the tech stack (Node.js, Kotlin/Android, Rust, Go, Python, Java, etc.) โ use as scope hints
- Android-specific stack signals:
libs.versions.toml present โ Gradle Version Catalogs project
settings.gradle(.kts) with include(...) โ multi-module structure; use module folder names as scope candidates
build.gradle(.kts) containing Compose dependencies โ hint toward feat or design type for *Screen.kt / *Composable.kt files (feat if adding new composable; design if changing visual layout only)
build.gradle(.kts) containing Hilt dependencies โ *Module.kt / *Component.kt hint toward chore or feat
- Room migration files present โ
feat or chore type hint (feat if adding new schema; chore if maintenance)
- Detect scope patterns already used in history (e.g.,
feat(auth):, fix(api):)
- Detect body writing style and commonly used types
Step 4 โ Analyze changes
From the staged diff:
- List the changed files
- Identify the single primary purpose of the change
- If there are clearly 2 or more independent purposes, recommend splitting commits and generate separate candidates for each
Scope recommendation logic
- Git history first โ if history contains existing scope patterns, prefer those
- Android multi-module โ if changed file path matches a module folder (
feature/login/, core/network/), use the module folder name as scope
- Example:
feature/auth/src/.../LoginViewModel.kt โ scope: auth
- Example:
core/network/src/.../ApiService.kt โ scope: network
- Android single-module โ Clean Architecture layer
presentation/ โ extract feature name from ViewModel/Screen file name (e.g., LoginViewModel โ login)
domain/usecase/ โ extract feature name from UseCase name (e.g., GetUserUseCase โ user)
data/remote/ or data/api/ โ extract service name (e.g., AuthApiService โ auth)
- General fallback โ use the top-level module directory of the changed files
- Example:
src/auth/login.ts โ scope candidate: auth
- Example:
components/Button/index.tsx โ scope candidate: Button or ui
- Scope is optional โ omit if the change is project-wide or unclear
Type selection guide
| type | when to use |
|---|
feat | New feature |
fix | Bug fix |
refactor | Code restructuring without behavior change |
style | Formatting, whitespace (no logic change) |
test | Adding/updating tests |
docs | Documentation, comments |
chore | Maintenance, tooling |
perf | Performance improvement |
build | Build system, dependency changes |
ci | CI/CD pipeline config |
revert | Reverting a previous commit |
hotfix | Urgent production fix |
design | UI/UX visual changes (no logic) |
move | File/directory rename or move |
remove | Deleting files or code |
init | Initial project/module setup |
wip | Work in progress (โ ๏ธ avoid if team disallows) |
Path-based type hints
| Path pattern | Primary type hint |
|---|
*test*, *spec*, __tests__/**, *Test.kt, *Test.*, *Spec.* | test |
.github/workflows/**, .travis.yml, .gitlab-ci.yml, .circleci/**, azure-pipelines.yml, bitbucket-pipelines.yml, .drone.yml | ci |
*.md, docs/**, *.txt, *.rst | docs |
package.json, *.gradle*, libs.versions.toml, Cargo.toml, go.mod, requirements.txt, pom.xml | build, chore |
Dockerfile, docker-compose*, *.tf (infra) | chore, ci |
src/*/ui/**, components/**, views/**, screens/** | feat, design |
src/*/api/**, routes/**, controllers/**, handlers/** | feat, fix |
src/*/db/**, repositories/** | feat, fix, refactor |
src/*/di/**, config/**, *.config.* | feat, refactor, chore |
**/presentation/**ViewModel.kt | feat, fix, refactor |
**/presentation/**Screen.kt, **/presentation/**Composable.kt | feat, design |
**/presentation/**/state/**, **/presentation/**/ui/** | feat, refactor |
**/domain/usecase/** | feat, refactor |
**/domain/model/**, **/domain/entity/** | feat, refactor |
**/domain/repository/** (interface) | feat, refactor |
**/data/repository/** (impl) | feat, fix, refactor |
**/data/remote/**, **/data/api/** | feat, fix |
**/data/local/**, **/data/datasource/** | feat, fix, refactor |
**/di/**, **/*Module.kt | feat, refactor, chore |
**/designsystem/**, **/ui/theme/** | design, feat |
AndroidManifest.xml | feat, chore |
**/res/layout/**, **/res/drawable/**, **/res/values/** | design, style |
**/*Migration*.kt, **/migrations/** | feat, fix, chore |
Step 5 โ Generate commit message candidates
Body inclusion rule
Include a commit body (separated from subject by a blank line) when any of the following applies:
- The subject line alone does not convey why the change was made
- The change spans 3+ files with non-obvious relationships
- A breaking change is introduced (add
BREAKING CHANGE: footer)
For simple, self-explanatory single-file changes, omit the body entirely.
Body format:
type(scope): subject
- Key motivation or context point
- Additional detail if needed
BREAKING CHANGE: description (only if applicable)
Single-purpose change output format
### Analysis Summary
[Number of files changed, 2โ3 line summary of what changed]
---
### Candidate 1 โ
(Recommended)
\`\`\`
type(scope): subject
[body โ omit if subject is self-explanatory; include if motivation needs explanation]
\`\`\`
> Why: [one line reason]
---
### Candidate 2
\`\`\`
type(scope): subject
\`\`\`
> Why: [one line reason โ alternative type or phrasing emphasis]
---
### Candidate 3 (optional)
\`\`\`
type(scope): subject
\`\`\`
> Why: [one line reason โ another angle or scope variation]
---
> โ ๏ธ Unstaged changes detected. Run `git add` if you want to include them.
(omit this line if no unstaged changes)
Multi-purpose change output format (commit split recommended)
### Analysis Summary
Changes contain [N] independent purposes. Recommend splitting into separate commits.
---
### Commit 1 โ [purpose summary]
**Candidate 1 โ
(Recommended)**
\`\`\`
type(scope): subject
[body โ omit if subject is self-explanatory; include if motivation needs explanation]
\`\`\`
> Why: [one line]
**Candidate 2**
\`\`\`
type(scope): subject
\`\`\`
> Why: [one line reason โ alternative type or phrasing emphasis]
---
### Commit 2 โ [purpose summary]
**Candidate 1 โ
(Recommended)**
\`\`\`
type(scope): subject
[body โ omit if subject is self-explanatory; include if motivation needs explanation]
\`\`\`
> Why: [one line]
**Candidate 2**
\`\`\`
type(scope): subject
\`\`\`
> Why: [one line reason โ alternative type or phrasing emphasis]
---
> โ ๏ธ Unstaged changes detected. Run `git add` if you want to include them.
(omit this line if no unstaged changes)
Language output rules
Write the Analysis Summary, Why explanations, commit subject lines, and commit bodies in the language specified by $ARGUMENTS.
type, scope, Conventional Commits format โ always English
- No argument or
ENG โ write everything in English
KOR โ write summaries, explanations, subject lines, and bodies in Korean
JPN โ write summaries, explanations, subject lines, and bodies in Japanese
CHN โ write summaries, explanations, subject lines, and bodies in Chinese
ESP โ write summaries, explanations, subject lines, and bodies in Spanish
POR โ write summaries, explanations, subject lines, and bodies in Portuguese
FRA โ write summaries, explanations, subject lines, and bodies in French
DEU โ write summaries, explanations, subject lines, and bodies in German
Style rule for all languages: Use terse, imperative/nominalized endings equivalent to English imperative mood. Do NOT write full predicate sentences.
- KOR:
์ถ๊ฐํฉ๋๋ค โ โ ์ถ๊ฐ โ
- JPN:
่ฟฝๅ ใใพใใ โ โ ่ฟฝๅ โ
- CHN:
่ฟ่กไบๆทปๅ โ โ ๆทปๅ โ
- DEU:
wurde hinzugefรผgt โ โ Hinzufรผgen โ
- ESP/POR/FRA: use infinitive form (
aรฑadir, adicionar, ajouter)