name: pr-base-branch-merge-base
description: 'Resolve PRBaseBranch for mcp__drm-copilot__collect_pr_context using merge-base ancestry. Use when orchestrators or review workflows need the correct comparison base branch and must select the branch with the most recent common ancestor commit with HEAD.'
PR Base Branch (Merge-Base)
Deterministic branch-selection rules for PR context collection.
When to Use This Skill
Use this skill when:
running mcp__drm-copilot__collect_pr_context,
delegating post-implementation review that depends on PRBaseBranch,
constructing PR context artifacts where the base must not be hard-coded.
Selection Contract
PRBaseBranch MUST be resolved from git ancestry, not guessed.
Definition of correct base:
choose the candidate branch whose merge-base with HEAD has the most recent commit timestamp,
this implements “find the branch with the most recent commit in common.”
Deterministic Procedure
Enumerate candidate branches from local and remotes, excluding HEAD and detached refs.
For each candidate B, compute merge-base commit M = git merge-base HEAD B.
Compute merge_base_epoch(B) from git show -s --format=%ct M.
Select branch with maximum merge_base_epoch(B).
Tie-breakers (in order):
development
main
master
lexical ascending branch name
Guardrails
Do not default to main unless merge-base resolution fails for all candidates.
If all candidates fail, surface explicit error context and use repository default branch only as last-resort fallback.
Persist chosen PRBaseBranch in orchestration state and reuse it within the same run.
Collector Invocation Rule
When invoking PR context collection, pass the resolved base explicitly:
mcp__drm-copilot__collect_pr_context with base=<resolved-PRBaseBranch>
Evidence Recommendation
For auditability, include in logs/checkpoint:
selected branch name,
selected merge-base SHA,
selected merge-base timestamp,
top competing candidates with timestamps when available.
1---2name: pr-base-branch-merge-base-73description: Converted skill4---5# Converted skill67Applied rewrites:8- None910---11name: pr-base-branch-merge-base12description: 'Resolve PRBaseBranch for mcp__drm-copilot__collect_pr_context using merge-base ancestry. Use when orchestrators or review workflows need the correct comparison base branch and must select the branch with the most recent common ancestor commit with HEAD.'13---1415# PR Base Branch (Merge-Base)1617Deterministic branch-selection rules for PR context collection.1819## When to Use This Skill2021Use this skill when:22- running `mcp__drm-copilot__collect_pr_context`,23- delegating post-implementation review that depends on `PRBaseBranch`,24- constructing PR context artifacts where the base must not be hard-coded.2526## Selection Contract2728`PRBaseBranch` MUST be resolved from git ancestry, not guessed.2930Definition of correct base:31- choose the candidate branch whose merge-base with `HEAD` has the most recent commit timestamp,32- this implements “find the branch with the most recent commit in common.”3334## Deterministic Procedure35361. Enumerate candidate branches from local and remotes, excluding `HEAD` and detached refs.372. For each candidate `B`, compute merge-base commit `M = git merge-base HEAD B`.383. Compute `merge_base_epoch(B)` from `git show -s --format=%ct M`.394. Select branch with maximum `merge_base_epoch(B)`.405. Tie-breakers (in order):41 - `development`42 - `main`43 - `master`44 - lexical ascending branch name4546## Guardrails4748- Do not default to `main` unless merge-base resolution fails for all candidates.49- If all candidates fail, surface explicit error context and use repository default branch only as last-resort fallback.50- Persist chosen `PRBaseBranch` in orchestration state and reuse it within the same run.5152## Collector Invocation Rule5354When invoking PR context collection, pass the resolved base explicitly:5556- `mcp__drm-copilot__collect_pr_context` with `base=<resolved-PRBaseBranch>`5758## Evidence Recommendation5960For auditability, include in logs/checkpoint:61- selected branch name,62- selected merge-base SHA,63- selected merge-base timestamp,64- top competing candidates with timestamps when available.
Run npx get-skill add drmoisan/pr-base-branch-merge-base-7 in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Converted skill It is listed under Coding & Dev Tools on SkillMD.
This skill has not completed SkillMD's automated safety review yet. Independent scanners report: SkillSpector: PASS, Skill Scanner: PASS. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
drmoisan (@drmoisan) published this skill. Their other Agent Skills are listed on their SkillMD profile.