Token导航 LogoToken导航TokenDH.com
研究检索权限需确认github未标认证来源可访问clear审计未展示

git-workflowGit 工作流

Agent Skill

git-workflow 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

186

周安装

8

GitHub Stars

公开资料未说明

下载量

65
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:git-workflow(Git 工作流)
来源仓库:https://github.com/philoserf/claude-code-setup
仓库路径:skills/git-workflow
安装命令:
npx skills add philoserf/claude-code-setup --skill "git-workflow"
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

AgentSkills.tonpx skills
npx skills add philoserf/claude-code-setup --skill "git-workflow"

简介

git-workflow 用于查找、检索和筛选相关信息,适用于 Codex、Claude、Cursor、Gemini CLI 等宿主环境。

  • 支持基于关键词或任务场景快速定位候选结果,提升开发流程中的信息检索效率。
  • 通过 npx skills add 命令从 philoserf/claude-code-setup 仓库安装。
  • 安装前请确认是否需要联网、执行命令或访问文件系统,并检查仓库维护状态。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

name
git-workflow
description
Automates git workflows with branch management, atomic commits, history cleanup, and PRs. Use when committing, pushing, creating PRs, cleaning up commits, or organizing git changes with best practices.
allowed-tools
[Read, Bash, AskUserQuestion, TodoWrite]

Reference Files

Detailed git workflow guidance:

  • workflow-phases.md - Step-by-step instructions for each workflow phase (0-6) with specific commands, safety checks, and decision points
  • commit-format.md - Comprehensive commit message formatting guide with rules, examples, templates, and common mistakes
  • rebase-guide.md - Interactive rebase safety guidelines, commands, conflict resolution, and recovery techniques
  • examples.md - Real-world workflow scenarios showing the skill in action across different situations

Git Workflow Skill

This skill provides intelligent, end-to-end Git workflow automation. It analyzes repository changes, organizes them into atomic commits with well-formatted messages, manages branches, cleans up commit history, and helps create pull requests.

Contents

Workflow Overview

The skill follows a 7-phase workflow:

  1. Branch Management - Ensure work is on appropriate branch
  2. Repository Analysis - Understand current state and changes
  3. Organize into Atomic Commits - Group related changes logically
  4. Create Commits - Generate well-formatted commit messages
  5. Commit History Cleanup - Optionally reorganize commits before push

4.5. Pre-Push Quality Review - Analyze commit quality and run tests (MANDATORY)

  1. Push with Confirmation - Push changes to remote after approval
  2. Pull Request Creation - Optionally create PR with generated description

Phase 0: Branch Management

Goal: Prevent accidental work on protected branches and ensure proper isolation.

If the user is on a protected branch (main/master/develop/production/staging) with uncommitted changes, BLOCK and require creating a feature branch. If working directory is clean, proactively suggest branching. Provides 3 options: auto-suggested branch (recommended), custom branch name, or override with confirmation.

Skip this phase if the user is already on a feature branch, hotfix branch, or release branch.

For detailed steps, see phase-0-protocol.md and workflow-phases.md#phase-0-branch-management.

Phase 1: Repository Analysis

Goal: Thoroughly understand the current repository state and changes.

Run git commands to see changed files, diffs, and recent history. Analyze to identify types of changes, affected files, logical groupings, and untracked files.

Perform safety checks for merge conflicts and rebase-in-progress before proceeding.

For detailed steps, see workflow-phases.md#phase-1-repository-analysis.

Phase 2: Organize into Atomic Commits

Goal: Group changes into logical, atomic commits that each represent a single coherent change.

Apply atomic commit principles: one logical change per commit, self-contained and compilable, related changes together.

Group changes by priority: bug fixes → tests → refactoring → features → documentation → configuration.

Create a commit plan and present to user for approval. Use TodoWrite to track commits if there are 3+.

For detailed steps and grouping strategy, see workflow-phases.md#phase-2-organize-into-atomic-commits.

Phase 3: Create Commits

Goal: Create each commit with a properly formatted commit message.

For each commit: stage files, generate well-formatted commit message (≤72 chars, imperative mood, explains WHY), execute commit using heredoc, and verify success.

Key commit message rules:

  • Imperative mood: "Add feature" not "Added"
  • Be specific: "Fix null pointer in login" not "Fix bug"
  • Explain WHY, not WHAT
  • Summary ≤72 characters, body wrapped at 72

For detailed formatting rules, examples, and templates, see commit-format.md.

For detailed steps, see workflow-phases.md#phase-3-create-commits.

Phase 4: Commit History Cleanup (Optional)

Goal: Optionally reorganize recent commits for a cleaner history before pushing.

Offer cleanup when multiple commits could be squashed, messages need improvement, or better ordering would help. Skip if commits are already pushed (unless explicit force push approval), on shared branch, or only one commit.

IMPORTANT: NEVER use git rebase -i (requires interactive input). Instead, explain manual commands to user or use non-interactive alternatives like git reset --soft.

For detailed rebase safety guidelines, commands, and examples, see rebase-guide.md.

For detailed steps, see workflow-phases.md#phase-4-commit-history-cleanup-optional.

Phase 4.5: Pre-Push Quality Review (Mandatory)

Goal: Ensure commit quality and verify tests before pushing to remote.

This phase is MANDATORY - it always runs before Phase 5 to catch quality issues early.

Performs automated analysis of commits including generic message detection, squash opportunity identification, format compliance verification, and offers test execution.

Shows push preview with commit list, stats, and quality report. If issues found, provides clear options to fix or override with justification.

Quality checks performed:

  • Generic message detection - Flags "WIP", "fix", "update", "temp" and other vague messages
  • Squash opportunity detection - Identifies related commits that could be combined
  • Format compliance - Verifies 72-char limit, imperative mood, capitalization
  • Test integration - Detects and offers to run npm, pytest, go test, cargo test, make test

User options when issues detected:

  • Fix issues - Return to Phase 3 or 4 to reword or squash commits
  • Run tests - Execute test suite before push (optional)
  • Override - Push anyway with justification (required for blockers)
  • Cancel - Exit workflow to investigate

For detailed quality checks, test detection, and user interaction patterns, see phase-4.5-protocol.md.

For detailed steps, see workflow-phases.md#phase-45-pre-push-quality-review-mandatory.

Phase 5: Push with Confirmation

Goal: Push commits to remote safely after user approval.

CRITICAL: Before allowing push, check if current branch is protected (main/master/develop/production/staging). If protected, BLOCK the push and enter the Protected Branch Push Protocol.

Show summary of commits to be pushed (number, branch, commit messages), ask for confirmation, then push. Use -u flag for new branches.

Perform safety checks: verify remote exists, detect and block protected branch pushes, prevent force pushes to protected branches, handle failures gracefully.

For protected branch handling, see protected-branch-protocol.md.

For detailed steps, see workflow-phases.md#phase-5-push-with-confirmation.

Phase 6: Pull Request Creation (Optional)

Goal: Optionally create a pull request after successful push.

After successful push, ask if user wants a PR. Verify gh CLI is available, detect base branch, generate title and description from commits, show for review, then create PR and show URL.

If gh not available, provide GitHub web URL for manual PR creation.

For detailed steps, see workflow-phases.md#phase-6-pull-request-creation-optional.

Safety Checks

Always perform these checks during the workflow:

  1. Before any operation:

- Check for merge conflicts in files - Check for rebase/merge in progress - Alert user and stop if found

  1. Before committing:

- Verify files are actually changed - Check commit message meets format requirements

  1. Before rebasing:

- Verify commits haven't been pushed (or get explicit force-push approval) - Check not on protected branch - Ensure working directory is clean

  1. Before pushing:

- Verify remote exists - CRITICAL: Check if current branch is protected - if yes, BLOCK and enter Protected Branch Push Protocol - Detect force push requirement - if pushing to protected branch, BLOCK absolutely - Confirm with user (only if not blocked)

  1. Before creating PR:

- Verify push succeeded - Check branch exists on remote - Verify gh CLI or provide alternative

Common Edge Cases

No changes to commit:

  • Inform user repository is clean
  • Exit gracefully

Untracked files found:

  • List untracked files
  • Ask if any should be included
  • Identify files that should be .gitignored (.env, debug logs, etc.)
  • Add to .gitignore if appropriate

Large changesets (10+ files or 500+ lines):

  • May need user guidance for grouping
  • Suggest reviewing changes carefully
  • Consider breaking into multiple PRs

Detached HEAD state:

  • Alert user
  • Explain situation
  • Offer to create branch from current commit

Merge conflicts:

  • Do not proceed with commits
  • Alert user to resolve conflicts first
  • Show conflicted files and suggest resolution steps

No remote configured:

  • Detect with git remote -v
  • Ask if user wants to add remote
  • Help set up origin if needed

Protected branch (working on main/master/develop/production/staging):

Rebase in progress:

  • Detect state
  • Alert user
  • Ask if they want to continue or abort:

- Continue: User must resolve manually - Abort: Run git rebase --abort

Tool Usage Examples

Check current state:

git status --short
git branch --show-current
git log --oneline -n 10

Analyze changes:

git diff
git diff --staged
git diff --stat

Create commits:

git add file1.js file2.js
git commit -m "$(cat <<'EOF'
Add user authentication feature

Implement JWT-based authentication to secure API endpoints.

- Add login/logout endpoints
- Implement JWT token generation and validation
- Add authentication middleware
EOF
)"

Push changes:

# New branch
git push -u origin feature/user-auth

# Existing branch
git push

Create PR:

gh pr create --title "Add user authentication" --body "$(cat <<'EOF'
## Summary
Implements JWT-based authentication for API security.

## Changes
- Add login/logout endpoints
- JWT token generation and validation
- Authentication middleware

## Testing
- Added unit tests for auth functions
- Manual testing with Postman
EOF
)"

User Interaction Patterns

Use AskUserQuestion for:

  • Branch creation confirmation
  • Commit plan approval
  • Modifications to commit grouping
  • Push confirmation
  • PR creation confirmation
  • Force push warnings
  • Protected branch warnings

Use TodoWrite for:

  • Tracking multiple commits to create (3+ commits)
  • Long workflow with many steps
  • Keeping user informed of progress

Use Bash for:

  • All git commands
  • All gh commands
  • Repository state inspection

Reference Documentation

For detailed information, see supporting files:

  • workflow-phases.md - Detailed step-by-step instructions for each workflow phase (0-6). Read this when you need the complete procedure for any phase including specific commands, safety checks, and decision points.
  • commit-format.md - Comprehensive commit message formatting guide with detailed rules, examples, templates, and common mistakes. Read this when you need specific guidance on commit message format, character limits, imperative mood examples, or want to see good vs. bad examples.
  • rebase-guide.md - Interactive rebase safety guidelines, commands, conflict resolution, and recovery techniques. Read this when planning commit history cleanup, before rebasing, or when handling rebase conflicts.
  • protected-branch-protocol.md - Protected branch push prevention protocol with detection logic, 3-option handling (feature branch migration, branch rename, emergency override), force push blocking, and edge cases. Read this when Phase 5 detects a push to protected branch, or when implementing protected branch safety checks.
  • examples.md - Real-world workflow scenarios showing the skill in action across different situations: simple features, bug fixes, large refactorings, messy history cleanup, edge cases, and more. Read this to understand how to apply the workflow in practice.

Summary

This skill automates the entire Git workflow from analyzing changes to creating a PR. It emphasizes:

  • Quality over speed - well-formatted commits are important
  • Safety first - always check state and confirm destructive operations
  • User control - ask for approval at key decision points
  • Education - explain what's happening and why

The goal is to help users maintain clean, professional Git history with minimal effort while teaching best practices along the way.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

windsurf

26.42%
按下载量换算17

OpenCode

21%
按下载量换算14

Codex

17.76%
按下载量换算12

Claude Code

12.87%
按下载量换算8

Antigravity

7.35%
按下载量换算5

Gemini CLI

3.32%
按下载量换算2

安全审计

暂无安全审计结果可展示。

权限和风险

权限需确认

当前来源未能明确判断权限范围,默认进入异常复核队列。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills