安全处理 Git 状态检查、提交信息、commit、分支、push、PR 和 rebase。用于用户要求检查改动、生成或创建提交、管理分支、推送、发起 PR 或整理历史时;严格区分每个动作的授权,并保护工作树中已有和无关的修改。
npx skills add https://github.com/laolaoshiren/claude-code-skills-zh --skill git-workflow
先阅读适用的 AGENTS.md、CONTRIBUTING.md、README、提交规范和 CI 说明,再检查:
git status --short --branch
git diff
git diff --cached
git log --oneline -10
git remote -v
git branch -vv
同时识别未跟踪文件、当前分支、upstream、远程差异和已有失败。不得只看 staged diff。
把用户请求拆成独立授权:
| 动作 | 默认权限 |
|------|----------|
| 分析状态、生成 commit message 或 PR 文案 | 只读 |
| 暂存、commit | 仅用户要求后执行,只选本轮相关文件 |
| 创建或切换分支 | 仅用户明确要求时执行;实现流程需要但未获授权时,先说明原因并取得同意 |
| fetch、push、创建 PR | 分别确认在请求范围内,不互相推导 |
| merge、关闭 Issue、发布 Release | 必须有明确授权 |
| rebase、修改已发布历史、强制更新远程 | 高风险,必须明确授权并满足额外条件 |
存在无关改动时不得使用 git add . 或 git add -A。逐个暂存目标文件,并用 git diff --cached 复核。
feat、fix、docs、refactor、test、perf 或 chore。Closes #123 仅在对应 Issue 确实应由该提交自动关闭时使用。提交信息遵循:
<type>(<scope>): <简短描述>
<必要时说明原因、关键实现和兼容性>
<关联 Issue 或 Breaking Change>
提交前先检查验证脚本是否会下载依赖、访问外部服务或产生其他状态,再运行与改动相关的测试、lint、构建或文档检查,并记录实际命令和退出状态。可能产生外部副作用时先取得授权。基线已有失败时单独说明,不能把未运行的项目标为通过。
执行 commit 后检查:
git status --short --branch
git show --stat --oneline HEAD
推送前先 git fetch,确认 upstream 没有未整合的新提交;禁止 force push。
PR 文案应帮助 reviewer 结合 diff 和验证结果快速审查,至少包含:
## 变更摘要
## 关键改动
## 验证结果
## 风险与回滚
## 关联 Issue
只勾选真实完成的检查。截图、迁移说明和回滚步骤仅在适用时加入。
git push --force。确需更新用户明确授权重写的私有分支时,只能在重新确认远程状态后使用 --force-with-lease。用中文简要报告:
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
Automatically creates user-facing changelogs from git commits by analyzing commit history, categorizing changes, and transforming technical commits into clear, customer-friendly release notes. Turns hours of manual changelog writing into minutes of automated generation.
Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for merge, PR, or cleanup
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.
Next.js best practices - file conventions, RSC boundaries, data patterns, async APIs, metadata, error handling, route handlers, image/font optimization, bundling
Use when starting feature work that needs isolation from current workspace or before executing implementation plans - creates isolated git worktrees with smart directory selection and safety verification
Take laolaoshiren/git-workflow from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.