commit

A Git command that creates a short commit message from the actual code changes, following the Conventional Commits format. It can produce the message in Chinese or English.

In plain words
What is it for?
Use it to review staged or unstaged changes, summarize what changed, and prepare a commit command for confirmation.
Why use it?
It avoids vague commit messages and reduces the need to inspect changes and write the wording by hand.

Command for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/ttdazi/cursoraicommit/commit
Clone the repo
git clone --depth 1 https://github.com/ttdazi/CursorAiCommit

Made for: Cursor.

Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,022 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.01022
Opus 5 $0.00000 $0.00511
Sonnet 5 $0.00000 $0.00204
Haiku 4.5 $0.00000 $0.00102

Measured yesterday against content hash c14160ad285b, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

commit scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/commands/commit.md · 106 lines

How it starts

The opening of the file, as written. The whole thing — 106 lines — stays where its author put it; the contents beside it link to each section on GitHub.

commit

生成符合 Conventional Commits 规范的 Git Commit Message,支持{language_type1}{language_type2}动态切换。

语言类型配置

可配置变量(用户可以根据需要修改这些值):

  • {language_type1} = "中文"
  • {language_type2} = "英文"

使用说明:以下所有出现 {language_type1}{language_type2} 的地方,将自动替换为上述配置的值。

核心原则

  1. 基于实际代码变更:commit 信息必须基于实际代码变更内容生成,而不是仅根据文件名猜测。
  2. 关注具体变更:专注于具体的代码改动,避免泛泛而谈。描述要具体到修改了什么功能、添加了什么代码、修复了什么问题。
  3. 隐私保护
    • 不要输出姓名、邮箱地址或其他个人身份信息(除非在代码变更中明确存在且是必要的)
    • 不要输出 bug ID、issue ID、ticket ID 或其他唯一标识符(除非在代码变更中明确存在且是必要的)
  4. 简洁准确:commit 信息要简洁明了,准确反映代码的实际变更内容,不超过 60 字符。

使用方法

在 Chat 中输入以下命令:

  • /commit {language_type1} - 生成{language_type1} commit 信息
  • /commit {language_type2} - 生成{language_type2} commit 信息
  • /commit - 默认生成{language_type1} commit 信息

执行流程

  1. 检查暂存区和工作区:执行 git status --short 检查暂存区和工作区状态,如果没有暂存文件,自动暂存工作区的变更
  2. 获取代码变更:执行 git --no-pager diff --cached 获取完整代码变更内容(使用 --no-pager 避免分页器阻塞)
  3. 分析代码变更:阅读实际代码,专注于具体的改动,理解:
    • 具体修改了什么功能?(例如:添加了用户登录验证逻辑)
    • 具体添加了什么新代码?(例如:新增了 token 过期检查函数)
    • 具体修复了什么问题?(例如:修复了登录后页面跳转失败,原因是缺少 await)
    • 避免使用"更新代码"、"修改文件"等模糊描述
  4. 生成 commit message:基于实际变更内容,按 Conventional Commits 规范生成,subject 应包含主要变更要点
  5. 显示结果并询问确认:展示变更内容摘要和跨平台提交命令
  6. 执行提交:用户确认后执行 git commit

Commit 类型

  • feat: 新功能
  • fix: 修复 bug
  • docs: 文档变更
  • style: 代码格式
  • refactor: 代码重构
  • perf: 性能优化
  • test: 测试相关
  • chore: 构建/工具

输出格式


📋 暂存区变更信息:

变更文件:

  • <文件1> (状态)

主要变更内容: <基于 git diff 的实际代码变更,简要说明改了什么>

变更摘要:新增 X 个 | 修改 Y 个 | 删除 Z 个


📝 生成的 Commit Message:

<type>(<scope>): <subject>

- <主要变更1>
- <主要变更2>
- <主要变更3>

💻 提交命令(跨平台):

Windows PowerShell(避免乱码):

$msg = "<commit message>"; $bytes = [System.Text.Encoding]::UTF8.GetBytes($msg); [System.IO.File]::WriteAllBytes("$env:TEMP\commit-msg.txt", $bytes); git commit -F "$env:TEMP\commit-msg.txt"

Mac/Linux/Git Bash:

git commit -m "<commit message>"

❓ 确认提交:

是否需要执行此 commit?回复'好的'、'可以'、'yes'等即可执行。

Read the full file on GitHub · 106 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 106 lines · 0 tokens per session scan A c14160ad285b

Subscribe to this mod's changes

commit is a command published in the GitHub repository ttdazi/CursorAiCommit (2 stars, last pushed 9mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,022 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.