agentleFS
softwareone-platformsoftwareone-platform/mpt-extension-skills/skills/mpt-ext-tool-git-branch-ops/SKILL.md

mpt-ext-tool-git-branch-ops

Skill3 starsChanged 4 months agoApache-2.0View on GitHub

When a task needs a low-level Git branch operation for an already-decided branch name — create or switch safely on the correct base. Used by branch tasks, not for deriving names from Jira.

The file

Show its rules and text

We split this skill into the rules it gives an agent

18 rules. About 0 are common, 16 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈16

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Read repository-specific docs when they exist, because they may extend or override shared guidance.

    line 52
  2. Very specific:

    Read shared docs only when the repository explicitly points to them.

    line 53
  3. Distinctive:

    Use the bundled deterministic script to resolve the base branch:

    line 57
  4. Very specific:

    If the script reports that no remote release/* branch exists for hotfix or backport, stop and report the blocker.

    line 67
  5. Distinctive:

    Check the current branch and worktree status.

    line 70
  6. Distinctive:

    If the worktree is dirty, stop and ask the user whether to continue.

    line 71
  7. Distinctive:

    Check whether the target branch already exists locally or remotely.

    line 72
  8. Distinctive:

    If the target branch already exists, stop and ask the user what to do.

    line 73
  9. Distinctive:

    Update the base branch locally.

    line 75
  10. Distinctive:

    Create and switch to the target branch.

    line 83
  11. Distinctive:

    Create the new branch from the updated local base branch:

    line 84
  12. Distinctive:

    If blocked, report the exact blocker: dirty worktree, branch naming conflict, or missing release branch.

    line 93
  13. Distinctive:

    Never continue past a dirty worktree without explicit user confirmation.

    line 118
  14. Distinctive:

    Never hand-select the base branch when the bundled script can resolve it.

    line 119
  15. Distinctive:

    Never silently reuse an existing local or remote branch with the same name.

    line 120
  16. Distinctive:

    Never invent a release branch when none exists.

    line 121
  17. Distinctive:

    Never rewrite history or delete branches as part of this skill.

    line 122
  18. Distinctive:

    Never generate business-specific branch names from Jira content inside this tool skill.

    line 123

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “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 Ops

Purpose

Perform Git branch operations safely and consistently when starting work.

Use When

  • The user wants to create a new work branch.
  • The user wants to start a feature, bugfix, hotfix, or backport branch.
  • The task requires selecting the correct base branch from the branch type.
  • The task requires checking for dirty worktrees or branch naming conflicts before branch creation.

Do Not Use When

  • The task is to read or update Jira issues.
  • The task is to generate a branch name from Jira title or description.
  • The task is to open or update a pull request.
  • The task is to perform destructive Git history operations such as reset, rewrite, or force-delete.

Inputs

  • branch_type
    • feature
    • bugfix
    • hotfix
    • backport
  • target_branch_name
  • Optional remote_name
    • default: origin
  • Installed shared package root when shared package guidance is needed:
${MPT_EXTENSION_SKILLS_HOME:-$HOME/.mpt-extension-skills}/current

Assumptions

  • The command is running inside the target Git repository and local Git tooling is available.
  • Remote access and Git credentials are configured well enough to read and update the selected base branch.
  • The current repository state is suitable for branch creation, or the user is available to decide how to proceed when the worktree is dirty or a branch conflict is detected.

Workflow

  1. Build repository context first.
  • Read the target repository AGENTS.md once per session. If you already loaded it earlier in this session and still have its full contents, reuse them instead of re-reading; if the context was summarized or you are unsure it is complete, read it again. Do not pre-load shared docs in this step; read them lazily only when the repository points to them.
  • Read repository-specific docs when they exist, because they may extend or override shared guidance.
  • Read shared docs only when the repository explicitly points to them. Resolve those shared docs from ${MPT_EXTENSION_SKILLS_HOME:-$HOME/.mpt-extension-skills}/current when available; otherwise read them from the main branch of the shared GitHub repository.
  1. Resolve the base branch from the branch type.
  • For repositories that follow this package standard, read standards/branching.md using the shared-doc resolution rule from the repository context step, and use it as the source of truth for base-branch selection, hotfix/backport handling, and push conventions.
  • Use the bundled deterministic script to resolve the base branch:
python3 "${MPT_EXTENSION_SKILLS_HOME:-$HOME/.mpt-extension-skills}/current/skills/mpt-ext-tool-git-branch-ops/scripts/resolve_base_branch.py" \
  --branch-type feature \
  --remote-name origin
  • For feature and bugfix, the script returns main.
  • For hotfix and backport, the script returns the latest remote release/* branch by numeric suffix.
  • If the script reports that no remote release/* branch exists for hotfix or backport, stop and report the blocker.
  1. Inspect the current Git state.
  • Check the current branch and worktree status.
  • If the worktree is dirty, stop and ask the user whether to continue.
  • Check whether the target branch already exists locally or remotely.
  • If the target branch already exists, stop and ask the user what to do.
  1. Update the base branch locally.
  • Switch to the resolved base branch.
  • Update it with:
git pull <remote_name> <base-branch>
  1. Create and switch to the target branch.
  • Create the new branch from the updated local base branch:
git checkout -b <target_branch_name>
  1. Report the result clearly.
  • State which base branch was selected.
  • State whether the branch was created successfully.
  • If blocked, report the exact blocker: dirty worktree, branch naming conflict, or missing release branch.

Command Patterns

# Inspect repository state
git status --short --branch
git branch --list
git branch --remotes

# Resolve base branch
base_branch="$(python3 "${MPT_EXTENSION_SKILLS_HOME:-$HOME/.mpt-extension-skills}/current/skills/mpt-ext-tool-git-branch-ops/scripts/resolve_base_branch.py" \
  --branch-type <branch_type> \
  --remote-name <remote_name>)"

# Switch to base branch and update it
git checkout "${base_branch}"
git pull <remote_name> "${base_branch}"

# Create target branch
git checkout -b feature/MPT-1234/example-short-description

Guardrails

  • Never continue past a dirty worktree without explicit user confirmation.
  • Never hand-select the base branch when the bundled script can resolve it.
  • Never silently reuse an existing local or remote branch with the same name.
  • Never invent a release branch when none exists.
  • Never rewrite history or delete branches as part of this skill.
  • Never generate business-specific branch names from Jira content inside this tool skill; accept the target branch name as input.

Bundled Resources

  • scripts/resolve_base_branch.py
    • Inputs: branch type and optional remote name
    • Output: base branch name, or JSON with base_branch
    • Runtime path: ${MPT_EXTENSION_SKILLS_HOME:-$HOME/.mpt-extension-skills}/current/skills/mpt-ext-tool-git-branch-ops/scripts/resolve_base_branch.py

Expected Outcome

The correct base branch is selected and updated, the target branch is created and checked out safely, or the operation stops with a clear blocker that requires user direction.

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.