Token导航 LogoToken导航TokenDH.com
开发权限需确认github未标认证来源可访问许可证需确认审计提醒

git-automationgit 自动化

Agent Skill

git-automation 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

188

周安装

8

GitHub Stars

22

下载量

66
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

请帮我安装这个 Agent Skill:git-automation(git 自动化)
来源仓库:https://github.com/bejranonda/llm-autonomous-agent-plugin-for-claude
仓库路径:skills/git-automation
安装命令:
npx skills add https://github.com/bejranonda/llm-autonomous-agent-plugin-for-claude --skill git-automation
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/bejranonda/llm-autonomous-agent-plugin-for-claude --skill git-automation

简介

git-automation 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,辅助整理项目状态与变更。

  • 适用于需要围绕仓库状态或协作事项进行整理的场景。
  • 通过 npx skills add 命令从 GitHub 仓库安装,需确认权限与维护状态。
  • 使用前建议核实是否会触发联网、命令执行或文件读写操作。
  • 可结合原始 README 进一步验证具体用法和功能边界。

SKILL.md

Overview

Comprehensive Git automation skill that provides intelligent repository management, advanced branching strategies, automated commit optimization, and sophisticated release workflows with continuous learning from repository patterns.

Git Repository Intelligence

Repository Analysis

# Analyze repository structure and patterns
analyze_repository() {
  local repo_path=$1

  # Repository metrics
  local total_commits=$(git rev-list --count HEAD)
  local total_branches=$(git branch -a | wc -l)
  local total_tags=$(git tag -l | wc -l)
  local repo_size=$(du -sh .git 2>/dev/null | cut -f1)

  # Activity metrics
  local recent_commits=$(git log --since="1 month ago" --oneline | wc -l)
  local active_contributors=$(git log --since="3 months ago" --format='%ae' | sort -u | wc -l)

  # Quality metrics
  local merge_conflicts=$(git log --grep="conflict" --oneline | wc -l)
  local large_files=$(git rev-list --objects --all | git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' | sed -n 's/^blob //p' | sort -nr | head -10 | wc -l)

  echo "Repository Analysis for $repo_path:"
  echo "  Total Commits: $total_commits"
  echo "  Total Branches: $total_branches"
  echo "  Total Tags: $total_tags"
  echo "  Repository Size: $repo_size"
  echo "  Recent Commits (1mo): $recent_commits"
  echo "  Active Contributors (3mo): $active_contributors"
  echo "  Merge Conflicts: $merge_conflicts"
  echo "  Large Files (>1MB): $large_files"
}

Branching Strategy Detection

# Detect current branching strategy
detect_branching_strategy() {
  local main_branch=$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')
  local develop_branch=$(git branch -r | grep -E "origin/develop|origin/dev" | head -1 | sed 's@origin/@@')
  local release_branches=$(git branch -r | grep -E "origin/release|origin/rel" | wc -l)
  local feature_branches=$(git branch -r | grep -E "origin/feat|origin/feature" | wc -l)

  if [[ -n "$develop_branch" ]] && [[ $release_branches -gt 0 ]]; then
    echo "GitFlow"
  elif [[ -z "$develop_branch" ]] && [[ $feature_branches -gt 0 ]]; then
    echo "GitHub Flow"
  elif [[ $feature_branches -eq 0 ]] && [[ $release_branches -eq 0 ]]; then
    echo "Trunk-Based Development"
  else
    echo "Custom Strategy"
  fi
}

Intelligent Commit Management

Semantic Commit Analysis

# Analyze commits for semantic versioning impact
analyze_commit_impact() {
  local commit_range=$1

  # Count commit types
  local breaking_changes=$(git log --oneline $commit_range | grep -c "BREAKING\|breaking")
  local features=$(git log --oneline $commit_range | grep -c "feat:")
  local fixes=$(git log --oneline $commit_range | grep -c "fix:")
  local performance=$(git log --oneline $commit_range | grep -c "perf:")
  local refactors=$(git log --oneline $commit_range | grep -c "refactor:")

  # Determine version bump
  if [[ $breaking_changes -gt 0 ]]; then
    echo "major ($breaking_changes breaking changes)"
  elif [[ $features -gt 0 ]]; then
    echo "minor ($features features added)"
  else
    echo "patch ($fixes fixes, $performance improvements)"
  fi
}

# Generate intelligent commit messages
generate_commit_message() {
  local changes=$(git diff --cached --name-only)
  local commit_type=""
  local scope=""
  local description=""

  # Analyze changed files to determine commit type
  if echo "$changes" | grep -q "test\|spec"; then
    commit_type="test"
  elif echo "$changes" | grep -q "doc\|readme\|md"; then
    commit_type="docs"
  elif echo "$changes" | grep -q "package\|requirements\|setup"; then
    commit_type="chore"
  elif echo "$changes" | grep -q "\.py\|\.js\|\.ts\|\.java\|\.cpp"; then
    commit_type="feat"  # Default to feature for code changes
  fi

  # Extract scope from file paths
  scope=$(echo "$changes" | head -1 | cut -d'/' -f1)

  # Generate description from file changes
  description=$(echo "$changes" | head -3 | tr '\n' ', ' | sed 's/,$//')

  echo "$commit_type($scope): $description"
}

Automated Commit Optimization

# Optimize commit history
optimize_commit_history() {
  local target_branch=$1
  local since_date=${2:-"1 month ago"}

  # Identify fixup commits
  local fixup_commits=$(git log --since="$since_date" --oneline --grep="fixup!" --grep="squash!" | wc -l)

  if [[ $fixup_commits -gt 0 ]]; then
    echo "Found $fixup_commits fixup/squash commits"

    # Interactive rebase to squash fixups
    local base_commit=$(git merge-base $target_branch HEAD)
    git rebase -i --autosquash $base_commit
  fi

  # Remove empty commits
  git filter-branch --commit-filter '
    if git rev-parse --verify HEAD^1 >/dev/null 2>&1 &&
       [ "$(git diff-tree --no-commit-id --root -r --name-only HEAD | wc -l)" = 0 ]; then
      skip_commit "$@";
    else
      git commit-tree "$@";
    fi
  ' HEAD~50..HEAD
}

Advanced Release Automation

Intelligent Version Bumping

# Smart version bump based on changes
smart_version_bump() {
  local current_version=$(get_current_version)
  local commit_range=$(get_last_release_range)
  local version_impact=$(analyze_commit_impact "$commit_range")

  echo "Current version: $current_version"
  echo "Version impact: $version_impact"

  case $version_impact in
    major*)
      local new_version=$(bump_version "$current_version" major)
      ;;
    minor*)
      local new_version=$(bump_version "$current_version" minor)
      ;;
    patch*)
      local new_version=$(bump_version "$current_version" patch)
      ;;
  esac

  echo "New version: $new_version"
  update_version_files "$new_version"
}

# Update version across all files
update_version_files() {
  local new_version=$1

  # Common version files
  local version_files=(
    "package.json"
    "setup.py"
    "pyproject.toml"
    "Cargo.toml"
    "composer.json"
    "pom.xml"
    "__init__.py"
    "version.py"
    "Dockerfile"
  )

  for file in "${version_files[@]}"; do
    if [[ -f "$file" ]]; then
      case "$file" in
        "package.json")
          npm version $new_version --no-git-tag-version
          ;;
        "setup.py"|"pyproject.toml")
          bump2version $new_version --allow-dirty
          ;;
        "Cargo.toml")
          cargo bump $new_version
          ;;
        *)
          # Generic version update
          sed -i "s/version\s*=\s*[\"'][0-9]\+\.[0-9]\+\.[0-9]\+[\"']/version = \"$new_version\"/" "$file"
          ;;
      esac
    fi
  done
}

Release Workflow Automation

# Complete release workflow
execute_release_workflow() {
  local new_version=$1
  local release_notes_file=$2

  echo "Starting release workflow for v$new_version"

  # 1. Pre-release validation
  validate_release_readiness || exit 1

  # 2. Update version files
  update_version_files "$new_version"

  # 3. Generate changelog
  generate_changelog "$new_version" > CHANGELOG.md.tmp
  cat CHANGELOG.md.tmp >> CHANGELOG.md
  rm CHANGELOG.md.tmp

  # 4. Commit version changes
  git add .
  git commit -m "chore(release): v$new_version"

  # 5. Create release branch/tag
  git checkout -b "release/v$new_version"
  git tag -a "v$new_version" -m "Release v$new_version"

  # 6. Merge to main
  git checkout main
  git merge "release/v$new_version" --no-ff

  # 7. Push changes
  git push origin main
  git push origin "v$new_version"

  # 8. Create GitHub release
  if command -v gh >/dev/null 2>&1; then
    if [[ -f "$release_notes_file" ]]; then
      gh release create "v$new_version" --title "Release v$new_version" --notes-file "$release_notes_file"
    else
      gh release create "v$new_version" --title "Release v$new_version" --generate-notes
    fi
  fi

  # 9. Cleanup
  git branch -d "release/v$new_version"

  echo "Release v$new_version completed successfully!"
}

# Pre-release validation
validate_release_readiness() {
  local errors=0

  # Check working directory is clean
  if [[ -n $(git status --porcelain) ]]; then
    echo "❌ Working directory is not clean"
    ((errors++))
  fi

  # Run tests
  if command -v npm >/dev/null 2>&1; then
    npm test || ((errors++))
  elif command -v pytest >/dev/null 2>&1; then
    pytest || ((errors++))
  fi

  # Check for linting issues
  if command -v npm >/dev/null 2>&1; then
    npm run lint || ((errors++))
  elif command -v flake8 >/dev/null 2>&1; then
    flake8 . || ((errors++))
  fi

  # Security scan
  if command -v npm >/dev/null 2>&1; then
    npm audit --audit-level high || ((errors++))
  fi

  if [[ $errors -gt 0 ]]; then
    echo "❌ Pre-release validation failed with $errors errors"
    return 1
  fi

  echo "✅ Pre-release validation passed"
  return 0
}

Multi-Platform Integration

GitHub Integration

# GitHub operations automation
github_operations() {
  local operation=$1
  local repo_name=$2

  case $operation in
    "create-pr")
      local title=$3
      local body=$4
      local head_branch=$5
      local base_branch=${6:-"main"}

      gh pr create \
        --title "$title" \
        --body "$body" \
        --head "$head_branch" \
        --base "$base_branch"
      ;;

    "merge-pr")
      local pr_number=$2
      local merge_method=${3:-"merge"}

      gh pr merge "$pr_number" --"$merge_method" --delete-branch
      ;;

    "create-release")
      local tag=$2
      local title=$3
      local notes_file=$4

      if [[ -f "$notes_file" ]]; then
        gh release create "$tag" --title "$title" --notes-file "$notes_file"
      else
        gh release create "$tag" --title "$title" --generate-notes
      fi
      ;;

    "update-repo-info")
      local description=$2
      local homepage=$3
      local topics=$4

      gh repo edit \
        --description "$description" \
        --homepage "$homepage" \
        --add-topic $topics
      ;;
  esac
}

GitLab Integration

# GitLab operations automation
gitlab_operations() {
  local operation=$1

  case $operation in
    "create-mr")
      local title=$2
      local description=$3
      local source_branch=$4
      local target_branch=${5:-"main"}

      glab mr create \
        --title "$title" \
        --description "$description" \
        --source-branch "$source_branch" \
        --target-branch "$target_branch"
      ;;

    "create-release")
      local tag=$2
      local name=$3
      local description=$4

      glab release create "$tag" \
        --name "$name" \
        --description "$description"
      ;;
  esac
}

Repository Health Management

Repository Cleanup

# Cleanup repository for better performance
cleanup_repository() {
  echo "Cleaning up repository..."

  # Remove unreachable objects
  git prune --expire=now

  # Compress repository
  git gc --aggressive --prune=now

  # Remove stale references
  git remote prune origin

  # Clean up large files (requires git-filter-repo)
  if command -v git-filter-repo >/dev/null 2>&1; then
    git-filter-repo --strip-blobs-bigger-than 10M
  fi

  # Check for sensitive data
  if command -v git-secrets >/dev/null 2>&1; then
    git-secrets --scan-history
  fi

  echo "Repository cleanup completed"
}

# Analyze repository health
analyze_repository_health() {
  local issues=0

  echo "Repository Health Analysis:"

  # Check for large files
  local large_files=$(git rev-list --objects --all | git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' | sed -n 's/^blob //p' | awk '$2 > 1048576 { print $2, $3 }')
  if [[ -n "$large_files" ]]; then
    echo "⚠️  Found large files in repository:"
    echo "$large_files"
    ((issues++))
  fi

  # Check for many small commits
  local small_commits=$(git log --stat --oneline | awk '{if($2 < 10) count++} END {print count+0}')
  if [[ $small_commits -gt 50 ]]; then
    echo "⚠️  High number of small commits ($small_commits). Consider squashing."
    ((issues++))
  fi

  # Check for old branches
  local old_branches=$(git branch -r | while read branch; do
    local last_commit=$(git log -1 --format='%ci' "$branch" 2>/dev/null)
    if [[ -n "$last_commit" ]]; then
      local days_old=$(( ($(date +%s) - $(date -d "$last_commit" +%s)) / 86400 ))
      if [[ $days_old -gt 90 ]]; then
        echo "$branch ($days_old days old)"
      fi
    fi
  done)

  if [[ -n "$old_branches" ]]; then
    echo "⚠️  Found old branches:"
    echo "$old_branches"
    ((issues++))
  fi

  if [[ $issues -eq 0 ]]; then
    echo "✅ Repository is healthy"
  else
    echo "❌ Found $issues health issues"
  fi
}

Integration Patterns

Continuous Learning Integration

{
  "git_patterns": {
    "commit_frequency": {
      "average": 5.2,
      "peak_day": "friday",
      "peak_time": "14:00 UTC"
    },
    "branch_strategy": "github_flow",
    "release_cadence": "bi_weekly",
    "common_issues": [
      "merge_conflicts",
      "version_inconsistencies",
      "documentation_drift"
    ],
    "optimization_opportunities": [
      "automated_changelog_generation",
      "pre_commit_validation",
      "automated_dependency_updates"
    ]
  },
  "automation_success_rates": {
    "release_automation": 0.95,
    "version_bumping": 0.98,
    "branch_creation": 0.99,
    "commit_optimization": 0.87
  }
}

Error Recovery Patterns

# Handle common Git operation failures
handle_git_failure() {
  local operation=$1
  local error_code=$2

  case $operation in
    "merge")
      if [[ $error_code -eq 1 ]]; then
        echo "Merge conflict detected. Attempting resolution..."
        git merge --abort
        # Analyze conflicts and suggest resolution strategy
      fi
      ;;
    "push")
      if [[ $error_code -eq 1 ]]; then
        echo "Push failed. Checking for issues..."
        # Check if remote is ahead
        git fetch origin
        local behind=$(git rev-list --count HEAD..origin/$(git branch --show-current))
        if [[ $behind -gt 0 ]]; then
          echo "Local branch is $behind commits behind. Pulling first..."
          git pull origin $(git branch --show-current)
        fi
      fi
      ;;
  esac
}

When to Apply

Use Git Automation when:

  • Managing complex branching strategies and release workflows
  • Need to standardize commit messages and version bumping
  • Automating GitHub/GitLab operations and releases
  • Optimizing repository performance and health
  • Implementing continuous deployment pipelines
  • Coordinating multi-platform repository operations

The Git Automation skill provides comprehensive repository management with intelligent automation, learning capabilities, and seamless integration with modern development workflows.

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

展示第三方安全扫描或审计结果

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

平台分布

Codex

32.98%
按下载量换算22

Claude

30.3%
按下载量换算20

Cursor

17.74%
按下载量换算12

Gemini CLI

9.82%
按下载量换算6

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

权限需确认

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

安装前确认

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

来源信息

继续浏览同类 Skills