agentleFS
lost-rob0tlost-rob0t/skills/skills/git-worktrees/SKILL.md

git-worktrees

Skill0 starsChanged 13 days agoBSD-3-ClauseView on GitHub

git, worktrees, parallel-work, branch-isolation, pr-review, cleanup

24 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use obsidian-bases, verification-before-completion 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.
  • wangzhuofengSkill

    obsidian-bases

    Create and edit Obsidian Bases (.base files) with views, filters, formulas, and summaries. Use when working with .base files, creating database-like views of notes, or when the user mentions Bases, table views, card views, filters, or formulas in Obsidian.

    Also in 3 projects that use this

  • OpenAISkill

    verification-before-completion

    Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always

    Also in 4 projects that use this

  • SentrySkill

    security-review

    Finds exploitable application security vulnerabilities in code changes. Use for Warden security scans, appsec review, OWASP-style checks, authentication or authorization bugs, injection, XSS, SSRF, path traversal, secrets, unsafe crypto, webhook verification, open redirects, or sensitive data exposure.

    Also in 4 projects that use this

  • OpenAISkill

    systematic-debugging

    Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes

    Also in 4 projects that use this

  • CloudflareSkill

    receiving-code-review

    Use when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation

    Also in 3 projects that use this

  • CloudflareSkill

    security-audit

    Security guidance and vulnerability review for codebases, APIs, services, CLI tools, libraries, and daemons. Use for security questions, focused reviews, vulnerability research, security audits, or pen tests. Run the complete workflow only for explicit codebase audit or pen-test requests, full/comprehensive/end-to-end reviews, or requested report artifacts.

    Also in 3 projects that use this

  • +3 more from openai

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 24 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:

    Run inside a git repository.

    line 16
  2. Distinctive:

    Only create or delete directories under the configured worktree root.

    line 52
  3. Distinctive:

    Never create a second worktree for a branch already checked out anywhere, and never remove the main working tree.

    line 56
  4. Distinctive:

    Use the printed path as the single source of truth.

    line 60
  5. Very specific:

    When work ends, remove the worktree and prune.

    line 62

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

Git worktrees

Goal

Give each branch or pull request its own checked-out directory under one shared root, so parallel work never disturbs the primary checkout.

Input

Run inside a git repository. Supply a branch name or a PR number:

  • --root DIR overrides the worktree root; default ~/git/worktrees, also configurable with GIT_WORKTREE_ROOT.
  • --base REF creates a missing branch from REF; without it a missing branch is an error.
  • --pr N fetches pull request N from origin into branch pr/N.
  • --dry-run prints the plan without mutating anything.

Output

~/git/worktrees/<project-slug>-<pr-or-branch-name>

<project-slug> comes from the repository directory name; separators in branch names become -. Branch feature/foo in repository my-app lands at ~/git/worktrees/my-app-feature-foo; PR 12 lands at ~/git/worktrees/my-app-pr-12. Creating prints the new path.

Workflow

Invoke scripts/worktree.py from this skill with python3:

python3 scripts/worktree.py add feature/foo --base main
python3 scripts/worktree.py add --pr 123
python3 scripts/worktree.py path feature/foo
python3 scripts/worktree.py list
python3 scripts/worktree.py remove my-app-feature-foo
python3 scripts/worktree.py prune

remove accepts a worktree directory name (looked up under the root), a relative path, or an absolute path.

Rules

  • Only create or delete directories under the configured worktree root.
  • Fail closed: never overwrite an existing directory, never delete branches, and never guess between reusing an existing branch and creating a new one; --base must say so explicitly.
  • Never create a second worktree for a branch already checked out anywhere, and never remove the main working tree.
  • git worktree remove refuses dirty or locked worktrees; pass --force only when the operator confirmed discarding the changes.
  • Use the printed path as the single source of truth; never hand-build worktree directories outside this layout.
  • When work ends, remove the worktree and prune; keep or delete branches by explicit choice, never as a side effect.

Verification

git worktree list
git -C <worktree-path> status

The new path must appear registered and its status clean. For this skills repository, also run bash scripts/validate-skills, bash scripts/validate-support-scripts, and python3 -m unittest tests/test_git_worktrees.py -v.

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.