agentleFS
HenryQWHenryQW/skills/update-from-main/SKILL.md

update-from-main

Skill1 starsChanged 5 months agoApache-2.0View on GitHub

Safely sync attached non-`main` worktree branch with fetched `origin/main`. Use when asked to update, merge, or bring main into current branch.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Run python3 <skill>/scripts/update_from_main.py once.

    line 8
  2. Distinctive:

    Stop. No tests, install, history scan, push, extra commit, or helper rerun.

    line 19
  3. Distinctive:

    Start conflict triage with emitted JSON conflict path list, then inspect marker line numbers one separately quoted path at a time:

    line 31
  4. Distinctive:

    After recovery, verify exact source merged:

    line 42

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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

update-from-main

Run python3 <skill>/scripts/update_from_main.py once. Helper fetches before mutation, stashes tracked/untracked state plus colliding ignored paths, and merges exact emitted main SHA.

Fast path

For status=merged or status=up_to_date, report emitted line, run:

git status --short --branch
git diff --check <emitted-before-sha> HEAD

Stop. No tests, install, history scan, push, extra commit, or helper rerun.

Recovery

Emitted main SHA is authoritative for run. Do not rerun because origin/main advances. Never rerun while emitted stash remains retained; finish current recovery first.

  • status=merge_conflict: resolve and git add <paths>; run GIT_EDITOR=true git merge --continue, then apply non-none stash with git stash apply --index <oid>.
  • status=merge_pending: fix failed merge hook, run GIT_EDITOR=true git merge --continue, then apply non-none stash.
  • status=submodule_update_required: run git submodule update --checkout --recursive, then apply non-none stash.
  • status=stash_conflict: resolve and stage every emitted conflict path; retain and report stash OID.
  • status=stash_restore_failed: retain and report stash OID. Inspect once with git stash show --name-status --include-untracked <oid>, restore clear changes, and ask user only when one upstream-path collision version must win. Never drop backup first.

Start conflict triage with emitted JSON conflict path list, then inspect marker line numbers one separately quoted path at a time:

git show --no-patch --oneline <emitted-main-sha>
grep -nE '^(<<<<<<<|=======|>>>>>>>)' -- '<one-conflict-path>'

Inspect bounded source regions around markers. Never dump full git diff --cc across files. Use bounded git show :2:path | sed -n '<start>,<end>p' and git show :3:path | sed -n '<start>,<end>p' only when hunk lacks context. Prefer upstream for unrelated changes; combine compatible overlapping behavior. Ask user only when intent cannot determine one required semantic winner.

Resolve source first. Regenerate lockfiles and build artifacts instead of reading generated conflicts. For docs/index conflicts, keep entries whose paths exist, add upstream paths, remove deleted paths, and avoid full-repo scans.

After recovery, verify exact source merged:

git merge-base --is-ancestor <emitted-main-sha> HEAD
git status --short --branch

Run only smallest relevant check; docs-only recovery gets docs-specific checks, not broad tests. Run project dependency preflight before dependency-backed checks. Redirect check output to temp file. On success report command plus PASS; on failure print only final 100 lines. Never rebase, reset, abort, push, or commit unrelated work.

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.