Generates Conventional Commits messages from staged changes after pre-flight checks (staged files, conflicts, tests, specs). Suggests spec refs for feat/fix and commits after confirmation.
npx claudepluginhub asiaostrich/universal-dev-standards --plugin universal-dev-standards# Commit Message Assistant | Commit Message 助手
Generate well-formatted commit messages following the Conventional Commits standard.
根據 staged 的變更,產生符合 Conventional Commits 格式的 commit message。
## Pre-Flight Checks | 前置檢查
Before generating a commit, the AI assistant MUST run these checks:
在產生 commit 前,AI 助手必須執行以下檢查:
| Check | Command | On Failure |
|-------|---------|------------|
| Staged changes exist | `git diff --cached --stat` | → Guide user to `git add` |
| No merge conflicts | `grep -r "<<<<<<< " --include="*.{js,ts,md,yaml}" .` | → Resolve conflicts first |
| Tests pass (if feat.../commitAnalyzes staged git changes, generates a conventional commit message, seeks user approval, and executes the commit without trailers.
/commitAnalyzes git changes to generate conventional commit messages, stages files appropriately, runs pre-commit checks like linting and tests, and creates atomic commits.
/commit-smartAnalyzes staged Git changes to generate a conventional commit message (type(scope): description), confirms with user, and commits if approved.
/commitCommits staged changes with descriptive messages in conventional commit format using emoji prefixes (e.g., ✨ feat:, 🐛 fix:, ♻️ refactor:). Runs git status and git commit -m.
/commitAnalyzes current git diff, generates 3 conventional commit message options (concise, detailed, comprehensive), presents for user selection, and executes git commit.
/commitCreates a conventional git commit with auto-generated message from staged changes. Supports types like feat, fix; accepts optional scope or message hint.
Share bugs, ideas, or general feedback.
Generate well-formatted commit messages following the Conventional Commits standard.
根據 staged 的變更,產生符合 Conventional Commits 格式的 commit message。
Before generating a commit, the AI assistant MUST run these checks:
在產生 commit 前,AI 助手必須執行以下檢查:
| Check | Command | On Failure |
|---|---|---|
| Staged changes exist | git diff --cached --stat | → Guide user to git add |
| No merge conflicts | grep -r "<<<<<<< " --include="*.{js,ts,md,yaml}" . | → Resolve conflicts first |
| Tests pass (if feat/fix) | cd cli && npm run test:unit (or project test cmd) | → Fix tests before committing |
| Spec reference (feat/fix) | Check docs/specs/SPEC-*.md for active specs | → Suggest Refs: SPEC-XXX in footer |
| UDS upstream files | git diff --cached --name-only | grep -E '^\.(standards|claude/skills)/' | → Suggest /audit --friction (advisory) |
For feat and fix type commits:
ls docs/specs/SPEC-*.md 2>/dev/null — any active specs?Refs: SPEC-XXX to commit footer/sdd對於 feat 和 fix 類型的提交:
Refs: SPEC-XXX/sdd 建立規格git status and git diff --staged to understand changes<type>(<scope>): <subject>
<body>
<footer>
git commitFor feat/fix commits, evaluate whether a spec should be created or linked. Suggest a spec when: many files changed (>3), public API signatures modified, or significant new functionality. Skip for docs/style/chore/test types.
If a spec is linked, add Refs: SPEC-XXX to the commit footer. This is advisory — the user can always ignore.
| Type | When to Use | 使用時機 |
|---|---|---|
feat | New feature | 新功能 |
fix | Bug fix | 修復錯誤 |
refactor | Code refactoring | 重構 |
docs | Documentation | 文件更新 |
style | Formatting | 格式調整 |
test | Tests | 測試相關 |
perf | Performance | 效能優化 |
chore | Maintenance | 維護任務 |
/commit - Auto-analyze changes and suggest commit message/commit fix login bug - Generate message based on provided descriptionFollows AI Command Behavior Standards
| Input | AI Action | AI 行為 |
|---|---|---|
/commit | 執行 Pre-Flight Checks → 分析 staged 變更 → 產生 commit message → 等待確認 | Run checks, analyze, generate, confirm |
/commit <description> | 以描述為基礎,結合 staged diff 產生 commit message → 等待確認 | Use description + diff to generate message |
git diff --cached --stat 確認有 staged 變更git status 和 git diff --staged 了解變更內容Decision: Pre-Flight Check 結果
git add,停止Decision: Spec 追蹤(僅 feat/fix)
Refs: SPEC-XXX/sddDecision: UDS 上游檔案偵測
.standards/ 或 .claude/skills/ → 顯示 ⚠️「偵測到 UDS 上游管理的檔案被修改,建議執行 /audit --friction 回報上游」🛑 STOP: 展示 commit message 後等待使用者確認或修改
git commit| Stop Point | 等待內容 |
|---|---|
| Pre-Flight 失敗 | 使用者修復問題後重新執行 |
| Message 展示後 | 確認 message 正確,或要求修改 |
| Error Condition | AI Action |
|---|---|
| 無 staged 變更 | 顯示 git add 指引,不嘗試 commit |
| 合併衝突存在 | 提示解決衝突,列出衝突檔案 |
| 測試失敗(feat/fix) | 顯示失敗摘要,建議修復後再 commit |
| commit 執行失敗 | 顯示 git 錯誤訊息,不重試 |