merge-base-branch

Installation
SKILL.md

Merge the chosen base branch into the current branch and finish with a clean lint, full test coverage, and successful build. Use when you want the branch fully reconciled with its parent and CI-quality checks passing locally.

Usage:

  • /merge-base-branch — Run the full workflow below

Prerequisites:

  • Repository root must be a git checkout on a named branch (not detached HEAD).
  • If the project uses Node/npm, package.json must define scripts lint, test:coverage, and build. If package.json is missing or any of those scripts is missing, report what is absent and STOP (do not merge or proceed without the mandated checks).

Instructions:

  1. Current branch:

    • Run git branch --show-current. If detached HEAD, inform the user and STOP.
  2. Determine base branch candidate, then let the user choose:

    • First, if .agent exists at the repo root, read it for baseBranch=<value>. That value is the detected candidate (if present).
    • Else, infer from git: run git merge-base --fork-point main HEAD, git merge-base --fork-point master HEAD, and git merge-base --fork-point develop HEAD. Any branch name that returns a commit is a match. If exactly one matches, that is the detected candidate. If several match, choose by priority: main, then master, then develop. If none match, detected candidate is unset.
    • Use AskUserQuestion so the user picks the base branch to merge. Always include main as an option. Include the detected candidate as an option when it is set and differs from main. Include master and develop as additional options when they exist on origin (or locally). Include a short label on each option (e.g. “Detected from history: develop”). Wait for the answer; the selected branch is <base-branch>.
Related skills

More from morphet81/cheat-sheets

Installs
79
First Seen
Apr 7, 2026