surrealdb-python — Claude Code skill: features and installation
Guidance for using SurrealDB from Python, with WebSocket client/server connections and embedded in-memory or file-based storage. Useful for Python CRUD work or running a database without a separate server.
npx skills add surrealdb/agent-skills --skill surrealdb-python -a claude-codeWhat surrealdb-python does
The skill covers the surrealdb Python SDK in two modes. For client/server use, it shows connecting with Surreal, signing in, selecting a namespace and database, and running CRUD operations or queries. The server examples start SurrealDB with RocksDB or in memory.
Embedded mode runs SurrealDB inside the Python process. Use mem:// for in-memory storage or file:// for persistence, with examples for both Surreal and AsyncSurreal. Server-mode examples connect over WebSocket, so the SurrealDB server needs to be running before the client code can connect.
What it helps with
- connect a Python app to SurrealDB over WebSocket
- create, read, update, or delete records from Python
- run database queries through the Python SDK
- use in-memory or file-based storage without a separate server
Example prompts for the agent
- Show me how to connect my Python app to SurrealDB over WebSocket and perform CRUD operations.
- Run SurrealDB in memory from Python using the SDK.
- Set up file-based persistence with
AsyncSurrealandfile://.
How to install surrealdb-python
1Skills CLI (Vercel)
npx skills add surrealdb/agent-skills --skill surrealdb-python -a claude-code2Manually: put the files in place
~/.claude/skills/surrealdb-python/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/surrealdb-python/
1Skills CLI (Vercel)
npx skills add surrealdb/agent-skills --skill surrealdb-python -a codex2Manually: put the files in place
.agents/skills/surrealdb-python/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add surrealdb/agent-skills --skill surrealdb-python -a cursor2Manually: put the files in place
.cursor/skills/surrealdb-python/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install surrealdb/agent-skills surrealdb-python2Manually: put the files in place
.github/skills/surrealdb-python/SKILL.md1Skills CLI (Vercel)
npx skills add surrealdb/agent-skills --skill surrealdb-python -a gemini-cli2Platform CLI
gemini skills install https://github.com/surrealdb/agent-skills --path skills/surrealdb-pythonManually: put the files in place
.devin/skills/surrealdb-python/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add surrealdb/agent-skills --skill surrealdb-python -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about surrealdb-python
How do I install surrealdb-python in Claude Code?
Run npx skills add surrealdb/agent-skills --skill surrealdb-python -a claude-code. The skill file is at ~/.claude/skills/surrealdb-python/SKILL.md.
What does surrealdb-python do?
It guides Python use of the surrealdb SDK, including server connections, CRUD operations, queries, and embedded storage.
Can I use SurrealDB without running a separate server?
Yes. The skill covers embedded use inside a Python process, with mem:// for in-memory storage and file:// for file-based persistence. It includes Surreal and AsyncSurreal variants.
Source text
SKILL.md · MIT
---
name: surrealdb-python
description: "Using SurrealDB with the Python SDK, covering both client/server mode (WebSocket) and embedded mode (in-memory or file-based). Use when connecting to SurrealDB from Python, using the surrealdb Python package, running SurrealDB embedded without a server, or performing CRUD operations from Python code. Triggers: surrealdb Python, Surreal(), AsyncSurreal(), Python SDK, embedded SurrealDB, mem://, file://."
metadata:
author: surrealdb
version: "0.1.0"
---
# SurrealDB Python SDK
## Running SurrealDB (Server Mode)
Persist data with RocksDB:
```bash
surreal start -u root -p root rocksdb:database
```
In-memory:
```bash
surreal start -u root -p root
```
## Client/Server Mode
Connect via WebSocket using the `Surreal` context manager:
```python
from surrealdb import Surreal
with Surreal("ws://localhost:8000/rpc") as db:
db.signin({"username": "root", "password": "root"})
db.use("namespace_test", "database_test")
db.create(
"person",
{
"user": "me",
"password": "safe",
"marketing": True,
"tags": ["python", "documentation"],
},
)
print(db.select("person"))
print(db.update("person", {
"user": "you",
"password": "very_safe",
"marketing": False,
"tags": ["Awesome"],
}))
print(db.delete("person"))
db.query("""
insert into person {
user: 'me',
password: 'very_safe',
tags: ['python', 'documentation']
};
""")
print(db.query("select * from person"))
print(db.query("""
update person content {
user: 'you',
password: 'more_safe',
tags: ['awesome']
};
"""))
print(db.query("delete person"))
```
## Embedded Mode
Run SurrealDB directly inside your Python process — no server required.
- **In-memory**: `Surreal("mem://")` / `AsyncSurreal("mem://")`
- **File-based persistence**: `Surreal(f"file://{db_path}")` / `AsyncSurreal(f"file://{db_path}")`
See [references/embedded.md](references/embedded.md) for a complete async
example with file-based persistence.
© surrealdb · MIT · surrealdb/agent-skills