agentsclimarketplace

Empty trigger short circuit before app state

Skill ychampion/cskill-agents/agents/claude-code/skills/empty-trigger-short-circuit-before-app-state

Skip nested memory collection when no triggers exist so render-bound `getAppState()` is never invoked unnecessarily.From its SKILL.md

Install
npx -y skills add ychampion/cskill-agents --skill empty-trigger-short-circuit-before-app-state

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

SKILL.md

1.9 KB, 348 tokens by cl100k_base, as published. Nobody here has run it

SKILL: Empty Trigger Short-Circuit Before App State

Domain: context-management
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. Source Pattern: Distilled from reviewed context, compaction, and memory-governance patterns.

Core Method

Before 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.

Key Rules

  • Check nestedMemoryAttachmentTriggers for truthiness and non-zero size before doing anything else.
  • Keep the early exit path separate from the work path so future readers recognize the guard without parsing the loop logic.
  • Only call getAppState() or other render-dependent helpers after you confirm there are triggers to process.
  • Treat the guard as part of the method contract; stateful or async helpers should not run unless this simple check passed.

Example Application

In 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.

Anti-Patterns (What NOT to do)

  • Do not fetch the React appState before validating that the trigger set requires it.
  • Do not assume the triggers will always be non-empty and let React-dependent helpers run every turn.

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.