merged
Skill311 starsChanged 18 days agoMITView on GitHub
Use when the user says a pull request was merged, to clean up its session, branch and local main
- Deletes or force-pushes
4 other projects use a version of this.
Adopted by
Most recently taken up by
- zahidakhyar/skillstheir own version, first seen Nov 1, 2026
- luainkernel/lunatiktheir own version, first seen Oct 9, 2026
- DanaResearchGroup/agent-skillstheir own version, first seen Aug 26, 2026
- EternallLight/tgc-skillstheir own version, first seen Jul 13, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- luainkernel/lunatik★ 611same name
- EternallLight/tgc-skills★ 11same name
- DanaResearchGroup/agent-skills★ 1same name
- zahidakhyar/skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository18 other files it gives its agents.
- AGENTS.mdAGENTS.md
- commands/agents.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/feature-worktrees.mdcCursor rule
- .cursor/rules/no-cursor-commit-notes.mdcCursor rule
- diagnosisSkill
- draftingSkill
- feature-prototypeSkill
- inventingSkill
- mvp-prototypeSkill
- proofSkill
- researchSkill
- shippingSkill
- swarmSkill
- testingSkill
- upgrade-scanSkill
- using-superliteSkill
- writing-specsSkill
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 1 is distinctive, and 2 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 24
Keep only PRs whose headRepositoryOwner is this repo's owner (gh repo view --json owner): --head also matches same-named fork branches.
- Distinctive: line 35
Look up the branch's checkout in git worktree list --porcelain.
- Very specific: line 63
Delete a branch gh has not reported as merged, or one with commits the PR does not hold, unless the user chose "Discard it".
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Merged
The PR is merged on the remote. Bring the local repo up to date and remove what the PR left behind. Only existing tools, in this order; never push, never touch the remote branch. Nothing here is guessed: each step checks before it changes anything, and any check that fails stops the flow with nothing changed after it.
1. Find the branch
Take the first that works:
- the argument: a session slug, a branch name, or a PR number (
gh pr view <n> --json headRefName). Resolve a slug throughbash <skill-dir>/../swarm/scripts/superlite-cli session status --jsonor<hub>/.superlite/session-store/<slug>/session.jsonand use its recorded branch; only fall back tosuperlite/sessions/<slug>when no session metadata exists. - the current branch, when it is not the base branch
- otherwise list live sessions, archived session manifests and local branches, and ask once (one AskUserQuestion) which one was merged
Find the base branch the way superlite:shipping step 2 does. Retain the slug resolved from an argument. For a branch selected by argument, PR, current checkout or the user's answer, find the slug by matching its branch in live session rows or archived <hub>/.superlite/session-store/*/session.json manifests. Only infer the slug from the superlite/sessions/ prefix when no matching metadata exists; otherwise a branch without matching metadata or that prefix has no slug.
2. Confirm the merge
gh pr list --head <branch> --state all --json number,state,url,headRefOid,headRepositoryOwner,mergeCommit,baseRefName
Keep only PRs whose headRepositoryOwner is this repo's owner (gh repo view --json owner): --head also matches same-named fork branches. The PR with the highest number decides.
- No
gh, not signed in, or no PR for the branch: say so and stop. Do not fall back togit branch --merged; a squash merge never shows there. OPEN: say it is still open and stop.CLOSED, not merged: ask once, "Keep the branch" / "Discard it". On keep, stop. On discard, skip the head check below and step 4: run steps 3, 5 and 6.MERGED: use itsbaseRefNameas the base and go on.
Then check the local branch holds nothing the PR did not. If git cat-file -e <headRefOid> fails, run git fetch origin pull/<number>/head first; if it still fails, stop. Then git rev-parse --verify refs/heads/<branch> must equal headRefOid, or git log --oneline <headRefOid>..refs/heads/<branch> must exit 0 and print nothing. If it lists commits or exits non-zero, name them (or the error) and stop: they were never in the PR.
3. Leave the branch
Look up the branch's checkout in git worktree list --porcelain.
- Its checkout has uncommitted work (
git status --shortthere is not empty), its session row insession statusreportsstash:yes, orgit rev-parse -q --verify refs/superlite/wip/<slug>finds parked work: that work is not in the PR. Name it and ask once, "Stop and keep it" / "Discard it". On stop, stop. - The session is still listed in
session status: first leave its worktree if you are in one (ExitWorktreewithaction: "keep"under Claude Code, elsecdto the main checkout), then from the main checkout runbash <skill-dir>/../swarm/scripts/superlite-cli session close --slug <slug> --keep-branch. It puts the host back on the base branch and removes a worktree superlite cut. On anASKline (exit 4, nothing changed), ask exactly what itsask:line says and do what the chosenon ...:line says. A Claude-created worktree is not removed by close: end it withExitWorktreeremove, assuperlite:shippingstep 7 says. - No session, but the branch is checked out: if the user chose to discard its uncommitted work above, first run
git reset --hardandgit clean -fdin that checkout while it is still on the feature branch. Then switch that checkout to the base branch (git switch <base>), or leave a linked worktree the way step 7 ofsuperlite:shippingdoes.
4. Update the base branch
git fetch --prune origin, then fast-forward only:
- The base is checked out in a clean, unoccupied checkout (
session statuslists no session hosted there, even one whose run is finished):git merge --ff-only origin/<base>there. If another session hosts that checkout, report it and skip this step without changing its files. - The base is not checked out anywhere:
git fetch origin <base>:<base>. - The base is checked out with uncommitted work, or the fast-forward fails (local base has commits origin does not): report it and skip this step. Never merge, rebase or reset the base.
5. Delete the branch
- With a slug (a listed or archived superlite session):
bash <skill-dir>/../swarm/scripts/superlite-cli session discard --slug <slug>. It drops the session's store and parked work ref, and the branch unless superlite adopted it. - Then, or without a slug: if
git rev-parse -q --verify refs/heads/<branch>still finds it,git branch -D <branch>.-Dis safe here only because step 2 proved the branch is in the merged PR, or the user chose "Discard it"; never use it otherwise.
The remote branch is not touched. GitHub's "delete branch on merge" or the user removes it.
6. Report
Run bash <skill-dir>/../swarm/scripts/superlite-cli session status. Print one line per step: PR number and URL, merge commit, the session closed, base <old sha>..<new sha> (or why it was skipped), the branch deleted. Name each session now behind the base (main:+N); each one is offered the update in its own chat, nothing is synced here.
Never
- Push, delete a remote branch, or open, close or merge a PR.
- Delete a branch
ghhas not reported as merged, or one with commits the PR does not hold, unless the user chose "Discard it". - Merge, rebase or reset the base branch.
- Discard uncommitted or parked work without the user's answer.
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
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.

