mergemain

mergemain is a skill for Claude Code from nazmulnahid-git/Ai-Stack. It costs 97 tokens per session (1,422 once invoked), scanned A, original, MIT.

A Git workflow that fetches the latest default branch and merges it into the branch you are working on.

In plain words
What is it for?
Use it before continuing feature work or opening a pull request when your branch has fallen behind the main project branch.
Why use it?
It helps bring in teammates’ changes while resolving conflicts by considering both versions, instead of blindly choosing one side.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the ai-stack plugin — 5 skills shipped together

Good fit Use it before continuing feature work or opening a pull request when your branch has fallen behind the main project branch.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/nazmulnahid-git/ai-stack/mergemain
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add nazmulnahid-git/Ai-Stack --skill mergemain
Clone the repo
git clone --depth 1 https://github.com/nazmulnahid-git/Ai-Stack

Made for: Claude Code.

Or install ai-stack, the plugin that ships this one along with the rest of its 5 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for mergemain

README.md
[![agentmods](https://agentmods.dev/badge/skills/nazmulnahid-git/ai-stack/mergemain/github.svg)](https://agentmods.dev/skills/nazmulnahid-git/ai-stack/mergemain)
Your own site
<a href="https://agentmods.dev/skills/nazmulnahid-git/ai-stack/mergemain"><img src="https://agentmods.dev/badge/skills/nazmulnahid-git/ai-stack/mergemain/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for mergemain

Your own site · 80×15
<a href="https://agentmods.dev/skills/nazmulnahid-git/ai-stack/mergemain"><img src="https://agentmods.dev/badge/skills/nazmulnahid-git/ai-stack/mergemain.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 97 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,422 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00097 $0.01422
Opus 5.5 $0.00039 $0.00569
Sonnet 5.5 $0.00019 $0.00284
Haiku 4.5 $0.00010 $0.00142

Measured 1mo ago against content hash 89ab5a2d3498, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

mergemain scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/mergemain/SKILL.md · 132 lines

How it starts

The opening of the file, as written. The whole thing — 132 lines — stays where its author put it; the contents beside it link to each section on GitHub.

mergemain

Merge the latest main into the current branch and resolve the conflicts correctly. The whole point is the conflict resolution: never resolve by picking a side because it is easier.

Step 1 — Pre-flight

git rev-parse --abbrev-ref HEAD          # current branch
git status --porcelain                   # must be clean
git remote -v
git rev-parse --abbrev-ref origin/HEAD   # real default branch (main/master/develop)
  • If HEAD is already the default branch, stop and tell the user — there is nothing to merge.
  • If the working tree is dirty, stop and ask: commit, stash, or abort. Do not stash silently; someone's uncommitted work is not yours to move.
  • Note the current HEAD sha so you can offer an exact rollback later.

Step 2 — Get main fresh

git fetch origin --prune

Merge from origin/<default> directly — do not check out main, and do not rely on a stale local copy. Report how far behind the branch was (git rev-list --count HEAD..origin/main) and how many files main touched.

Step 3 — Merge

git merge origin/main --no-edit

If it merges cleanly, jump to Step 6.

Step 4 — Understand before resolving

List the conflicts (git diff --name-only --diff-filter=U) and, for each file, build real context before touching it:

  • git log --oneline HEAD..origin/main -- <file> — why main changed it.
  • git log --oneline origin/main..HEAD -- <file> — why this branch changed it.
  • Read the whole file, not just the <<<<<<< hunks, plus the callers of anything whose signature moved.

Classify each conflicted hunk:

  • Disjoint — the two sides changed different concerns that happen to sit on adjacent lines. Keep both, ordered so the file still reads correctly.
  • Same concern, main is newer — main refactored/renamed/moved what the branch also edited. Take main's structure and re-apply the branch's intent on top of it (rename the branch's call sites, move its logic into main's new file, adapt to the new signature). Never discard the branch's behavior just because main rewrote the surroundings.
  • Same concern, genuinely competing — both sides implement the same thing differently. This is the only case that needs a decision, and it is the case you escalate if it is not obvious.

Read the full file on GitHub · 132 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 132 lines · 97 tokens per session scan A 89ab5a2d3498

Subscribe to this mod's changes

mergemain is a skill published in the GitHub repository nazmulnahid-git/Ai-Stack (4 stars, last pushed yesterday), licensed MIT. It adds 97 tokens to every session and 1,422 once invoked, about $0.0004 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.