agentleFS
surrealdbsurrealdb/agent-skills/skills/surrealdb-cli/SKILL.md

surrealdb-cli

Skill29 starsChanged 8 days agoMITView on GitHub

Use the `surreal` command-line binary to run a SurrealDB server (in-memory, RocksDB, SurrealKV, or TiKV), open an interactive or piped SQL REPL, import and export databases, check server readiness, install, switch and pin multiple database versions (`surreal +4.0.1 db …`), repair storage, and manage SurrealML models. Use this skill whenever users run, connect to, back up, restore, or operate SurrealDB from the terminal. Triggers: surreal db start, surreal db sql, surreal db import, surreal db export, surreal install, surreal cloud, surreal memory, surreal use, surreal list, surreal upgrade, surreal +VERSION, surreal fix, surreal ml, SurrealDB CLI, surreal server.

  • Pipes a download into a shell
  • Installs packages

2 other projects use a version of this, 1 of them edited.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 0 are distinctive, and 4 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.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Verify with surreal --version (launcher) and surreal list (installed components and versions).

    line 37
  2. Very specific:

    When a task needs one of these (managing a Cloud instance, storing or recalling agent memory), check surreal list, install the component if …

    line 91
  3. Very specific:

    Run surreal db fix after a major upgrade: if the server reports an incompatible storage version, pointing it at the same PATH used by …

    line 152
  4. Very specific:

    Pin the version for anything that matters: Use +VERSION (or surreal use) so scripts do not change behaviour when the default moves.

    line 153

≈ “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

SurrealDB CLI

A skill for driving the surreal command-line binary — SurrealDB's all-in-one launcher for running a server, querying it, moving data in and out, and installing multiple database versions side by side.

This skill covers operating the surreal binary itself. To write the SurrealQL that you run with it, use the surrealql skill; for declarative schema migrations and type generation, use the surrealkit skill.

When to use this skill

Reference these guidelines when:

  • Starting a SurrealDB server, locally or in a container (surreal db start)
  • Opening the SQL shell or piping queries from a file (surreal db sql)
  • Importing or exporting a database for backups, seeding, or migration (surreal db import / surreal db export)
  • Gating scripts or CI on server availability (surreal db is-ready)
  • Installing, switching, pinning or running a specific database version (surreal install, surreal use, surreal +4.0.1 db …)
  • Installing or using the cloud, memory, kit, lsp, ent or ext components (surreal install cloud, surreal memory --help)
  • Upgrading the CLI or database, or repairing on-disk storage after an upgrade (surreal upgrade / surreal db fix)
  • Importing or exporting SurrealML models (surreal db ml, db 3.x only)

Installation

MethodCommand
curl (macOS / Linux)curl -sSf https://install.surrealdb.com | sh
Windows (PowerShell)iwr https://windows.surrealdb.com -useb | iex
Homebrewbrew install surrealdb/tap/surreal
Dockerdocker run --rm --pull always -p 8000:8000 surrealdb/surrealdb:latest start

Verify with surreal --version (launcher) and surreal list (installed components and versions). Pin a specific image tag (not latest) for production. See the install docs for the current set of methods.

Components & versions

surreal is a launcher (v1.x) that dispatches to separately installed components: db (the database), ent, memory, cloud, ext, kit, lsp. Server commands live under db: surreal db start, not surreal start. The bare forms (surreal start, surreal sql, surreal version, …) still run but are deprecated and print a warning.

Several db versions can be installed at once. Prefix any command with +VERSION to run that version for just that command:

surreal list                          # components, default version, installed versions
surreal install db@4.0.1              # install beside existing versions
surreal +4.0.1 db start --user root --pass root memory   # run 4.0.1 once
surreal +3.3.5 db export --ns main --db main > dump.surql
surreal use db@4.0.1                  # make 4.0.1 the default (no download)

+VERSION must already be installed; otherwise the CLI tells you to run surreal install db@VERSION. Use +VERSION to try a new major against a copy of your data, or to export from an old server and import into a new one. See maintenance.md for install, use, upgrade and uninstall.

The db surface differs by version — 4.x has no ml, module, upgrade or v2 subcommands. Check surreal +VERSION db --help.

Other components

Besides db, the launcher fronts these components. They are not installed by default: running one that is missing fails with an install hint (it will not download without confirmation). Install on demand, and learn each one's arguments from its own --help rather than guessing — their surface changes independently of db.

ComponentPurposeInstall
cloudSurrealDB Cloud: organisations, instances, backups, teamssurreal install cloud
memoryAgent memory: remember, recall, reflectsurreal install memory
kitSchema migrations, seed data, typegen, tests (see the surrealkit skill)surreal install kit
lspSurrealQL language server for editors (see the surrealql-functions skill)surreal install lsp
entSurrealDB Enterprise, the licensed edition of the databasesurreal install ent
extBuild and run WebAssembly extensionssurreal install ext
surreal list                    # which components are installed
surreal install cloud           # install (add -y to skip the prompt)
surreal cloud --help            # discover subcommands and flags
surreal memory --help

When a task needs one of these (managing a Cloud instance, storing or recalling agent memory), check surreal list, install the component if the user's task calls for it, then use surreal <component> --help and surreal <component> <subcommand> --help to work out the arguments. Both cloud and memory act on remote accounts or data, so confirm destructive operations (deleting instances, forgetting memories) with the user first.

Command map

CommandPurposeReference
surreal db start [PATH]Run the database server with a chosen storage backendstart.md
surreal db sqlInteractive REPL or piped, non-interactive queryingsql.md
surreal db import <FILE>Load a SurrealQL script into a databaseimport-export.md
surreal db export [FILE]Dump a database to SurrealQL (file or stdout)import-export.md
surreal db is-readyExit 0 when the server is accepting connections (alias isready)maintenance.md
surreal db versionPrint the db version and remote server versionmaintenance.md
surreal list / install / use / uninstallManage installed component versionsmaintenance.md
surreal upgrade [COMPONENT[@VERSION]]Upgrade the launcher and componentsmaintenance.md
surreal db fix [PATH]Migrate on-disk storage to the current formatmaintenance.md
surreal db ml <sub>Import / export SurrealML models (db 3.x only)maintenance.md

surreal db validate (SurrealQL file checking) and formatting are covered by the surrealql skill. surreal db mcp (MCP server over stdio) also exists — run surreal db --help to confirm the surface of the installed version. Other components are covered under "Other components" above.

Connection flags & env vars

db sql, db import, db export, and db ml share the same connection flags. Each flag has a SURREAL_* environment variable fallback; an explicit flag wins.

Flag (aliases)Env varNotes
-e, --endpoint—ws://localhost:8000 for sql; http://localhost:8000 for import/export
--namespace (--ns)SURREAL_NAMESPACERequired for import/export/ml
--database (--db)SURREAL_DATABASERequired for import/export/ml
-u, --username (--user)SURREAL_USER
-p, --password (--pass)SURREAL_PASS
-t, --tokenSURREAL_TOKENJWT; use instead of username/password
--auth-levelSURREAL_AUTH_LEVELroot (default), namespace/ns, or database/db

Pass secrets via env vars rather than flags so they do not leak into shell history or process listings.

Quick start

# 1. Start an authenticated in-memory server (foreground)
surreal db start --user root --pass root memory

# 2. In another shell, open the SQL REPL on namespace/database "main"
surreal db sql --endpoint ws://localhost:8000 \
  --user root --pass root --ns main --db main --pretty

# 3. Load a dump into that database
surreal db import --endpoint http://localhost:8000 \
  --user root --pass root --ns main --db main backup.surql

Rules & conventions

  • Authentication is on by default. surreal db start needs --user/--pass; only use --unauthenticated for throwaway local instances.
  • Choose a storage backend deliberately. memory (the default) is ephemeral — data vanishes on exit. Use rocksdb:/surrealkv:// for persistence and tikv:// for distributed clusters. See start.md.
  • Export defaults to stdout. surreal db export writes to - (stdout) unless you give a file path; redirect or pipe accordingly.
  • Gate CI with is-ready. It returns a non-zero exit code until the server accepts connections — ideal in healthchecks and scripts.
  • Run surreal db fix after a major upgrade if the server reports an incompatible storage version, pointing it at the same PATH used by start.
  • Pin the version for anything that matters. Use +VERSION (or surreal use) so scripts do not change behaviour when the default moves; back up with export before running a new major against existing data.
  • The CLI evolves. Confirm flags and subcommands against surreal db <command> --help (or surreal +VERSION db …); this skill reflects launcher 1.2 with db 3.3 / 4.0.

References

  • Running a server and storage backends — references/start.md
  • Interactive and piped querying — references/sql.md
  • Importing and exporting data — references/import-export.md
  • Versioning, upgrades, readiness, repair, and ML models — references/maintenance.md

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.