convex-schema-validator

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

1|Updated Feb 19, 2026
One-click install
npx skills add https://github.com/kausthubh-coder/kriyan-web --skill convex-schema-validator-kausthubh-coder
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: convex-schema-validator
Source: https://github.com/kausthubh-coder/kriyan-web/tree/main/.cursor/skills/convex-schema-validator
Command: npx skills add https://github.com/kausthubh-coder/kriyan-web --skill convex-schema-validator-kausthubh-coder

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Designing Convex database schemas requires correct validator typing, index configuration, and safe migration patterns, and mistakes like missing indexes or non-optional new fields can break queries or existing data. ## Core Features & Use Cases - Typed Schema Definition: Build tables with the full set of Convex validators including strings, numbers, unions, literals, records, optional fields, and document references. - Index and Search Configuration: Configure single-field, compound, and full-text search indexes with 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 a Convex-backed app, use this Skill to write a complete schema.ts with discriminated unions for event tables, compound indexes for filtered queries, and a backfill mutation for a newly added column. ## Quick Start Ask the AI to define a Convex schema for your tables with proper validators, indexes, and an optional-field migration plan.

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 table declares field types like v.string(), v.number(), v.id(), and v.optional(), giving you end-to-end type safety in queries and mutations.

How do I add an index to a Convex table?▼

Add indexes by chaining .index() on defineTable with a name and ordered field list, such as .index("by_channel_and_time", ["channelId", "sentAt"]). Use .searchIndex() for full-text search with a searchField and optional filterFields.

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

An optional field via v.optional(v.string()) may be absent from the document entirely, while a nullable field via v.union(v.string(), v.null()) must exist but can hold null. You can combine both with v.optional(v.union(v.string(), v.null())).

How do I migrate a Convex schema when adding new fields?▼

Add new fields as optional first so existing documents remain valid, then backfill values with an internal mutation that patches documents missing the field. After backfilling, you can update the schema to make the field required.

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

Every query using withIndex requires a corresponding index defined in the schema with matching fields in the same order. Define the index in schema.ts with .index() and ensure the field order matches how the query filters and sorts.