convex-migration-helper
Что он делает
Этот скилл планирует изменения структуры данных приложения Convex, в котором уже есть данные. Он нужен разработчикам, которым нужен пошаговый план, не ломающий пользователей.
Когда использовать
- ✓Когда нужно изменить тип поля или разделить таблицу в приложении Convex с существующими данными.
- ✓Когда вы переименовываете или удаляете поля, которые ещё используются существующими записями.
- ✓Когда вы хотите выкатить изменение бэкенда без простоя.
Ссылка на скилл
https://github.com/openclaw/clawhub/blob/main/.agents/skills/convex-migration-helper/SKILL.mdСкопируйте и вставьте её в ваш ИИ (Claude, ChatGPT или Cursor) с просьбой следовать инструкциям.
Как использовать
Самый простой способ: скопируйте сообщение и вставьте его в свой ИИ. Он прочитает скилл и выполнит инструкции.
Готовое сообщение для вставки
Для Claude Code, Codex или Cursor: запустите в папке проекта, и скилл установится.
Скачайте SKILL.md и положите его в папку скиллов вашего агента.
Пример запроса к вашему ИИ
“Помоги спланировать, как разделить мою таблицу пользователей Convex на две таблицы, не сломав приложение.”
5 новых скиллов в неделю. 1 минута чтения.
Как это работает
Агент планирует последовательность шагов: сначала расширяет схему, чтобы работали и старые, и новые данные, затем переносит существующие записи пакетами, а после того как всё обновлено, сужает схему.
Технический текст (оригинальный SKILL.md)
Оригинальный текст автора на английском, прямо с GitHub.
Convex Migration Helper
Safely migrate Convex schemas and data when making breaking changes.
When to Use
- Adding new required fields to existing tables
- Changing field types or structure
- Splitting or merging tables
- Renaming or deleting fields
- Migrating from nested to relational data
When Not to Use
- Greenfield schema with no existing data in production or dev
- Adding optional fields that do not need backfilling
- Adding new tables with no existing data to migrate
- Adding or removing indexes with no correctness concern
- Questions about Convex schema design without a migration need
Key Concepts
Schema Validation Drives the Workflow
Convex will not let you deploy a schema that does not match the data at rest. This is the fundamental constraint that shapes every migration:
- You cannot add a required field if existing documents don't have it
- You cannot change a field's type if existing documents have the old type
- You cannot remove a field from the schema if existing documents still have it
This means migrations follow a predictable pattern: widen the schema, migrate the data, narrow the schema.
Online Migrations
Convex migrations run online, meaning the app continues serving requests while data is updated asynchronously in batches. During the migration window, your code must handle both old and new data formats.
Prefer New Fields Over Changing Types
When changing the shape of data, create a new field rather than modifying an existing one. This makes the transition safer and easier to roll back.
Don't Delete Data
Unless you are certain, prefer deprecating fields over deleting them. Mark the
field as v.optional and add a code comment explaining it is deprecated and why
it existed.
Safe Changes (No Migration Needed)
Adding Optional Field
// Before
users: defineTable({
name: v.string(),
});
// After - safe, new field is optional
users: defineTable({
name: v.string(),
bio: v.optional(v.string()),
});
Adding New Table
posts: defineTable({
userId: v.id("users"),
title: v.string(),
}).index("by_user", ["userId"]);
Adding Index
users: defineTable({
name: v.string(),
email: v.string(),
}).index("by_email", ["email"]);
Breaking Changes: The Deployment Workflow
Every breaking migration follows the same multi-deploy pattern:
Deploy 1 - Widen the schema:
- Update schema to allow both old and new formats (e.g., add optional new field)
- Update code to handle both formats when reading
- Update code to write the new format for new documents
- Deploy
Between deploys - Migrate data:
- Run migration to backfill existing documents
- Verify all documents are migrated
Deploy 2 - Narrow the schema:
- Update schema to require the new format only
- Remove code that handles the old format
- Deploy
Using the Migrations Component
For any non-trivial migration, use the
@convex-dev/migrations
component. It handles batching, cursor-based pagination, state tracking, resume
from failure, dry runs, and progress monitoring.
See references/migrations-component.md for installation, setup, defining and
running migrations directly with npx convex run migrations:myMigration, dry
runs, status monitoring, and configuration options.
Common Migration Patterns
See references/migration-patterns.md for complete patterns with code examples
covering:
- Adding a required field
- Deleting a field
- Changing a field type
- Splitting nested data into a separate table
- Cleaning up orphaned documents
- Zero-downtime strategies (dual write, dual read)
- Small table shortcut (single internalMutation without the component)
- Verifying a migration is complete
Common Pitfalls
- Making a field required before migrating data: Convex rejects the deploy because existing documents lack the field. Always widen the schema first.
- Using
.collect()on large tables: Hits transaction limits or causes timeouts. Use the migrations component for proper batched pagination..collect()is only safe for tables you know are small. - Not writing the new format before migrating: Documents created during the migration window will be missed, leaving unmigrated data after the migration "completes."
- Skipping the dry run: Use
dryRun: trueto validate migration logic before committing changes to produ
Частые вопросы
Почему процесс идёт по шагам?
Convex проверяет существующие данные по схеме, поэтому изменения должны идти по порядку, чтобы не сорвать развёртывание.
Остаётся ли приложение онлайн во время изменения?
Да. Миграции выполняются в фоне пакетами, но код должен обрабатывать старые и новые данные в это время.
Когда этот скилл не нужен?
Для нового проекта без существующих данных или для добавления необязательных полей, которые не требуют заполнения.
Подробности
Оригинальное описание автора
Plans Convex schema and data migrations with widen-migrate-narrow and @convex-dev/migrations. Use for breaking schema changes, backfills, table reshaping, or zero-downtime rollouts.
repo: openclaw/clawhub
Популярность
- Звёзды на GitHub
- 9.5k
- Место в рейтинге
- #12250
- Лицензия
- MIT
- Обновлён
- 02.11.2026
Комментарии
- …
Другие скиллы из этого репозитория
axiom-alerting
9.5kПомогает агенту создавать и вести мониторы Axiom и маршруты уведомлений через API Axiom, а также проверять, что оповещения работают как ожидается.
axiom-sre
9.5kПомогает агенту пошагово расследовать производственные инциденты и ошибки, проверяя каждое предположение по логам Axiom до вывода.
building-dashboards
9.5kПомогает агенту проектировать дашборды Axiom с подходящими графиками, запросами и фильтрами, начиная с тех решений, которые дашборд должен поддерживать.
controlling-costs
9.5kПомогает агенту найти неиспользуемые данные в Axiom и построить дашборды и мониторы, которые отслеживают и снижают расходы на логирование.
Похожие скиллы
api-connector-builder
280kАгент создаёт новые подключения к API по существующему шаблону. Используйте, когда нужна ещё одна интеграция без нового способа делать то же самое.
api-design
280kПомогает агенту проектировать REST API по лучшим практикам: как API общаются, как показываются ошибки и как организовать данные.
backend-patterns
280kПомогает агенту с архитектурными паттернами серверной части и оптимизацией баз данных. Полезен при создании и проверке серверного кода.