ychampion/cskill-agents/fast-worktree-reuse-with-head-pointer-checks

Claude Code and agent skill by ychampion/cskill-agents

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

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

Install

npx vskill@latest install ychampion/cskill-agents/fast-worktree-reuse-with-head-pointer-checks

SKILL.md

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.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
36
Repository forks
7
7-day trend score
18

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/ychampion/cskill-agents/fast-worktree-reuse-with-head-pointer-checks/badge)](https://verified-skill.com/skills/ychampion/cskill-agents/fast-worktree-reuse-with-head-pointer-checks)

Something wrong with this skill or its page? Tell us.