agentleFS
RileyCorneliusRileyCornelius/Code-Skills/skills/git-worktrees/SKILL.md

git-worktrees

Skill0 starsChanged 7 months agoMITView on GitHub

Create or manage isolated git worktrees for parallel feature work, experiments, reviews, or bug fixes without disturbing the current checkout. Use when the user wants a separate workspace or branch, asks to isolate work before implementation, or when working in the current tree risks conflicts or mixing unrelated changes.

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

Show its rules and text

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 24 edited versions we read keep these.

  • 19

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

    Use commands that fit the current shell and platform.

    line 14
  2. Distinctive:

    Follow this priority order:

    line 24
  3. Very specific:

    Prefer an existing .worktrees/ directory.

    line 26
  4. Distinctive:

    Ask the user only if the location is still ambiguous.

    line 29
  5. Distinctive:

    Use git check-ignore instead of guessing.

    line 35
  6. Distinctive:

    If the directory is not ignored, add an appropriate ignore rule before creating the worktree.

    line 36
  7. Distinctive:

    If adding the ignore rule would create a visible repository change, call that out before committing it.

    line 37
  8. Very specific:

    Use git worktree add <path> -b <branch> when creating a new branch.

    line 43
  9. Very specific:

    If the branch already exists, create the worktree without -b.

    line 44
  10. Distinctive:

    Run lightweight setup commands that establish a clean baseline.

    line 52
  11. Distinctive:

    Avoid hardcoding package managers or shells when the repo indicates something else.

    line 53
  12. Distinctive:

    Use the repository's existing scripts when available instead of inventing your own.

    line 55
  13. Distinctive:

    If the project has tests or an obvious smoke-check, run the appropriate baseline check before implementation.

    line 59
  14. Distinctive:

    If checks fail, stop and ask whether to proceed with a dirty baseline.

    line 61
  15. Distinctive:

    If checks pass, report the workspace as ready.

    line 62
  16. Distinctive:

    Fix: Always use git check-ignore before creating a project-local worktree

    line 88
  17. Distinctive:

    Fix: Follow priority: existing directory > repo guidance > ask

    line 93
  18. Distinctive:

    Fix: Use the active shell, and consult references/powershell.md or references/posix.md for shell-specific examples

    line 108
  19. Distinctive:

    Create a worktree without verifying it is ignored when using a project-local directory

    line 129
  20. Distinctive:

    Follow directory priority: existing directory > repo guidance > ask

    line 136
  21. Distinctive:

    Verify directory is ignored for project-local locations

    line 137
  22. Distinctive:

    Verify a clean baseline before implementation

    line 139

“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

Overview

Git worktrees create isolated workspaces that share a repository while keeping separate checkouts.

Core principle: Systematic directory selection + safety verification = reliable isolation.

Use commands that fit the current shell and platform. For concrete examples, see references/powershell.md for PowerShell and references/posix.md for POSIX shells.

Workflow

1. Announce intent

State that you are setting up an isolated workspace with git worktrees.

2. Inspect existing conventions

Follow this priority order:

  • Prefer an existing .worktrees/ directory.
  • Otherwise prefer an existing worktrees/ directory.
  • Otherwise check repository guidance such as CLAUDE.md, AGENTS.md, or README.md for a preferred location.
  • Ask the user only if the location is still ambiguous.

3. Verify safety for project-local directories

For .worktrees/ or worktrees/, verify the directory is ignored before creating anything.

  • Use git check-ignore instead of guessing.
  • If the directory is not ignored, add an appropriate ignore rule before creating the worktree.
  • If adding the ignore rule would create a visible repository change, call that out before committing it.

4. Create the worktree

Choose a path under the selected location and create the worktree on a branch that matches the task.

  • Use git worktree add <path> -b <branch> when creating a new branch.
  • If the branch already exists, create the worktree without -b.
  • Change into the new worktree before running setup commands.

5. Prepare the project

Auto-detect the project tooling from files in the worktree.

  • Install dependencies only when the repo uses a package manager that requires it.
  • Run lightweight setup commands that establish a clean baseline.
  • Avoid hardcoding package managers or shells when the repo indicates something else.
  • Common signals: package.json or a Node lockfile (npm/yarn/pnpm install), Cargo.toml (cargo build), pyproject.toml or requirements.txt (pip/poetry install), go.mod (go mod download).
  • Use the repository's existing scripts when available instead of inventing your own.

6. Verify the baseline

If the project has tests or an obvious smoke-check, run the appropriate baseline check before implementation.

  • If checks fail, stop and ask whether to proceed with a dirty baseline.
  • If checks pass, report the workspace as ready.

7. Report outcome

Worktree ready at <full-path>
Tests passing (<N> tests, 0 failures)
Ready to implement <feature-name>

Quick Reference

SituationAction
.worktrees/ existsUse it after verifying it is ignored
worktrees/ existsUse it after verifying it is ignored
No existing locationCheck repo docs, then ask only if still ambiguous
Directory not ignoredAdd ignore rule before creating the worktree
Tests fail during baselineReport failures + ask
No obvious setup filesSkip dependency installation

Common Mistakes

Skipping ignore verification

  • Problem: Worktree contents get tracked, pollute git status
  • Fix: Always use git check-ignore before creating a project-local worktree

Assuming directory location

  • Problem: Creates inconsistency, violates project conventions
  • Fix: Follow priority: existing directory > repo guidance > ask

Proceeding with failing tests

  • Problem: Can't distinguish new bugs from pre-existing issues
  • Fix: Report failures, get explicit permission to proceed

Hardcoding setup commands

  • Problem: Breaks on projects using different tools
  • Fix: Auto-detect from project files and existing scripts

Assuming a POSIX shell

  • Problem: Commands fail in PowerShell or other environments
  • Fix: Use the active shell, and consult references/powershell.md or references/posix.md for shell-specific examples

Example Workflow

You: I'm using the use-git-worktrees skill to set up an isolated workspace.

[Check .worktrees/ - exists]
[Verify ignored - git check-ignore confirms .worktrees/ is ignored]
[Create worktree: git worktree add .worktrees/auth -b feature/auth]
[Run project setup]
[Run baseline checks - passing]

Worktree ready at <full-path>
Tests passing (<N> tests, 0 failures)
Ready to implement auth feature

Red Flags

Never:

  • Create a worktree without verifying it is ignored when using a project-local directory
  • Skip baseline verification when the repo has tests or a smoke-check
  • Proceed with failing baseline checks without asking
  • Assume directory location when it is ambiguous
  • Assume shell-specific commands will work everywhere

Always:

  • Follow directory priority: existing directory > repo guidance > ask
  • Verify directory is ignored for project-local locations
  • Auto-detect and run project setup
  • Verify a clean baseline before implementation

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.