agentleFS
stablebaselinestablebaseline/claude-code/skills/sb-sync/SKILL.md

sb-sync

Skill1 starsChanged 40 days agoApache-2.0View on GitHub

Generate or update the Stable Baseline section in AGENTS.md for cross-IDE auto-sync. Preserves all existing AGENTS.md content. Use when user wants to sync AGENTS.md, regenerate sync rules, or run sb-sync.

The file

Show its rules and text

We split this skill into the rules it gives an agent

22 rules. About 0 are common, 9 are distinctive, and 13 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈9

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 13

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Add or update the Stable Baseline section in the repository's AGENTS.md file.

    line 9
  2. Very specific:

    If you don't have IDs yet, read .sb/config.json or call listWorkspaces then listProjects to discover them.

    line 11
  3. Distinctive:

    If AGENTS.md already exists, READ IT FIRST.

    line 14
  4. Distinctive:

    ONLY append or update the "Stable Baseline: Documentation Sync" section.

    line 15
  5. Distinctive:

    If that section already exists from a previous run, update it in-place.

    line 16
  6. Distinctive:

    If AGENTS.md does not exist, create a new file with ONLY the Stable Baseline section below (do not invent other rules).

    line 18
  7. Distinctive:

    BEFORE writing the section, you MUST analyse the repository to understand:

    line 20
  8. Very specific:

    Read .sb/config.json to get workspaceId, projectId, AND the cache object

    line 65
  9. Very specific:

    Look up the target document in cache.documents by title

    line 66
  10. Very specific:

    Cache HIT: Call getDocument directly with the cached document ID (skip getProjectHierarchy entirely)

    line 67
  11. Very specific:

    Cache MISS or 404: Call getProjectHierarchy to find the document, then update cache.documents with the discovered ID so future syncs are …

    line 68
  12. Very specific:

    Read the document's current content and get its versionTimestamp

    line 69
  13. Very specific:

    Call editDocument with targeted patches (NOT full rewrites)

    line 71
  14. Very specific:

    If no matching document exists, call createDocument in the appropriate folder, then add it to cache.documents

    line 72
  15. Very specific:

    Update cache.lastUpdated in .sb/config.json with the current ISO 8601 timestamp

    line 73
  16. Very specific:

    Use sb tools for ALL document, folder, diagram, and image operations

    line 81
  17. Very specific:

    NEVER manually write or edit DIAGRAM_OMITTED, IMAGE_OMITTED, or <!-- DIAGRAM: ...

    line 82
  18. Very specific:

    ALWAYS call getDocument before editDocument (versionTimestamp is required for optimistic locking)

    line 83
  19. Distinctive:

    Create documents first, THEN insert diagrams/images with dedicated tools

    line 84
  20. Very specific:

    Prefer editDocument with small patches over full document rewrites

    line 86
  21. Distinctive:

    Document the "why" behind decisions, not just the "what"

    line 94
  22. Distinctive:

    Every document should be immediately useful to a developer joining tomorrow

    line 97

≈ “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: Sync AGENTS.md

Add or update the Stable Baseline section in the repository's AGENTS.md file. This is the cross-IDE standard for agent instructions: it works in Cursor, VS Code Copilot, Claude Code, OpenCode, Windsurf, Zed, Warp, Roo Code, Aider, and all other AGENTS.md-compatible tools.

If you don't have IDs yet, read .sb/config.json or call listWorkspaces then listProjects to discover them.

CRITICAL (PRESERVE EXISTING CONTENT):

  • If AGENTS.md already exists, READ IT FIRST. You MUST NOT remove, replace, or overwrite ANY existing content.
  • ONLY append or update the "Stable Baseline: Documentation Sync" section.
  • If that section already exists from a previous run, update it in-place. Leave all other sections untouched.
  • A section from an older version of this plugin has the same heading with a long dash in place of the colon: it is this section. Update it in place and give it this heading; never add a second one.
  • If AGENTS.md does not exist, create a new file with ONLY the Stable Baseline section below (do not invent other rules).

BEFORE writing the section, you MUST analyse the repository to understand:

  • What languages, frameworks, and tools are used
  • What the key directories and file patterns are
  • What areas of the codebase are architecturally significant
  • What existing documentation exists in Stable Baseline (call getProjectHierarchy)

Then generate the Stable Baseline section with ALL of the following sub-sections:

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ SECTION 1: Project Documentation Link ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Under the heading ## Stable Baseline: Documentation Sync, state that this project's documentation lives in Stable Baseline. Include the workspaceId, projectId, and MCP server name (sb).

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ SECTION 2: Auto-Sync Rules ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

This is the CRITICAL section. Create a table mapping file patterns to documentation actions.

The agent reading this file must know: "When I change file X, I need to update document Y in Stable Baseline."

Rules for building the table:

  • File patterns MUST be specific to THIS repo (based on your analysis)
  • Map each pattern to the specific Stable Baseline document that covers it
  • Include the action: editDocument for updates, createDocument for new docs
  • Cover ALL architecturally significant areas

Categories to consider (include only what's relevant to THIS repo):

  • Architecture changes: system design files, service boundaries, API schemas
  • Security changes: auth config, authorization rules, secrets management
  • Data model changes: migrations, schema files, ORM models
  • Infrastructure changes: Dockerfiles, CI/CD configs, IaC templates, deploy scripts
  • API contract changes: OpenAPI specs, protobuf, GraphQL schemas, route definitions
  • Dependency changes: package.json, go.mod, Cargo.toml, requirements.txt
  • Configuration changes: environment configs, feature flags, build configs
  • Business logic changes: core domain logic, business rules, workflow definitions

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ SECTION 3: Sync Workflow ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Explain the step-by-step workflow the agent must follow when a sync trigger fires:

  1. Read .sb/config.json to get workspaceId, projectId, AND the cache object
  2. Look up the target document in cache.documents by title
    • Cache HIT: Call getDocument directly with the cached document ID (skip getProjectHierarchy entirely)
    • Cache MISS or 404: Call getProjectHierarchy to find the document, then update cache.documents with the discovered ID so future syncs are fast
  3. Read the document's current content and get its versionTimestamp
  4. Determine what changed and how the documentation should be updated
  5. Call editDocument with targeted patches (NOT full rewrites)
  6. If no matching document exists, call createDocument in the appropriate folder, then add it to cache.documents
  7. Update cache.lastUpdated in .sb/config.json with the current ISO 8601 timestamp

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ SECTION 4: MCP Tool Rules ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Include these universal rules:

  • Use sb tools for ALL document, folder, diagram, and image operations
  • NEVER manually write or edit DIAGRAM_OMITTED, IMAGE_OMITTED, or <!-- DIAGRAM: ... --> markers
  • ALWAYS call getDocument before editDocument (versionTimestamp is required for optimistic locking)
  • Create documents first, THEN insert diagrams/images with dedicated tools
  • For bulk text substitutions use findAndReplaceTextInDocument
  • Prefer editDocument with small patches over full document rewrites

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ SECTION 5: Documentation Principles ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Include a brief section on documentation philosophy:

  • Document the "why" behind decisions, not just the "what"
  • Technical and business documentation must be consistent and reference each other
  • Documentation should prevent architectural drift by recording rationale
  • Every document should be immediately useful to a developer joining tomorrow

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ SECTION 6: Resources ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

List the MCP resources:

  • sb://cdmd-guide: CDMD syntax reference
  • sb://diagram-types: Available diagram types and their renderers
  • sb://server-info: Server capabilities, tools, and prompts
  • sb://projects/{projectId}/hierarchy: Project folder/document structure

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

OUTPUT: If AGENTS.md already exists, read it first, then output the UPDATED file preserving ALL existing content and appending/updating ONLY the Stable Baseline section. If it does not exist, output a new file containing ONLY the Stable Baseline section. The Stable Baseline section must be self-contained: an agent reading it with zero prior context must understand what to do.

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.