{"id":"582b3b7b-ce26-4ba8-9617-effbe1513d76","shortId":"SYDsD6","kind":"skill","title":"layered-command-cache-invalidation","tagline":"Clear every memoized layer in a command or skill pipeline so dynamic updates invalidate outer derived views as well as inner source caches.","description":"# SKILL: Layered Command Cache Invalidation\n**Domain:** Command Architecture  \n**Trigger:** Use when commands, skills, or search indexes are cached in layers and a refresh must make newly added or removed entries visible immediately.  \n**Source Pattern:** Distilled from reviewed command-surface, skill-discovery, and CLI capability implementations.\n\n## Core Method\nTreat cache invalidation as a stack problem, not a single-cache problem. When one memoized command view is built on top of other memoized loaders, clear the outer derived cache alongside the inner source caches in the same invalidation path. Otherwise the outer memoized function can keep returning its old result without ever touching the refreshed inner layers, so callers never observe the update.\n\n## Key Rules\n- Map the dependency order of cached views: raw sources, merged registries, derived command subsets, and any search or index layer built on top.\n- Clear every cache layer that can satisfy requests from its own memoized result; if an outer layer can return without recomputing, it must be invalidated explicitly.\n- Centralize the clears in one helper that runs whenever dynamic command or skill state changes, so mutation paths cannot forget a derived cache.\n- Keep the invalidation contract close to the layering comment or dependency declaration, because partial clears often look correct in code review while remaining behavioral no-ops.\n- Prefer one named reset entrypoint for the whole stack over scattered per-cache clears; callers should ask for a fresh command surface, not reason about cache topology.\n\n## Example Application\nAn agentic IDE may memoize the merged command registry, memoize the slash-command projection derived from that registry, and memoize a local skill-search index built on top of both. When a new skill is installed, invalidate all three layers together. Clearing only the registry caches is insufficient if the search index still serves its own cached snapshot.\n\n## Anti-Patterns (What NOT to do)\n- Do not clear only the innermost loaders and assume outer memoized views will notice; cached derived layers can bypass recomputation entirely.\n- Do not let each mutation site clear an ad hoc subset of caches; one missed caller leaves stale command surfaces in place.\n- Do not describe a partial clear as a refresh if users can still hit an old search index, command palette, or tool registry afterward.","tags":["layered","command","cache","invalidation","cskill","agents","ychampion","agent-skills","ai-agents","cli","coding-agents","context-engineering"],"capabilities":["skill","source-ychampion","skill-layered-command-cache-invalidation","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/layered-command-cache-invalidation","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 (2,412 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:49.933Z","embedding":null,"createdAt":"2026-04-18T22:20:33.385Z","updatedAt":"2026-04-22T06:56:49.933Z","lastSeenAt":"2026-04-22T06:56:49.933Z","tsv":"'ad':55,370 'afterward':407 'agent':275 'alongsid':109 'anti':335 'anti-pattern':334 'applic':273 'architectur':36 'ask':261 'assum':349 'behavior':240 'built':97,165,301 'bypass':359 'cach':4,28,32,46,79,89,108,113,150,170,216,257,270,321,332,355,374 'caller':138,259,377 'cannot':212 'capabl':74 'central':194 'chang':208 'clear':6,104,168,196,231,258,317,343,368,389 'cli':73 'close':221 'code':236 'command':3,12,31,35,40,67,94,157,204,265,281,287,380,402 'command-surfac':66 'comment':225 'contract':220 'core':76 'correct':234 'declar':228 'depend':147,227 'deriv':21,107,156,215,289,356 'describ':386 'discoveri':71 'distil':63 'domain':34 'dynam':17,203 'entir':361 'entri':58 'entrypoint':248 'ever':131 'everi':7,169 'exampl':272 'explicit':193 'forget':213 'fresh':264 'function':123 'helper':199 'hit':397 'hoc':371 'ide':276 'immedi':60 'implement':75 'index':44,163,300,327,401 'inner':26,111,135 'innermost':346 'instal':311 'insuffici':323 'invalid':5,19,33,80,117,192,219,312 'keep':125,217 'key':143 'layer':2,9,30,48,136,164,171,184,224,315,357 'layered-command-cache-invalid':1 'leav':378 'let':364 'loader':103,347 'local':296 'look':233 'make':53 'map':145 'may':277 'memoiz':8,93,102,122,179,278,283,294,351 'merg':154,280 'method':77 'miss':376 'must':52,190 'mutat':210,366 'name':246 'never':139 'new':308 'newli':54 'no-op':241 'notic':354 'observ':140 'often':232 'old':128,399 'one':92,198,245,375 'op':243 'order':148 'otherwis':119 'outer':20,106,121,183,350 'palett':403 'partial':230,388 'path':118,211 'pattern':62,336 'per':256 'per-cach':255 'pipelin':15 'place':383 'prefer':244 'problem':84,90 'project':288 'raw':152 'reason':268 'recomput':188,360 'refresh':51,134,392 'registri':155,282,292,320,406 'remain':239 'remov':57 'request':175 'reset':247 'result':129,180 'return':126,186 'review':65,237 'rule':144 'run':201 'satisfi':174 'scatter':254 'search':43,161,299,326,400 'serv':329 'singl':88 'single-cach':87 'site':367 'skill':14,29,41,70,206,298,309 'skill-discoveri':69 'skill-layered-command-cache-invalidation' 'skill-search':297 'slash':286 'slash-command':285 'snapshot':333 'sourc':27,61,112,153 'source-ychampion' 'stack':83,252 'stale':379 'state':207 'still':328,396 'subset':158,372 'surfac':68,266,381 'three':314 'togeth':316 'tool':405 'top':99,167,303 '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' 'topolog':271 'touch':132 'treat':78 'trigger':37 'updat':18,142 'use':38 'user':394 'view':22,95,151,352 'visibl':59 'well':24 'whenev':202 'whole':251 'without':130,187","prices":[{"id":"37057da1-060a-4237-8351-d07ea999896c","listingId":"582b3b7b-ce26-4ba8-9617-effbe1513d76","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:33.385Z"}],"sources":[{"listingId":"582b3b7b-ce26-4ba8-9617-effbe1513d76","source":"github","sourceId":"ychampion/cskill-agents/layered-command-cache-invalidation","sourceUrl":"https://github.com/ychampion/cskill-agents/tree/main/skills/layered-command-cache-invalidation","isPrimary":false,"firstSeenAt":"2026-04-18T22:20:33.385Z","lastSeenAt":"2026-04-22T06:56:49.933Z"}],"details":{"listingId":"582b3b7b-ce26-4ba8-9617-effbe1513d76","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"ychampion","slug":"layered-command-cache-invalidation","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":"8360ad40c4199ce7c8e4006a7549abf0a0855931","skill_md_path":"skills/layered-command-cache-invalidation/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/ychampion/cskill-agents/tree/main/skills/layered-command-cache-invalidation"},"layout":"multi","source":"github","category":"cskill-agents","frontmatter":{"name":"layered-command-cache-invalidation","description":"Clear every memoized layer in a command or skill pipeline so dynamic updates invalidate outer derived views as well as inner source caches."},"skills_sh_url":"https://skills.sh/ychampion/cskill-agents/layered-command-cache-invalidation"},"updatedAt":"2026-04-22T06:56:49.933Z"}}