{"id":"9562a71d-0cd9-4cc4-a77b-7c61ca4f5d47","shortId":"2XG7gg","kind":"skill","title":"empty-trigger-short-circuit-before-app-state","tagline":"Skip nested memory collection when no triggers exist so render-bound `getAppState()` is never invoked unnecessarily.","description":"# SKILL: Empty Trigger Short-Circuit Before App State\n**Domain:** context-management  \n**Trigger:** Use when nested memory attachment triggers may be empty and you want to avoid React render-cycle work unless there is actual work to do.\n**Source Pattern:** Distilled from reviewed context, compaction, and memory-governance patterns.\n\n## Core Method\nBefore calling expensive or render-bound helpers, check the cheap trigger state. If `nestedMemoryAttachmentTriggers` is missing or empty, return immediately so that the expensive `getAppState()` call does not fire on every turn. Only when work exists do you fetch the React-bound state and iterate over the trigger set, ensuring each attachment run still has access to the required context but only when needed.\n\n## Key Rules\n- Check `nestedMemoryAttachmentTriggers` for truthiness and non-zero size before doing anything else.\n- Keep the early exit path separate from the work path so future readers recognize the guard without parsing the loop logic.\n- Only call `getAppState()` or other render-dependent helpers after you confirm there are triggers to process.\n- Treat the guard as part of the method contract; stateful or async helpers should not run unless this simple check passed.\n\n## Example Application\nIn a turn that has no nested memory triggers, return `[]` right away so `getAppState()` is never invoked; when triggers exist, call `getAppState()`, collect each nested attachment, and clear the set afterward as usual.\n\n## Anti-Patterns (What NOT to do)\n- Do not fetch the React `appState` before validating that the trigger set requires it.\n- Do not assume the triggers will always be non-empty and let React-dependent helpers run every turn.","tags":["empty","trigger","short","circuit","before","app","state","cskill","agents","ychampion","agent-skills","ai-agents"],"capabilities":["skill","source-ychampion","skill-empty-trigger-short-circuit-before-app-state","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-trigger-short-circuit-before-app-state","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,705 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.562Z","embedding":null,"createdAt":"2026-04-18T22:20:20.243Z","updatedAt":"2026-04-22T06:56:48.562Z","lastSeenAt":"2026-04-22T06:56:48.562Z","tsv":"'access':137 'actual':62 'afterward':252 'alway':282 'anti':256 'anti-pattern':255 'anyth':159 'app':7,33 'applic':221 'appstat':267 'assum':278 'async':210 'attach':44,133,247 'avoid':53 'away':233 'bound':20,86,123 'call':81,106,183,242 'cheap':90 'check':88,148,218 'circuit':5,31 'clear':249 'collect':12,244 'compact':72 'confirm':193 'context':37,71,141 'context-manag':36 'contract':207 'core':78 'cycl':57 'depend':189,291 'distil':68 'domain':35 'earli':163 'els':160 'empti':2,27,48,98,286 'empty-trigger-short-circuit-before-app-st':1 'ensur':131 'everi':111,294 'exampl':220 'exist':16,116,241 'exit':164 'expens':82,104 'fetch':119,264 'fire':109 'futur':172 'getappst':21,105,184,235,243 'govern':76 'guard':176,201 'helper':87,190,211,292 'immedi':100 'invok':24,238 'iter':126 'keep':161 'key':146 'let':288 'logic':181 'loop':180 'manag':38 'may':46 'memori':11,43,75,229 'memory-govern':74 'method':79,206 'miss':96 'need':145 'nest':10,42,228,246 'nestedmemoryattachmenttrigg':94,149 'never':23,237 'non':154,285 'non-empti':284 'non-zero':153 'pars':178 'part':203 'pass':219 'path':165,170 'pattern':67,77,257 'process':198 'react':54,122,266,290 'react-bound':121 'react-depend':289 'reader':173 'recogn':174 'render':19,56,85,188 'render-bound':18,84 'render-cycl':55 'render-depend':187 'requir':140,274 'return':99,231 'review':70 'right':232 'rule':147 'run':134,214,293 'separ':166 'set':130,251,273 'short':4,30 'short-circuit':29 'simpl':217 'size':156 'skill':26 'skill-empty-trigger-short-circuit-before-app-state' 'skip':9 'sourc':66 'source-ychampion' 'state':8,34,92,124,208 'still':135 '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':199 'trigger':3,15,28,39,45,91,129,196,230,240,272,280 'truthi':151 'turn':112,224,295 'unless':59,215 'unnecessarili':25 'use':40 'usual':254 'valid':269 'want':51 'without':177 'work':58,63,115,169 'zero':155","prices":[{"id":"7610080b-a17c-4bda-ba8a-1214d766d242","listingId":"9562a71d-0cd9-4cc4-a77b-7c61ca4f5d47","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:20.243Z"}],"sources":[{"listingId":"9562a71d-0cd9-4cc4-a77b-7c61ca4f5d47","source":"github","sourceId":"ychampion/cskill-agents/empty-trigger-short-circuit-before-app-state","sourceUrl":"https://github.com/ychampion/cskill-agents/tree/main/skills/empty-trigger-short-circuit-before-app-state","isPrimary":false,"firstSeenAt":"2026-04-18T22:20:20.243Z","lastSeenAt":"2026-04-22T06:56:48.562Z"}],"details":{"listingId":"9562a71d-0cd9-4cc4-a77b-7c61ca4f5d47","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"ychampion","slug":"empty-trigger-short-circuit-before-app-state","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":"dfd89c3f5ab9259624d69a157991d3896c9d206b","skill_md_path":"skills/empty-trigger-short-circuit-before-app-state/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/ychampion/cskill-agents/tree/main/skills/empty-trigger-short-circuit-before-app-state"},"layout":"multi","source":"github","category":"cskill-agents","frontmatter":{"name":"empty-trigger-short-circuit-before-app-state","description":"Skip nested memory collection when no triggers exist so render-bound `getAppState()` is never invoked unnecessarily."},"skills_sh_url":"https://skills.sh/ychampion/cskill-agents/empty-trigger-short-circuit-before-app-state"},"updatedAt":"2026-04-22T06:56:48.562Z"}}