Recipes
Claude Code
Connect Stable Baseline's MCP server to Claude Code and let your AI agent generate, maintain, and sync project documentation — automatically. One prompt, zero tab-switching.
What You'll Get
MCP Tools
Claude Code gets direct access to Stable Baseline — creating documents, inserting diagrams, managing images, and uploading data files, all from your terminal session.
Bespoke Documentation
The AI analyses your repo deeply — stack, architecture, domain, data layer — then builds a documentation structure tailored to your codebase. No generic templates.
AGENTS.md Sync Rules
Auto-sync rules are added to your AGENTS.md so Claude Code knows exactly which docs to update when you change code. Existing AGENTS.md content is always preserved.
Project Config
A local .sb/config.json file stores your workspace and project IDs so every future session picks up right where you left off.
Total setup time: ~2 minutes to connect, then the agent does the rest.
Step 1: Add the MCP Server
Connect Stable Baseline to Claude Code using the CLI or by editing the config file directly.
Prerequisites:
- A Stable Baseline account with a workspace and project → Create one at app.stablebaseline.io
- An API key from your Stable Baseline workspace settings
- Claude Code installed (
npm install -g @anthropic-ai/claude-code)
CLI (Recommended)
claude mcp add --transport http --scope project stablebaseline-mcp \ https://api.stablebaseline.io/functions/v1/cloud-serve/mcp \ --header "Authorization: Bearer YOUR_API_KEY"
Scope options:--scope project — Shared with your team via .mcp.json (recommended)--scope local — Only you, only this project (default if omitted)--scope user — Available to you across all projects
Manual Config (.mcp.json)
Create or edit .mcp.json in your project root:
{
"stablebaseline-mcp": {
"type": "http",
"url": "https://api.stablebaseline.io/functions/v1/cloud-serve/mcp",
"headers": {
"Authorization": "Bearer ${STABLE_BASELINE_API_KEY}"
}
}
}Set the environment variable in your shell profile (~/.bashrc, ~/.zshrc, etc.):
export STABLE_BASELINE_API_KEY="sta_your_api_key_here"Tip: Run /mcp inside Claude Code to verify the server is connected and all tools are loaded.
Step 2: Run Setup
Once connected, tell Claude Code to run the onboarding prompt. It will analyse your repository and create tailored documentation.
Use the prompt
/sb-setup
Or with a specific goal
/sb-setup project_goal="Generate architecture and onboarding docs for new team members"
What it does (in order):
- Verifies MCP connection — Calls listWorkspaces to confirm the server is reachable and authenticated.
- Resolves workspace & project — Picks your workspace and project (or asks if there are multiple).
- Creates local config — Writes .sb/config.json with your IDs and adds .sb/ to .gitignore.
- Checks for existing docs — If documentation already exists, asks whether to augment, replace, or cancel.
- Analyses your repository — Reads package files, configs, directory structure, source code, READMEs — everything.
- Designs a bespoke doc structure — No templates. Folders and documents are tailored to your repo's architecture, domain, and stack.
- Creates the documentation — Writes substantive documents with real content, including architecture diagrams where they add value.
- Adds sync rules to AGENTS.md — Appends a Stable Baseline sync section to your AGENTS.md. If AGENTS.md already exists, existing content is never removed.
- Provides a summary — Lists everything created: folders, documents, diagrams, and suggested next steps.
What Gets Documented
The agent doesn't follow a checklist. It reads your code and documents what matters for THIS repo. Areas it considers:
Architecture & System Design
Component relationships, data flows, API contracts, integration points
Technical Standards
Coding patterns, naming conventions, style guides specific to your stack
Security Patterns
Auth flows, authorization model, secrets management, vulnerability handling
Operational & Maintenance
Deployment procedures, monitoring, alerting, incident response runbooks
Business Context
Domain models, business rules, stakeholder requirements, product decisions
Drift Prevention
The "why" behind every decision, so future developers don't undo them unknowingly
How Auto-Sync Works
The setup prompt adds sync rules to your generic AGENTS.md file. These rules tell Claude Code which documentation to update when specific files change.
| File Pattern | Documentation Impact | Action |
|---|---|---|
| src/components/** | UI components and patterns | Update "Frontend Patterns" |
| src/lib/agents/** | AI agents and pipelines | Update "AI Services" |
| supabase/functions/** | Edge functions and backend logic | Update "API & Integrations" |
| supabase/migrations/** | Database schema changes | Update "Data Model" |
Note: These patterns are generated specifically for your repository. The example above is illustrative — your actual rules will match your codebase structure.
File Structure
your-repo/ ├── .mcp.json ← MCP server config (shared with team) ├── .sb/ │ └── config.json ← Workspace & project IDs ├── AGENTS.md ← Sync rules appended here └── ...your code
Try It
After setup, try these prompts in Claude Code:
"Create a document explaining our authentication flow with a sequence diagram"
"Update the API documentation to reflect the new /v2/users endpoint"
"Add an architecture diagram showing how our services communicate"
"Document the deployment process for the staging environment"
Regenerate Documentation
Need to re-run the full setup? Use the same prompt again:
Use the sb-setup prompt from the stable-baseline MCP server
If documentation already exists, the setup will ask whether you want to augment (fill gaps), replace (start fresh), or cancel.
Other Prompts Available
| Prompt | What it does |
|---|---|
| sb-setup | Full onboarding — analyse repo, create docs, configure sync |
| sb-sync | Regenerate AGENTS.md sync rules (preserves existing content) |
| sb-create-doc | Create a single document with CDMD formatting guidance |
| sb-create-diagram | Create a diagram with type selection and DSL guidance |
| sb-edit-doc | Edit an existing document with merge-safe patching |
| sb-manage-images | Upload and manage images in documents |
| sb-manage-data | Upload CSV/JSON/TSV data files for Vega/Vega-Lite charts |