agentleFS
MicrosoftKnown publishermicrosoft/devsquad-copilot/.github/plugins/devsquad/skills/git-branch/SKILL.md

git-branch

Skill50 starsChanged 16 days agoMITView on GitHub

Branch management for implementation. Use when you need to create a branch, switch branches, checkout, or verify branching strategy before implementing code. Do not use for commits (use git-commit), pull requests (use pull-request), or advanced git operations (rebase, merge).

We split this skill into the rules it gives an agent

10 rules. 0 are common, 6 are distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 6

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If Branching Strategy is filled in, use the configured strategy.

    line 14
  2. Very specific:

    If the config has Confidence: medium, confirm with the dev before using (see Detect Branching Strategy section).

    line 16
  3. Very specific:

    If on main/master/develop, check synchronization:

    line 30
  4. Distinctive:

    If the main branch is behind:

    line 42
  5. Distinctive:

    When the source of work is a GitHub issue or Azure DevOps work item, create the branch automatically.

    line 65
  6. Distinctive:

    Remove articles, prepositions, and unnecessary words

    line 78
  7. Distinctive:

    Action: Create branch and inform the user:

    line 88
  8. Distinctive:

    When the source is tasks.md (without issue/work item), ask the user:

    line 101
  9. Distinctive:

    If the user is already on a feature branch, use the current branch without additional questions.

    line 115
  10. Very specific:

    When .memory/git-config.md does not exist or does not have Branching Strategy, detect automatically:

    line 119

“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Git Branch — Branch Management

Check Branching Strategy Config

cat .memory/git-config.md 2>/dev/null

If Branching Strategy is filled in, use the configured strategy. The detect-branching-strategy.sh hook automatically seeds on sessionStart.

If the config has Confidence: medium, confirm with the dev before using (see Detect Branching Strategy section).

Check Git State

Before starting implementation:

git branch --show-current
git status
git fetch origin

Remote Synchronization

If on main/master/develop, check synchronization:

git rev-list HEAD..origin/<branch> --count
SituationAction
Branch behind (commits behind remote)Alert and suggest pull
Branch with uncommitted local changesAlert about pending changes
Branch up to date and cleanProceed normally

If the main branch is behind:

Your branch [main] is [N] commits behind the remote.

I recommend updating before creating a new branch:

[P] Pull and continue
[I] Ignore and continue anyway (not recommended)
[A] Abort implementation

Evaluate Situation for Branch Creation

SituationAction
Already on a feature branch (not main/master/develop)Use current branch
On main/master/develop without changes with work itemCreate branch automatically (see below)
On main/master/develop without changes without work itemAsk if they want to create a branch
On main/master/develop with changesAlert and ask how to proceed

Automatic Creation (when there is a work item)

When the source of work is a GitHub issue or Azure DevOps work item, create the branch automatically.

Naming convention:

feature/<id>-<short-description>

Rules for <short-description>:

  • Derived from the work item title
  • Lowercase letters, numbers, and hyphens only
  • Maximum 50 characters in the total branch name
  • Remove articles, prepositions, and unnecessary words

Examples:

Work ItemBranch
#42 "Implement user authentication"feature/42-user-authentication
#108 "Add rate limiting to API endpoints"feature/108-rate-limiting-api
WI 5678 "Create financial reports endpoint"feature/5678-financial-reports-endpoint

Action: Create branch and inform the user:

Branch created: feature/<id>-<short-description>

[C] Continue with this branch
[R] Rename branch: _

The user can rename, but the flow does not block waiting for confirmation to create.

Interactive Creation (without work item)

When the source is tasks.md (without issue/work item), ask the user:

You are on the main branch. Do you want me to create a branch for this implementation?

Suggestion: feature/<short-description>

[S] Yes, create suggested branch
[N] No, continue on current branch
[C] Create with another name: _

Existing Branch

If the user is already on a feature branch, use the current branch without additional questions.

Detect Branching Strategy

When .memory/git-config.md does not exist or does not have Branching Strategy, detect automatically:

# 1. Default branch
DEFAULT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@')

# 2. Does develop branch exist?
HAS_DEVELOP=$(git ls-remote --heads origin develop 2>/dev/null | grep -q develop && echo "yes" || echo "no")

# 3. Do release/* or hotfix/* branches exist? (GitFlow pattern)
HAS_GITFLOW_BRANCHES=$(git branch -r 2>/dev/null | grep -qE '(release|hotfix)/' && echo "yes" || echo "no")

Detection rules

developrelease/* or hotfix/*StrategyConfidenceAction
YesYesGitFlowHighSave and inform
YesNoGitFlowMediumAsk to confirm
NoNoTrunk-BasedHighSave and inform

High confidence — save automatically and inform:

Branching strategy detected: [trunk-based|gitflow]
Integration branch: [branch]

Saved to .memory/git-config.md. To change: edit the file or delete it.

Medium confidence — ask to confirm:

I detected a `develop` branch in the repository.

Which branching strategy does the project use?

[G] GitFlow (features → develop)
[T] Trunk-Based (features → main/master)

Save config

Save to .memory/git-config.md:

# Git Config

Branching Strategy: [trunk-based|gitflow]
Integration Branch: [main|master|develop]

Behavior by Strategy

ActionTrunk-BasedGitFlow
Branch created fromIntegration BranchIntegration Branch (develop)
PR targetIntegration BranchIntegration Branch (develop)
next-task returns toIntegration BranchIntegration Branch (develop)

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.