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.
npx agentmods add rules/ttdazi/cursoraicommit/commit-commandsgit clone --depth 1 https://github.com/ttdazi/CursorAiCommitWhat 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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.02542 | $0.02542 |
| Opus 5 | $0.01271 | $0.01271 |
| Sonnet 5 | $0.00508 | $0.00508 |
| Haiku 4.5 | $0.00254 | $0.00254 |
Grade A, and why
commit-commands 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 2d ago.
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.
How it starts
The opening of the file, as written. The whole thing — 231 lines — stays where its author put it; the contents beside it link to each section on GitHub.
动态 Commit 语言切换规则
语言类型配置
可配置变量(用户可以根据需要修改这些值):
{language_type1}= "中文"{language_type2}= "英文"
使用说明:以下所有出现 {language_type1} 和 {language_type2} 的地方,将自动替换为上述配置的值。
AI 角色定位
你是一位经验丰富的软件工程师和高效的技术沟通者。你的任务是分析代码变更并生成准确、简洁的 commit 信息。
当用户在对话框中输入以下指令时,请严格按照本规则执行:
触发指令
commit {language_type1}:生成{language_type1} commit 信息commit {language_type2}:生成{language_type2} commit 信息
核心原则
- 基于实际代码变更:commit 信息必须基于实际代码变更内容生成,而不是仅根据文件名猜测。
- 关注具体变更:专注于具体的代码改动,避免泛泛而谈。描述要具体到修改了什么功能、添加了什么代码、修复了什么问题。
- 隐私保护:
- 不要输出姓名、邮箱地址或其他个人身份信息(除非在代码变更中明确存在且是必要的)
- 不要输出bug ID、issue ID、ticket ID 或其他唯一标识符(除非在代码变更中明确存在且是必要的)
- 简洁准确:commit 信息要简洁明了,准确反映代码的实际变更内容,不超过 60 字符。
执行步骤
-
检查暂存区和工作区:
- 执行
git status --short检查暂存区和工作区的状态。 - 如果暂存区有文件(第一列有 A/M/D/R 等标记),直接进入下一步。
- 如果暂存区为空,检查工作区是否有未暂存的变更:
- 如果工作区有修改的文件(第二列有 M/D 标记)或未跟踪的文件(?? 标记),自动执行
git add暂存这些文件。 - 使用直接文件路径而不是目录路径,避免卡住(例如:
git add "file1" "file2")。 - 暂存完成后,重新执行
git status --short确认文件已暂存。
- 如果工作区有修改的文件(第二列有 M/D 标记)或未跟踪的文件(?? 标记),自动执行
- 执行
-
获取实际代码变更内容(关键步骤):
- 必须执行
git --no-pager diff --cached获取暂存区的完整代码变更内容。 - 重要:使用
--no-pager选项避免分页器阻塞,确保命令直接输出所有内容。 - 这是生成准确 commit 信息的基础,不能跳过。
- 仔细阅读代码变更,专注于具体的改动,理解:
- 具体修改了什么功能?(例如:添加了用户登录验证逻辑,而不是"更新了代码")
- 具体添加了什么新代码?(例如:新增了 token 过期检查函数,而不是"添加了代码")
- 具体删除了什么代码?(例如:移除了过时的 API 调用,而不是"删除了代码")
- 具体修复了什么问题?(例如:修复了登录后页面跳转失败的问题,原因是缺少 await,而不是"修复了 bug")
- 具体重构了什么逻辑?(例如:将用户认证逻辑提取到独立模块,而不是"重构了代码")
- 注意:如果代码变更中包含个人信息或唯一标识符,不要在 commit 信息中输出。
- 必须执行
-
分析代码变更:
- 基于实际的代码变更内容,判断变更类型:
- 新增功能代码 →
feat - 修复 bug 的代码 →
fix - 文档/注释变更 →
docs - 代码格式调整 →
style - 代码重构 →
refactor - 性能优化 →
perf - 测试代码 →
test - 构建/配置文件 →
chore
- 新增功能代码 →
- 提取变更的核心内容,作为 commit 信息的描述。
- 避免模糊描述:不要使用"更新代码"、"修改文件"、"优化代码"等泛泛而谈的描述。
- 使用具体描述:例如"修复登录跳转失败"、"添加 token 过期检查"、"重构用户认证模块"等。
- 基于实际的代码变更内容,判断变更类型:
-
生成 commit message:
- 格式:多行格式,包含简洁的 subject 和详细的主要变更
<type>(<scope>): <subject> - <主要变更1> - <主要变更2> - <主要变更3> - 语言要求:
commit {language_type1}→ subject 和主要变更都使用**{language_type1}**commit {language_type2}→ subject 和主要变更都使用**{language_type2}**
- 准确描述:commit 信息必须准确反映代码变更的实际内容
- subject 要求:简洁明了,不超过 60 字符,概括主要变更点
- 主要变更要求:基于 git diff 的实际内容,列出具体的变更点,每个变更点一行,使用
-开头
- 格式:多行格式,包含简洁的 subject 和详细的主要变更
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.
- 2d ago First seen · 231 lines · 2,542 tokens per session scan A b94902afc72e
commit-commands is a cursor rule published in the GitHub repository ttdazi/CursorAiCommit (2 stars, last pushed 9mo ago), licensed MIT. It adds 2,542 tokens to every session, about $0.0127 per session on Opus 5. 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.
Other cursor rules, from other repositories
angular-20
This rule provides comprehensive best practices and coding standards for Angular development, focusing on modern TypeScript, standalone components, signals, and performance optimizations.
dev-standard
Apache Superset development standards and guidelines for Cursor IDE.
cli-error-handling
CLI command error handling patterns.
prefer-direct-imports-over-module-mocks
Prefer extracting a testable core over vi.mock / vi.resetModules when unit tests need to reach production logic entangled with config, env, or singletons.
control-plane-descriptors
Control plane descriptor and instance implementation patterns.
family-instance-domain-actions
Family instance domain action implementation patterns.