agentleFS
michaelegnermichaelegner/architecture-intelligence-platform/.agents/skills/post-merge-sync/SKILL.md

post-merge-sync

Skill10 starsChanged 28 days agoApache-2.0View on GitHub

Use only when the owner explicitly asks to clean up after a merged AIP pull request - verify the merge live, sync the actual main worktree safely, remove the merged feature worktree if clean, delete only the local feature branch, and report exact merge/main SHAs. Never delete a remote branch.

  • Commits and pushes

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 2 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

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

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

    Verify the merge live: Read the PR with GitHub and require state=MERGED.

    line 13
  2. Very specific:

    If a worktree has refs/heads/main, require it to be clean, then fast-forward it with git -C <main-worktree> pull --ff-only origin main.

    line 19
  3. Very specific:

    If no main worktree exists, do not repurpose or switch another worktree.

    line 21
  4. Very specific:

    Remove the merged feature worktree only if safe: If a worktree is attached to the captured head branch, require it to be clean, then remove …

    line 23
  5. Very specific:

    Delete only the local feature branch: After the feature worktree is gone and the branch is confirmed merged into origin/main, delete it …

    line 26
  6. Distinctive:

    Never run git push --delete, git branch -D, or otherwise delete the remote branch unless the owner separately asks.

    line 28
  7. Distinctive:

    No test suite is required: this skill changes no repository content.

    line 33

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

Post-merge sync

This skill is deliberately conservative because the repository may have several worktrees and the shared checkout may be on an unrelated branch.

Procedure

  1. Verify the merge live. Read the PR with GitHub and require state=MERGED. Capture headRefName and mergeCommit.oid directly from that response. If the PR is not merged, stop.
  2. Fetch main without switching the current checkout: git fetch origin main.
  3. Verify ancestry. Require the captured merge commit to be an ancestor of origin/main. Report and stop if it is not.
  4. Find worktrees explicitly with git worktree list --porcelain.
    • If a worktree has refs/heads/main, require it to be clean, then fast-forward it with git -C <main-worktree> pull --ff-only origin main.
    • If no main worktree exists, do not repurpose or switch another worktree. origin/main is the synchronized reference; report that no local main worktree was present.
  5. Remove the merged feature worktree only if safe. If a worktree is attached to the captured head branch, require it to be clean, then remove it with git worktree remove <path>. A dirty worktree is a stop condition; never discard its changes.
  6. Delete only the local feature branch. After the feature worktree is gone and the branch is confirmed merged into origin/main, delete it with git branch -d <headRefName> if it exists. Never run git push --delete, git branch -D, or otherwise delete the remote branch unless the owner separately asks.
  7. Report exact state: PR number, merge SHA, origin/main SHA, local main-worktree SHA if one exists, removed worktree path, and whether the local feature branch was deleted.

No test suite is required: this skill changes no repository content.

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.