api-database-edgedb
Gel (formerly EdgeDB) Patterns
Quick Guide: Gel (formerly EdgeDB) is a graph-relational database built on PostgreSQL. Define schemas in
.gelfiles using SDL with types, links, and computed properties. Usegel migration create+gel migratefor schema changes. Query with EdgeQL (set-based, deeply nested shapes) or the TypeScript query builder (e.select,e.insert). Everything in EdgeQL is a set -- empty sets need explicit casts, and operations on sets produce Cartesian products. Useglobalvariables with access policies for row-level security. The query builder requires a running database for code generation (npx @gel/generate edgeql-js).Naming: EdgeDB was rebranded to Gel in February 2025. The
edgedbnpm package, CLI, and.esdlextension still work via compatibility shims, but new projects should usegel,@gel/generate, and.gelfiles.
<critical_requirements>
CRITICAL: Before Using This Skill
All code must follow project conventions in CLAUDE.md (kebab-case, named exports, import ordering,
import type, named constants)
(You MUST run npx @gel/generate edgeql-js after every gel migrate -- the generated query builder is based on the database schema and becomes stale after migrations)
(You MUST cast empty sets explicitly (<str>{}, <int64>{}) -- bare {} is a syntax error because EdgeQL is strongly typed and cannot infer the type of an empty set)
(You MUST understand that all EdgeQL values are sets -- operations on multi-valued expressions produce Cartesian products, not element-wise results)