后端与数据库

convex-schema-validator

waynesutton/bui…r-skills

Designs convex/schema.ts tables, validators, indexes, and relationships, and keeps the schema honest as data evolves. Use when creating tables, adding fields, choosing index fields, modeling relationships, or when a validator error appears at deploy time.

  • 2942 次安装
  • 405 星标
  • 收录于

安装命令

npx skills add https://github.com/waynesutton/builder-skills --skill convex-schema-validator

SKILL.md

Convex schema validator

Produces a convex/schema.ts that types every document, indexes every query path, and passes validation against the data already in the database. The one rule: every withIndex in a function needs a matching .index() here, named after its fields, queried in field order.

When to reach for this

  • Creating a new table or adding a field to an existing one
  • A query uses .filter() and needs an index instead
  • Deciding whether to embed an object or link with v.id
  • Modeling a document that comes in several shapes
  • npx convex dev fails with a schema validation error

Schema skeleton

// convex/schema.ts
import { defineSchema, defineTable } from "convex/server";
import { v } from "convex/values";