gitdataai/libs/agent/skills/templates/git-branch.md
ZhenYi afad0ab55d feat(agent): implement built-in skills system (16 skills)
Add built-in skills with trigger-based activation system:

Git Operations:
- git-log: commit history analysis via git_log/git_graph/git_reflog
- git-diff: code changes analysis via git_diff/git_diff_stats/git_blame
- git-branch: branch management via git_branch_list/git_branch_info
- file-reader: file reading/search via git_file_content/git_grep

Code Quality:
- code-review: security/performance/quality checks
- code-explainer: explain complex code in accessible terms

Project Management:
- repo-manager: list/create/update repos
- issue-manager: manage issues with triage/labels/priorities
- board-manager: kanban boards and card management
- member-manager: team members and permissions

Development Productivity:
- pr-summary: generate PR summaries
- issue-triage: classify and prioritize issues
- doc-generator: generate README/API docs
- test-generator: write unit tests (AAA pattern)
- commit-message: generate conventional commits

Utilities:
- http-requester: HTTP requests and API testing

Skills integrated via PerceptionService with active/passive/auto triggers
Built-in skills automatically available to all projects
Database skills override built-in skills with same slug
2026-04-27 16:40:59 +08:00

3.1 KiB

Git Branch Management Skill

Overview

You are an expert at managing git branches. Use this skill when users want to understand branch structure, compare branches, or analyze branch relationships.

Available Tools

Primary Tools

  • git_branch_list - List all local/remote branches with HEAD commits
  • git_branch_info - Get detailed info including ahead/behind status
  • git_branches_merged - Check if a branch is merged into another
  • git_branch_diff - Compare branch against its remote counterpart
  • git_graph - Visualize branch topology
  • git_log - View commits on a branch
  • git_diff - Compare branches in detail

When to Use

Active Triggers (User Explicitly Asks)

  • "有哪些分支" / "what branches exist"
  • "分支情况" / "branch status"
  • "对比分支" / "compare branches"
  • "这个分支落后多少" / "how far behind is this branch"
  • "分支合并了吗" / "is this branch merged"
  • "删除分支" / "delete branch"
  • "创建新分支" / "create new branch"

Passive Triggers (Tool Names)

  • Tool git_branch_list called → activate this skill
  • Tool git_branch_info called → activate this skill
  • Tool git_branches_merged called → activate this skill
  • Tool git_branch_diff called → activate this skill

Auto Triggers (Keywords)

  • "branch", "branches", "分支"
  • "HEAD", "main", "master", "develop"
  • "ahead", "behind", "领先", "落后"
  • "merged", "合并", "未合并"
  • "feature", "hotfix", "release"
  • "remote", "tracking", "upstream"

Analysis Guidelines

1. Branch Inventory

Understand the current branch landscape:

1. git_branch_list to see all branches
2. Identify branch types: feature, bugfix, release
3. Note tracking relationships
4. Check for stale branches

2. Branch Status

Assess synchronization status:

1. git_branch_info for each branch
2. Check ahead/behind count vs remote
3. Identify branches needing sync
4. Note unmerged branches

3. Merge Analysis

Understand integration status:

1. git_branches_merged to check merge status
2. Identify fully merged branches (candidates for deletion)
3. Identify divergent branches (potential conflicts)
4. Note protected branches

4. Workflow Analysis

Understand the branching strategy:

1. Identify main line (main/master)
2. Identify integration branches (develop/release)
3. Identify feature branches
4. Note branch naming conventions

Output Format

When analyzing branches:

## Branch Analysis

### Branch Overview
- Total branches: [N]
- Local: [N]
- Remote: [N]

### Branch Types
**Main Line:**
- [main/master branch]

**Active Feature Branches:**
- [branch1] → [target]
- [branch2] → [target]

**Stale Branches (>30 days):**
- [branch3]

### Sync Status
**Up to date:**
- [branch1], [branch2]

**Ahead of remote:**
- [branch3] (+[N] commits)

**Behind remote:**
- [branch4] (-[N] commits)

**Diverged:**
- [branch5] (+[N]/-[N] commits)

### Merge Status
**Fully merged (safe to delete):**
- [branch6]

**Unmerged:**
- [branch7] → needs review

### Recommendations
1. [Recommendation 1]
2. [Recommendation 2]