convex-migrations

convex-migrations is a skill for Claude Code, Codex from waynesutton/convexskills. It costs 35 tokens per session (4,435 once invoked), scanned A, original, Apache-2.0.

Guidance for changing a Convex database schema and updating existing records as an application evolves. A schema defines the fields and structure of stored data.

In plain words
What is it for?
Use it for adding fields, backfilling existing data, removing deprecated fields, changing indexes, and planning zero-downtime updates.
Why use it?
It explains how to add, fill, or remove fields and indexes safely, including changes that avoid interrupting a running application.

Skill for Claude CodeCodex

Written for Claude Code and Codex: shipped in a Claude Code plugin, but also agents/openai.yaml present.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is import { internalMutation } from "../_generated/server";.

Part of the convexskills plugin — 14 skills shipped together

Good fit Use it for adding fields, backfilling existing data, removing deprecated fields, changing indexes, and planning zero-downtime updates.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/waynesutton/convexskills
agentmods
npx agentmods add skills/waynesutton/convexskills/convex-migrations

Made for: Claude Code, Codex.

Or install convexskills, the plugin that ships this one along with the rest of its 14 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for convex-migrations

README.md
[![agentmods](https://agentmods.dev/badge/skills/waynesutton/convexskills/convex-migrations/github.svg)](https://agentmods.dev/skills/waynesutton/convexskills/convex-migrations)
Your own site
<a href="https://agentmods.dev/skills/waynesutton/convexskills/convex-migrations"><img src="https://agentmods.dev/badge/skills/waynesutton/convexskills/convex-migrations/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for convex-migrations

Your own site · 80×15
<a href="https://agentmods.dev/skills/waynesutton/convexskills/convex-migrations"><img src="https://agentmods.dev/badge/skills/waynesutton/convexskills/convex-migrations.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 35 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,435 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • Socket pass 18 Mar 2026
  • Snyk pass 17 Feb 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00035 $0.04435
Opus 5 $0.00017 $0.02218
Sonnet 5 $0.00007 $0.00887
Haiku 4.5 $0.00003 $0.00443

Measured 11d ago against content hash 9f01eb1b953a, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

convex-migrations scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

Copies of this mod

3 near-identical copies found in the catalogue:

skills/convex-migrations/SKILL.md · 713 lines

How it starts

The opening of the file, as written. The whole thing — 713 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Convex Migrations

Evolve your Convex database schema safely with patterns for adding fields, backfilling data, removing deprecated fields, and maintaining zero-downtime deployments.

Documentation Sources

Before implementing, do not assume; fetch the latest documentation:

Instructions

Migration Philosophy

Convex handles schema evolution differently than traditional databases:

  • No explicit migration files or commands
  • Schema changes deploy instantly with npx convex dev
  • Existing data is not automatically transformed
  • Use optional fields and backfill mutations for safe migrations

Adding New Fields

Start with optional fields, then backfill:

// Step 1: Add optional field to schema
// convex/schema.ts
import { defineSchema, defineTable } from "convex/server";
import { v } from "convex/values";

export default defineSchema({
  users: defineTable({
    name: v.string(),
    email: v.string(),
    // New field - start as optional
    avatarUrl: v.optional(v.string()),
  }),
});
// Step 2: Update code to handle both cases
// convex/users.ts
import { query } from "./_generated/server";
import { v } from "convex/values";

export const getUser = query({
  args: { userId: v.id("users") },
  returns: v.union(
    v.object({
      _id: v.id("users"),
      name: v.string(),
      email: v.string(),
      avatarUrl: v.union(v.string(), v.null()),
    }),
    v.null()
  ),
  handler: async (ctx, args) => {
    const user = await ctx.db.get(args.userId);
    if (!user) return null;

    return {
      _id: user._id,
      name: user.name,
      email: user.email,
      // Handle missing field gracefully
      avatarUrl: user.avatarUrl ?? null,
    };
  },
});
// Step 3: Backfill existing documents
// 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.optional(v.string()),
  },
  returns: v.object({
    processed: v.number(),
    hasMore: v.boolean(),
  }),
  handler: async (ctx, args) => {
    const result = await ctx.db
      .query("users")
      .paginate({ numItems: BATCH_SIZE, cursor: args.cursor ?? null });

    let processed = 0;
    for (const user of result.page) {
      // Only update if field is missing
      if (user.avatarUrl === undefined) {
        await ctx.db.patch(user._id, {
          avatarUrl: generateDefaultAvatar(user.name),
        });
        processed++;
      }
    }

    // Schedule next batch if needed
    if (!result.isDone) {
      await ctx.scheduler.runAfter(0, internal.migrations.backfillAvatarUrl, {
        cursor: result.continueCursor,
      });
    }

    return {
      processed,
      hasMore: !result.isDone,
    };
  },
});

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

Read the full file on GitHub · 713 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 713 lines · 35 tokens per session scan A 9f01eb1b953a

Subscribe to this mod's changes

convex-migrations is a skill published in the GitHub repository waynesutton/convexskills (404 stars, last pushed 7mo ago), licensed Apache-2.0. It adds 35 tokens to every session and 4,435 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

convex-migrations

Schema migration strategies for evolving applications including adding new fields, backfilling data, removing deprecated fields, index migrations, and zero-downtime migration patterns.

J-StaR-Films-Studios/VibeCode-Protocol-Suite · 35 tokens

database-sql

Design database schemas, write efficient SQL queries, create migrations, and optimize database performance. Use when working with databases, writing queries, or designing data models.

asgarovf/locusai · 35 tokens

convex-schema-validator

Defining and validating database schemas with proper typing, index configuration, optional fields, unions, and migration strategies for schema changes.

J-StaR-Films-Studios/VibeCode-Protocol-Suite · 29 tokens

db-migrations

Use when a schema change must ship without downtime — NOT NULL, rename, type change, or backfilling millions of live rows — for the expand-contract sequence and the lock/batching discipline that keeps each step from freezing prod. NOT lock internals or EXPLAIN (that is postgresdb), NOT drizzle-kit mechanics (that is…

ericrisco/rsc-harness · 90 tokens

prisma-orm

Use when modeling data or writing type-safe queries with Prisma ORM in TypeScript — schema.prisma, prisma.config.ts, the generated Prisma Client, and Prisma Migrate, including the v6 to v7 upgrade. NOT schema-as-TS with a SQL builder (that is drizzle-orm), NOT ORM-agnostic zero-downtime migration (that is…

ericrisco/rsc-harness · 101 tokens

drizzle-orm

Use when modeling data or querying with Drizzle ORM in TypeScript — pgTable schema in .ts, type-safe select/insert/relational queries, drizzle-kit migrations. NOT Prisma Client or schema.prisma (that is prisma-orm), NOT ORM-agnostic migration strategy (that is db-migrations), NOT Postgres engine tuning or EXPLAIN…

ericrisco/rsc-harness · 96 tokens