/SKILL.md
Expert SurrealDB 3 architect and developer skill. SurrealQL mastery, multi-model data modeling (document, graph, vector, time-series, geospatial), schema design, security, deployment, performance tuning, SDK integration (JS, Python, Go, Rust, Java, .NET, PHP, Swift, Kotlin, Ruby), Surrealism WASM extensions, SurrealML in-database inference, SurrealMCP for AI agent hosts, LangChain integration, editor tooling (LSP, tree-sitter, VS Code/JetBrains/Neovim/Zed), and the wider ecosystem (Surrealist, Surreal-Sync, SurrealFS, SurrealKit, setup-surreal). Universal skill for 30+ AI agents.
npx skillsauth add 24601/surreal-skills surrealdbInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
4 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Expert-level SurrealDB 3 architecture, development, and operations. Covers SurrealQL, multi-model data modeling, graph traversal, vector search, security, deployment, performance tuning, SDK integration, and the full SurrealDB ecosystem, including SurrealKit for schema sync, rollouts, seeding, and declarative testing.
Get a full capabilities manifest, decision trees, and output contracts:
uv run {baseDir}/scripts/onboard.py --agent
See AGENTS.md for the complete structured briefing.
| Command | What It Does |
|---------|-------------|
| uv run {baseDir}/scripts/doctor.py | Health check: verify surreal CLI, connectivity, versions |
| uv run {baseDir}/scripts/doctor.py --check | Quick pass/fail check (exit code only) |
| uv run {baseDir}/scripts/schema.py introspect | Dump full schema of a running SurrealDB instance |
| uv run {baseDir}/scripts/schema.py tables | List all tables with field counts and indexes |
| uv run {baseDir}/scripts/onboard.py --agent | JSON capabilities manifest for agent integration |
brew install surrealdb/tap/surreal (macOS) or see install docsbrew install uv (macOS) or pip install uv or see uv docsOptional:
docker run surrealdb/surrealdb:v3)Security note: This skill documents package-manager and container installs only. Prefer auditable installs through Homebrew, apt/dnf, Cargo, npm, or Docker rather than remote one-line shell installers.
Credential warning: Examples below use
root/rootfor local development only. Never use default credentials against production or shared instances. Create scoped, least-privilege users for non-local environments.
# Start SurrealDB in-memory for LOCAL DEVELOPMENT ONLY
surreal start memory --user root --pass root --bind 127.0.0.1:8000
# Start with persistent RocksDB storage (local dev)
surreal start rocksdb://data/mydb.db --user root --pass root
# Start with SurrealKV (time-travel queries supported, local dev)
surreal start surrealkv://data/mydb --user root --pass root
# Connect via CLI REPL (local dev)
surreal sql --endpoint http://localhost:8000 --user root --pass root --ns test --db test
# Import a SurrealQL file
surreal import --endpoint http://localhost:8000 --user root --pass root --ns test --db test schema.surql
# Export the database
surreal export --endpoint http://localhost:8000 --user root --pass root --ns test --db test backup.surql
# Check version
surreal version
# Run the skill health check
uv run {baseDir}/scripts/doctor.py
| Variable | Description | Default |
|----------|-------------|---------|
| SURREAL_ENDPOINT | SurrealDB server URL | http://localhost:8000 |
| SURREAL_USER | Root or namespace username | root |
| SURREAL_PASS | Root or namespace password | root |
| SURREAL_NS | Default namespace | test |
| SURREAL_DB | Default database | test |
These map directly to the surreal sql CLI flags (--endpoint, --user, --pass, --ns, --db) and are recognized by official SurrealDB SDKs.
Full coverage of the SurrealQL query language: CREATE, SELECT, UPDATE, UPSERT, DELETE, RELATE, INSERT, LIVE SELECT, DEFINE, REMOVE, INFO, subqueries, transactions, futures, and all built-in functions (array, crypto, duration, geo, math, meta, object, parse, rand, string, time, type, vector).
See: rules/surrealql.md
Design schemas that leverage SurrealDB's multi-model capabilities -- document collections, graph edges, relational references, vector embeddings, time-series data, and geospatial coordinates -- all in a single database with a single query language.
See: rules/data-modeling.md
First-class graph traversal without JOINs. RELATE creates typed edges between records. Traverse with -> (outgoing), <- (incoming), and <-> (bidirectional) operators. Filter, aggregate, and recurse at any depth.
See: rules/graph-queries.md
Built-in vector similarity search using HNSW and brute-force indexes. Define vector fields, create indexes with configurable distance metrics (cosine, euclidean, manhattan, minkowski), and query with vector::similarity::* functions. Build RAG pipelines and semantic search directly in SurrealQL.
See: rules/vector-search.md
Row-level security via DEFINE TABLE ... PERMISSIONS, namespace/database/record-level access control, DEFINE ACCESS for JWT/token-based auth, DEFINE USER for system users, and $auth/$session runtime variables for permission predicates.
See: rules/security.md
Single-binary deployment, Docker, Kubernetes (Helm charts), storage engine selection (memory, RocksDB, SurrealKV, TiKV for distributed), backup/restore, monitoring, and production hardening.
See: rules/deployment.md
Index strategies (unique, search, vector HNSW, MTree), query optimization with EXPLAIN, connection pooling, storage engine trade-offs, batch operations, and resource limits.
See: rules/performance.md
Official SDKs for JavaScript/TypeScript (Node.js, Deno, Bun, browser), Python, Go, Rust, Java, Kotlin, .NET, C, PHP, Dart, Swift (iOS/macOS/visionOS), and Ruby. Connection protocols (HTTP, WebSocket), authentication flows, live query subscriptions, and typed record handling.
See: rules/sdks.md
New in SurrealDB 3: extend the database with custom functions, analyzers, and logic written in Rust and compiled to WASM. Define, deploy, and manage Surrealism modules.
See: rules/surrealism.md
Upload trained models (PyTorch / ONNX / TensorFlow / scikit-learn / HuggingFace) as .surml artifacts and call them from SurrealQL with ml::name<version>(...). Rolls out via SurrealKit, scopes via DEFINE PERMISSIONS, composes with Surrealism.
See: rules/surrealml.md
The official MCP server lets any MCP-compatible LLM host (Claude Code/Desktop, Cursor, Codex, OpenCode, Amp, Continue, Windsurf) read and write SurrealDB through one configuration entry. Exposes query/select/create/update/merge/delete/relate/live/schema introspection as structured MCP tools.
See: rules/surrealmcp.md, skills/surrealmcp/SKILL.md
Language server (surrealql-language-server), tree-sitter grammar, and official extensions for VS Code / Cursor / Windsurf / VSCodium, JetBrains IDEs, Neovim, Helix, Sublime Text, and Zed. Live schema completion, diagnostics, formatting, and CI lint.
See: rules/editor-tooling.md
langchain-surrealdb (Python) and @langchain/surrealdb (JS) expose SurrealDB as a vector store, retriever, hybrid retriever, and chat message history backend for LangChain 0.3+ pipelines.
See: rules/langchain.md
See: rules/surrealist.md, rules/surreal-sync.md, rules/surrealfs.md, rules/surrealkit.md, rules/surrealml.md, rules/surrealmcp.md, rules/deployment.md (setup-surreal section)
# Full diagnostic (Rich output on stderr, JSON on stdout)
uv run {baseDir}/scripts/doctor.py
# Quick check (exit code 0 = healthy, 1 = issues found)
uv run {baseDir}/scripts/doctor.py --check
# Check a specific endpoint
uv run {baseDir}/scripts/doctor.py --endpoint http://my-server:8000
The doctor script verifies: surreal CLI installed and on PATH, server reachable, authentication succeeds, namespace and database exist, version compatibility, and storage engine status.
# Full schema dump (all tables, fields, indexes, events, accesses)
uv run {baseDir}/scripts/schema.py introspect
# List tables with summary
uv run {baseDir}/scripts/schema.py tables
# Inspect a specific table
uv run {baseDir}/scripts/schema.py table <table_name>
# Export schema as SurrealQL (reproducible DEFINE statements)
uv run {baseDir}/scripts/schema.py export --format surql
# Export schema as JSON
uv run {baseDir}/scripts/schema.py export --format json
Introspection uses INFO FOR DB, INFO FOR TABLE, and INFO FOR NS to reconstruct the full schema.
| Rule File | Coverage |
|-----------|----------|
| rules/surrealql.md | SurrealQL syntax, statements, functions, operators, idioms |
| rules/data-modeling.md | Schema design, record IDs, field types, relations, normalization |
| rules/graph-queries.md | RELATE, graph traversal operators, path expressions, recursive queries |
| rules/vector-search.md | Vector fields, HNSW/brute-force indexes, similarity functions, RAG patterns |
| rules/security.md | Permissions, access control, authentication, JWT, row-level security |
| rules/deployment.md | Installation, storage engines, Docker, Kubernetes, production config, setup-surreal bootstrap CLI |
| rules/performance.md | Indexes, EXPLAIN, query optimization, batch ops, resource tuning |
| rules/sdks.md | JS/TS, Python, Go, Rust, Java, Kotlin, .NET, PHP, Swift, Ruby SDK usage, connection patterns, live queries |
| rules/surrealism.md | WASM extensions, custom functions, Surrealism module authoring |
| rules/surrealml.md | SurrealML model upload, in-database inference, versioning, rollouts |
| rules/surrealmcp.md | Model Context Protocol server: tool catalog, host configuration, transports, deployment |
| rules/editor-tooling.md | LSP, tree-sitter grammar, VS Code / JetBrains / Neovim / Helix / Sublime / Zed extensions |
| rules/langchain.md | LangChain Python + JS integration: vector store, retrievers, chat message history |
| rules/surrealist.md | Surrealist IDE/GUI usage, schema designer, query editor |
| rules/surreal-sync.md | CDC migration tool, source/target connectors, migration workflows |
| rules/surrealfs.md | AI agent filesystem, file storage, metadata, retrieval patterns |
| rules/surrealkit.md | Desired-state schema sync, rollout-based migrations, seeding, and declarative DB testing |
All workflow examples use
root/rootfor local development only. For production, useDEFINE USERwith scoped, least-privilege credentials.
# 1. Verify environment
uv run {baseDir}/scripts/doctor.py
# 2. Start SurrealDB
surreal start rocksdb://data/myproject.db --user root --pass root
# 3. Design schema (use rules/data-modeling.md for guidance)
# 4. Import initial schema
surreal import --endpoint http://localhost:8000 --user root --pass root \
--ns myapp --db production schema.surql
# 5. Introspect to verify
uv run {baseDir}/scripts/schema.py introspect
# 1. Export v2 data
surreal export --endpoint http://old-server:8000 --user root --pass root \
--ns myapp --db production v2-backup.surql
# 2. Review breaking changes (see rules/surrealql.md v2->v3 migration section)
# Key changes: range syntax 1..4 is now exclusive of end, new WASM extension system
# 3. Import into v3
surreal import --endpoint http://localhost:8000 --user root --pass root \
--ns myapp --db production v2-backup.surql
# 4. Verify schema
uv run {baseDir}/scripts/schema.py introspect
# 1. Read rules/data-modeling.md for schema design patterns
# 2. Read rules/graph-queries.md if your domain has relationships
# 3. Read rules/vector-search.md if you need semantic search
# 4. Draft schema.surql with DEFINE TABLE, DEFINE FIELD, DEFINE INDEX
# 5. Import and test
surreal import --endpoint http://localhost:8000 --user root --pass root \
--ns dev --db test schema.surql
uv run {baseDir}/scripts/schema.py introspect
# 1. Read rules/deployment.md for storage engine selection and hardening
# 2. Read rules/security.md for access control setup
# 3. Read rules/performance.md for index strategy
# 4. Run doctor against production endpoint
uv run {baseDir}/scripts/doctor.py --endpoint https://prod-surreal:8000
# 5. Verify schema matches expectations
uv run {baseDir}/scripts/schema.py introspect --endpoint https://prod-surreal:8000
# Check if upstream SurrealDB repos have changed since this skill was built
uv run {baseDir}/scripts/check_upstream.py
# JSON-only output for agents
uv run {baseDir}/scripts/check_upstream.py --json
# Only show repos that have new commits
uv run {baseDir}/scripts/check_upstream.py --stale
Compares current HEAD SHAs and release tags of all tracked repos against the
baselines in SOURCES.json. Use this to plan incremental skill updates.
This skill was refreshed on 2026-05-03 from these upstream sources:
| Repository | Release | Snapshot Date |
|------------|---------|---------------|
| surrealdb/surrealdb | v3.0.5 (main a97d3af, +38 since v3.0.5 toward v3.1.0-alpha) | 2026-04-29 |
| surrealdb/surrealist | surrealist-v3.8.5 | 2026-05-01 |
| surrealdb/surrealdb.js | v2.0.3 | 2026-03-25 |
| surrealdb/surrealdb.py | v2.0.0 (GA) | 2026-05-02 |
| surrealdb/surrealdb.go | v1.4.0 (main aef39d3) | 2026-04-30 |
| surrealdb/surreal-sync | v0.3.4 | 2026-03-11 |
| surrealdb/surrealfs | -- | 2026-01-29 |
| surrealdb/surrealkit | v0.6.0 (pre-release) | 2026-05-03 |
Documentation: surrealdb.com/docs snapshot 2026-05-03.
Machine-readable provenance: SOURCES.json.
All Python scripts in this skill follow a dual-output pattern:
This means 2>/dev/null hides the human output, and piping stdout gives clean JSON for downstream processing.
tools
SurrealMCP -- Model Context Protocol server for SurrealDB. Lets MCP-compatible LLM hosts (Claude Code/Desktop, Cursor, Codex, OpenCode, Amp, Continue, Windsurf) read and write a SurrealDB instance through a single config entry. Part of the surreal-skills collection.
testing
SurrealKit schema sync, rollout migrations, seeding, and declarative testing for SurrealDB apps. Part of the surreal-skills collection.
tools
SurrealDB Surrealism WASM extension development. Write Rust functions, compile to WASM, deploy as database modules. Part of the surreal-skills collection.
development
SurrealFS virtual filesystem for AI agents. Rust core + Python agent (Pydantic AI). Persistent file operations backed by SurrealDB. Part of the surreal-skills collection.