convex-schema-validator

Define and validate Convex database schemas with typed validators, indexes, and migration strategies.

Updated May 28, 2026
One-click install
npx skills add https://github.com/mrisoli/pokerhouse --skill convex-schema-validator-mrisoli
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: convex-schema-validator
Source: https://github.com/mrisoli/pokerhouse/tree/main/.agents/skills/convex-schema-validator
Command: npx skills add https://github.com/mrisoli/pokerhouse --skill convex-schema-validator-mrisoli

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Designing Convex database schemas requires correct validator types, index configuration, and safe migration patterns; mistakes cause broken queries, lost type safety, or failed deployments. ## Core Features & Use Cases - Schema Definition: Build typed tables using Convex validators such as v.string(), v.id(), v.union(), v.optional(), and v.record() with full TypeScript inference. - Index Configuration: Create single-field, compound, and full-text search indexes with descriptive naming conventions that match query patterns. - Migration Strategies: Add optional fields, backfill data with internal mutations, and safely promote optional fields to required ones. - Use Case: When building an e-commerce backend on Convex, use this Skill to define users, products, orders, and reviews tables with proper indexes and discriminated unions for order status. ## Quick Start Ask the AI to define a Convex schema for your app's tables with appropriate validators, indexes, and optional fields for future migrations.

Frequently Asked Questions about convex-schema-validator

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

FAQPage Schema
How do I define a schema in Convex?▼

Define a Convex schema in convex/schema.ts using defineSchema and defineTable with validators from convex/values. Each field uses a validator like v.string(), v.number(), or v.id("table") to enforce types at the database level.

How do I add indexes to a Convex table?▼

Add indexes by chaining .index() on defineTable with a name and field array, such as .index("by_channel", ["channelId"]). Compound indexes list multiple fields in query order, and searchIndex enables full-text search with filter fields.

What is the difference between optional and nullable fields in Convex?▼

An optional field using v.optional(v.string()) may not exist on the document, while a nullable field using v.union(v.string(), v.null()) must exist but can hold null. Use optional fields when adding new columns to existing data.

How do I migrate a Convex schema without breaking existing data?▼

Add new fields as optional first, then run an internal mutation to backfill values for existing documents. After backfilling completes, update the schema to make the field required.

Why does my Convex query fail with a missing index error?▼

Queries using withIndex require a corresponding index defined in the schema with matching fields in the same order. Define the index in schema.ts and deploy so Convex builds it before querying.