Skillquality 0.47

fast-worktree-reuse-with-head-pointer-checks

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

Price
free
Protocol
skill
Verified
no

What it does

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.

Capabilities

skillsource-ychampionskill-fast-worktree-reuse-with-head-pointer-checkstopic-agent-skillstopic-ai-agentstopic-clitopic-coding-agentstopic-context-engineeringtopic-developer-toolstopic-mcptopic-multi-agenttopic-terminal-ui

Install

Quality

0.47/ 1.00

deterministic score 0.47 from registry signals: · indexed on github topic:agent-skills · 34 github stars · SKILL.md body (1,991 chars)

Provenance

Indexed fromgithub
Enriched2026-04-22 06:56:48Z · deterministic:skill-github:v1 · v1
First seen2026-04-18
Last seen2026-04-22

Agent access