agentsclimarketplace

Create only idempotent artifact write

Skill ychampion/cskill-agents/skills/create-only-idempotent-artifact-write

Persist deterministic artifacts with a create-only write and treat existing files as replay success instead of an error.From its SKILL.md

Install
npx -y skills add ychampion/cskill-agents --skill create-only-idempotent-artifact-write

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

SKILL.md

2.3 KB, 443 tokens by cl100k_base, as published. Nobody here has run it

SKILL: Create-Only Idempotent Artifact Write

Domain: tool-orchestration
Trigger: Apply when a deterministic artifact is keyed by a stable invocation ID and may be replayed across retries, compaction, or resume passes. Source Pattern: Distilled from reviewed tool-loop and result-shaping patterns.

Core Method

When an artifact path is derived from a stable identity, write it once with an atomic create-only operation instead of checking for existence first. If the write hits "already exists," treat that as proof the earlier successful write already materialized the deterministic content and continue with the normal readback or preview path. This removes the stat-then-write race, avoids useless rewrites during replay, and keeps repeated passes behaviorally identical.

Key Rules

  • Derive the artifact path from a stable key such as tool_use_id so repeated calls target the same location.
  • Use a create-only write primitive like flag: 'wx' to collapse "create if absent" into one filesystem operation.
  • Treat EEXIST as idempotent success when the content is deterministic for that key; only unexpected filesystem errors should fail the operation.
  • Continue into the downstream preview or response-building path even when the file already existed, so replayed calls return the same contract as fresh ones.
  • Avoid preflight existence checks because they reintroduce races and duplicate I/O under concurrency.

Example Application

If a large tool result is persisted under tool-results/<tool_use_id>.json, write it once with a create-only flag. When transcript replay or micro-compaction revisits that same tool result, the write sees EEXIST, skips the rewrite, and still returns the same preview payload and saved path to the caller.

Anti-Patterns (What NOT to do)

  • Do not stat() and then writeFile() for idempotency; another writer can win between those calls.
  • Do not overwrite existing artifacts on every replay when the file path is already the canonical output for that key.
  • Do not treat "file already exists" as a hard error in deterministic replay flows; it is often the success path.

What ships with it: 1 file

935 B alongside SKILL.md

Gives 0 of the 12 instructions most docs writing skills give in 443 tokens

Counted across 1,637 of the 3,044 authors here whose files we hold, read 2026-08-07

  • Announce the skill at startin 54 of 1637, across 26 files
  • Convert legacy doc files before editingin 45 of 1637, across 7 files
  • Predict questions readers might askin 42 of 1637, across 4 files
  • Generate clarifying questions for initial contextin 42 of 1637, across 3 files
  • Create document scaffold with placeholder textin 42 of 1637, across 3 files
  • Brainstorm content options for each sectionin 42 of 1637, across 3 files
  • Test the document with a fresh context-less instancein 42 of 1637, across 3 files
  • Include exact file paths in every taskin 42 of 1637, across 15 files
  • Ask interview questions one at a timein 42 of 1637, across 27 files
  • Apply surgical edits during refinementin 41 of 1637, across 2 files
  • Offer structured workflow or freeformin 40 of 1637, across 1 file
  • Ask for document meta-contextin 40 of 1637, across 2 files

Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.

Keep looking

Skills are one crate of 326,852. 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.