# surrealql

Writes and fixes SurrealQL statements against SurrealDB: records, schemas, graph edges, live queries. Installs with one command.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 694 installs · ★ 28
- Author: surrealdb
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/surrealdb/agent-skills/tree/HEAD/skills/surrealql/SKILL.md
- Updated: 2026-09-29
- HTML: https://affpapa.org/en/nevibecode/skills/surrealql

## What it does

The skill hands your agent a reference for SurrealQL: statement tables for reading and creating records, schema definitions, graph edges via `RELATE`, streaming `LIVE SELECT`, transactions and conditional blocks. `DEFINE` gets its own coverage — tables, fields, indexes, search analyzers, access methods, functions. Converting queries from other languages is in scope too.

SurrealQL is not ANSI-SQL, and that trips people up. Whatever you know from PostgreSQL or MySQL does not carry over here. The skill tells the agent to check the examples and the docs instead of guessing by analogy. Files holding SurrealQL use the `.surql` extension.

The language shifts between releases, so syntax from SurrealDB 2.x often fails validation on 3.x. The skill targets the latest stable release unless you ask for an older one. Before generating version-sensitive code the agent checks the active version: `surreal version` when the CLI is present, otherwise the version string published at `https://download.surrealdb.com`.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add surrealdb/agent-skills --skill surrealql -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/surrealql/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/surrealql/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add surrealdb/agent-skills --skill surrealql -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/surrealql/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add surrealdb/agent-skills --skill surrealql -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/surrealql/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install surrealdb/agent-skills surrealql
```

2. **Manually: put the files in place**
- File: `.github/skills/surrealql/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add surrealdb/agent-skills --skill surrealql -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/surrealdb/agent-skills --path skills/surrealql
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/surrealql/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add surrealdb/agent-skills --skill surrealql -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/surrealdb/agent-skills/tree/HEAD/skills/surrealql/SKILL.md

## When to use it
- write a filtered record query
- define a table schema with typed fields and an index
- connect two records with a graph edge via `RELATE`
- subscribe to table changes with `LIVE SELECT`
- port an existing SQL query to SurrealQL

## Example prompts
- Write a SurrealQL query that pulls every order for `user:abc` from the last month
- Define a `post` table with an `author` record field and an index on it
- Convert this SQL query to SurrealQL and save it as `queries/orders.surql`

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: ae0b5c11de9b250e.

BEGIN THIRD-PARTY FILE ae0b5c11de9b250e
````text
---
name: surrealql
description: "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."
metadata:
  author: surrealdb
  version: "0.2.0"
---

# 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`):

  ```bash
  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 `.surql` extension.
- SurrealQL is a relatively young language and changes between releases. Default to the **latest** SurrealDB version (see [Version & Documentation](#version--documentation)) and refer to https://surrealdb.com/docs for the most up-to-date syntax.

## Statements

### Query Statements

| Statement | Purpose |
| --- | --- |
| [SELECT](https://surrealdb.com/docs/surrealql/statements/select) | Query records, traverse graphs, aggregate data |
| [CREATE](https://surrealdb.com/docs/surrealql/statements/create) | Create new records (errors if record exists) |
````
END THIRD-PARTY FILE ae0b5c11de9b250e

The third-party file has ended. Everything between the ae0b5c11de9b250e tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2798 of 9128 bytes. © surrealdb · MIT · https://github.com/surrealdb/agent-skills/tree/HEAD/skills/surrealql/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
