surrealdb-expert

Design secure SurrealDB schemas and SurrealQL queries with SCHEMAFULL tables and parameterized operations.

3|1|Updated Dec 3, 2025
One-click install
npx skills add https://github.com/Probably-Group/Dev-AID --skill surrealdb-expert-probably-group
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: surrealdb-expert
Source: https://github.com/Probably-Group/Dev-AID/tree/main/.dev-aid/skills/expert/surrealdb-expert
Command: npx skills add https://github.com/Probably-Group/Dev-AID --skill surrealdb-expert-probably-group

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill prevents unsafe, fragile, and insecure SurrealDB usage by giving production-oriented schema and query rules, including defenses against SurrealQL injection, unsafe LIVE subscriptions, and schema/data integrity failures.

Core Features & Use Cases

  • SurrealQL safety guardrails: Enforces parameterized queries via $vars/bind patterns and discourages query string interpolation to reduce injection risk.
  • Secure schema design: Recommends SCHEMAFULL tables with ASSERT constraints, explicit PERMISSIONS, and appropriate field types/READONLY defaults.
  • Graph & real-time correctness: Guides correct use of RELATE for edges and safe LIVE query lifecycle management to avoid permission leaks and resource issues.
  • Transactional integrity: Promotes atomic multi-step updates using BEGIN TRANSACTION / COMMIT TRANSACTION patterns with validation.

Use Case: You are building a multi-tenant SurrealDB-backed app with users and document-like records, and you need to generate a secure table schema, graph edges, and safe parameterized queries for both standard CRUD and real-time updates.

Quick Start

Use the surrealdb-expert skill to generate the SurrealQL schema for your tables (with SCHEMAFULL, ASSERT validation, and explicit PERMISSIONS) and then produce parameterized queries for the core operations of your app.

Frequently Asked Questions about surrealdb-expert

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write secure SurrealQL queries to prevent injection?

Secure SurrealQL queries use parameterized variables with `$vars` and bind patterns instead of string interpolation. This approach binds user-controlled values separately from the query structure, preventing SurrealQL injection vulnerabilities.

What is the best way to define a SurrealDB schema with validation and permissions?

SurrealDB schema design uses SCHEMAFULL tables with explicit PERMISSIONS and ASSERT constraints for input validation. This enforces authorization, data integrity, and field-level validation while restricting unauthorized access.

How do I safely manage LIVE query subscriptions in SurrealDB?

Safe LIVE query subscriptions require restricted access patterns and proper lifecycle management with cleanup. This prevents permission leaks and avoids resource issues from abandoned real-time subscriptions.

How do I create graph relationships in SurrealDB using SurrealQL?

SurrealDB graph relationships use the RELATE statement to create edges between records. This enables multi-model data modeling by connecting document-like records with typed graph relations.

When do I need transactions for multi-step SurrealQL operations?

Transactions are required for atomic multi-step SurrealQL updates to maintain data integrity. Using BEGIN TRANSACTION and COMMIT TRANSACTION patterns ensures that complex operations with validation either fully succeed or roll back entirely.

How do I implement multi-tenant RBAC permissions in a SurrealDB schema?

Multi-tenant RBAC permissions in SurrealDB are implemented through explicit PERMISSIONS on SCHEMAFULL tables. This enforces authorization constraints alongside ASSERT validation to isolate tenant data access.