SurrealDB 3 Expert Skill
Expert-level SurrealDB 3 architecture, development, and operations for GitHub Copilot.
When Copilot Should Use This Skill
Activate automatically when the user:
- Writes or asks about SurrealQL queries
- Works with
.surql files
- Designs database schemas for SurrealDB
- Configures SurrealDB deployment or Docker
- Uses SurrealDB SDKs (JavaScript, Python, Go, Rust, Java, .NET)
- Works with graph relationships (RELATE, traversal)
- Implements vector search or RAG patterns
- Configures security, permissions, or access control
- Builds Surrealism WASM extensions
- Migrates data to SurrealDB from other databases
Rules Reference
This skill contains 12 detailed rule files. Read the relevant rule file when
the user's request matches its domain:
| Rule File |
When to Load |
Domain |
| surrealql.md |
Writing or debugging SurrealQL queries |
Full SurrealQL language reference |
| data-modeling.md |
Designing schemas, choosing field types, record IDs |
Multi-model schema design patterns |
| graph-queries.md |
RELATE, graph traversal, path expressions |
Graph edge and traversal patterns |
| vector-search.md |
HNSW indexes, similarity search, embeddings |
Vector search and RAG pipelines |
| security.md |
Permissions, auth, JWT, access control |
Row-level security and auth flows |
| deployment.md |
Installing, configuring, running SurrealDB |
Storage engines, Docker, Kubernetes |
| performance.md |
Slow queries, index strategy, EXPLAIN |
Performance tuning and optimization |
| sdks.md |
Using SurrealDB from application code |
JS, Python, Go, Rust SDK patterns |
| surrealism.md |
Writing WASM extensions |
Rust to WASM extension development |
| surrealist.md |
Using the Surrealist IDE/GUI |
IDE features and schema designer |
| surreal-sync.md |
Migrating from other databases |
CDC sync from Postgres, Mongo, etc. |
| surrealfs.md |
AI agent filesystem operations |
Virtual FS backed by SurrealDB |
Quick Reference
SurrealQL Essentials
-- Create records
CREATE person:alice SET name = 'Alice', age = 30;
-- Graph edges
RELATE person:alice->follows->person:bob SET since = time::now();
-- Traverse graph
SELECT ->follows->person.name AS following FROM person:alice;
-- Vector search (HNSW)
DEFINE INDEX idx_embed ON document FIELDS embedding HNSW DIMENSION 1536 DIST COSINE;
SELECT * FROM document WHERE embedding <|10,40|> $query_vector;
-- Row-level permissions
DEFINE TABLE post SCHEMALESS PERMISSIONS
FOR select WHERE published = true OR user = $auth.id
FOR create, update WHERE user = $auth.id;
-- Live queries
LIVE SELECT * FROM person WHERE age > 25;
Key Concepts
- Record IDs:
table:id (e.g., person:alice) -- first-class citizens, no JOINs needed
- Multi-model: Document + Graph + Vector + Time-series + Geospatial in one DB
- Graph operators:
-> (outgoing), <- (incoming), <-> (bidirectional)
- KNN operator:
<|K,EF|> where K=neighbors, EF=search parameter (NOT distance metric)
- Storage engines: memory, RocksDB, SurrealKV (time-travel), TiKV (distributed)
- WASM extensions: New in v3 -- write Rust, compile to WASM, register with DEFINE MODULE
Scripts
# Health check
uv run scripts/doctor.py
# Schema introspection
uv run scripts/schema.py introspect
# Check upstream for updates
uv run scripts/check_upstream.py
Security Notes
- Examples use
root/root for local development only. Use scoped credentials in production.
- Scripts connect to user-specified endpoints only. No third-party network calls.
- Table names are validated against
[a-zA-Z_][a-zA-Z0-9_]* before query interpolation.
- Prefer
brew install over curl | sh for installing prerequisites.
1---2name: surrealdb3description: Expert SurrealDB 3 skill. Use when working with SurrealDB, SurrealQL queries, multi-model data modeling (document, graph, vector, time-series, geospatial), schema design, graph traversal, vector search, security and permissions, deployment and operations, performance tuning, SDK integration (JavaScript, Python, Go, Rust, Java, .NET), Surrealism WASM extensions, Surrealist IDE, Surreal-Sync migrations, or SurrealFS.4---56# SurrealDB 3 Expert Skill78Expert-level SurrealDB 3 architecture, development, and operations for GitHub Copilot.910## When Copilot Should Use This Skill1112Activate automatically when the user:13- Writes or asks about SurrealQL queries14- Works with `.surql` files15- Designs database schemas for SurrealDB16- Configures SurrealDB deployment or Docker17- Uses SurrealDB SDKs (JavaScript, Python, Go, Rust, Java, .NET)18- Works with graph relationships (RELATE, traversal)19- Implements vector search or RAG patterns20- Configures security, permissions, or access control21- Builds Surrealism WASM extensions22- Migrates data to SurrealDB from other databases2324## Rules Reference2526This skill contains 12 detailed rule files. Read the relevant rule file when27the user's request matches its domain:2829| Rule File | When to Load | Domain |30|-----------|-------------|--------|31| [surrealql.md](../../../rules/surrealql.md) | Writing or debugging SurrealQL queries | Full SurrealQL language reference |32| [data-modeling.md](../../../rules/data-modeling.md) | Designing schemas, choosing field types, record IDs | Multi-model schema design patterns |33| [graph-queries.md](../../../rules/graph-queries.md) | RELATE, graph traversal, path expressions | Graph edge and traversal patterns |34| [vector-search.md](../../../rules/vector-search.md) | HNSW indexes, similarity search, embeddings | Vector search and RAG pipelines |35| [security.md](../../../rules/security.md) | Permissions, auth, JWT, access control | Row-level security and auth flows |36| [deployment.md](../../../rules/deployment.md) | Installing, configuring, running SurrealDB | Storage engines, Docker, Kubernetes |37| [performance.md](../../../rules/performance.md) | Slow queries, index strategy, EXPLAIN | Performance tuning and optimization |38| [sdks.md](../../../rules/sdks.md) | Using SurrealDB from application code | JS, Python, Go, Rust SDK patterns |39| [surrealism.md](../../../rules/surrealism.md) | Writing WASM extensions | Rust to WASM extension development |40| [surrealist.md](../../../rules/surrealist.md) | Using the Surrealist IDE/GUI | IDE features and schema designer |41| [surreal-sync.md](../../../rules/surreal-sync.md) | Migrating from other databases | CDC sync from Postgres, Mongo, etc. |42| [surrealfs.md](../../../rules/surrealfs.md) | AI agent filesystem operations | Virtual FS backed by SurrealDB |4344## Quick Reference4546### SurrealQL Essentials4748```surql49-- Create records50CREATE person:alice SET name = 'Alice', age = 30;5152-- Graph edges53RELATE person:alice->follows->person:bob SET since = time::now();5455-- Traverse graph56SELECT ->follows->person.name AS following FROM person:alice;5758-- Vector search (HNSW)59DEFINE INDEX idx_embed ON document FIELDS embedding HNSW DIMENSION 1536 DIST COSINE;60SELECT * FROM document WHERE embedding <|10,40|> $query_vector;6162-- Row-level permissions63DEFINE TABLE post SCHEMALESS PERMISSIONS64 FOR select WHERE published = true OR user = $auth.id65 FOR create, update WHERE user = $auth.id;6667-- Live queries68LIVE SELECT * FROM person WHERE age > 25;69```7071### Key Concepts7273- **Record IDs**: `table:id` (e.g., `person:alice`) -- first-class citizens, no JOINs needed74- **Multi-model**: Document + Graph + Vector + Time-series + Geospatial in one DB75- **Graph operators**: `->` (outgoing), `<-` (incoming), `<->` (bidirectional)76- **KNN operator**: `<|K,EF|>` where K=neighbors, EF=search parameter (NOT distance metric)77- **Storage engines**: memory, RocksDB, SurrealKV (time-travel), TiKV (distributed)78- **WASM extensions**: New in v3 -- write Rust, compile to WASM, register with DEFINE MODULE7980### Scripts8182```bash83# Health check84uv run scripts/doctor.py8586# Schema introspection87uv run scripts/schema.py introspect8889# Check upstream for updates90uv run scripts/check_upstream.py91```9293## Security Notes9495- Examples use `root/root` for local development only. Use scoped credentials in production.96- Scripts connect to user-specified endpoints only. No third-party network calls.97- Table names are validated against `[a-zA-Z_][a-zA-Z0-9_]*` before query interpolation.98- Prefer `brew install` over `curl | sh` for installing prerequisites.