write-patch
Skill1 starsChanged 7 months agoApache-2.0View on GitHub
Surgical edit — insert/replace under a specific heading, block id, or frontmatter key. Use when you need to modify ONE section of a long note without rewriting the whole file.
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-create-or-replaceSkill
- write-frontmatter-mergeSkill
- write-frontmatter-setSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 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.
2
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 patch_file MCP tool with arguments parsed from $ARGUMENTS.
- Very specific: line 50
If the call fails, do NOT silently redo it with direct-filesystem tools (Read/Edit/Write on the vault's real path):
- Distinctive: line 58
After the patch, report what was patched (target type, target, operation).
≈ “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-patch
Call the obsidian-router patch_file MCP tool with arguments parsed from $ARGUMENTS.
Arguments
Required:
path— file path relative to vault root.operation—append,prepend, orreplace.targetType—heading,block, orfrontmatter.target— the target identifier:heading→ the FULL heading path joined by::(e.g.Section 1::Subsection). Just the heading name alone won't work; the parent path is required.block→ the block id without the leading^(e.g.atp-config).frontmatter→ the property name (e.g.status).
content— new content. String for heading/block; for frontmatter accepts string/number/boolean/array/object (types preserved).
Optional:
vault— omit for default.targetDelimiter— override the heading delimiter (default::).createTargetIfMissing— create the target if absent (heading/frontmatter only).applyIfContentPreexists— skip if target already contains the content (idempotency).trimTargetWhitespace— trim whitespace around the target before applying.ifMatch— acontentSha256from a priorget_file. Whole-file precondition: the patch is refused with a 409 conflict if the file changed since you read it. (The precondition is checked before patching; the patch itself is not hash-locked — this catches patching stale content, it does not make the patch atomic.)
Argument parsing from $ARGUMENTS
This tool has many parameters. If $ARGUMENTS doesn't make the intent crystal-clear, ask the user before calling. A typical bare invocation as $ARGUMENTS should be path=... operation=... targetType=... target=... content=....
Common quick patterns
- Set a frontmatter key:
path=X operation=replace targetType=frontmatter target=<key> content=<value>(consider usingwrite-frontmatter-setinstead — friendlier wrapper). - Append under a heading:
path=X operation=append targetType=heading target="Section::Sub" content="...". - Replace a block:
path=X operation=replace targetType=block target=<block-id> content="...".
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 (HTTP 4xx, e.g.
invalid-target= heading not the FULL::-joined path) → fix the arguments, or use a coarser router tool (write_file,append_to_file).
Rationale + message template: the default-vault-health-check convention (canonical source).
Output
After the patch, report what was patched (target type, target, operation).
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.

