smithery.ai

git-helper

分析未提交的代码变更,生成符合 Conventional Commits 规范的提交信息,并自动执行 git add、commit 和 push 操作。当用户需要提交代码、推送更改、生成提交信息,或提到 git commit、git push、提交代码、推送代码时使用。

First seen Mar 21, 2026

Installation

$ npx skills add https://smithery.ai

Summary

分析未提交的代码变更,生成符合 Conventional Commits 规范的提交信息,并自动执行 git add、commit 和 push 操作。当用户需要提交代码、推送更改、生成提交信息,或提到 git commit、git push、提交代码、推送代码时使用。

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from smithery.ai · top by installs.

npx skills add https://smithery.ai

Browse all from smithery.ai

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 4,822 B
  • docs SUMMARY.md 299 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 4 installs

SKILL.md

Git Helper

自动分析代码变更,生成简洁的 commit 消息,并执行提交和推送操作。

工作流程

按以下步骤执行:

  1. 检查 Git 状态

``bash git status git diff ``

  1. 分析代码变更

- 识别修改的文件类型和数量 - 理解代码变更的意图和影响范围 - 确定变更类型(功能、修复、重构、文档等)

  1. 生成 Commit 消息

- 使用 Conventional Commits 格式 - 标题简洁明了(50 字符以内) - 正文详细说明变更内容(如需要)

  1. 执行 Git 操作

- git add .git add <specific-files> 暂存变更 - git commit -m "<生成的提交信息>" - git push 推送到远程仓库

Commit 消息格式

使用 Conventional Commits 规范:

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

<body>

Type 类型

  • feat: 新功能
  • fix: 修复 bug
  • docs: 文档变更
  • style: 代码格式(不影响代码运行)
  • refactor: 重构(既不是新功能也不是修复)
  • perf: 性能优化
  • test: 测试相关
  • chore: 构建过程或辅助工具的变动
  • ci: CI 配置文件和脚本的变更

示例

示例 1:新功能

feat(chat): 添加流式响应支持

实现 ChatController 的流式输出功能,提升用户体验

示例 2:修复 Bug

fix(vector-store): 修复 SimpleVectorStore 初始化错误

解决 VectorStoreConfig 中构造函数参数不匹配的问题

示例 3:重构

refactor(service): 优化 ChatService 代码结构

提取公共方法,减少代码重复,提升可维护性

示例 4:文档更新

docs: 更新 README 添加快速开始指南

补充 API 使用示例和配置说明

示例 5:依赖更新

chore: 更新 Spring AI 版本到 1.0.0-M5

同步最新依赖,修复已知问题

生成规则

标题规则

  1. 简洁性:标题不超过 50 字符
  2. 具体性:明确说明做了什么,而不是为什么做
  3. 时态:使用祈使语气(如"添加"、"修复"、"更新")
  4. 语言:使用中文(与项目代码注释保持一致)

正文规则(可选)

当变更较复杂时,添加正文说明:

  • 解释变更的原因和背景
  • 列出主要变更点
  • 说明可能的影响

分析代码变更的要点

  1. 文件类型识别

- Java 文件 → 关注类、方法、功能 - 配置文件 → 关注配置项和值 - 文档文件 → 关注内容更新

  1. 变更类型判断

- 新增文件 → featdocs - 修改逻辑 → fixrefactor - 删除代码 → refactorchore - 仅格式调整 → style

  1. 影响范围评估

- 单个文件 → 在 scope 中指定文件名或模块 - 多个文件 → 使用通用 scope 或省略

执行命令

检查状态

git status
git diff

暂存文件

根据变更范围决定:

  • 所有变更:git add .
  • 特定文件:git add <file1> <file2>

提交

git commit -m "<生成的标题>"

如果变更复杂,使用多行消息:

git commit -m "<标题>" -m "<正文>"

推送

git push

如果当前分支没有设置上游:

git push -u origin <branch-name>

特殊情况处理

没有变更

如果 git status 显示没有变更:

  • 提示用户:"当前工作目录干净,没有需要提交的变更"
  • 不执行任何 git 命令

冲突检测

在执行 git push 前:

  • 检查是否有未拉取的远程更新
  • 如有冲突,提示用户先执行 git pull

未跟踪的文件

对于新文件:

  • 确认是否应该提交(避免提交临时文件、日志等)
  • 检查 .gitignore 规则

注意事项

  • ⚠️ 执行 git push 前确认当前分支和远程仓库正确
  • ⚠️ 不要提交敏感信息(API keys、密码等)
  • ⚠️ 检查 .gitignore 确保不会提交临时文件
  • ⚠️ 对于重要变更,建议先让用户确认 commit 消息

使用场景

场景 1:用户说"提交代码"

  1. 检查 git 状态
  2. 分析变更
  3. 生成 commit 消息
  4. 执行 add、commit、push

场景 2:用户说"帮我推送代码"

  1. 检查是否有未提交的变更
  2. 如有,先提交再推送
  3. 如无,直接推送已提交的变更

场景 3:用户说"生成提交信息"

  1. 分析代码变更
  2. 生成 commit 消息
  3. 展示给用户确认
  4. 询问是否执行提交和推送