Skip to content
Skill

Clean merge lands line guard on a value neither branch predicted

Re-checks line-number citations and guard tests after a clean git merge

Clean merge lands line guard on a value neither branch predicted is an open-source agent skill for developer tools. It is available on Claude Code.

Scripts
None
Platforms
Claude Code
GitHub stars
5
Last commit
License
MIT
Listing updated

Similar skills

About Clean merge lands line guard on a value neither branch predicted

This skill covers a quiet merge failure: two branches each correctly update a line number that a test or page cites in a third file, and git merges both edits without a conflict, leaving a number that matches neither branch. It tells the agent to stop trusting a clean merge and instead re-locate each cited anchor by searching for its text in the merged file.

The workflow is to grep the anchor text on the merged result, run the guard tests before longer test suites, and avoid computing new line numbers by adding the size of an insertion to an old one. Where a cited page cannot be edited, the skill suggests moving the inserted block so the original address resolves again, then re-running the documentation checks. It also includes a sweep with git grep for retired line numbers before committing.

It expects a git repository with shell access, grep, and Python with pytest for the guard tests. It is written for merges and rebases in hand-authored reference files, and it does not apply to generated files, which should be regenerated instead.

When your agent uses it

Two branches each contain a guard, test or document that pins a line NUMBER in a third file, each side correctly re-aims that number for its own tree, and git merges both edits with NO conflict — leaving a merged tree whose real line can be neither number. Use when: (1) two parallel PRs both insert or delete lines in a file that other files cite by line, (2) a merge you just completed touched a test or page that resolves `path:NNN` and the merge was clean, (3) a guard file in your merge result looks "freshly fixed" — touched minutes ago by a competent session for this exact reason — and leaving it alone feels like respecting their work, (4) you are tempted to compute the new line by adding your insertion's size to the old one. A clean auto-merge is evidence of nothing here: conflict is the loud case and this is the quiet one. Re-grep the anchor TEXT on the merged bytes, run the guards before the long test legs, and never carry an offset. NOT for a merge conflict in a generated file (regenerate it instead) and

From the skill's SKILL.md. Your agent reads this description to decide when to load the skill.

What it can access

From a static check of its 1 file (9 KB) on GitHub on 4 December 2026. Nothing was run. Read the files before you install a skill: it can tell your agent to run anything its tools allow.

Check another skill before you install it.

Install

This skill ships in the agent-traffic-control plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

/plugin marketplace add wan-huiyan/agent-traffic-control
/plugin install agent-traffic-control@wan-huiyan-agent-traffic-control

Or copy only this skill to ~/.claude/skills/clean-merge-lands-line-guard-on-a-value-neither-branch-predicted:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/wan-huiyan/agent-traffic-control.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/clean-merge-lands-line-guard-on-a-value-neither-branch-predicted &&
cp -R "$tmp/plugins/agent-traffic-control/skills/clean-merge-lands-line-guard-on-a-value-neither-branch-predicted" ~/.claude/skills/clean-merge-lands-line-guard-on-a-value-neither-branch-predicted &&
rm -rf "$tmp"

For one project only, put the folder in .claude/skills/clean-merge-lands-line-guard-on-a-value-neither-branch-predicted inside it instead.

Claude Code docs on skills

Copy the skill folder to ~/.agents/skills/clean-merge-lands-line-guard-on-a-value-neither-branch-predicted to use it in every repository:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/wan-huiyan/agent-traffic-control.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/clean-merge-lands-line-guard-on-a-value-neither-branch-predicted &&
cp -R "$tmp/plugins/agent-traffic-control/skills/clean-merge-lands-line-guard-on-a-value-neither-branch-predicted" ~/.agents/skills/clean-merge-lands-line-guard-on-a-value-neither-branch-predicted &&
rm -rf "$tmp"

For one repository only, put the folder in .agents/skills/clean-merge-lands-line-guard-on-a-value-neither-branch-predicted inside it instead.

Codex docs on skills

Copy the skill folder to ~/.cursor/skills/clean-merge-lands-line-guard-on-a-value-neither-branch-predicted to use it in every project:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/wan-huiyan/agent-traffic-control.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/clean-merge-lands-line-guard-on-a-value-neither-branch-predicted &&
cp -R "$tmp/plugins/agent-traffic-control/skills/clean-merge-lands-line-guard-on-a-value-neither-branch-predicted" ~/.cursor/skills/clean-merge-lands-line-guard-on-a-value-neither-branch-predicted &&
rm -rf "$tmp"

For one project only, put the folder in .cursor/skills/clean-merge-lands-line-guard-on-a-value-neither-branch-predicted inside it instead.

Cursor docs on skills

Run in a terminal (add --scope workspace to install it for the current workspace only):

gemini skills install https://github.com/wan-huiyan/agent-traffic-control.git --path plugins/agent-traffic-control/skills/clean-merge-lands-line-guard-on-a-value-neither-branch-predicted

Or copy the folder to ~/.gemini/skills/clean-merge-lands-line-guard-on-a-value-neither-branch-predicted yourself.

Gemini CLI docs on skills

For GitHub Copilot in VS Code, copy the skill folder to ~/.copilot/skills/clean-merge-lands-line-guard-on-a-value-neither-branch-predicted:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/wan-huiyan/agent-traffic-control.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/clean-merge-lands-line-guard-on-a-value-neither-branch-predicted &&
cp -R "$tmp/plugins/agent-traffic-control/skills/clean-merge-lands-line-guard-on-a-value-neither-branch-predicted" ~/.copilot/skills/clean-merge-lands-line-guard-on-a-value-neither-branch-predicted &&
rm -rf "$tmp"

For one project only, put the folder in .github/skills/clean-merge-lands-line-guard-on-a-value-neither-branch-predicted inside it instead.

VS Code docs on skills

Get the folder:

git clone --depth 1 https://github.com/wan-huiyan/agent-traffic-control.git

Then copy agent-traffic-control/plugins/agent-traffic-control/skills/clean-merge-lands-line-guard-on-a-value-neither-branch-predicted into your agent's skills folder as clean-merge-lands-line-guard-on-a-value-neither-branch-predicted. Agents that support SKILL.md read one folder per skill.

The SKILL.md format

What it does

Anchor text re-grep
Locates cited code by its text on the merged file rather than by a remembered line number.
Guard tests first
Runs the fast line-citation guard tests before the long test legs so failures surface early.
Offset avoidance
Warns against computing new line numbers by adding an insertion's size to an old value.
Retired citation sweep
Uses git grep across all file types to find stale line numbers before committing.
Block relocation fix
Describes moving an inserted block below cited code when the citing page cannot be edited.

Good for

  • Check that line-number citations in tests and docs still resolve after merging two branches
  • Find where a cited function moved after a clean merge
  • Run the guard tests on a merge commit to confirm citations are correct
  • Search the repo for old line numbers left behind after a rebase

Clean merge lands line guard on a value neither branch predicted FAQ

Does this apply to merge conflicts in generated files?

No. For a conflict in a generated file, the skill says to regenerate it instead.

Should I fix a stale citation in a dated document?

No. A dated audit's citation that disagrees with the base branch is expected, since it describes the tree it was measured on.

Why not just add my insertion size to the old line number?

The skill says an offset can agree with one parent while being wrong for the merged result, and the error is not visible.

How do I install Clean merge lands line guard on a value neither branch predicted in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/clean-merge-lands-line-guard-on-a-value-neither-branch-predicted to use it in all your projects, or to .claude/skills/clean-merge-lands-line-guard-on-a-value-neither-branch-predicted in one project. Or install the agent-traffic-control plugin, which includes it: /plugin marketplace add wan-huiyan/agent-traffic-control, then /plugin install agent-traffic-control@wan-huiyan-agent-traffic-control.

Does Clean merge lands line guard on a value neither branch predicted run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

Which AI agents can use Clean merge lands line guard on a value neither branch predicted?

Claude Code. It reads skills in the SKILL.md format; the install steps on this page show where to put the folder.

What are the best alternatives to Clean merge lands line guard on a value neither branch predicted?

The closest alternatives to Clean merge lands line guard on a value neither branch predicted are Fix merge conflicts, Merge PR, Check a stale branch is not undoing newer main work, Batch member cites a path only a non member adds and Git post merge cleanup.

Where this comes from

  • Description: from the skill's own SKILL.md.

More from wan-huiyan/agent-traffic-control