git-commit-message

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Git Commit Message Generator

Git 提交信息生成器

Auto-generates conventional commit messages from git diffs with tiered format enforcement
基于Git差异自动生成符合约定式提交规范的提交信息,并支持分层格式校验

Purpose

用途

Analyze staged git changes and generate concise, meaningful commit messages following a tiered Conventional Commits specification. This skill examines file modifications, additions, and deletions to infer the type and scope of changes, producing commit messages that match the importance of the change - from detailed documentation for critical features to concise messages for minor updates.
Key Innovation: Three-tier format system that balances thoroughness for critical commits (feat, fix, security) with efficiency for routine changes (docs, chore, style).
分析Git暂存的变更内容,按照分层的Conventional Commits规范生成简洁、有意义的提交信息。本工具会检查文件的修改、新增和删除情况,推断变更的类型和范围,根据变更的重要程度生成匹配的提交信息——从关键功能的详细文档到小更新的简洁描述。
核心创新点:三级格式系统,在关键提交(feat、fix、security)的详尽性与日常变更(docs、chore、style)的高效性之间取得平衡。

When This Skill Activates

触发场景

  • When
    /commit-msg
    command is invoked
  • When invoked from a
    commit-msg
    /
    prepare-commit-msg
    hook (if installed)
  • When user requests commit message suggestions
  • When analyzing changes before creating a commit
  • 调用
    /commit-msg
    命令时
  • 通过
    commit-msg
    /
    prepare-commit-msg
    钩子触发(已安装的情况下)
  • 用户请求提交信息建议时
  • 创建提交前分析变更内容时

Core Capabilities

核心能力

1. Diff Analysis
  • Parse
    git diff --staged
    output
  • Identify modified, added, and deleted files
  • Analyze code changes (additions, deletions, modifications)
  • Detect patterns across multiple files
2. Change Classification
  • Determine commit type from changes:
    • feat
      : New features or functionality
    • fix
      : Bug fixes
    • security
      : Security fixes or hardening
    • refactor
      : Code restructuring without behavior change
    • docs
      : Documentation changes
    • style
      : Formatting, whitespace, code style
    • test
      : Adding or modifying tests
    • chore
      : Build process, dependencies, tooling
    • perf
      : Performance improvements
    • ci
      : CI/CD configuration changes
    • build
      : Build system changes
    • revert
      : Reverting previous commits
3. Scope Detection
  • Infer scope from file paths and patterns:
    • Directory names (e.g.,
      api
      ,
      auth
      ,
      ui
      )
    • File name patterns (e.g.,
      *.test.js
      tests
      )
    • Framework conventions (e.g.,
      components/
      ,
      services/
      )
4. Message Generation
  • Format:
    type(scope): description
  • Enforce tier limits: Tier 1 summary max 50 chars; Tier 2/3 summary max 72 chars (ideal 50)
  • Use imperative mood ("add" not "added")
  • Focus on "what" and "why", not "how"
  • Provide 2-3 alternative suggestions
1. 差异分析
  • 解析
    git diff --staged
    输出结果
  • 识别修改、新增和删除的文件
  • 分析代码变更(新增、删除、修改)
  • 检测多文件间的变更模式
2. 变更分类
  • 根据变更内容确定提交类型:
    • feat
      : 新功能或新特性
    • fix
      : 漏洞修复
    • security
      : 安全修复或加固
    • refactor
      : 代码重构(不改变功能逻辑)
    • docs
      : 文档变更
    • style
      : 格式调整、空白字符、代码风格变更
    • test
      : 添加或修改测试用例
    • chore
      : 构建流程、依赖项、工具链变更
    • perf
      : 性能优化
    • ci
      : CI/CD 配置变更
    • build
      : 构建系统变更
    • revert
      : 回滚之前的提交
3. 范围识别
  • 根据文件路径和模式推断变更范围:
    • 目录名称(如
      api
      auth
      ui
    • 文件名模式(如
      *.test.js
      tests
    • 框架约定(如
      components/
      services/
4. 信息生成
  • 格式:
    type(scope): description
  • 分层长度限制:Tier 1 摘要最多50字符;Tier 2/3 摘要最多72字符(理想长度为50字符)
  • 使用祈使语气(用"add"而非"added")
  • 聚焦于“做了什么”和“为什么做”,而非“怎么做”
  • 提供2-3个备选提交信息

Tier System: Smart Format Enforcement

分层系统:智能格式校验

This skill uses a three-tier format system that matches message detail to commit criticality:
本工具采用三级格式系统,根据提交的重要性匹配信息详细程度:

Tier 1: Critical Commits (feat, fix, perf, security)

Tier 1: 关键提交(feat、fix、perf、security)

Requirements: Detailed documentation with impact statement
Format:
type(scope): summary line (max 50 chars)

- Detailed description point 1
- Detailed description point 2
- Detailed description point 3

This change [impact statement describing user-facing benefit or risk addressed].

Affected files/components:
- path/to/file1
- path/to/file2
Why: Features, fixes, and performance changes affect users directly and need thorough documentation for future reference and changelog generation.
要求:包含影响说明的详细文档
格式
type(scope): 摘要行(最多50字符)

- 详细描述点1
- 详细描述点2
- 详细描述点3

本变更[描述面向用户的收益或解决的风险的影响说明]。

受影响的文件/组件:
- path/to/file1
- path/to/file2
设计原因:功能、修复和性能变更直接影响用户,需要详尽的文档以便未来参考和生成变更日志。

Tier 2: Standard Commits (refactor, test, build, ci)

Tier 2: 标准提交(refactor、test、build、ci)

Requirements: Brief context and file list
Format:
type(scope): summary line (max 72 chars)

Brief explanation of what changed and why (1-2 sentences).

Files: path/to/file1, path/to/file2
Why: Internal improvements need context for maintainability but don't require extensive documentation.
要求:包含简要上下文和文件列表
格式
type(scope): 摘要行(最多72字符)

关于变更内容和原因的简要说明(1-2句话)。

文件:path/to/file1, path/to/file2
设计原因:内部优化需要上下文以保证可维护性,但无需过度冗长的文档。

Tier 3: Minor Commits (docs, style, chore)

Tier 3: 次要提交(docs、style、chore)

Requirements: Summary line, optional description
Format:
type(scope): summary line (max 72 chars)

[Optional: Additional context if helpful]
Why: Documentation and routine maintenance are self-explanatory from the diff; verbose messages add noise.
要求:仅摘要行,可选补充描述
格式
type(scope): 摘要行(最多72字符)

[可选:如有帮助可添加额外上下文]
设计原因:文档和日常维护的变更可通过差异内容直接理解,冗长的信息会增加冗余。

Workflow

工作流程

text
1. Get staged changes (staged only, not working tree):
   - git diff --staged --name-status
   - git diff --staged --stat
   - git diff --staged
2. Load config → frameworks/shared-skills/skills/git-commit-message/config.yaml
3. Analyze changes:
   - Count files modified/added/deleted
   - Identify primary change type using analysis patterns
   - Detect scope from project structure (config.yaml)
   - Determine tier (1/2/3) based on commit type
   - Extract key modifications
4. Generate commit messages:
   - Apply tier-appropriate format
   - Primary suggestion (best match)
   - Alternative 1 (different scope/angle)
   - Alternative 2 (broader/narrower focus)
5. Validate against rules:
   - Check forbidden patterns
   - Verify required elements present
   - Ensure length limits
6. Present to user with explanation and tier info
text
1. 获取暂存的变更内容(仅暂存区,不包含工作区):
   - git diff --staged --name-status
   - git diff --staged --stat
   - git diff --staged
2. 加载配置文件 → frameworks/shared-skills/skills/git-commit-message/config.yaml
3. 分析变更内容:
   - 统计修改/新增/删除的文件数量
   - 使用分析模式确定主要变更类型
   - 根据项目结构(config.yaml)识别变更范围
   - 根据提交类型确定分层级别(1/2/3)
   - 提取关键修改内容
4. 生成提交信息:
   - 应用对应分层的格式要求
   - 主推荐信息(最佳匹配)
   - 备选信息1(不同范围/角度)
   - 备选信息2(更宽泛/更聚焦的描述)
5. 规则校验:
   - 检查禁用模式
   - 验证必填元素是否存在
   - 确保符合长度限制
6. 向用户展示信息及分析说明和分层级别

Optional Modes (If Supported By The Caller)

可选模式(需调用方支持)

  • --validate "<message>"
    : Validate a commit message without generating suggestions (format/type/scope/length/forbidden patterns; then report required Tier 1/2/3 elements if missing).
  • --tier <1|2|3>
    : Force the tier format (overrides auto-detection).
  • --interactive
    or
    -i
    : Ask for confirmation of type, scope, and summary before final output.
  • --validate "<message>"
    : 校验提交信息的格式/类型/范围/长度/禁用模式,无需生成建议;若缺少Tier 1/2/3的必填元素则进行提示。
  • --tier <1|2|3>
    :强制使用指定分层格式(覆盖自动检测结果)。
  • --interactive
    -i
    :在最终输出前,确认提交类型、范围和摘要内容。

Output Format

输出格式

[NOTE] Suggested Commit Messages (based on X files changed)

PRIMARY:
feat(api): add user authentication endpoints

ALTERNATIVES:
1. feat(auth): implement JWT token validation
2. feat: add user authentication system

ANALYSIS:
- 3 files modified in src/api/
- New functions: authenticateUser, generateToken
- Primary change: new feature (authentication)
- Scope detected: api/auth
[注意] 建议的提交信息(基于X个文件的变更)

主推荐:
feat(api): add user authentication endpoints

备选信息:
1. feat(auth): implement JWT token validation
2. feat: add user authentication system

分析说明:
- src/api/目录下3个文件被修改
- 新增函数:authenticateUser, generateToken
- 主要变更:新功能(身份认证)
- 识别的范围:api/auth

Conventional Commits Quick Reference

Conventional Commits 快速参考

Type Guidelines:
  • feat
    : User-facing features or API additions
  • fix
    : Corrects incorrect behavior
  • refactor
    : Improves code without changing behavior
  • docs
    : README, comments, documentation files
  • style
    : Formatting only (prettier, eslint --fix)
  • test
    : Test files or test utilities
  • chore
    : Build scripts, package updates, config
  • perf
    : Measurable performance improvements
  • ci
    : GitHub Actions, CircleCI, build pipelines
Scope Guidelines:
  • Use lowercase
  • Be specific but not too narrow
  • Match your project's module structure
  • Omit if changes span multiple unrelated areas
Description Guidelines:
  • Start with lowercase verb
  • No period at the end
  • Be specific and concise
  • Focus on user impact for
    feat
    and
    fix
类型指南:
  • feat
    : 面向用户的功能或API新增
  • fix
    : 修正错误行为
  • refactor
    : 优化代码但不改变功能逻辑
  • docs
    : README、注释、文档文件变更
  • style
    : 仅格式调整(prettier、eslint --fix)
  • test
    : 测试文件或测试工具变更
  • chore
    : 构建脚本、依赖更新、配置变更
  • perf
    : 可量化的性能优化
  • ci
    : GitHub Actions、CircleCI、构建流水线变更
范围指南:
  • 使用小写字母
  • 具体但不过于狭窄
  • 匹配项目的模块结构
  • 若变更涉及多个不相关领域则省略范围
描述指南:
  • 以小写动词开头
  • 结尾不加句号
  • 具体且简洁
  • 对于
    feat
    fix
    ,聚焦于用户影响

Edge Cases

边缘场景处理

Multiple unrelated changes:
  • Suggest splitting into separate commits
  • If forced to combine, use broader scope or omit scope
Breaking changes:
  • Append exclamation mark after type/scope (example: feat(api)!: change auth flow)
  • Include BREAKING CHANGE in body (handled by user)
WIP or experimental:
  • Use
    chore(wip): description
    or
    feat(experimental): description
No meaningful changes:
  • Detect and warn: "No staged changes detected"
  • Suggest
    git add
    commands
多个不相关变更:
  • 建议拆分为多个独立提交
  • 若必须合并,使用更宽泛的范围或省略范围
破坏性变更:
  • 在类型/范围后添加感叹号(示例:feat(api)!: change auth flow)
  • 在正文部分包含BREAKING CHANGE说明(由用户自行补充)
进行中或实验性变更:
  • 使用
    chore(wip): description
    feat(experimental): description
无有效变更:
  • 检测到后提示:"未检测到暂存的变更内容"
  • 建议执行
    git add
    命令

Integration Points

集成方式

Pre-commit hook: Triggered before commit (if installed/configured) Slash command: Manual invocation via
/commit-msg
Direct skill call: From other skills or tools
提交前钩子:提交前自动触发(已安装/配置的情况下) 斜杠命令:通过
/commit-msg
手动调用 直接调用:被其他工具或技能调用

Best Practices

最佳实践

  1. Analyze context: Look at file paths, function names, import statements
  2. Prioritize clarity: Prefer obvious descriptions over clever ones
  3. Respect conventions: Follow project's existing commit patterns if detected
  4. Avoid hallucination: Only describe what's actually in the diff
  5. Be concise: 50 chars is ideal, 72 is maximum for first line
  1. 分析上下文:参考文件路径、函数名、导入语句
  2. 优先清晰度:选择直白的描述而非花哨的表达
  3. 遵循约定:若检测到项目已有提交模式则遵循该模式
  4. 避免虚构:仅描述差异中实际存在的内容
  5. 保持简洁:第一行理想长度为50字符,最大不超过72字符

Example Analyses

分析示例

Scenario 1: New React component
Files: src/components/UserProfile.tsx, src/components/UserProfile.test.tsx
Changes: +120 lines, component definition, props interface, tests
Message: feat(components): add UserProfile component
Scenario 2: Bug fix in API
Files: src/api/auth.ts
Changes: -5 +8 lines, fix token expiration check
Message: fix(auth): correct token expiration validation
Scenario 3: Documentation update
Files: README.md, docs/api.md
Changes: +45 lines documentation
Message: docs: update API documentation and README
Scenario 4: Dependency update
Files: package.json, package-lock.json
Changes: version bumps for eslint, typescript
Message: chore(deps): update eslint and typescript
场景1:新增React组件
文件:src/components/UserProfile.tsx, src/components/UserProfile.test.tsx
变更:新增120行代码,包含组件定义、props接口和测试用例
提交信息:feat(components): add UserProfile component
场景2:API漏洞修复
文件:src/api/auth.ts
变更:删除5行,新增8行,修复令牌过期检查逻辑
提交信息:fix(auth): correct token expiration validation
场景3:文档更新
文件:README.md, docs/api.md
变更:新增45行文档内容
提交信息:docs: update API documentation and README
场景4:依赖更新
文件:package.json, package-lock.json
变更:eslint和typescript版本升级
提交信息:chore(deps): update eslint and typescript

Analysis Patterns: Smart Type Detection

分析模式:智能类型检测

The skill uses pattern matching to intelligently detect commit types from diffs:
本工具使用模式匹配从差异内容中智能检测提交类型:

feat Detection

feat检测

  • New files created (especially in src/, components/, api/)
  • New functions/classes exported (
    export function
    ,
    export class
    )
  • New API routes (
    app.get
    ,
    router.post
    , etc.)
  • New assets/skills (in .claude/, custom-gpt/, etc.)
  • Threshold: 20+ lines added typically indicates feature
  • 新增文件(尤其是src/、components/、api/目录下)
  • 新增导出的函数/类
    export function
    export class
  • 新增API路由
    app.get
    router.post
    等)
  • 新增资源/技能(.claude/、custom-gpt/等目录下)
  • 阈值:新增20行以上代码通常判定为功能新增

fix Detection

fix检测

  • Test file changes (often indicates bug reproduction)
  • New conditionals (validation fixes)
  • Error handling additions (
    try
    ,
    catch
    ,
    throw
    )
  • Input validation (
    validate
    ,
    sanitize
    ,
    check
    )
  • Commit message hints: Words like "bug", "issue", "error", "crash"
  • 测试文件变更(通常表示漏洞复现)
  • 新增条件判断(校验逻辑修复)
  • 新增错误处理
    try
    catch
    throw
  • 输入校验
    validate
    sanitize
    check
  • 提交信息提示词:包含"bug"、"issue"、"error"、"crash"等词汇

refactor Detection

refactor检测

  • Balanced changes (similar additions and deletions)
  • Function renames/moves (same logic, different location)
  • No new features or fixes
  • Test coverage unchanged
  • Keywords: "extract", "move", "rename", "reorganize"
  • 均衡的变更(新增和删除代码行数相近)
  • 函数重命名/移动(逻辑不变,位置变更)
  • 无新功能或修复
  • 测试覆盖率无变化
  • 关键词:"extract"、"move"、"rename"、"reorganize"

docs Detection

docs检测

  • File patterns:
    .md
    ,
    .txt
    ,
    README
    ,
    CHANGELOG
    ,
    /docs/
  • Pure documentation changes (no code modifications)
  • Mixed code+docs: Prefer code type, note docs in description
  • 文件模式
    .md
    .txt
    README
    CHANGELOG
    /docs/
    目录
  • 纯文档变更(无代码修改)
  • 代码+文档混合变更:优先标记为代码变更类型,在描述中提及文档更新

test Detection

test检测

  • File patterns:
    test.js
    ,
    spec.ts
    ,
    __tests__/
    ,
    /tests/
  • Test framework patterns:
    describe
    ,
    it
    ,
    test
    ,
    expect
    ,
    assert
  • 文件模式
    test.js
    spec.ts
    __tests__/
    /tests/
    目录
  • 测试框架模式
    describe
    it
    test
    expect
    assert

style Detection

style检测

  • CSS/styling files:
    .css
    ,
    .scss
    ,
    .sass
    ,
    .less
  • Formatter configs:
    prettier
    ,
    eslint
  • Whitespace-only changes
  • Keywords: "formatting", "indent", "whitespace"
  • CSS/样式文件
    .css
    .scss
    .sass
    .less
  • 格式化工具配置
    prettier
    eslint
  • 仅空白字符变更
  • 关键词:"formatting"、"indent"、"whitespace"

chore Detection

chore检测

  • Dependency files:
    package.json
    ,
    requirements.txt
    ,
    Gemfile
  • Lock files:
    package-lock.json
    ,
    yarn.lock
  • Config files:
    .gitignore
    ,
    .env
  • Keywords: "dependency", "deps", "upgrade", "bump"
  • 依赖文件
    package.json
    requirements.txt
    Gemfile
  • 锁文件
    package-lock.json
    yarn.lock
  • 配置文件
    .gitignore
    .env
  • 关键词:"dependency"、"deps"、"upgrade"、"bump"

Configuration

配置

Project-specific configuration loaded from
config.yaml
:
  • Scope mapping: Maps directory patterns to scope names (e.g.,
    frameworks/claude-code-kit/**
    claude-kit
    )
  • Tier rules: Defines which commit types require which tier format
  • Forbidden patterns: Blocks commits with generic messages or assistant/tool attribution
  • Analysis patterns: Customizes type detection logic for your codebase
  • Validation mode:
    strict
    (block),
    warning
    (warn), or
    disabled
项目专属配置
config.yaml
加载:
  • 范围映射:将目录模式映射为范围名称(例如:
    frameworks/claude-code-kit/**
    claude-kit
  • 分层规则:定义不同提交类型对应的分层格式
  • 禁用模式:拦截通用模糊信息或工具/助手署名
  • 分析模式:针对代码库自定义类型检测逻辑
  • 校验模式
    strict
    (拦截)、
    warning
    (警告)或
    disabled
    (禁用)

Forbidden Patterns (Validation)

禁用模式(校验规则)

The skill automatically blocks commits with these patterns:
本工具会自动拦截包含以下模式的提交信息:

Generic/Vague Messages

通用/模糊信息

  • [FAIL] "Update files" → [OK] "docs: update API reference"
  • [FAIL] "Fix stuff" → [OK] "fix(auth): correct token validation"
  • [FAIL] "Change code" → [OK] "refactor(utils): simplify date formatting"
  • [失败] "Update files" → [正确] "docs: update API reference"
  • [失败] "Fix stuff" → [正确] "fix(auth): correct token validation"
  • [失败] "Change code" → [正确] "refactor(utils): simplify date formatting"

Assistant/Tool Attribution (Per Repository Policy)

助手/工具署名(遵循仓库政策)

  • [FAIL] "Generated with Claude Code"
  • [FAIL] "Co-Authored-By: Claude noreply@anthropic.com"
  • [FAIL] Any assistant/tool attribution in commit messages
  • [失败] "Generated with Claude Code"
  • [失败] "Co-Authored-By: Claude noreply@anthropic.com"
  • [失败] 提交信息中包含任何助手/工具署名

Work-in-Progress Markers

进行中标记

  • [WARNING] "WIP: feature" (warning - should be squashed before merge)
  • [WARNING] "temp: quick fix" (warning - should be squashed)
  • [警告] "WIP: feature"(警告 - 合并前应压缩提交)
  • [警告] "temp: quick fix"(警告 - 合并前应压缩提交)

Missing Type

缺少类型前缀

  • [FAIL] Commits without type prefix (feat, fix, docs, etc.)
  • [失败] 提交信息无前缀类型(feat、fix、docs等)

Error Handling

错误处理

  • No staged changes: Run
    git status
    and guide user to
    git add
    files
  • Binary files only: Note that commit message should mention file types
  • Merge conflicts: Detect and suggest
    chore: resolve merge conflicts
  • Git not available: Graceful failure with helpful error message
  • Forbidden pattern detected: Show error with examples and block commit (strict mode)
  • Missing required elements: List what's missing based on tier requirements
  • Length exceeded: Show character count and suggest shortening
  • 无暂存变更:执行
    git status
    并引导用户执行
    git add
    命令
  • 仅二进制文件变更:提示提交信息应提及文件类型
  • 合并冲突:检测到后建议使用
    chore: resolve merge conflicts
  • Git不可用:友好提示错误信息
  • 检测到禁用模式:显示错误示例并拦截提交(严格模式下)
  • 缺少必填元素:根据分层要求列出缺失的内容
  • 长度超出限制:显示字符数并建议缩短

Integration with Repository

与仓库的集成

This skill integrates with the AI-Agents repository standards:
  • CLAUDE.md reference: Mandatory skill usage before commits
  • config.yaml: Project-specific scope mappings and rules
  • Pre-commit hook: Automatic activation before git commits
  • CONTRIBUTING.md: Commit guidelines for contributors

本工具符合AI-Agents仓库的标准:
  • CLAUDE.md参考:提交前必须使用本工具
  • config.yaml:项目专属的范围映射和规则
  • 提交前钩子:Git提交前自动触发
  • CONTRIBUTING.md:为贡献者提供提交指南

Commit Message Template

提交信息模板

assets/template-commit-message.md — Copy-paste template and good/bad examples.
Use it to standardize
type(scope): summary
messages and keep history automation-friendly.

assets/template-commit-message.md — 可复制的模板及正反示例。
使用该模板标准化
type(scope): summary
格式的提交信息,使提交历史更易于自动化处理。

Security-Sensitive Commits

安全敏感提交

assets/template-security-commits.md — Guide for handling security-sensitive changes.
assets/template-security-commits.md — 处理安全敏感变更的指南。

Key Sections

核心章节

  • Pre-Commit Security Checklist — Secrets detection, prohibited patterns
  • Security-Related Commit Types — Security fix, enhancement, configuration
  • Accidental Secret Commits — Immediate response, rotation, history cleanup
  • Sensitive File Patterns — .gitignore templates, files that should never be committed
  • Audit Trail Requirements — CVE, CVSS, CWE metadata for security commits
  • 提交前安全检查清单 — 敏感信息检测、禁用模式检查
  • 安全相关提交类型 — 安全修复、增强、配置变更
  • 意外提交敏感信息的处理 — 立即响应、密钥轮换、历史清理
  • 敏感文件模式 — .gitignore模板、禁止提交的文件类型
  • 审计追踪要求 — 安全提交需包含CVE、CVSS、CWE元数据

Do / Avoid

应做/避免

GOOD: Do

正确做法

  • Run secrets scan before every commit
  • Rotate secrets immediately if exposed
  • Use environment variables for credentials
  • Document security fixes with CVE/CVSS
  • Require security team review for auth changes
  • Keep .gitignore updated for secret patterns
  • 每次提交前运行敏感信息扫描
  • 若敏感信息泄露立即轮换密钥
  • 使用环境变量存储凭证
  • 用CVE/CVSS信息记录安全修复
  • 身份认证变更需经安全团队审核
  • 持续更新.gitignore以覆盖敏感信息模式

BAD: Avoid

错误做法

  • Committing secrets "temporarily"
  • Using hardcoded credentials in tests
  • Storing real credentials in example files
  • Assuming deleted secrets are safe
  • Committing before secrets scan completes
  • Using generic commit messages for security fixes
  • “临时”提交敏感信息
  • 在测试中使用真实凭证
  • 在示例文件中存储真实凭证
  • 认为删除后的敏感信息已安全
  • 未完成敏感信息扫描就提交
  • 安全修复使用通用模糊的提交信息

Anti-Patterns

反模式

Anti-PatternProblemFix
"Add secrets later"Secrets committed accidentallyUse env vars from start
Secrets in testsReal credentials in repoUse mocks/test credentials
Force push to hideHistory still recoverableRotate + document
Vague security commitsNo audit trailInclude CVE/CVSS
No pre-commit scanSecrets reach remoteInstall gitleaks hook

反模式问题修复方案
"后续添加敏感信息"意外提交敏感信息从项目初期就使用环境变量
测试中包含敏感信息仓库中存在真实凭证使用模拟/测试凭证
强制推送隐藏变更历史记录仍可恢复轮换密钥并记录事件
安全提交信息模糊无审计追踪包含CVE/CVSS信息
无提交前扫描敏感信息推送到远程仓库安装gitleaks钩子

Optional: AI/Automation

可选:AI/自动化

Note: AI suggestions should preserve human intent.
  • Commit message suggestions — Draft from diff analysis
  • Type detection — Pattern-based commit type inference
  • Scope detection — Auto-detect from changed paths
注意:AI生成的建议应保留用户的真实意图。
  • 提交信息建议 — 基于差异分析生成草稿
  • 类型检测 — 基于模式的提交类型推断
  • 范围识别 — 从变更路径自动识别范围

Bounded Claims

边界说明

  • AI-generated messages need human review and modification
  • Automated type detection may miss context
  • Security commits always need human judgment

Version: 2.1.1 Last Updated: 2026-01-26 Repository: AI-Agents (documentation repository) Conventional Commits Spec: https://www.conventionalcommits.org/
  • AI生成的信息需要人工审核和修改
  • 自动化类型检测可能会遗漏上下文信息
  • 安全相关提交始终需要人工判断

版本: 2.1.1 最后更新: 2026-01-26 仓库: AI-Agents(文档仓库) Conventional Commits 规范: https://www.conventionalcommits.org/