{"id":"d37a55de-6e25-4e70-81ad-67bb1f63e0e0","shortId":"ZG77ce","kind":"skill","title":"empty-repo-bundle-preflight","tagline":"Fail fast when the repository has no refs so downstream bundling never triggers empty Git bundles.","description":"# SKILL: Empty Repo Bundle Preflight\n**Domain:** safety-worktrees  \n**Trigger:** Apply before running `git bundle create` to ensure the repository actually has refs, avoiding the 128 exit code and providing a clearer error path.\n**Source Pattern:** Distilled from reviewed repo-safety, packaging, and worktree-management patterns.\n\n## Core Method\nRun `git for-each-ref --count=1 refs/` from the repository root; if the output is empty, report that the repo has no commits, record an analytics metric with the `empty_repo` outcome, and abort with a helpful message instead of invoking `git bundle create`, which would exit 128 on an empty repo. Sweep stale temporary refs first so the check reflects the true repo state, and treat the empty case as a known failure reason with a dedicated fail reason identifier that consumers can react to.\n\n## Key Rules\n- Always clean up `refs/seed/stash` and `refs/seed/root` before testing for refs so old placeholders cannot make an empty repo appear populated.\n- Capture the `empty_repo` outcome via analytics or logs so you can audit why bundling never ran.\n- Return a structured error with a fail reason (`empty_repo`) so callers can distinguish it from git failures or oversized bundles.\n- When the repo has refs, proceed to bundle creation without repeating the check unnecessarily.\n\n## Example Application\nWhen building a git bundle upload helper, call this skill before `_bundleWithFallback`; if it signals an empty repo, stop and surface “Repository has no commits yet” to the UI and telemetry instead of letting `git bundle create` crash.\n\n## Anti-Patterns (What NOT to do)\n- Do not rely on the git bundle exit code alone to detect emptiness; it produces a cryptic message and leaves temporary files behind.\n- Do not skip the cleanup step—stale refs from prior runs can mask an empty repo and let you bundle garbage.\n- Do not proceed to bundle creation when the guard reports no refs; the upload would stall and return a generic failure reason.","tags":["empty","repo","bundle","preflight","cskill","agents","ychampion","agent-skills","ai-agents","cli","coding-agents","context-engineering"],"capabilities":["skill","source-ychampion","skill-empty-repo-bundle-preflight","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/empty-repo-bundle-preflight","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,990 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.474Z","embedding":null,"createdAt":"2026-04-18T22:20:19.507Z","updatedAt":"2026-04-22T06:56:48.474Z","lastSeenAt":"2026-04-22T06:56:48.474Z","tsv":"'1':79 '128':47,121 'abort':107 'actual':42 'alon':290 'alway':162 'analyt':99,188 'anti':275 'anti-pattern':274 'appear':180 'appli':32 'applic':235 'audit':194 'avoid':45 'behind':303 'build':237 'bundl':4,16,21,25,36,116,196,219,227,240,271,287,323,329 'bundlewithfallback':247 'call':243 'caller':210 'cannot':175 'captur':182 'case':143 'check':133,232 'clean':163 'cleanup':308 'clearer':53 'code':49,289 'commit':96,260 'consum':156 'core':70 'count':78 'crash':273 'creat':37,117,272 'creation':228,330 'cryptic':297 'dedic':151 'detect':292 'distil':58 'distinguish':212 'domain':27 'downstream':15 'empti':2,19,23,89,103,124,142,178,184,207,252,293,318 'empty-repo-bundle-preflight':1 'ensur':39 'error':54,202 'exampl':234 'exit':48,120,288 'fail':6,152,205 'failur':147,216,345 'fast':7 'file':302 'first':130 'for-each-ref':74 'garbag':324 'generic':344 'git':20,35,73,115,215,239,270,286 'guard':333 'help':110 'helper':242 'identifi':154 'instead':112,267 'invok':114 'key':160 'known':146 'leav':300 'let':269,321 'log':190 'make':176 'manag':68 'mask':316 'messag':111,298 'method':71 'metric':100 'never':17,197 'old':173 'outcom':105,186 'output':87 'overs':218 'packag':64 'path':55 'pattern':57,69,276 'placehold':174 'popul':181 'preflight':5,26 'prior':313 'proceed':225,327 'produc':295 'provid':51 'ran':198 'react':158 'reason':148,153,206,346 'record':97 'ref':13,44,77,80,129,171,224,311,336 'reflect':134 'refs/seed/root':167 'refs/seed/stash':165 'reli':283 'repeat':230 'repo':3,24,62,93,104,125,137,179,185,208,222,253,319 'repo-safeti':61 'report':90,334 'repositori':10,41,83,257 'return':199,342 'review':60 'root':84 'rule':161 'run':34,72,314 'safeti':29,63 'safety-worktre':28 'signal':250 'skill':22,245 'skill-empty-repo-bundle-preflight' 'skip':306 'sourc':56 'source-ychampion' 'stale':127,310 'stall':340 'state':138 'step':309 'stop':254 'structur':201 'surfac':256 'sweep':126 'telemetri':266 'temporari':128,301 'test':169 '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':140 'trigger':18,31 'true':136 'ui':264 'unnecessarili':233 'upload':241,338 'via':187 'without':229 'worktre':30,67 'worktree-manag':66 'would':119,339 'yet':261","prices":[{"id":"3649c684-7968-41ed-97bc-4b91481987bb","listingId":"d37a55de-6e25-4e70-81ad-67bb1f63e0e0","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:19.507Z"}],"sources":[{"listingId":"d37a55de-6e25-4e70-81ad-67bb1f63e0e0","source":"github","sourceId":"ychampion/cskill-agents/empty-repo-bundle-preflight","sourceUrl":"https://github.com/ychampion/cskill-agents/tree/main/skills/empty-repo-bundle-preflight","isPrimary":false,"firstSeenAt":"2026-04-18T22:20:19.507Z","lastSeenAt":"2026-04-22T06:56:48.474Z"}],"details":{"listingId":"d37a55de-6e25-4e70-81ad-67bb1f63e0e0","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"ychampion","slug":"empty-repo-bundle-preflight","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":"c560df967f8233490686bac2609d48527e5c6674","skill_md_path":"skills/empty-repo-bundle-preflight/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/ychampion/cskill-agents/tree/main/skills/empty-repo-bundle-preflight"},"layout":"multi","source":"github","category":"cskill-agents","frontmatter":{"name":"empty-repo-bundle-preflight","description":"Fail fast when the repository has no refs so downstream bundling never triggers empty Git bundles."},"skills_sh_url":"https://skills.sh/ychampion/cskill-agents/empty-repo-bundle-preflight"},"updatedAt":"2026-04-22T06:56:48.474Z"}}