{"id":"eb7a9b01-137d-4732-9638-91c4b0d05222","shortId":"dkbUq4","kind":"skill","title":"circular-safe-tool-registry-loading","tagline":"Safely assemble the tool registry when optional tools have circular dependencies or heavy side effects.","description":"# SKILL: Circular-Safe Tool Registry Loading\n**Domain:** Tool Orchestration  \n**Trigger:** Use when optional tools depend on the main registry or on each other, and eager imports would create cycles or unnecessary startup work.  \n**Source Pattern:** Distilled from reviewed tool execution, streaming, persistence, and output-budget implementations.\n\n## Core Method\nKeep registry assembly as a simple ordered list, but place any cyclic or expensive tool behind a tiny lazy loader. That loader imports and constructs the tool only when the registry is being composed and the relevant feature is enabled. The loader returns either one tool or nothing, and the registry flattens those results in a stable order. This breaks circular dependency chains, keeps disabled features cold, and preserves one authoritative registry surface.\n\n## Key Rules\n- Wrap any tool that would trigger a cycle or heavy initialization in a zero-argument lazy loader.\n- Apply the same feature gate at the loader boundary so disabled tool branches never initialize.\n- Keep registry assembly deterministic: each loader should return one tool or no value, and the final list should preserve a fixed order.\n- Document why each lazy loader exists so future maintainers do not inline it and reintroduce the cycle.\n\n## Example Application\nIf a collaborative workspace tool depends on the same registry module that is trying to list it, move that tool behind a lazy loader and call the loader only when the collaboration feature is enabled. The registry still exposes the full surface, but startup no longer hits a circular import.\n\n## Anti-Patterns (What NOT to do)\n- Don’t import mutually dependent tools at the top level of both modules; that recreates the cycle you are trying to avoid.\n- Don’t hide feature gating deep inside tool constructors; keep the gating decision at the registry edge.\n- Don’t instantiate the same optional tool from multiple ad hoc call sites; let one registry pass own ordering and construction.","tags":["circular","safe","tool","registry","loading","cskill","agents","ychampion","agent-skills","ai-agents","cli","coding-agents"],"capabilities":["skill","source-ychampion","skill-circular-safe-tool-registry-loading","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/circular-safe-tool-registry-loading","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:47.002Z","embedding":null,"createdAt":"2026-04-18T22:20:04.767Z","updatedAt":"2026-04-22T06:56:47.002Z","lastSeenAt":"2026-04-22T06:56:47.002Z","tsv":"'ad':326 'anti':272 'anti-pattern':271 'appli':165 'applic':220 'argument':162 'assembl':8,74,182 'authorit':142 'avoid':299 'behind':87,241 'boundari':173 'branch':177 'break':131 'budget':68 'call':246,328 'chain':134 'circular':2,16,24,132,269 'circular-saf':23 'circular-safe-tool-registry-load':1 'cold':138 'collabor':223,252 'compos':105 'construct':96,337 'constructor':308 'core':70 'creat':50 'cycl':51,154,218,294 'cyclic':83 'decis':312 'deep':305 'depend':17,37,133,226,282 'determinist':183 'disabl':136,175 'distil':58 'document':202 'domain':29 'eager':47 'edg':316 'effect':21 'either':115 'enabl':111,255 'exampl':219 'execut':62 'exist':207 'expens':85 'expos':259 'featur':109,137,168,253,303 'final':195 'fix':200 'flatten':123 'full':261 'futur':209 'gate':169,304,311 'heavi':19,156 'hide':302 'hit':267 'hoc':327 'implement':69 'import':48,94,270,280 'initi':157,179 'inlin':213 'insid':306 'instanti':319 'keep':72,135,180,309 'key':145 'lazi':90,163,205,243 'let':330 'level':287 'list':79,196,236 'load':6,28 'loader':91,93,113,164,172,185,206,244,248 'longer':266 'main':40 'maintain':210 'method':71 'modul':231,290 'move':238 'multipl':325 'mutual':281 'never':178 'noth':119 'one':116,141,188,331 'option':13,35,322 'orchestr':31 'order':78,129,201,335 'output':67 'output-budget':66 'pass':333 'pattern':57,273 'persist':64 'place':81 'preserv':140,198 'recreat':292 'registri':5,11,27,41,73,102,122,143,181,230,257,315,332 'reintroduc':216 'relev':108 'result':125 'return':114,187 'review':60 'rule':146 'safe':3,7,25 'side':20 'simpl':77 'site':329 'skill':22 'skill-circular-safe-tool-registry-loading' 'sourc':56 'source-ychampion' 'stabl':128 'startup':54,264 'still':258 'stream':63 'surfac':144,262 'tini':89 'tool':4,10,14,26,30,36,61,86,98,117,149,176,189,225,240,283,307,323 'top':286 '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' 'tri':234,297 'trigger':32,152 'unnecessari':53 'use':33 'valu':192 'work':55 'workspac':224 'would':49,151 'wrap':147 'zero':161 'zero-argu':160","prices":[{"id":"77c91185-58e0-4373-906e-34df725f79e9","listingId":"eb7a9b01-137d-4732-9638-91c4b0d05222","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:04.767Z"}],"sources":[{"listingId":"eb7a9b01-137d-4732-9638-91c4b0d05222","source":"github","sourceId":"ychampion/cskill-agents/circular-safe-tool-registry-loading","sourceUrl":"https://github.com/ychampion/cskill-agents/tree/main/skills/circular-safe-tool-registry-loading","isPrimary":false,"firstSeenAt":"2026-04-18T22:20:04.767Z","lastSeenAt":"2026-04-22T06:56:47.002Z"}],"details":{"listingId":"eb7a9b01-137d-4732-9638-91c4b0d05222","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"ychampion","slug":"circular-safe-tool-registry-loading","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":"be1b48e8b855ba3a83acfd4748c01f68512aecf8","skill_md_path":"skills/circular-safe-tool-registry-loading/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/ychampion/cskill-agents/tree/main/skills/circular-safe-tool-registry-loading"},"layout":"multi","source":"github","category":"cskill-agents","frontmatter":{"name":"circular-safe-tool-registry-loading","description":"Safely assemble the tool registry when optional tools have circular dependencies or heavy side effects."},"skills_sh_url":"https://skills.sh/ychampion/cskill-agents/circular-safe-tool-registry-loading"},"updatedAt":"2026-04-22T06:56:47.002Z"}}