Agent skill

Convex Migrations

by waynesutton in waynesutton/builder-skills

Changes a live Convex schema without downtime: make a field optional, backfill in batches, flip the validator, then clean up.

Apache-2.0Auto-check passedFrontend & Design

Install Convex Migrations

skills CLI
$ npx skills add waynesutton/builder-skills --skill convex-migrations -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install waynesutton/builder-skills convex-migrations --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/waynesutton/builder-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/convex-migrations .claude/skills/convex-migrations && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
convex-migrations
GitHub stars
404
Token cost
~2.1k tokens
SKILL.md length
857 words
Files
6 (incl. references, assets)
Skills in repo
17
Repo updated
First seen
Licence
Apache-2.0

At a glance

Changes a live Convex schema without downtime: make a field optional, backfill in batches, flip the validator, then clean up.

  • Works in 6 steps: Make the field optional in… → Deploy with npx convex dev. Update… → Backfill existing documents in batches… → …
  • Removing a field
  • SKILL.md covers When to reach for this, The safe sequence, Hand rolled batched backfill and When to use the component…, plus 4 more sections
  • Calls npx; reaches api.dicebear.com

What it does

Convex Migrations is an agent skill from waynesutton/builder-skills. Changes a live Convex schema without downtime: make a field optional, backfill in batches, flip the validator, then clean up. Uses the @convex-dev/migrations component where it fits. Use when renaming or removing a field, changing a type, splitting a table, or when deploy fails with a schema validation error on existing documents.

Its SKILL.md is about 2.1k tokens, which your agent loads only when the skill is triggered. The skill folder holds 8 other files, including reference files and assets (for example `agents/openai.yaml`, `references/migration-patterns.md` and `references/migrations-component.md`).

It sits in Frontend & Design, covering Forms and validation. It works with Convex. The repository describes itself as: Builder skills for Convex apps. Convex patterns plus a PRD, task.md, changelog, and files.md workflow for Claude Code, Codex, Cursor, and OpenCode. The licence is Apache-2.0.

When your agent uses it

  • Removing a field
  • Changing a type
  • Splitting a table
  • Deploy fails with a schema validation error on existing documents

Example prompts

  • “Use the convex-migrations skill to change a live Convex schema without downtime: make a field optional, backfill in batches, flip the validator…”
  • “/convex-migrations”

Requirements

  • Node.js

Workflow steps

6 steps, taken from the first numbered list in SKILL.md.

  1. Make the field optional in convex/schema.ts (or add the new field as v.optional).
  2. Deploy with npx convex dev. Update readers to handle undefined and writers to set the new shape.
  3. Backfill existing documents in batches with an internal mutation or the migrations component.
  4. Flip the validator to its final shape (v.string() instead of v.optional(v.string()), or drop the old field).
  5. Deploy again. Validation now passes because every document already matches.
  6. Clean up: delete fallback code, remove the backfill function, drop stale indexes.

What it can do on your machine

Read from SKILL.md and the folder at commit 82d1ce2. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • npx

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • api.dicebear.com

    Also links to:

    • docs.convex.dev
    • convex.dev
    • stack.convex.dev

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Convex Migrations loads about 2.1k tokens when it runs, and up to ~5.5k if it reads all its reference files. Until then it costs about 88 tokens; SKILL.md has 857 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~88
When it runs · the whole SKILL.md, loaded when a task matches
~2.1k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~5.5k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from waynesutton/builder-skills at commit 82d1ce2, republished under its Apache-2.0 licence (© waynesutton). 857 words, ~2,149 tokens.

Download SKILL.mdSave it as .claude/skills/convex-migrations/SKILL.md (or your agent's skills folder). This skill also uses 5 other files; get the full folder from GitHub.
name
convex-migrations
description
Changes a live Convex schema without downtime: make a field optional, backfill in batches, flip the validator, then clean up. Uses the @convex-dev/migrations component where it fits. Use when renaming or removing a field, changing a type, splitting a table, or when deploy fails with a schema validation error on existing documents.

Convex migrations

Produces a schema change plus a batched backfill that keeps every deploy green. The one rule: the schema must describe the documents that exist right now, not the documents you want. Change the data first, then tighten the validator.

Convex has no migration files or migrate command. npx convex dev pushes the schema and validates every existing document against it. Existing data is never transformed for you.

When to reach for this

  • Adding a field that should be required, but the table already has rows
  • Renaming a field, changing its type, or removing it
  • Splitting one table into two or merging two into one
  • npx convex dev fails with Schema validation failed after a schema edit
  • A backfill needs to touch more rows than one mutation can handle

For step by step recipes (rename, change type, split, merge, add required, remove) open references/migration-patterns.md. For installing and running @convex-dev/migrations open references/migrations-component.md.

The safe sequence

Every migration follows the same six steps. Skipping one is how deploys break.

  1. Make the field optional in convex/schema.ts (or add the new field as v.optional).
  2. Deploy with npx convex dev. Update readers to handle undefined and writers to set the new shape.
  3. Backfill existing documents in batches with an internal mutation or the migrations component.
  4. Flip the validator to its final shape (v.string() instead of v.optional(v.string()), or drop the old field).
  5. Deploy again. Validation now passes because every document already matches.
  6. Clean up: delete fallback code, remove the backfill function, drop stale indexes.

Steps 1 and 2 must ship before step 3 starts. Otherwise new writes keep producing old shaped documents while the backfill runs.

Hand rolled batched backfill

One internalMutation that pages through the table with paginate, patches only documents that still need it, then reschedules itself with the continue cursor. Each batch is its own transaction, so a large table never hits the per function limit.

typescript
// convex/migrations.ts
import { internalMutation } from "./_generated/server";
import { internal } from "./_generated/api";
import { v } from "convex/values";

const BATCH_SIZE = 100;

export const backfillAvatarUrl = internalMutation({
  args: { cursor: v.union(v.string(), v.null()) },
  returns: v.null(),
  handler: async (ctx, args) => {
    const result = await ctx.db
      .query("users")
      .paginate({ numItems: BATCH_SIZE, cursor: args.cursor });

    for (const user of result.page) {
      // Idempotent: skip documents that already have the field
      if (user.avatarUrl === undefined) {
        await ctx.db.patch(user._id, {
          avatarUrl: defaultAvatar(user.name),
        });
      }
    }

    // Reschedule with the cursor until the table is exhausted
    if (!result.isDone) {
      await ctx.scheduler.runAfter(0, internal.migrations.backfillAvatarUrl, {
        cursor: result.continueCursor,
      });
    }
    return null;
  },
});

function defaultAvatar(name: string): string {
  return `https://api.dicebear.com/7.x/initials/svg?seed=${encodeURIComponent(name)}`;
}

Start it from the CLI against the dev deployment:

bash
npx convex run migrations:backfillAvatarUrl '{"cursor": null}'

Keep the mutation idempotent. Re running it after a partial failure must be safe. Use internalMutation, never a public mutation, so it cannot be called from a client. Use ctx.db.patch for adding or changing fields and ctx.db.patch(id, { field: undefined }) to remove one.

When to use the component instead

@convex-dev/migrations wraps the pattern above and adds what the hand rolled version lacks: persisted progress per migration, status checks, dry runs, cancel, and ordered runs of several migrations. Reach for it when:

  • The project will run more than one or two migrations over its life
  • You need to know whether a migration already completed in production
  • You want a dry run before touching real data
  • Several migrations must run in a fixed order

Minimal setup:

typescript
// convex/convex.config.ts
import { defineApp } from "convex/server";
import migrations from "@convex-dev/migrations/convex.config.js";

const app = defineApp();
app.use(migrations);
export default app;
typescript
// convex/migrations.ts
import { Migrations } from "@convex-dev/migrations";
import { components } from "./_generated/api";
import { DataModel } from "./_generated/dataModel";

export const migrations = new Migrations<DataModel>(components.migrations);

export const addDefaultRole = migrations.define({
  table: "users",
  migrateOne: async (ctx, user) => {
    if (user.role === undefined) {
      await ctx.db.patch(user._id, { role: "user" });
    }
  },
});
bash
npx convex run migrations:addDefaultRole '{"dryRun": true}'
npx convex run migrations:addDefaultRole

A one off backfill on a small table does not need the component. The hand rolled mutation is fine.

Show full SKILL.md (386 more words)Show less

Reading the deploy time schema error

When a schema push fails, npx convex dev prints the table, one offending document id, and the field that does not match:

Schema validation failed
Document with ID "j57abc..." in table "users" does not match the schema:
Object is missing the required field `avatarUrl`.
Consider wrapping the field validator in `v.optional(...)` if this is expected.

Read it as: existing data in users predates the field. The fix is never to delete the document. Wrap the field in v.optional, deploy, backfill, then remove the v.optional. If the error says the field has the wrong type (for example string where number is expected), widen the validator to v.union(v.string(), v.number()), backfill the conversion, then narrow it.

Do not pass { schemaValidation: false } to defineSchema to make the push succeed. It hides the mismatch and moves the failure into your queries.

Common mistakes

MistakeWhy it breaksDo instead
Add a required field in one deployExisting documents fail validation, push is rejectedAdd as v.optional, backfill, then require
Start the backfill before deploying the new writersNew rows keep arriving in the old shapeDeploy schema and code first, backfill second
One mutation that .collect()s the whole tableHits the transaction size and time limitsPage with paginate and reschedule per batch
Backfill with a public mutationAnyone can call it and re run itinternalMutation or migrations.define
Non idempotent patchRe running after a failure double appliesCheck the field before patching
Removing the old field before readers stop using itFallback code reads undefinedSwitch readers, then remove
Using .filter() to find unmigrated rowsFull scan on every batchPaginate the whole table or use customRange with an index
Turning off schemaValidation to pass the deployBad data reaches queries at runtimeFix the data, keep validation on
Running a backfill against production firstNo way to catch a wrong conversionRun on dev, then --prod

Checklist

  • New or changed field is v.optional (or a widened v.union) in the first deploy
  • Readers handle undefined and writers produce the new shape before the backfill starts
  • Backfill is an internalMutation or migrations.define, never public
  • Backfill pages with paginate and reschedules via ctx.scheduler.runAfter(0, internal....)
  • Each patch is guarded so re running is safe
  • Backfill ran to completion on dev before touching prod
  • Validator flipped to its final shape and deployed without a validation error
  • Fallback code, old field, and backfill function removed
  • Indexes that referenced the old field are dropped or renamed

Docs

© waynesutton, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 5 other files (references, assets) in skills/convex-migrations of waynesutton/builder-skills.

  • SKILL.md
  • agents/openai.yaml
  • assets/large-logo.png
  • assets/small-logo.svg
  • references/migration-patterns.md
  • references/migrations-component.md

Open the folder on GitHubat commit 82d1ce2

Compare with similar skills

Convex Migrations next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Convex Migrations compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Convex Migrations this skillwaynesutton/builder-skills404—~2.1kAutomated safety check: PassApache-2.0
MCP Developmentcoollabsio/coolify63k1 repos~949Automated safety check: PassMIT
Accessibility Fixeribelick/ui-skills9.5k4 repos~1.2kAutomated safety check: PassMIT
Formik Form PatternsChrisWiles/claude-code-showcase6.1k3 repos~2.1kAutomated safety check: PassNone
Buefy Vue UI Componentsbuefy/buefy9.5k—~8.2kAutomated safety check: PassMIT
Formkitformkit/formkit4.8k—~1.7kAutomated safety check: PassMIT

Similar skills

  • MCP Development

    coollabsio/coolify

    A skill your agent uses for Laravel MCP development. An agent skill from coollabsio/coolify.

    63k GitHub starsUsed in 1 repo~949 tokens
    Frontend & DesignAuto-check passed
  • Accessibility Fixer

    ibelick/ui-skills

    Audits and fixes HTML accessibility problems such as ARIA labels, keyboard navigation, focus management, contrast and form errors with minimal changes.

    9.5k GitHub starsUsed in 4 repos~1.2k tokens
    Frontend & DesignAuto-check passed
  • Formik Form Patterns

    ChrisWiles/claude-code-showcase

    Shows how to build forms with Formik and Yup validation, including conditional rules, field helpers, GraphQL submission, edit forms and multi-step flows.

    6.1k GitHub starsUsed in 3 repos~2.1k tokens
    Frontend & DesignAuto-check passed
  • Rules for writing Vue 3 templates with Buefy components on Bulma CSS: install options, prop conventions, b-field wrapping, tables, theming and dialogs.

    9.5k GitHub stars~8.2k tokensUpdated 1 mo ago
    Frontend & DesignAuto-check passed
  • Formkit

    formkit/formkit

    A skill your agent uses when working with FormKit forms, validation, schema, or custom inputs in React, Vue, or Nuxt projects.

    4.8k GitHub stars~1.7k tokensUpdated 2 mo ago
    Frontend & DesignAuto-check passed
  • HTML Coder

    TokenRhythm/opensquilla

    Guides semantic, accessible HTML work: pages, forms, media and HTML5 APIs, plus how to deliver a runnable webpage project with a preview.

    7.1k GitHub stars~1.4k tokensUpdated 4 days ago
    Frontend & DesignAuto-check passed

More from waynesutton/builder-skills

All 17 skills in this repo
  • Convex Agents

    waynesutton/builder-skills

    Builds AI agents on the Convex agent component: threads, messages, tools that call queries and mutations, streaming, RAG with vector search, and workflows for multi step jobs.

    404 GitHub stars~2.2k tokensUpdated 10 days ago
    Auto-check passed
  • Convex Best Practices

    waynesutton/builder-skills

    Production patterns for Convex apps and the rules the @convex-dev/eslint-plugin enforces: validators, indexes, idempotent mutations, avoiding OCC conflicts, thin function wrappers, error handling.

    404 GitHub stars~2.6k tokensUpdated 10 days ago
    Auto-check passed
  • Convex Component Authoring

    waynesutton/builder-skills

    Creates reusable Convex components with defineComponent, a clean client wrapper, their own schema, and an npm publish setup.

    404 GitHub stars~2.6k tokensUpdated 10 days ago
    Auto-check passed
  • Convex Cron Jobs

    waynesutton/builder-skills

    Schedules work in Convex: cron jobs in convex/crons.ts, one off scheduled functions with runAfter and runAt, batching large jobs, and cancelling or inspecting the queue.

    404 GitHub stars~2k tokensUpdated 10 days ago
    Auto-check passed
  • Convex HTTP Actions

    waynesutton/builder-skills

    Adds HTTP endpoints in convex/http.ts: webhook receivers with signature checks, REST style routes, CORS, auth headers, streaming responses, and file uploads over HTTP.

    404 GitHub stars~2.6k tokensUpdated 10 days ago
    Auto-check passed
  • Convex Security Audit

    waynesutton/builder-skills

    Deep security review of a Convex app: authorization model, data access paths per table, HTTP action exposure, rate limiting, file storage access, scheduled function trust, and a written findings…

    404 GitHub stars~2.6k tokensUpdated 10 days ago
    Auto-check passed

Works with

Questions about Convex Migrations

What does Convex Migrations do?

Changes a live Convex schema without downtime: make a field optional, backfill in batches, flip the validator, then clean up. Convex Migrations is an agent skill from waynesutton/builder-skills. Changes a live Convex schema without downtime: make a field optional, backfill in batches, flip the validator, then clean up.

When should I use Convex Migrations?

Convex Migrations fits situations like: removing a field; changing a type; splitting a table; deploy fails with a schema validation error on existing documents.

How do I install Convex Migrations in Claude Code?

Run `npx skills add waynesutton/builder-skills --skill convex-migrations -a claude-code`. Or copy the skill folder (skills/convex-migrations in waynesutton/builder-skills) into .claude/skills/convex-migrations in your project. Claude Code loads it when a task matches its description.

How do I install Convex Migrations in Codex?

Run `npx skills add waynesutton/builder-skills --skill convex-migrations -a codex`. Or copy the skill folder (skills/convex-migrations in waynesutton/builder-skills) into .agents/skills/convex-migrations in your project. Codex loads it when a task matches its description.

Can I use Convex Migrations in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add waynesutton/builder-skills --skill convex-migrations -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/convex-migrations, .gemini/skills/convex-migrations, .github/skills/convex-migrations and .opencode/skills/convex-migrations in your project.

What does Convex Migrations need to run?

Going by SKILL.md and its folder, Convex Migrations needs the command-line tools its instructions call (npx). Our summary lists: Node.js.

Does Convex Migrations access the network?

SKILL.md names 4 domains. In commands or code: api.dicebear.com; the agent is likely to contact it when it follows the instructions. As links in the text: docs.convex.dev, convex.dev and stack.convex.dev. This is read from the text; nothing was executed.

Is Convex Migrations safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Convex Migrations use?

Convex Migrations is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Convex Migrations use?

About 2.1k tokens (SKILL.md is roughly 8.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 3.4k tokens, read only when the agent opens those files.

What are the alternatives to Convex Migrations?

Skills that share tags, products or a category with Convex Migrations: MCP Development (coollabsio/coolify, 63k stars), Accessibility Fixer (ibelick/ui-skills, 9.5k stars), Formik Form Patterns (ChrisWiles/claude-code-showcase, 6.1k stars) and Buefy Vue UI Components (buefy/buefy, 9.5k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Convex Migrations?

waynesutton (a GitHub user) maintains it in waynesutton/builder-skills, which has 404 GitHub stars. The repository holds 17 skills in this directory. The repository was last updated on September 28, 2026.

Source: waynesutton/builder-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.