Skip to content
Convex Live Migrations

Convex Live MigrationsSkill

Added to Onei
Repository Docs

Summary

Convex's official skill for changing the schema of a deployed app without breaking it — add the field optional, backfill with @convex-dev/migrations, verify, then tighten the validator.

Features

  • Four-step order: optional field, backfill, verify, then require
  • Uses @convex-dev/migrations for the backfill
  • Blocks tightening a validator before the backfill completes
  • Verifies row counts before and after
  • Points at convex-migrate-rehearse for a preview-first, rollback-backed variant

Install This Skill

Add this skill to your favorite AI agent in a few steps.

Any AI agent

This skill is plain instructions — it works with any assistant that accepts custom instructions or system prompts.

  1. Copy the skill content with the button below.
  2. Paste it into your agent's instruction file or system prompt (for example AGENTS.md, .cursorrules, or a custom instructions field).
  3. Ask the agent to apply the skill whenever the task matches.

Skill Content

Markdown Content

Copy this content and use it with your preferred AI agent

---
name: convex-migrate
description: "Migrate schema + backfill data on a deployed Convex app using @convex-dev/migrations."
---

<!-- GENERATED from convex-agents content/capabilities/migrate.json — do not edit by hand. -->

# Migrate the schema / data on a live app

Change a deployed schema without breaking existing data: stage the schema change, install @convex-dev/migrations, write a backfill that makes old rows valid, run it, and verify before tightening the validator.

## Workflow

1. Make the new field optional first (so deploy doesn't reject existing rows).
2. Install @convex-dev/migrations; write a migration that backfills/transforms existing rows.
3. Run the migration; verify all rows are valid.
4. Tighten the validator (make the field required) once the backfill is complete.

## Rules

- Never tighten a validator before the backfill completes — it rejects existing rows and breaks the live app.
- Add new fields as optional first, migrate, then require.
- Verify row counts before and after.

Usage Instructions

Learn how to use this skill with different AI agents.

Claude Desktop

In Claude Code: /convex-migrate.

Example Usage

I need to add a required organizationId to the users table on a live Convex deployment — plan and run the migration safely.

Description

Convex validates every document against the schema, which is exactly what you want until the day you add a required field to a table that already has rows in production. Then the deploy rejects the existing data and the live app breaks. This skill encodes the four-step order that avoids that, and — more usefully — states the rule that makes the order non-negotiable.

The workflow. Make the new field optional first, so the deploy accepts existing rows. Install @convex-dev/migrations and write a migration that backfills or transforms those rows. Run it and verify every row is now valid. Only then tighten the validator to make the field required.

The rules it will not let an agent skip. Never tighten a validator before the backfill completes — that is the step that rejects existing rows and takes the app down. Add new fields as optional, migrate, then require. And verify row counts on both sides of the migration rather than trusting that it ran.

It is a deliberately short skill: three paragraphs of procedure rather than a reference manual, on the theory that an agent about to alter a production schema needs an ordering constraint far more than it needs background reading. For the higher-risk version of the same job, Convex ships convex-migrate-rehearse, which runs the change against a snapshot-seeded preview deployment first and promotes it with the snapshot as a rollback.

Part of Convex's official agent-skills set. Install with npx skills add get-convex/agent-skills --skill convex-migrate.

Related Skills

Skill: Convex

by Convex

New

Convex's official top-level agent skill — routes an agent to the right convex-* skill for the task and to a served capability catalogue that stays current without a reinstall.

Official Shopify skill for theme development in Liquid — teaches an agent the modern theme architecture of sections, blocks and snippets, and validates generated templates and schemas.

1 views

Shopify's official skill for writing Admin GraphQL queries and mutations — it searches the live API docs and validates every operation against the schema before handing you code.

1 views

Planning skill that interrogates your use case before any code is written, then recommends the right Twilio Conversations stack — ConversationRelay, Memory, Intelligence, Orchestrator, TaskRouter — and the implementation skills to follow.

1 views
Browse all skills →