{"id":"5ec8b66c-a952-49eb-857d-d7b48e1a5d68","shortId":"jTBX9E","kind":"skill","title":"memoized-command-source-aggregation","tagline":"Load independent command sources in parallel, then memoize the merged registry by cwd so repeated lookups stay cheap and ordered.","description":"# SKILL: Memoized Command Source Aggregation\n**Domain:** command-architecture\n**Trigger:** Use when a command or skill registry must combine several expensive sources, but repeated lookups from the same workspace should reuse one stable merged result.\n**Source Pattern:** Distilled from reviewed command-surface, skill-discovery, and CLI capability implementations.\n\n## Core Method\nWrap the expensive registry assembly behind a memoized async function keyed by the scope that changes the result, such as `cwd`. Inside that loader, start every independent source fetch at once with promise all so disk scans, plugin discovery, and optional workflow imports overlap instead of serializing. After all sources resolve, merge them in one explicit precedence order rather than in completion order. This keeps first-load latency down while making every later lookup for the same scope a cheap cache hit with deterministic command ordering.\n\n## Key Rules\n- Memoize the fully merged registry by the narrowest scope key that actually changes the command surface, such as project root or `cwd`.\n- Use promise all only for independent sources; keep source-local fallback or error handling inside each loader so one slow or broken branch does not dictate the aggregation structure.\n- Build the final array in a hard-coded precedence order after all promises resolve; never let race timing decide which source comes first.\n- Keep synchronous sources and built-ins in the same final merge so cached callers receive the complete command surface from one lookup.\n\n## Example Application\nIf an agentic IDE must expose commands from local extensions, workspace automations, and remote plugins, create a memoized load all commands workspace root function that fans out those three loaders in parallel, then returns them in the product's chosen precedence order followed by built-ins. Every later command palette lookup for that workspace can reuse the cached merged list instead of rescanning the filesystem and plugin graph.\n\n## Anti-Patterns (What NOT to do)\n- Do not await each command source sequentially when the loaders are independent; that turns startup into serialized I/O.\n- Do not rebuild the merged registry on every command lookup when the workspace scope has not changed.\n- Do not concatenate sources in the order their promises finish, because nondeterministic precedence produces unstable command resolution.","tags":["memoized","command","source","aggregation","cskill","agents","ychampion","agent-skills","ai-agents","cli","coding-agents","context-engineering"],"capabilities":["skill","source-ychampion","skill-memoized-command-source-aggregation","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/memoized-command-source-aggregation","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,404 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:50.907Z","embedding":null,"createdAt":"2026-04-18T22:20:42.652Z","updatedAt":"2026-04-22T06:56:50.907Z","lastSeenAt":"2026-04-22T06:56:50.907Z","tsv":"'actual':178 'agent':270 'aggreg':5,30,217 'anti':338 'anti-pattern':337 'applic':267 'architectur':34 'array':222 'assembl':82 'async':86 'autom':279 'await':346 'behind':83 'branch':212 'broken':211 'build':219 'built':248,313 'built-in':247,312 'cach':159,256,326 'caller':257 'capabl':74 'chang':93,179,378 'cheap':23,158 'chosen':307 'cli':73 'code':227 'combin':44 'come':241 'command':3,8,28,33,39,67,163,181,261,274,288,317,348,370,394 'command-architectur':32 'command-surfac':66 'complet':139,260 'concaten':381 'core':76 'creat':283 'cwd':18,98,188 'decid':238 'determinist':162 'dictat':215 'discoveri':71,116 'disk':113 'distil':63 'domain':31 'error':202 'everi':103,150,315,369 'exampl':266 'expens':46,80 'explicit':133 'expos':273 'extens':277 'fallback':200 'fan':293 'fetch':106 'filesystem':333 'final':221,253 'finish':388 'first':144,242 'first-load':143 'follow':310 'fulli':169 'function':87,291 'graph':336 'handl':203 'hard':226 'hard-cod':225 'hit':160 'i/o':361 'ide':271 'implement':75 'import':120 'in':249,314 'independ':7,104,194,355 'insid':99,204 'instead':122,329 'keep':142,196,243 'key':88,165,176 'latenc':146 'later':151,316 'let':235 'list':328 'load':6,145,286 'loader':101,206,297,353 'local':199,276 'lookup':21,50,152,265,319,371 'make':149 'memoiz':2,13,27,85,167,285 'memoized-command-source-aggreg':1 'merg':15,59,129,170,254,327,366 'method':77 'must':43,272 'narrowest':174 'never':234 'nondeterminist':390 'one':57,132,208,264 'option':118 'order':25,135,140,164,229,309,385 'overlap':121 'palett':318 'parallel':11,299 'pattern':62,339 'plugin':115,282,335 'preced':134,228,308,391 'produc':392 'product':305 'project':185 'promis':110,190,232,387 'race':236 'rather':136 'rebuild':364 'receiv':258 'registri':16,42,81,171,367 'remot':281 'repeat':20,49 'rescan':331 'resolut':395 'resolv':128,233 'result':60,95 'return':301 'reus':56,324 'review':65 'root':186,290 'rule':166 'scan':114 'scope':91,156,175,375 'sequenti':350 'serial':124,360 'sever':45 'skill':26,41,70 'skill-discoveri':69 'skill-memoized-command-source-aggregation' 'slow':209 'sourc':4,9,29,47,61,105,127,195,198,240,245,349,382 'source-loc':197 'source-ychampion' 'stabl':58 'start':102 'startup':358 'stay':22 'structur':218 'surfac':68,182,262 'synchron':244 'three':296 'time':237 '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' 'trigger':35 'turn':357 'unstabl':393 'use':36,189 'workflow':119 'workspac':54,278,289,322,374 'wrap':78","prices":[{"id":"485f2b46-ff21-401b-8ac5-7ac0a68fbf5d","listingId":"5ec8b66c-a952-49eb-857d-d7b48e1a5d68","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:42.652Z"}],"sources":[{"listingId":"5ec8b66c-a952-49eb-857d-d7b48e1a5d68","source":"github","sourceId":"ychampion/cskill-agents/memoized-command-source-aggregation","sourceUrl":"https://github.com/ychampion/cskill-agents/tree/main/skills/memoized-command-source-aggregation","isPrimary":false,"firstSeenAt":"2026-04-18T22:20:42.652Z","lastSeenAt":"2026-04-22T06:56:50.907Z"}],"details":{"listingId":"5ec8b66c-a952-49eb-857d-d7b48e1a5d68","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"ychampion","slug":"memoized-command-source-aggregation","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":"7b64754289928755bc39d3ed57162e01edf7603b","skill_md_path":"skills/memoized-command-source-aggregation/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/ychampion/cskill-agents/tree/main/skills/memoized-command-source-aggregation"},"layout":"multi","source":"github","category":"cskill-agents","frontmatter":{"name":"memoized-command-source-aggregation","description":"Load independent command sources in parallel, then memoize the merged registry by cwd so repeated lookups stay cheap and ordered."},"skills_sh_url":"https://skills.sh/ychampion/cskill-agents/memoized-command-source-aggregation"},"updatedAt":"2026-04-22T06:56:50.907Z"}}