Skip to content
Convex Live Migrations

Convex Live MigrationsSkill

Added to Onei
1 views
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

New

Google's official skill for the gws CLI — drive Gmail, Drive, Calendar, Sheets, Docs, Chat and Admin APIs from an agent, with Model Armor screening.

4 views 1 copies
New

Netlify's official skill for zero-config managed Postgres — querying from Functions, Drizzle setup, migrations and per-preview database branches.

3 views

Official WordPress skill for Gutenberg block work: block.json, attributes and serialization, dynamic rendering, and the deprecation path that keeps existing content valid.

2 views

Skill: claude-mem

by thedotmack

New

Persistent cross-session memory for coding agents: hooks capture each session, a local SQLite + vector store compresses it, and a mem-search skill reads it back.

1 views
Browse all skills →