agentleFS
SantiagoVqzSantiagoVqz/claude-skills/skills/main-flow/worktree/SKILL.md

worktree

Skill2 starsChanged 2 months agoMITView on GitHub

Put code work in its own provisioned linked worktree: find the worktree that holds the branch or create one, run scripts/provision.sh, and share or fork the database from the spec's Schema changes line. Use before /implement or /dispatch writes code, and before you add a migration in a worktree that shares the database.

  • Reads credentials

40 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use coverage, backlog and 6 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.
  • 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

  • vertz-devSkill

    backlog

    Manages deferred/blocked work items as GitHub Issues with labels and blocker tracking

    Also in 3 projects that use this

  • johnlindquistSkill

    diagram

    Maintain and synchronize Unified Impact Diagrams following Diagram Driven Development (DDD) methodology. Create, update, and manage diagrams that connect user value to technical implementation.

    Also in 4 projects that use this

  • SentrySkill

    e2e

    Run E2E tests for Sentry JavaScript SDK test applications

    Also in 3 projects that use this

  • MongoDBSkill

    jira

    Use this skill for any Jira operation in the DOCSP project — creating, viewing, searching, updating, transitioning, commenting on, or linking tickets. Also handles follow-up ticket creation to manage scope creep. TRIGGER when: user mentions a DOCSP-XXXXX ticket number or any Jira ticket URL; user asks to view, open, check, update, transition, close, comment on, link, or search tickets; user references \"the ticket\", \"the Jira\", or \"open a ticket\". SKIP: GitHub issues; non-Jira platforms; questions unrelated to ticket operations.

    Also in 3 projects that use this

  • Microsoft AzureSkill

    validate

    Run the full CI validation workflow locally before submitting a PR. Use this as a final check to ensure all Azure DevOps CI pipeline steps will pass.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

3 rules. 0 are common, 2 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 35 edited versions we read keep these.

  • 2

    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:

    Read git worktree list --porcelain and where you stand.

    line 22
  2. Very specific:

    No script, and the repo has gitignored .env* files, a dependency lockfile, or a database URL in an env file: say Run /setup-worktrees and …

    line 36
  3. Distinctive:

    No script, and the repo has none of those: nothing to provision.

    line 38

“Common” is measured: kept by at least 6 in 10 of the 35 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 spec, one provisioned checkout

Code work runs in a linked worktree. One worktree holds one spec. The primary checkout stays free for planning and for changes to docs only.

This skill keys on git facts only. A worktree made by Herdr, by git worktree add, or by this skill resolves the same way.

Vocabulary

  • Primary: the checkout whose git dir is the common dir. git rev-parse --absolute-git-dir equals git rev-parse --path-format=absolute --git-common-dir.
  • Linked worktree: any other checkout of the same repo, wherever it lives.
  • Trunk: the branch the repo merges into (develop on a git-flow repo, main otherwise); same rule as /cleanup.
  • Branch: the spec branch, <type>/<spec-number>-<spec-slug> off the trunk. A ticket with no parent spec gets <type>/<ticket-number>-<slug>. A branch that already exists keeps its name.

1. Locate

Read git worktree list --porcelain and where you stand. Take the one matching case:

  • In a linked worktree whose branch is the target, or carries the spec or ticket number: stay. A hand-made worktree keeps its branch name; that name is the branch from here on.
  • In a linked worktree on any other branch: stop and say so. That worktree belongs to other work.
  • In the primary, and a worktree holds the branch: EnterWorktree on its path.
  • In the primary, and nothing holds the branch: git worktree add -b <branch> .claude/worktrees/<slug> <trunk>, without -b when the branch exists, then EnterWorktree on it. Always use plain git here, never a terminal tool such as Herdr: the tool opens the worktree in a new pane, and this conversation stays in the primary's pane.
  • In the primary, and the primary itself has the branch checked out: stop and say so. A branch is checked out in one place only.

Completion: the session stands in a linked worktree that has the branch checked out.

2. Provision

scripts/provision.sh exists: run it. It is idempotent, so a provisioned worktree costs one no-op run. Red: report the tail and stop. Nothing works in a worktree that failed to provision.

No script, and the repo has gitignored .env* files, a dependency lockfile, or a database URL in an env file: say Run /setup-worktrees and stop.

No script, and the repo has none of those: nothing to provision. Skip step 3.

Completion: the script ran green, or the repo needs no provisioning.

3. Database

The tail of the script has no db line: the repo has no database. Skip this step.

Find the Schema changes: line. It is in the Implementation Decisions of the spec. A ticket with no parent spec carries its own line. With no spec and no ticket, ask the human once: does this work change the schema?

  • The line lists migrations: run scripts/provision.sh db fork.
  • The line says none: keep the shared database.
  • There is no line, or no answer: run scripts/provision.sh db fork. This is the safe default.

Completion: the db line in the tail agrees with the rule. A fork shows <db>_<branch>; a share shows (shared).

While you work

The shared database is the primary's. A migration applied to it changes the schema under the primary and every other worktree. Before you create a migration in a worktree whose db line shows (shared), run scripts/provision.sh db fork. The database URL changes, so restart the dev servers that run from this worktree.

Report

<path> · <branch> · found | created · provisioned | nothing to provision · db shared | forked <name> | none

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.