当前位置: 首页 > Skill >

jm-jsjkxyjs02-zlm-405

jm-jsjkxyjs02-zlm-405

jm-jsjkxyjs02-zlm-405

Generate standardized Git commit messages using Conventional Commits. Use when: (1) Staging changes and need a commit message, (2) Reviewing a diff and want a structured summary, (3) Writing a PR description or changelog entry, (4) User asks 'write a commit message for this'. Analyzes staged/unstaged diffs and produces type-scoped messages.

1.0.0 2026.11.27 888
获取Skill文件查看使用说明
作 者:许安 许可证: 更新时间:2026.11.27
本文目录展开

Commit Writer

Generate clear, standardized Git commit messages following the Conventional Commits specification. Produces machine-readable messages that work with semantic versioning, changelog generators, and CI pipelines.

Quick Reference

Situation Command / Action
Need commit from staged changes Run git diff --cached --stat + git diff --cached
Need commit from all changes Run git diff --stat + git diff
Need recent history context Run git log --oneline -5
Amend last commit Use git commit --amend (confirm with user first)

Conventional Commits Format

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

<body>

<footer>

Type Reference

Type When to Use Example
feat A new feature feat(auth): add OAuth2 login flow
fix A bug fix fix(parser): handle empty input edge case
docs Documentation only docs: fix typo in README
style Formatting, missing semicolons, etc. (no production code change) style: format with prettier
refactor Code restructuring (no feature/fix) refactor(api): extract validation middleware
perf Performance improvement perf(db): add index on user email column
test Adding or fixing tests test(api): add endpoint integration tests
build Build system or dependencies build: bump lodash to 4.17.21
ci CI/CD configuration ci: add GitHub Actions release workflow
chore Maintenance, tooling, config chore: configure ESLint
revert Revert a previous commit revert: feat(auth): add OAuth2 login flow

Subject Rules

  • Maximum 50 characters (hard limit: 72)
  • No period at the end
  • Imperative mood ("add" not "added" / "adds")
  • Lowercase after type/scope, not capitalized

Scope

Optional but recommended when the change is localized:

  • Feature name: feat(auth), fix(checkout)
  • Module name: refactor(database), perf(api)
  • Area: docs(readme), test(e2e)

Breaking Changes

Append ! after type/scope or add a BREAKING CHANGE footer:

feat(api)!: remove deprecated v1 endpoints

Migrate to v2 endpoints. See migration guide.

BREAKING CHANGE: v1 API endpoints removed. Use /api/v2/* instead.

Body

Use when the subject alone is insufficient:

  • Why the change was made (not what — the subject covers that)
  • How it differs from the previous behavior
  • Bullet points for multiple motivations (use - )
feat(cart): add quantity validation

- Prevent checkout with zero-quantity items
- Show inline error per line item

Footer

For issue tracking and breaking changes:

  • BREAKING CHANGE: <description> — breaking change notice
  • Closes #123, Fixes #456 — issue references
  • Refs #789 — related issue
  • Co-authored-by: Name <email> — collaborators

Analysis Process

When generating a commit message from a diff:

  1. Read the diff stat first: understand which files changed
  2. Categorize the change: is it a feat, fix, refactor, etc.?
  3. Identify the scope: which module/feature area does it affect?
  4. Write a subject: concise, imperative, under 50 chars
  5. Add body if needed: explain motivation for non-obvious changes
  6. Add footer if needed: breaking changes, issue references

Grouping Multiple Changes

When a diff contains multiple unrelated changes:

  • Split into separate commits if they are genuinely independent
  • Use the dominant type if changes are thematically related
  • Prefer narrower scope over cramming everything into one message

Examples

Simple feature

feat(api): add pagination support to listings

Bug fix with context

fix(parser): handle malformed JSON gracefully

The parser crashed when receiving truncated JSON from upstream.
Return a partial result with error metadata instead.

Refactor with breaking change

refactor(db)!: merge users and profiles tables

BREAKING CHANGE: The `profiles` table is removed. Profile data
is now in the `users` table under the `profile` JSONB column.

Multi-file chore

chore: configure ESLint and Prettier

- Add .eslintrc.json with TypeScript rules
- Add .prettierrc with project formatting settings
- Add lint-staged for pre-commit checks

Test addition

test(e2e): add checkout flow tests

- Add test for complete purchase flow
- Add test for coupon application
- Add test for payment failure recovery

Edge Cases

Merge Commits

Preserve the default merge message format (Merge branch '...'). Do not rewrite merge commits unless explicitly asked.

Reverts

Use revert: type. Include the original commit hash in subject:

revert: feat(auth): add OAuth2 login flow

This reverts commit a1b2c3d4e5f6...

WIP / Temporary Commits

Use WIP: prefix only when user explicitly asks for a work-in-progress commit, or default to chore: wip with a brief description.

Squash Commits

When squashing, use the most significant type among squashed changes. If the squash includes both feat and fix, default to feat.

Empty / Config-Only Changes

chore: update .gitignore
chore: configure tsconfig.json paths
chore: add editorconfig
docs: update issue templates

Workflow

When the user says "write a commit message":

  1. Run git status to check state
  2. Run git diff --cached --stat to see what's staged
  3. Run git diff --cached to see the full staged diff
  4. Optionally run git log --oneline -5 for recent context
  5. Propose the commit message in the format above
  6. Confirm with the user before committing

推荐文章

更多
PHP时间戳与日期字符串相互转换方法详解

本文介绍PHP中时间数值(Unix时间戳)与日期字符串之间的相互转换方法。通过strtotime和date函数,实现将当前时间、指定日期转换为时间戳,以及将时间戳格式化为可读的日期时间字符串,并提供相关在线计算工具推荐。

2025.11.30 1,037
PHP日期转时间戳时区偏差怎么解决

在 PHP 中将日期字符串转换为时间戳时,若未显式指定时区,默认使用脚本配置的 date.timezone 或系统时区。当服务器时区与业务逻辑预期(如 UTC )不一致时,会产生偏差。解决核心是确保输入字符串携带明确时区信息,或在转换前统一设置时区上下文。

2026.10.24 1,031
JavaScript中利用replace结合正则实现replaceAll效果

JavaScript原生仅支持replace()进行单次或全局替换,缺乏类似Java的replaceAll()便捷方法。本文总结四种在JS中实现全量替换的方案:使用带g标志的正则、带gm标志的正则、扩展String原型以及split后join。通过对比代码示例,展示各方法的实现细节与适用场景,帮助开发者根据需求选择最优解。

2025.04.29 1,020
PHP跨域配置:怎么安全地允许指定域名而非使用通配符

在 PHP 中安全地允许指定域名跨域,核心是解析请求头中的 Origin ,验证其是否在白名单内,然后动态设置 Access-Control-Allow-Origin 响应头。不要使用通配符 * ,也不要硬编码单一域名。

2025.03.29 1,019
PHP实现基础文件上传:HTML表单与$_FILES处理流程

在 HTML 表单中设置 enctype="multipart/form-data" ,并在 PHP 后端通过 $_FILES 数组接收文件,调用 move_uploaded_file() 将临时文件移动到目标目录即可完成上传。

2026.09.07 1,016
OpenAI的Jalapeno芯片未落地,教你分辨300兆瓦算力消息

OpenAI计划在SB Energy租赁的数据中心部署约300兆瓦自研Jalapeno推理芯片,但目前双方仍处于洽谈阶段,交易细节与上线时间表均未公布。本文带你按报道原文核实项目所处阶段,厘清芯片发布、电力功率与实际推理算力的边界,并将融资意向与签约、开工、投运节点分开追踪,避免误将规划容量计入现有算力。

2026.12.02 1,015
Skill 文件
  • SKILL.md
    • Commit Writer
    • Quick Reference
    • Conventional Commits Format
      • Type Reference
      • Subject Rules
      • Scope
      • Breaking Changes
      • Body
      • Footer
    • Analysis Process
      • Grouping Multiple Changes
    • Examples
      • Simple feature
      • Bug fix with context
      • Refactor with breaking change
      • Multi-file chore
      • Test addition
    • Edge Cases
      • Merge Commits
      • Reverts
      • WIP / Temporary Commits
      • Squash Commits
      • Empty / Config-Only Changes
    • Workflow
  • 项目或源文件

相关 Skill

更多
Gitai - Git Commit Automation Gitai - Git Commit Automation 提升开发者生产力:Gitai 是一款 AI 驱动的 Git 自动化工具,可即时分析代码变更并生成语义化 Conventional Commits。支持 Node.js、Python、Java、Go、PHP 等语言,兼容 OpenAI、Anthropic 和 Groq。
Git 提交信息生成器 Git 提交信息生成器 Git 提交信息生成器。根据代码变更内容自动生成符合 Conventional Commits 规范的提交信息,包含类型、范围、简短描述、详细说明和关联的 Issue/需求号。触发词:生成提交信息、提交信息、commit message、git commit、生成 commit 信息
Conventional Git Conventional Git Conventional Commits v1.0.0 分支、工作树命名及提交信息规范,适用于 GitHub 与 GitLab 项目,用于创建分支和命名工作树等场景。
Git Commit Formatter Git Commit Formatter 按照 Conventional Commits 标准(v1.0.0)格式化提交信息。输入为 git diff 或变更描述,输出为包含类型的提交信息。
qui-conventional-commits qui-conventional-commits 使用 Conventional Commits 规范格式化提交信息。在创建提交、编写提交信息或用户提及提交时使用。