surrealql
FreeNo executable scriptsNot checkedGenerate and modify SurrealQL queries to interact with SurrealDB databases. This includes creating and retrieving records, designing and managing schemas…
by surrealdb★ 29 GitHub starsAbout this skill
SurrealQL
A skill for writing and modifying SurrealQL queries to interact with SurrealDB databases.
SurrealQL is the official query language for SurrealDB. It is a modern, flexible, and powerful query language that is designed to be easy to learn and use.
When to use this skill
Reference these guidelines when:
- Writing, modifying, or troubleshooting SurrealQL queries
- Designing or managing schemas
- Converting other query languages to SurrealQL
Version & Documentation
Always target the latest stable SurrealDB release. SurrealQL evolves between major versions, and syntax from older releases (e.g. SurrealDB 2.x) is a common source of incorrect, non-validating queries. Unless the user explicitly asks for an older version, generate current (3.x) syntax.
Determine the active version before generating version-sensitive syntax:
If the SurrealDB CLI is installed, run
surreal version.Otherwise, the latest released version is published as a plain string at
https://download.surrealdb.com(e.g.v3.1.4):curl -s https://download.surrealdb.com
https://surrealdb.com/docs always documents the latest stable release —
treat it as the source of truth for current syntax. When in doubt about whether
a function or form still applies (for example type::* helpers and how record
IDs are constructed), confirm against the current docs rather than assuming
older behavior.
Rules & Conventions
- SurrealQL is NOT ANSI-SQL. Never assume SQL knowledge from other databases applies. Always refer to the examples below or the documentation at https://surrealdb.com/docs for accurate syntax and behavior.
- When SurrealQL is stored in a file, it should have a
.surqlextension. - SurrealQL is a relatively young language and changes between releases. Default to the latest SurrealDB version (see Version & Documentation) and refer to https://surrealdb.com/docs for the most up-to-date syntax.
Statements
Query Statements
| Statement | Purpose |
|---|---|
| SELECT | Query records, traverse graphs, aggregate data |
| CREATE | Create new records (errors if record exists) |
| INSERT | Insert one or more records or graph edges; supports ON DUPLICATE KEY UPDATE |
| UPDATE | Update existing records (no-op if record doesn't exist) |
| UPSERT | Insert a record, or update it if it already exists |
| DELETE | Delete records or graph edges |
| RELATE | Create graph edges between records |
| LIVE SELECT | Stream real-time changes to a table |
| KILL | Cancel an active LIVE SELECT query |
| LET | Assign a value to a parameter |
| RETURN | Return a value from a block or function |
Schema & Resource Statements
| Statement | Purpose |
|---|---|
| DEFINE NAMESPACE | Define a namespace |
| DEFINE DATABASE | Define a database |
| DEFINE TABLE | Define a table (schemafull, schemaless, as view) |
| DEFINE FIELD | Define a field with type, default, assertion |
| DEFINE INDEX | Define an index (unique, search, vector) |
| DEFINE EVENT | Define event triggers on a table |
| DEFINE FUNCTION | Define a custom function |
| DEFINE ANALYZER | Define a search analyzer |
| DEFINE ACCESS | Define authentication access methods (Bearer, JWT, Record) |
| DEFINE API | Define an API endpoint |
| DEFINE BUCKET | Define a storage bucket |
| DEFINE CONFIG | Define a configuration |
| DEFINE MODULE | Define a Surrealism extension module |
| [DEFINE PARAM](https://surrealdb.com/docs/surrealql/statements/define/p |
Install surrealql in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
FAQ
What does the surrealql skill do?
Generate and modify SurrealQL queries to interact with SurrealDB databases. This includes creating and retrieving records, designing and managing schemas, establishing and querying graph relationships, performing live (real-time) queries, and leveraging all unique SurrealQL features for advanced database workflows. Use this skill whenever users need to write, adapt, or troubleshoot SurrealQL statements.
How do I install the surrealql skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the surrealql skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
by Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
by Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
by Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
by Anthropic