/cook-zh-tw:commit-message runs instead · from cook-zh-tw
Generates commit messages from git staged changes, supporting conventional commits, gitmoji, and angular formats. Detects project conventions and copies to clipboard.
This skill never runs in Claude Code
It ships in cook-zh-tw at skills/, but /cook-zh-tw:commit-message (a command, or a skill Claude Code finds first) has the same name: typing it, or Claude choosing it, runs that one instead.
從暂存的更改 (git diff --staged) 生成合適的提交消息。仅生成消息並復制到剪贴板,不執行 git 命令。
/commit-message [選項]
--format <格式> : 指定消息格式 (conventional, gitmoji, angular)--lang <語言> : 強制指定消息語言 (en, zh-tw)--breaking : 檢測並記錄 Breaking Change# 從暂存的更改生成消息 (自動判定語言)
# 主要候選會自動復制到剪贴板
/commit-message
# 強制指定語言
/commit-message --lang zh-tw
/commit-message --lang en
# 檢測 Breaking Change
/commit-message --breaking
重要: 此命令仅分析暂存的更改。需要先使用 git add 暂存更改。
# 如果没有暂存更改,會顯示警告
$ /commit-message
没有暂存的更改。請先執行 git add。
生成的主要候選會以 git commit -m "消息" 的完整格式自動復制到剪贴板。可以直接在終端粘贴執行。
實現注意事項:
pbcopy 時,應與消息輸出分開執行printf 而不是 echo 以避免末尾換行重要: 如果存在項目特有的規範,將優先使用。
從以下文件自動檢測配置:
commitlint.config.jscommitlint.config.mjscommitlint.config.cjscommitlint.config.ts.commitlintrc.js.commitlintrc.json.commitlintrc.yml.commitlintrc.yamlpackage.json 的 commitlint 部分# 搜索配置文件
find . -name "commitlint.config.*" -o -name ".commitlintrc.*" | head -1
項目特有類型示例:
// commitlint.config.mjs
export default {
extends: ["@commitlint/config-conventional"],
rules: {
"type-enum": [
2,
"always",
[
"feat",
"fix",
"docs",
"style",
"refactor",
"test",
"chore",
"wip", // 進行中
"hotfix", // 紧急修復
"release", // 發布
"deps", // 依賴更新
"config", // 配置更改
],
],
},
};
// 項目使用繁体字中文消息時
export default {
rules: {
"subject-case": [0], // 為支持繁体字中文而禁用
"subject-max-length": [2, "always", 72], // 為繁体字中文調整字符數限制
},
};
# 從最近的提交學習使用模式
git log --oneline -50 --pretty=format:"%s"
# 使用類型統計
git log --oneline -100 --pretty=format:"%s" | \
grep -oE '^[a-z]+(\([^)]+\))?' | \
sort | uniq -c | sort -nr
根據以下條件自動切換繁体字中文/英文:
默認為英文。判定為繁体字中文項目時生成繁体字中文消息。
<type>: <description>
重要: 必须生成單行提交消息。不生成多行消息。
注意: 如果項目有特有規範,將優先使用。
必须類型:
feat: 新功能 (用戶可見的功能添加)fix: 缺陷修復可選類型:
build: 構建系統或外部依賴的更改chore: 其他更改 (不影響發布)ci: CI 配置文件或腳本的更改docs: 仅文檔更改style: 不影響代碼含義的更改 (空格、格式、分号等)refactor: 既不修復缺陷也不添加功能的代碼更改perf: 性能改進test: 添加或更正測試$ /commit-message
📝 提交消息建議
━━━━━━━━━━━━━━━━━━━━━━━━━
✨ 主要候選:
feat: implement JWT-based authentication system
📋 備選方案:
1. feat: add user authentication with JWT tokens
2. fix: resolve token validation error in auth middleware
3. refactor: extract auth logic into separate module
✅ `git commit -m "feat: implement JWT-based authentication system"` 已復制到剪贴板
實現示例 (更正版):
# 先將提交命令復制到剪贴板 (無換行)
printf 'git commit -m "%s"' "$COMMIT_MESSAGE" | pbcopy
# 然後顯示消息
cat << EOF
📝 提交消息建議
━━━━━━━━━━━━━━━━━━━━━━━━━
✨ 主要候選:
$COMMIT_MESSAGE
📋 備選方案:
1. ...
2. ...
3. ...
✅ `git commit -m "$COMMIT_MESSAGE"` 已復制到剪贴板
EOF
$ /commit-message
📝 提交消息建議
━━━━━━━━━━━━━━━━━━━━━━━━━
✨ 主要候選:
feat: 實作 JWT 認證系統
📋 備選方案:
1. feat: 新增基於 JWT 令牌的使用者認證
2. fix: 解決認證中介軟體的令牌驗證錯誤
3. docs: 將認證邏輯分離到獨立模組
✅ `git commit -m "feat: 實作 JWT 認證系統"` 已復制到剪贴板
git diff --staged 的內容注意: 此命令不執行 git add 或 git commit。仅生成提交消息並復制到剪贴板。
featfixtestchoredocs.gitmessage 文件CONTRIBUTING.md 中的規範# 判定基準 (優先級)
1. 從 git diff --staged 的內容判定語言
2. 暂存文件的注釋分析
3. git log --oneline -20 的語言分析
4. 項目主要語言設置
分析使用的資訊 (仅讀取):
git diff --staged --name-only - 更改文件列表git diff --staged - 實際更改內容git status --porcelain - 文件狀態当有 API 破坏性更改時:
英文:
feat!: change user API response format
BREAKING CHANGE: user response now includes additional metadata
或
feat(api)!: change authentication flow
繁体字中文:
feat!: 更改用戶 API 響應格式
BREAKING CHANGE: 響應現在包含额外的元數據
或
feat(api)!: 更改認證流程
英文:
feat: add user registration endpoint
fix: resolve memory leak in cache manager
docs: update API documentation
繁体字中文:
feat: 添加用戶注冊端點
fix: 解決緩存管理器內存洩漏
docs: 更新 API 文檔
# 與暂存更改結合使用
git add -p # 交互式暂存
/commit-message
"生成最優的提交消息"
# 仅暂存特定文件後分析
git add src/auth/*.js
/commit-message --lang zh-tw
"為認證相關更改生成合適的消息"
# Breaking Change 檢測和應對
git add -A
/commit-message --breaking
"如有破坏性更改請適当標記"
git add 暂存What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub wasabeef/claude-code-cookbook --plugin cook-zh-tw39 skills in this plugin
/analyze-dependencies分析專案依賴關係並評估架構健全性分析專案依賴關係並評估架構健全性。「分析依賴關係」「檢測循環依賴」「架構問題?」「檢查模組耦合」「查找層違規」等觸發。/analyze-performance基於 Core Web Vitals 的效能分析和 UX 評分基於 Core Web Vitals 的效能分析和 UX 評分。「分析效能」「改善速度」「檢查 Core Web Vitals」「頁面速度」等觸發。/check-fact透過程式碼庫和文件驗證資訊準確性透過程式碼庫和文件驗證資訊準確性。「這個資訊對嗎?」「事實檢查」「驗證這個」等觸發。/check-prompt評估並改進 AI 提示詞品質評估並改進 AI 提示詞品質。「檢查提示詞」「評估提示詞品質」「改進提示詞」等觸發。/context7透過 Context7 MCP 搜尋技術文件透過 Context7 MCP 搜尋技術文件。「查文件」「查看官方文件」「函式庫怎麼用?」等觸發。/design-patterns建議設計模式並評估 SOLID 原則建議設計模式並評估 SOLID 原則。「建議設計模式」「可以用什麼模式?」「檢查 SOLID 原則」「偵測反模式」等觸發。2 plugins ship this exact skill · first indexed Jul 16, 2026
Other plugins' skills for the same job