agentleFS
stablebaselinestablebaseline/claude-code/skills/sb-manage-data/SKILL.md

sb-manage-data

Skill1 starsChanged 40 days agoApache-2.0View on GitHub

Upload, reference, and manage data files (CSV, JSON, TSV) for Vega/Vega-Lite diagrams in a Stable Baseline document. Use when user wants to upload data files, create charts with data, or run sb-manage-data.

The file

We split this skill into the rules it gives an agent

10 rules. About 0 are common, 0 are distinctive, and 10 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 10

    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, then listProjects, then listDocuments or getProjectHierarchy to find it.

    line 11
  2. Very specific:

    Call createVegaDataUploadSession with { documentId, fileName }.

    line 19
  3. Very specific:

    PUT the raw file bytes to uploadUrl with header Content-Type: <contentType>.

    line 24
  4. Very specific:

    Use the assetUrl in your Vega or Vega-Lite spec:

    line 27
  5. Very specific:

    Update any existing Vega/Vega-Lite diagrams to point to the new assetUrl:

    line 52
  6. Very specific:

    Call getDocument to find DIAGRAM_OMITTED markers.

    line 53
  7. Very specific:

    Call getDiagramInDocument to read the current spec.

    line 54
  8. Very specific:

    Call updateDiagramInDocument with updated diagramCode referencing the new assetUrl.

    line 55
  9. Very specific:

    Delete the old data file with deleteVegaDataFile.

    line 56
  10. Very specific:

    ALWAYS upload data files via createVegaDataUploadSession + PUT.

    line 63

≈ “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: Manage Data Files

Manage data files for Vega/Vega-Lite diagrams in a Stable Baseline document.

If you don't know the documentId: use listWorkspaces, then listProjects, then listDocuments or getProjectHierarchy to find it. Or read .sb/config.json for cached IDs.

Data files are sidebar attachments: they are NOT embedded in the document body. They are referenced by URL in Vega/Vega-Lite diagram specs.

Supported formats: CSV (.csv), JSON (.json), TSV (.tsv), plain text (.txt). Max 10MB.

Uploading a data file and creating a Vega diagram

  1. Call createVegaDataUploadSession with { documentId, fileName }.
    • Content type is auto-detected from the file extension (.csv becomes text/csv, etc.).
    • You can override with the contentType parameter if needed. It returns uploadUrl and assetUrl.
  2. PUT the raw file bytes to uploadUrl with header Content-Type: <contentType>.
    • The URL is single-use and expires in 5 minutes.
  3. Use the assetUrl in your Vega or Vega-Lite spec:
    {
      "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
      "data": { "url": "<assetUrl>" },
      "mark": "bar",
      "encoding": { ... }
    }
  4. Call insertDiagramInDocument with:
    • type: the Vega or Vega-Lite diagram type (check listDiagramTypes for the exact type name)
    • diagramCode: the JSON spec referencing the assetUrl
    • documentId, documentVersionTimestamp (from getDocument)
    • afterLine, prompt, nlDescription, etc.

Deleting a data file

  • Call deleteVegaDataFile with { documentId, attachmentId }.
  • This removes the storage file and database record.
  • NOTE: Any diagrams referencing the deleted file's assetUrl will break. Update or remove those diagrams first.

Replacing a data file

  1. Upload the new file using the upload-session flow above (step 1-2).
  2. Update any existing Vega/Vega-Lite diagrams to point to the new assetUrl:
    • Call getDocument to find DIAGRAM_OMITTED markers.
    • Call getDiagramInDocument to read the current spec.
    • Call updateDiagramInDocument with updated diagramCode referencing the new assetUrl.
  3. Delete the old data file with deleteVegaDataFile.

Multiple data files in one diagram

A single Vega spec can reference multiple data sources. Upload each file separately, then reference all their assetUrls in the spec.

Hard rules:

  • ALWAYS upload data files via createVegaDataUploadSession + PUT. Never embed large datasets inline in diagram code.
  • The assetUrl is permanent and JWT-authenticated: it requires a valid user session to access.
  • Data files are NOT part of the document body. They won't appear in getDocument output.
  • Clean up unused data files with deleteVegaDataFile to avoid orphaned storage.

Reference:

  • sb://diagram-types to find exact Vega/Vega-Lite type names
  • sb://cdmd-guide for document 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.