agentsclimarketplace

Fast worktree reuse with head pointer checks

Skill vishuwa2004/cskill-agents/skills/fast-worktree-reuse-with-head-pointer-checks

Build curated agent skills for coding CLIs, terminal tools, context engines, remote bridges, and multi-agent runtimes

Install
npx -y skills add vishuwa2004/cskill-agents --skill fast-worktree-reuse-with-head-pointer-checks

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Resume existing worktrees quickly by checking stored HEAD pointers before fetching or recreating.

SKILL.md

2.2 KB, 429 tokens by cl100k_base, as published. Nobody here has run it

SKILL: Fast Worktree Reuse With Head Pointer Checks

Domain: git-worktree Trigger: Apply when the user asks to enter or resume a named worktree and you want to avoid redundant git fetch/git worktree add calls if the worktree already exists. Source Pattern: Distilled from reviewed permission, shell-safety, and worktree-management implementations.

Core Method

Before reaching for git worktree add, compute the worktree path and read its git head pointer directly (no subprocess). If the file exists and contains a SHA, treat the worktree as already created: return the path/branch, skip fetch, and let the CLI proceed immediately. Only when the HEAD file is missing do you fetch and git worktree add, knowing the directory is missing or corrupted.

Key Rules

  • Read claude worktrees <slug head with read worktree head sha before any git fetch/add so the fast-path returns instantly when the worktree already exists.
  • When the fast-path finds a head, skip mkdir, fetch, and hook execution to minimize CLIs waiting on network calls.
  • Only run the fetch/add sequence when the head pointer is absent, ensuring deterministic worktree creation timing.
  • Capture the computed worktree branch, head commit, and existed flag so calling code can log a clear message.

Example Application

For a “worktree resume” command, call this skill each time by deriving the slug, invoking the head-read fast-path, and only running git fetch when head data is missing, so most resumes finish in the same tick regardless of external network speed.

Anti-Patterns (What NOT to do)

  • Don’t always fetch/padded-add even when the directory already exists; that doubles command latency and can fail if credentials are missing.
  • Avoid relying on git worktree list parsing alone—direct HEAD reading is cheaper and doesn’t require running git.
  • Don’t ignore the existed boolean; downstream message/choices should reflect whether the worktree was reused or freshly created.

Gives 0 of the 12 instructions most agent orchestration skills give in 429 tokens

Counted across 742 of the 995 authors here whose files we hold, read 2026-08-06

  • run the full test suite after integrating changesin 53 of 742, across 20 files
  • reference existing artifacts by path or URLin 52 of 742, across 22 files
  • dispatch one agent per independent problem domainin 50 of 742, across 17 files
  • verify fixes do not conflictin 45 of 742, across 13 files
  • include a suggested skills section in the documentin 45 of 742, across 15 files
  • redact sensitive informationin 41 of 742, across 11 files
  • save to the temporary directory of the operating systemin 39 of 742, across 9 files
  • tailor the document to user-provided focus argumentsin 39 of 742, across 9 files
  • spot check agent changes for systematic errorsin 34 of 742, across 7 files
  • write a handoff document summarising the current conversationin 31 of 742, across 6 files
  • assign each agent a specific scopein 23 of 742, across 8 files
  • provide specific scope and clear goalin 23 of 742, across 5 files

Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.