git-push
代码质量门禁与智能推送助手。核心能力:在 git push 前自动运行项目配置的代码质量检查(test、lint、format、check-types),检测到问题时尝试自动修复,修复成功后继续推送。使用场景:(1) 用户说 "push"、"推送"、"提交到远程" (2) 用户想确保代码质量后再推送 (3) 用户遇到 lint/format 错误需要修复后推送 (4) 作为 pre-push 质量门禁。始终遵循"检测 → 修复 → 再检测 → 推送"的循环,直到代码通过检查或无法自动修复。
Best use case
git-push is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
代码质量门禁与智能推送助手。核心能力:在 git push 前自动运行项目配置的代码质量检查(test、lint、format、check-types),检测到问题时尝试自动修复,修复成功后继续推送。使用场景:(1) 用户说 "push"、"推送"、"提交到远程" (2) 用户想确保代码质量后再推送 (3) 用户遇到 lint/format 错误需要修复后推送 (4) 作为 pre-push 质量门禁。始终遵循"检测 → 修复 → 再检测 → 推送"的循环,直到代码通过检查或无法自动修复。
Teams using git-push should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/git-push/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How git-push Compares
| Feature / Agent | git-push | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
代码质量门禁与智能推送助手。核心能力:在 git push 前自动运行项目配置的代码质量检查(test、lint、format、check-types),检测到问题时尝试自动修复,修复成功后继续推送。使用场景:(1) 用户说 "push"、"推送"、"提交到远程" (2) 用户想确保代码质量后再推送 (3) 用户遇到 lint/format 错误需要修复后推送 (4) 作为 pre-push 质量门禁。始终遵循"检测 → 修复 → 再检测 → 推送"的循环,直到代码通过检查或无法自动修复。
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
## 使用方式:子代理模式
本技能采用**子代理执行模式**。主代理通过 Task 工具调用子代理,子代理独立完成整个"检测-修复-推送"工作流后,返回简洁的确认信息。
使用 Task 工具调用子代理,子代理类型为 `general-purpose`:
```yaml
subagent_type: general-purpose
prompt: |
执行 git-push 工作流:
1. 检测当前 git 仓库的变更文件
2. 根据项目配置运行代码检查(lint、format、test、check-types)
3. 发现可自动修复的问题时,执行修复并重新检查
4. 所有检查通过后执行 git push
5. 返回执行结果给主代理
当前工作目录:{current_working_directory}
返回格式要求:
- 成功:简要说明推送成功
- 需要手动修复:列出具体问题
- 失败:说明失败原因
```
### 子代理工作流程
子代理执行以下完整工作流:
```
┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ 检测变更 │ → │ 运行检查 │ → │ 自动修复 │ → │ 执行推送 │
│ (git status)│ │ (lint/test)│ │ (fixable?) │ │ (git push) │
└─────────────┘ └──────┬──────┘ └──────┬──────┘ └─────────────┘
│ │
▼ ▼
┌─────────────┐ ┌─────────────┐
│ 通过 ✅ │ │ 无法自动修复 │
│ 直接推送 │ │ 报告给主代理 │
└─────────────┘ └─────────────┘
```
#### 1. 检测阶段
获取变更文件:
```bash
git status --porcelain
git diff --name-only --cached
git diff --name-only
```
如无变更 → 返回"无变更需要推送"
#### 2. 检查阶段
**检测项目配置(按优先级):**
1. **package.json scripts**(最优先):
- `npm run lint`
- `npm run format` 或 `npm run format -- --check`
- `npm run test`
- `npm run check-types`
2. **配置文件检测**(无 scripts 时):
- ESLint: `.eslintrc.*`, `eslint.config.*`
- Prettier: `.prettierrc.*`, `prettier.config.*`
- TypeScript: `tsconfig.json`
- Biome: `biome.json`
- Ruff: `pyproject.toml` (Python)
**执行策略:**
- 并行执行独立的检查(如 lint + check-types)
- 记录每个检查的结果
#### 3. 修复阶段
**可自动修复的问题:**
| 工具 | 修复命令 |
|-----|---------|
| ESLint | `npm run lint -- --fix` 或 `npx eslint --fix` |
| Prettier | `npm run format` 或 `npx prettier --write` |
| Biome | `npx biome check --write` |
| Ruff | `ruff check --fix` |
**修复后处理:**
1. 重新运行检查确认修复成功
2. 暂存修复后的文件:`git add -A`
**不可自动修复的问题:**
- 测试失败(需要理解业务逻辑)
- 类型错误(可能需要重构)
- 复杂 lint 错误(如未使用的变量涉及业务逻辑)
→ 停止自动修复,准备报告给主代理
#### 4. 推送阶段
**检查全部通过后:**
```bash
git push
```
**首次推送新分支:**
```bash
git push -u origin <branch-name>
```
### 异常处理
| 异常类型 | 处理方式 |
|---------|---------|
| 非快进推送 (non-fast-forward) | 告知主代理需要先 pull/rebase |
| 分支保护 (protected branch) | 告知主代理需要创建 Pull Request |
| 网络错误 | 重试 1 次,仍失败则报告 |
| 修复循环 | 自动修复最多尝试 2 次 |
### 返回格式
子代理向主代理返回简洁的执行结果:
**推送成功:**
```
✅ 推送成功
代码检查全部通过,变更已推送到远程仓库。
[可选:推送的分支和 commit 信息]
```
**需要手动修复:**
```
⚠️ 需要手动处理
以下问题无法自动修复:
1. [具体错误描述]
2. [具体错误描述]
建议操作:
- [修复建议]
```
**推送失败:**
```
❌ 推送失败
[失败原因]
建议操作:
- [解决建议]
```
**无变更:**
```
ℹ️ 没有变更
当前没有需要推送的变更文件。
```
## 主代理响应模板
主代理根据子代理返回的内容,向用户展示:
```
[子代理返回的结果]
[如有需要,主代理补充的上下文信息]
```
主代理不需要解释子代理的执行细节,只需传递子代理的结果。
## 重要原则
1. **子代理自治**:子代理独立完成整个工作流,主代理不干预中间过程
2. **结果简洁**:子代理只返回最终结果,不输出详细的执行日志
3. **失败透明**:无法自动修复时,清晰列出具体问题和修复建议
4. **安全边界**:自动修复最多尝试 2 次,避免无限循环Related Skills
open-u-dashboard
open understand dashboard for user
sync-template-skill
这是一个技能文件的模板,展示了技能的基本结构和内容组织方式。
talk-humanize
Be direct and informative. No filler, no fluff, but give enough to be useful.
search-web
使用 Evaluator-optimizer 模式进行系统性多轮网络搜索,采用结构化 Ask 流程在搜索前澄清研究目标。基于 YC Office Hours 的提问方法论,确保搜索方向清晰、结果可验证。当用户需要深入调查复杂主题、验证假设或全面收集信息时使用。
save-to-eagle
归档网络内容到 Eagle 素材库。支持:(1) Behance/Pixiv 图片归档,(2) 网页视频录制(页面动画、滚动录制)。使用方式:'归档 [URL]' 归档图片;'录制网页视频 [URL]' 录制页面动画;'滚动录制 [URL]' 自动滚动截图。支持评分如 '归档 [URL], 3/5'。
save-ob-chaos
将对话内容快速存档到 Obsidian Chaos 文件夹。触发词:"存档到 Obsidian"、"保存到 Chaos"、"ob 存档"、"记下这个"、"保存这段内容"、"存到 chaos"。
save-ob-chaos-mermaid
将 Mermaid 图表保存到 Obsidian Chaos 文件夹。触发词:"保存 mermaid 到 chaos"、"mermaid 存档"。
save-ob-chaos-excalidraw
绘制 Excalidraw 图表并存档到 Obsidian Chaos 文件夹。触发词:"画个图存到 Obsidian"、"excalidraw 存档"、"画个流程图保存"、"画图存到 chaos"、"创建图表并存档"、"画架构图到 ob"。
release-project
项目版本发布流程指导,帮助用户完成版本规划、Changelog 管理、版本号升级、Git 标签创建和 npm 首次发布准备。Use when: (1) 用户需要发布新版本 (2) 需要创建版本发布流程 (3) 需要管理版本号和 Changelog (4) 需要自动化版本发布 (5) 需要检查 release 分支同步 (6) 首次 npm 发布准备
recognize-codebase-branch-flow
识别并记忆项目 git 分支模型
rebase-commits
将零散的 commits 整合为清晰的逻辑提交,使 Git 历史更易读。 Use when: (1) 用户说 "rebase commits"、"整理提交历史"、"让历史更干净" (2) 用户想将多个相关 commits 合并为逻辑单元 (3) 完成一个功能后需要清理 commit 历史 (4) 提交历史混乱,需要重新组织
read-codebase
阅读棕地项目代码库,智能分析代码结构,递归补充其调用链上所有函数的注释。