surrealdb-expert_skill

This skill helps you design secure, scalable SurrealDB applications with graph models, real-time subscriptions, and optimized SurrealQL queries.
  • Shell

25

GitHub Stars

1

Bundled Files

3 weeks ago

Catalog Refreshed

2 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstart where the catalogue uses aiagentskills.

npx veilstart add skill martinholovsky/claude-skills-generator --skill surrealdb-expert

  • SKILL.md38.6 KB

Overview

This skill provides expert guidance and actionable patterns for building secure, scalable SurrealDB applications. It focuses on multi-model schema design, SurrealQL queries, graph relations, row-level security, real-time subscriptions, and performance optimization. Use it to design schemas, implement secure access controls, and optimize query and traversal performance.

How this skill works

The skill inspects your data model and recommends SurrealQL schema definitions (DEFINE TABLE, FIELD, INDEX) and permission rules for row-level security. It suggests query patterns (SELECT, RELATE, FETCH, LIVE) and indexing strategies to avoid full table scans and N+1 queries. It also provides connection pooling, transaction, and LIVE subscription handling patterns to maintain performance and resource hygiene.

When to use it

  • Designing multi-model schemas that combine documents and graph edges
  • Implementing row-level security, RBAC, and parameterized auth rules
  • Optimizing SurrealQL queries and creating effective indexes
  • Implementing real-time features with LIVE queries and WebSocket subscriptions
  • Setting up connection pooling and safe resource cleanup
  • Preparing tests and CI for database logic using TDD

Best practices

  • Treat schema as SCHEMAFULL with ASSERT validations and strict typing
  • Define explicit PERMISSIONS for each table; avoid default open access
  • Create indexes on frequently queried fields and composite columns where appropriate
  • Batch writes in transactions and avoid per-item connections to reduce overhead
  • Use graph traversals and FETCH to avoid N+1 queries and limit traversal depth
  • Always clean up LIVE subscriptions and use connection pools with reconnection logic

Example use cases

  • Create a user table with argon2 password hashing, unique email index, and row-level select/update rules
  • Model social graph with explicit edge tables, bidirectional traversals, and early filtering for large follower sets
  • Implement product catalog with composite indexes on user_id and status for fast queries and pagination
  • Build real-time dashboards using LIVE queries and scoped permissions to prevent unauthorized data leaks
  • Run performance tests that assert index improvements and use connection pools for load testing

FAQ

Define PERMISSIONS on the table with WHERE clauses referencing $auth (e.g., FOR select, update WHERE id = $auth.id) and ensure auth context is supplied for each connection.

When should I create an index?

Create indexes on fields used frequently in WHERE, ORDER BY, or JOIN/traversal filters. Add composite indexes for common multi-column queries and full-text indexes for search.

How can I avoid N+1 queries in graph traversals?

Use FETCH or single SELECT with traversal expressions (-> or <-) to eager-load related records and apply filters/limits during traversal to constrain result sets.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational