{"id":"7c9b9b4b-acfb-45a7-b59e-5aab589c0a84","shortId":"beBASN","kind":"skill","title":"fast-worktree-reuse-with-head-pointer-checks","tagline":"Resume existing worktrees quickly by checking stored HEAD pointers before fetching or recreating.","description":"# SKILL: Fast Worktree Reuse With Head Pointer Checks\n**Domain:** git-worktree\n**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.\n**Source Pattern:** Distilled from reviewed permission, shell-safety, and worktree-management implementations.\n\n## Core Method\nBefore 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.\n\n## Key Rules\n- 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.\n- When the fast-path finds a head, skip `mkdir`, `fetch`, and hook execution to minimize CLIs waiting on network calls.\n- Only run the fetch/add sequence when the head pointer is absent, ensuring deterministic worktree creation timing.\n- Capture the computed worktree branch, head commit, and `existed` flag so calling code can log a clear message.\n\n## Example Application\nFor 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.\n\n## Anti-Patterns (What NOT to do)\n- Don’t always fetch/padded-add even when the directory already exists; that doubles command latency and can fail if credentials are missing.\n- Avoid relying on `git worktree list` parsing alone—direct HEAD reading is cheaper and doesn’t require running git.\n- Don’t ignore the `existed` boolean; downstream message/choices should reflect whether the worktree was reused or freshly created.","tags":["fast","worktree","reuse","with","head","pointer","checks","cskill","agents","ychampion","agent-skills","ai-agents"],"capabilities":["skill","source-ychampion","skill-fast-worktree-reuse-with-head-pointer-checks","topic-agent-skills","topic-ai-agents","topic-cli","topic-coding-agents","topic-context-engineering","topic-developer-tools","topic-mcp","topic-multi-agent","topic-terminal-ui"],"categories":["cskill-agents"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/ychampion/cskill-agents/fast-worktree-reuse-with-head-pointer-checks","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add ychampion/cskill-agents","source_repo":"https://github.com/ychampion/cskill-agents","install_from":"skills.sh"}},"qualityScore":"0.467","qualityRationale":"deterministic score 0.47 from registry signals: · indexed on github topic:agent-skills · 34 github stars · SKILL.md body (1,991 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-04-22T06:56:48.848Z","embedding":null,"createdAt":"2026-04-18T22:20:23.332Z","updatedAt":"2026-04-22T06:56:48.848Z","lastSeenAt":"2026-04-22T06:56:48.848Z","tsv":"'absent':204 'add':57,85,137 'alon':310 'alreadi':62,111,171,290 'alway':284 'anti':276 'anti-pattern':275 'appli':35 'applic':229 'ask':39 'avoid':51,303 'boolean':327 'branch':214 'call':58,193,221,235 'captur':210 'cheaper':315 'check':8,14,29 'claud':148 'clear':226 'cli':121 'clis':189 'code':222 'command':234,294 'commit':216 'comput':86,212 'contain':104 'core':78 'corrupt':144 'creat':112,339 'creation':208 'credenti':300 'data':259 'deriv':241 'determinist':206 'direct':96,311 'directori':140,289 'distil':66 'doesn':317 'domain':30 'doubl':293 'downstream':328 'ensur':205 'enter':41 'even':286 'exampl':228 'execut':186 'exist':10,63,102,172,218,291,326 'extern':272 'fail':298 'fast':2,23,164,176,250 'fast-path':163,175,249 'fast-worktree-reuse-with-head-pointer-check':1 'fetch':19,54,117,133,183,256 'fetch/add':160,197 'fetch/padded-add':285 'file':101,128 'find':178 'finish':265 'flag':219 'fresh':338 'git':32,53,55,83,93,135,159,255,306,321 'git-worktre':31 'head':6,16,27,94,127,151,155,180,201,215,247,258,312 'head-read':246 'hook':185 'ignor':324 'immedi':123 'implement':77 'instant':167 'invok':244 'key':145 'know':138 'latenc':295 'let':119 'list':308 'log':224 'manag':76 'messag':227 'message/choices':329 'method':79 'minim':188 'miss':130,142,261,302 'mkdir':182 'name':45 'network':192,273 'pars':309 'path':89,165,177,251 'path/branch':115 'pattern':65,277 'permiss':69 'pointer':7,17,28,95,202 'proceed':122 'quick':12 'reach':81 'read':91,147,153,248,313 'recreat':21 'redund':52 'reflect':331 'regardless':270 'reli':304 'requir':319 'resum':9,43,233,264 'return':113,166 'reus':4,25,336 'review':68 'rule':146 'run':195,254,320 'safeti':72 'sequenc':198 'sha':106,156 'shell':71 'shell-safeti':70 'skill':22,237 'skill-fast-worktree-reuse-with-head-pointer-checks' 'skip':116,181 'slug':150,243 'sourc':64 'source-ychampion' 'speed':274 'store':15 'subprocess':98 'tick':269 'time':209,239 'topic-agent-skills' 'topic-ai-agents' 'topic-cli' 'topic-coding-agents' 'topic-context-engineering' 'topic-developer-tools' 'topic-mcp' 'topic-multi-agent' 'topic-terminal-ui' 'treat':107 'trigger':34 'user':38 'wait':190 'want':49 'whether':332 'worktre':3,11,24,33,46,56,61,75,84,88,109,136,149,154,170,207,213,232,307,334 'worktree-manag':74","prices":[{"id":"03c0224f-4511-4f2a-8a83-e0e6cce6be3a","listingId":"7c9b9b4b-acfb-45a7-b59e-5aab589c0a84","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"ychampion","category":"cskill-agents","install_from":"skills.sh"},"createdAt":"2026-04-18T22:20:23.332Z"}],"sources":[{"listingId":"7c9b9b4b-acfb-45a7-b59e-5aab589c0a84","source":"github","sourceId":"ychampion/cskill-agents/fast-worktree-reuse-with-head-pointer-checks","sourceUrl":"https://github.com/ychampion/cskill-agents/tree/main/skills/fast-worktree-reuse-with-head-pointer-checks","isPrimary":false,"firstSeenAt":"2026-04-18T22:20:23.332Z","lastSeenAt":"2026-04-22T06:56:48.848Z"}],"details":{"listingId":"7c9b9b4b-acfb-45a7-b59e-5aab589c0a84","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"ychampion","slug":"fast-worktree-reuse-with-head-pointer-checks","github":{"repo":"ychampion/cskill-agents","stars":34,"topics":["agent-skills","ai-agents","cli","coding-agents","context-engineering","developer-tools","mcp","multi-agent","terminal-ui"],"license":"mit","html_url":"https://github.com/ychampion/cskill-agents","pushed_at":"2026-04-04T14:13:23Z","description":"Agent skills for coding CLIs, multi-agent runtimes, context engines, MCP extensions, and terminal tooling. Instead of using claude code's source code, give your agent skills to create your own!","skill_md_sha":"1b641ac5e27f56e69005dc27f7156559df1a2f91","skill_md_path":"skills/fast-worktree-reuse-with-head-pointer-checks/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/ychampion/cskill-agents/tree/main/skills/fast-worktree-reuse-with-head-pointer-checks"},"layout":"multi","source":"github","category":"cskill-agents","frontmatter":{"name":"fast-worktree-reuse-with-head-pointer-checks","description":"Resume existing worktrees quickly by checking stored HEAD pointers before fetching or recreating."},"skills_sh_url":"https://skills.sh/ychampion/cskill-agents/fast-worktree-reuse-with-head-pointer-checks"},"updatedAt":"2026-04-22T06:56:48.848Z"}}