write-create-or-replace
Skill1 starsChanged 7 months agoApache-2.0View on GitHub
Create a new file, or replace the entire content of an existing one. Pass ifNew=true to refuse overwrite.
In this repository49 other files it gives its agents.
- AGENTS.mdAGENTS.md
- auto-modeSkill
- autoresearchSkill
- bind-workspaceSkill
- build-search-indexSkill
- canvasSkill
- conventionsSkill
- decision-consolidateSkill
- defuddleSkill
- discover-list-filesSkill
- discover-list-vaultsSkill
- force-new-port-startSkill
- hot-compactSkill
- lockSkill
- manage-deleteSkill
- manage-moveSkill
- meta-attach-vaultSkill
- meta-audit-bridge-readinessSkill
- meta-setupSkill
- meta-statusSkill
- meta-sync-templateSkill
- obsidian-basesSkill
- obsidian-markdownSkill
- read-frontmatterSkill
- read-getSkill
- read-searchSkill
- read-search-smartSkill
- saveSkill
- sync-from-githubSkill
- template-executeSkill
- unlockSkill
- who-is-speakingSkill
- wiki-boundarySkill
- wiki-exportSkill
- wiki-foldSkill
- wiki-graphSkill
- wiki-ingestSkill
- wiki-lintSkill
- wiki-neighborsSkill
- wiki-pathSkill
- wiki-querySkill
- wiki-refresh-digestsSkill
- wikiSkill
- wiki-tourSkill
- write-appendSkill
- write-bundleSkill
- write-frontmatter-mergeSkill
- write-frontmatter-setSkill
- write-patchSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 1 is distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 16
Call the obsidian-router write_file MCP tool with arguments parsed from $ARGUMENTS.
- Very specific: line 38
When you are rewriting a file whose current content matters (appending to a running note by full replace, editing a shared scaffold like …
- Very specific: line 48
If overwriting an existing file (ifNew is not set/true), preview the existing top 10 lines first and ask the user to confirm before sending …
- Distinctive: line 49
If the user explicitly says "overwrite" or "remplace", skip the confirmation.
- Very specific: line 53
If the call fails, do NOT silently redo it with direct-filesystem tools (Read/Edit/Write on the vault's real path):
- Very specific: line 61
After the write, report vault, path, bytesWritten, and mode (create-only, create-or-replace, or if-match:atomic / if-match:fallback when …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
write-create-or-replace
Call the obsidian-router write_file MCP tool with arguments parsed from $ARGUMENTS.
Arguments
Required:
path— file path relative to vault root.content— full markdown content (frontmatter + body).
Optional:
vault— vault name. Omit for default.ifNew— if true, fail with HTTP 409 when the file already exists. Default false (overwrite).ifMatch— acontentSha256from a priorget_fileof this file. The write is refused with a 409 conflict if the file changed since you read it (optimistic concurrency). Use it whenever another session — or an Obsidian edit — could have touched the file between your read and your write. Atomic when the vault runs the bridge plugin ≥ 0.7.0, otherwise a GET-compare fallback. Mutually exclusive withifNew.
Argument parsing from $ARGUMENTS
- the user usually wants to give the path on the slash line and the content in a follow-up turn → if the slash line gives only a path, ask for the content
path=X content="..."for full one-shot--if-neworifNew=true→ setifNewifMatch=<hash>→ setifMatch
Read-modify-write safely (ifMatch)
When you are rewriting a file whose current content matters (appending to a running note by full replace, editing a shared scaffold like hot.md/catalog.md), do it as a conditional write:
get_filethe path → note thecontentSha256it returns.- Build the new full content from what you read.
write_filewithifMatch=<that contentSha256>.
If it 409s, someone changed the file since your read: re-read, rebuild your change on the current content, retry. Never respond to a 409 by dropping ifMatch and force-overwriting — that is exactly the clobber the guard prevents. The write result echoes the new contentSha256, so a chain of edits can reuse it without re-reading.
Safety
- If overwriting an existing file (
ifNewis not set/true), preview the existing top 10 lines first and ask the user to confirm before sending the write. - If the user explicitly says "overwrite" or "remplace", skip the confirmation.
On failure — remediate, NEVER fall back to filesystem writes
If the call fails, do NOT silently redo it with direct-filesystem tools (Read/Edit/Write on the vault's real path):
- Connection error (
ECONNREFUSED, timeout) → vault closed;list_vaults, then ask the user to open it via theopenUrilink and wait. - Validation / API error (e.g. HTTP 409 with
ifNew=true) → resolve the conflict with the user or adjust the arguments — still through the router.
Rationale + message template: the default-vault-health-check convention (canonical source).
Output
After the write, report vault, path, bytesWritten, and mode (create-only, create-or-replace, or if-match:atomic / if-match:fallback when ifMatch was used).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

