{"id":"b06672d1-d843-49bb-90ce-2e5213ca025f","shortId":"58c5uy","kind":"skill","title":"memory-directory-exists-guidance","tagline":"Ensure memory directories exist once and surface consistent guidance so agents skip redundant mkdir calls.","description":"# SKILL: Memory Directory Exists Guidance\n**Domain:** context-management  \n**Trigger:** Use whenever you plan to write memory files so the agent can assume the directory exists instead of repeatedly running `mkdir -p`.\n**Source Pattern:** Distilled from reviewed context, compaction, and memory-governance patterns.\n\n## Core Method\nGuarantee the auto-memory directory exists with a single idempotent `mkdir` (handled once per session) and prepend every guidance response with the standard instructions (`DIR_EXISTS_GUIDANCE` and `DIRS_EXIST_GUIDANCE`) so Claude knows not to rerun filesystem commands that are already satisfied. Log any mkdir failure asynchronously for telemetry but let the tool write operation report the real error to keep the workflow moving.\n\n## Key Rules\n- Call `ensureMemoryDirExists` before prompting the agent to write memory files so the path is settled; the helper already swallows `EEXIST` and warns only on genuine failures.\n- Always echo either `DIR_EXISTS_GUIDANCE` or `DIRS_EXIST_GUIDANCE` when summarizing the directory state to the assistant so it stops issuing mkdir commands.\n- Keep the mkdir call outside the main agent loop (e.g., in init or once-per-session code) so repeated turns do not spawn redundant filesystem operations.\n\n## Example Application\nWhen saving a new memory from within the CLI, run `ensureMemoryDirExists(memoryDir)` at session start, mention `DIR_EXISTS_GUIDANCE`, and proceed to open the target file without extra mkdirs; this keeps the assistant focused on writing content instead of housekeeping.\n\n## Anti-Patterns (What NOT to do)\n- Don’t rerun `mkdir -p` right before every write; the persistent guidance plus singleton helper avoids redundant logs and permission stumbling blocks.\n- Don’t treat the guidance text as optional; skipping it results in the CLI repeatedly prompting for directory creation even though the path already exists.","tags":["memory","directory","exists","guidance","cskill","agents","ychampion","agent-skills","ai-agents","cli","coding-agents","context-engineering"],"capabilities":["skill","source-ychampion","skill-memory-directory-exists-guidance","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/memory-directory-exists-guidance","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,904 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:51.011Z","embedding":null,"createdAt":"2026-04-18T22:20:43.410Z","updatedAt":"2026-04-22T06:56:51.011Z","lastSeenAt":"2026-04-22T06:56:51.011Z","tsv":"'agent':16,41,140,192 'alreadi':109,152,306 'alway':161 'anti':255 'anti-pattern':254 'applic':213 'assist':178,246 'assum':43 'asynchron':115 'auto':70 'auto-memori':69 'avoid':276 'block':282 'call':20,135,188 'claud':100 'cli':222,296 'code':202 'command':106,184 'compact':59 'consist':13 'content':250 'context':28,58 'context-manag':27 'core':65 'creation':301 'dir':92,96,164,168,230 'directori':3,8,23,45,72,174,300 'distil':55 'domain':26 'e.g':194 'echo':162 'eexist':154 'either':163 'ensur':6 'ensurememorydirexist':136,224 'error':127 'even':302 'everi':85,268 'exampl':212 'exist':4,9,24,46,73,93,97,165,169,231,307 'extra':241 'failur':114,160 'file':38,144,239 'filesystem':105,210 'focus':247 'genuin':159 'govern':63 'guarante':67 'guidanc':5,14,25,86,94,98,166,170,232,272,287 'handl':79 'helper':151,275 'housekeep':253 'idempot':77 'init':196 'instead':47,251 'instruct':91 'issu':182 'keep':129,185,244 'key':133 'know':101 'let':119 'log':111,278 'loop':193 'main':191 'manag':29 'memori':2,7,22,37,62,71,143,218 'memory-directory-exists-guid':1 'memory-govern':61 'memorydir':225 'mention':229 'method':66 'mkdir':19,51,78,113,183,187,242,264 'move':132 'new':217 'once-per-sess':198 'open':236 'oper':123,211 'option':290 'outsid':189 'p':52,265 'path':147,305 'pattern':54,64,256 'per':81,200 'permiss':280 'persist':271 'plan':34 'plus':273 'prepend':84 'proceed':234 'prompt':138,298 'real':126 'redund':18,209,277 'repeat':49,204,297 'report':124 'rerun':104,263 'respons':87 'result':293 'review':57 'right':266 'rule':134 'run':50,223 'satisfi':110 'save':215 'session':82,201,227 'settl':149 'singl':76 'singleton':274 'skill':21 'skill-memory-directory-exists-guidance' 'skip':17,291 'sourc':53 'source-ychampion' 'spawn':208 'standard':90 'start':228 'state':175 'stop':181 'stumbl':281 'summar':172 'surfac':12 'swallow':153 'target':238 'telemetri':117 'text':288 'though':303 'tool':121 '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':285 'trigger':30 'turn':205 'use':31 'warn':156 'whenev':32 'within':220 'without':240 'workflow':131 'write':36,122,142,249,269","prices":[{"id":"c475cb01-3b21-45ef-818f-d9e9b964d547","listingId":"b06672d1-d843-49bb-90ce-2e5213ca025f","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:43.410Z"}],"sources":[{"listingId":"b06672d1-d843-49bb-90ce-2e5213ca025f","source":"github","sourceId":"ychampion/cskill-agents/memory-directory-exists-guidance","sourceUrl":"https://github.com/ychampion/cskill-agents/tree/main/skills/memory-directory-exists-guidance","isPrimary":false,"firstSeenAt":"2026-04-18T22:20:43.410Z","lastSeenAt":"2026-04-22T06:56:51.011Z"}],"details":{"listingId":"b06672d1-d843-49bb-90ce-2e5213ca025f","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"ychampion","slug":"memory-directory-exists-guidance","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":"80e7051924277c707d9c5747a6589903dc3cccaf","skill_md_path":"skills/memory-directory-exists-guidance/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/ychampion/cskill-agents/tree/main/skills/memory-directory-exists-guidance"},"layout":"multi","source":"github","category":"cskill-agents","frontmatter":{"name":"memory-directory-exists-guidance","description":"Ensure memory directories exist once and surface consistent guidance so agents skip redundant mkdir calls."},"skills_sh_url":"https://skills.sh/ychampion/cskill-agents/memory-directory-exists-guidance"},"updatedAt":"2026-04-22T06:56:51.011Z"}}