agentleFS
stablebaselinestablebaseline/claude-code/skills/sb-edit-doc/SKILL.md

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.

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
  1. Very specific:

    If you don't know the documentId: use listWorkspaces -> listProjects -> listDocuments or getProjectHierarchy to find it.

    line 10
  2. Distinctive:

    Never mix anchor patches and line patches in one call.

    line 19
  3. Very specific:

    Call getDocument with the documentId (or use the versionTimestamp a listDocuments result carries).

    line 23
  4. Distinctive:

    Read the line-numbered content to find what to change.

    line 25
  5. Very specific:

    If it occurs more than once, make oldText longer, or add before or after (the exact text just before or after it).

    line 29
  6. Distinctive:

    NEVER include line number prefixes in your replacement text.

    line 39
  7. Distinctive:

    If the edit fails with a versionTimestamp mismatch:

    line 48
  8. Very specific:

    ALWAYS read the current text first (getDocument, or listDocuments with query): never edit blind.

    line 53
  9. Very specific:

    NEVER hand-edit DIAGRAM_OMITTED or IMAGE_OMITTED markers.

    line 54
  10. Distinctive:

    Keep patches small and precise.

    line 55

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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:

  1. Call getDocument with the documentId (or use the versionTimestamp a listDocuments result 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.
  2. For anchor patches (editDocument):
    • Each patch is { oldText, newText }. oldText must match the document exactly and occur once.
    • If it occurs more than once, make oldText longer, or add before or after (the exact text just before or after it).
    • newText: "" deletes the anchored text.
    • The text of a listDocuments content match can be pasted straight in as oldText.
    • A no-match answers with nearby text and an ambiguous match with the count: read it and fix the anchor rather than retrying blindly.
  3. For line patches (editDocument):
    • Each patch has startLine, endLine (1-based, inclusive), and replacement.
    • 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.
  4. For bulk find-and-replace (findAndReplaceTextInDocument):
    • Provide find (exact text to match) and replace (replacement text).
    • Case-sensitive by default; set caseSensitive: false if needed.
    • It says how many it replaced.
  5. For a large or structural edit, call editDocument with dryRun: true first and show the user the result.
  6. If the edit fails with a versionTimestamp mismatch:
    • Re-call getDocument to get the latest versionTimestamp.
    • Re-apply your patches against the updated content.

Hard rules:

  • ALWAYS read the current text first (getDocument, or listDocuments with query): 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 changeSummary to document what changed (appears in version history).

Reference:

  • sb://cdmd-guide for CDMD syntax

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.