agentleFS
kazemcodeskazemcodes/skill-tree/skills/finish-branch/SKILL.md

finish-branch

Skill1 starsChanged 5 months agoMITView on GitHub

Complete development work — verify tests, present merge/PR/discard options, clean up worktree and branch

  • Commits and pushes

8 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 6 edited versions we read keep these.

  • 4

    Distinctive

    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. Distinctive:

    Tests fail?: Stop. Fix before proceeding.

    line 24
  2. Distinctive:

    Verify tests before presenting options

    line 75
  3. Distinctive:

    Don't clean up worktree for Option 2 (PR needs it)

    line 77
  4. Distinctive:

    Don't run git worktree remove from inside the worktree

    line 78
  5. Very specific:

    Always cd to main repo root first

    line 79

“Common” is measured: kept by at least 6 in 10 of the 6 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Finish Branch

Guide completion of development work with structured options.

When to Use

  • Implementation is complete
  • All tests pass
  • Ready to integrate or discard work

Process

Step 1: Verify Tests

npm test / cargo test / pytest / go test ./...

Tests fail? Stop. Fix before proceeding.

Step 2: Detect Environment

GIT_DIR=$(cd "$(git rev-parse --git-dir)" 2>/dev/null && pwd -P)
GIT_COMMON=$(cd "$(git rev-parse --git-common-dir)" 2>/dev/null && pwd -P)

Step 3: Present Options

Normal repo or named-branch worktree:

Implementation complete. What would you like to do?

1. Merge back to <base-branch> locally
2. Push and create a Pull Request
3. Keep the branch as-is (I'll handle it later)
4. Discard this work

Which option?

Detached HEAD (3 options):

1. Push as new branch and create a Pull Request
2. Keep as-is (I'll handle it later)
3. Discard this work

Step 4: Execute

OptionAction
1. Merge locallyCheckout base → pull → merge → verify tests → cleanup worktree → delete branch
2. Create PRPush branch (git push -u origin <branch>) — keep worktree alive for PR iteration
3. Keep as-isReport preserved state, no cleanup
4. DiscardConfirm with typed "discard" → remove worktree → force-delete branch

Step 5: Cleanup (Options 1 & 4 only)

# From main repo root
git worktree remove <worktree-path>
git worktree prune

Rules

  • Verify tests before presenting options
  • Get typed confirmation for discard
  • Don't clean up worktree for Option 2 (PR needs it)
  • Don't run git worktree remove from inside the worktree
  • Always cd to main repo root first

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.