agentleFS
tardigrdetardigrde/obsidian-agentic-chat/.agents/skills/worktree/SKILL.md

Worktree

Skill8 starsChanged 6 days agoMITView on GitHub

Use when a task needs its own worktree, env-dependent commands, a worktree audit, or safe cleanup. Creates a branch and worktree, links local-only files such as .env without copying secrets, and removes only work that is safe to remove.

  • Reads credentials
  • Deletes or force-pushes

59 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use worktree-merge, resolve-conflicts and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • leessjuSkill

    worktree-merge

    Squash-merge the current worktree branch into the main branch (or a specified target). Analyzes git history and source code to craft a comprehensive commit message.

    Also in 3 projects that use this

  • ralphkraussSkill

    resolve-conflicts

    Resolve git merge conflicts or re-apply changes from a stale branch onto current main. Use when user says "resolve conflicts", "merge conflicts", "rebase branch", "branch is behind", "re-apply changes", "port branch", or a branch is too far behind main to merge cleanly.

    Also in 5 projects that use this

  • SentrySkill

    e2e

    Run E2E tests for Sentry JavaScript SDK test applications

    Also in 5 projects that use this

  • hdcolaSkill

    pr-comments

    Fetch unresolved review comments from a GitHub PR or mark comments as resolved. Use this when managing PR review feedback, checking pending comments, or marking review threads as resolved. Supports GitHub URLs or explicit owner/repo/PR-number from anywhere, or PR number auto-detection from within a git repository.

    Also in 3 projects that use this

  • Google CloudSkill

    contributing

    Guides the developer workflow for contributing to Race Condition. Use when setting up pre-commit hooks, running tests before a PR, understanding code style requirements, or preparing a contribution.

    Also in 3 projects that use this

  • PydanticSkill

    coverage

    Fetch coverage diff from Codecov for the current branch or a specific PR. Shows uncovered lines, patch coverage, and overall coverage change.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

6 rules. 0 are common, 3 are distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 47 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    Use --base, --path, --branch, and --json as needed.

    line 29
  2. Distinctive:

    Default cleanup is a dry run.

    line 36
  3. Very specific:

    Before removal: unlink manifest symlinks, git worktree remove, rm -rf ignored artifacts if the directory survives, then git worktree prune.

    line 43
  4. Very specific:

    Run rm -rf on a dirty worktree without a human decision.

    line 49
  5. Distinctive:

    Run two writers in one worktree.

    line 50
  6. Distinctive:

    Delete a branch as part of cleanup.

    line 51

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

Worktree

One task, one branch, one worktree. Do not put parallel writers in the same worktree.

When to use

  • A task needs an isolated checkout without touching main.
  • A command needs the local .env from the main checkout.
  • You need to list or clean up old worktrees.

Commands

npm run worktree:new -- <name>
npm run worktree:env -- <command>
npm run worktree:list
npm run worktree:cleanup -- --dry-run
npm run worktree:cleanup -- --apply

new creates <repo-parent>/<repo-name>-worktrees/<slug> on branch wt/<slug> from main, then symlinks each existing worktree-links entry. Use --base, --path, --branch, and --json as needed.

env loads .env from the current worktree, does not overwrite exported variables, and never prints values. --env-file <path> selects another file.

Safety gates

  • Default cleanup is a dry run.
  • --apply removes only safe worktrees: clean and merged into the base, or a merged PR.
  • hold-wip, hold-scratch, hold-open-pr, recent, and review need a human decision. A closed but unmerged PR is review, not safe.
  • --force is a human-only override. It prints every path before removal.
  • Branch refs survive cleanup. Committed work is not lost.
  • Before removal: unlink manifest symlinks, git worktree remove, rm -rf ignored artifacts if the directory survives, then git worktree prune.

Do not

  • Copy .env into a worktree. Symlink it. Never commit it.
  • Run rm -rf on a dirty worktree without a human decision.
  • Run two writers in one worktree.
  • Delete a branch as part of cleanup.

The audit and bucket idea is adapted from pstack's worktree-cleanup playbook by Lauren Tan (MIT). Full reference: docs/development/worktrees.md.

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.