sb-edit-doc
Skill1 starsChanged 40 days agoApache-2.0View on GitHub
Edit an existing Stable Baseline document with anchor or line patches, or bulk find-and-replace, with proper optimistic locking. Use when user wants to edit a document, update docs, or run sb-edit-doc.
In this repository14 other files it gives its agents.
- sb-agentSkill
- sb-connectSkill
- sb-create-diagramSkill
- sb-create-docSkill
- sb-create-whiteboardSkill
- sb-dashboardSkill
- sb-databaseSkill
- sb-edit-whiteboardSkill
- sb-manage-dataSkill
- sb-manage-imagesSkill
- sb-searchSkill
- sb-setupSkill
- sb-syncSkill
- sb-updateSkill
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 5 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
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 10
If you don't know the documentId: use listWorkspaces -> listProjects -> listDocuments or getProjectHierarchy to find it.
- Distinctive: line 19
Never mix anchor patches and line patches in one call.
- Very specific: line 23
Call getDocument with the documentId (or use the versionTimestamp a listDocuments result carries).
- Distinctive: line 25
Read the line-numbered content to find what to change.
- Very specific: line 29
If it occurs more than once, make oldText longer, or add before or after (the exact text just before or after it).
- Distinctive: line 39
NEVER include line number prefixes in your replacement text.
- Distinctive: line 48
If the edit fails with a versionTimestamp mismatch:
- Very specific: line 53
ALWAYS read the current text first (getDocument, or listDocuments with query): never edit blind.
- Very specific: line 54
NEVER hand-edit DIAGRAM_OMITTED or IMAGE_OMITTED markers.
- Distinctive: line 55
Keep patches small and precise.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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
Stable Baseline: Edit Document
Edit an existing Stable Baseline document using MCP tools.
If you don't know the documentId: use listWorkspaces -> listProjects -> listDocuments or getProjectHierarchy to find it. Or read .sb/config.json for cached IDs. listDocuments with query also finds the text to change, line by line.
Choose the right approach:
A) Anchor patches (editDocument, recommended): replace an exact snippet of the document. They do not drift when someone else edits the document, so no fresh line numbers are needed.
B) Line patches (editDocument): replace, insert or delete whole lines by number, when an anchor will not do.
C) Bulk find-and-replace (findAndReplaceTextInDocument): rename a term, fix a repeated typo or update a brand name across the whole document.
D) Title or folder move only: pass an empty patches array with the new title or folderId.
Never mix anchor patches and line patches in one call.
Steps:
- Call
getDocumentwith the documentId (or use theversionTimestampalistDocumentsresult carries).- Note the
versionTimestamp: you MUST pass it on every edit call. - Read the line-numbered content to find what to change. The number and tab before each line are for display only.
- Note the
- For anchor patches (
editDocument):- Each patch is
{ oldText, newText }.oldTextmust match the document exactly and occur once. - If it occurs more than once, make
oldTextlonger, or addbeforeorafter(the exact text just before or after it). newText: ""deletes the anchored text.- The
textof alistDocumentscontent match can be pasted straight in asoldText. - A no-match answers with nearby text and an ambiguous match with the count: read it and fix the anchor rather than retrying blindly.
- Each patch is
- For line patches (
editDocument):- Each patch has
startLine,endLine(1-based, inclusive), andreplacement. - To replace line 5:
{ startLine: 5, endLine: 5, replacement: "new content" } - To delete lines 10 to 12:
{ startLine: 10, endLine: 12, replacement: "" } - To insert after line 7:
{ startLine: 8, endLine: 7, replacement: "inserted content" } - NEVER include line number prefixes in your replacement text.
- Each patch has
- For bulk find-and-replace (
findAndReplaceTextInDocument):- Provide
find(exact text to match) andreplace(replacement text). - Case-sensitive by default; set
caseSensitive: falseif needed. - It says how many it replaced.
- Provide
- For a large or structural edit, call
editDocumentwithdryRun: truefirst and show the user the result. - If the edit fails with a versionTimestamp mismatch:
- Re-call
getDocumentto get the latest versionTimestamp. - Re-apply your patches against the updated content.
- Re-call
Hard rules:
- ALWAYS read the current text first (
getDocument, orlistDocumentswithquery): never edit blind. - NEVER hand-edit DIAGRAM_OMITTED or IMAGE_OMITTED markers. Use dedicated diagram/image tools.
- Keep patches small and precise. Avoid replacing large document sections unnecessarily.
- Include a
changeSummaryto document what changed (appears in version history).
Reference:
sb://cdmd-guidefor CDMD syntax
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.

