一键导入
convex-migrate
Safe Convex schema/data migrations in scry, including schema removals, dry-runs, diagnostics, target verification, and production approval gates.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Safe Convex schema/data migrations in scry, including schema removals, dry-runs, diagnostics, target verification, and production approval gates.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Final mile for scry. Land a merge-ready backlog branch, archive the shipped backlog files into backlog.d/_done/ before squash, preserve backlog trailers in the squash commit, pull master, invoke /reflect, and route any reflect harness edits to harness/reflect-outputs. Assumes /settle already proved the branch merge-ready against scry's Quality Checks merge-gate; /ship does not refactor, review, or run a fresh CI campaign. Use when: "ship it", "merge and close out", "land this scry ticket", "finish this backlog item", "merge and reflect". Trigger: /ship.
Dialectical premise-and-alternatives audit for a plan, spec, or context packet. Four moves: premise challenge (is this the right problem?), mandatory structurally-distinct alternatives, cross-model outside voice, user-ratified convergence. Named for Gary Tan's plan-ceo-review pattern; operationalizes the AGENTS.md "Diverge Before You Converge" doctrine at the plan-review stage. Use when: about to commit to a plan/spec/design, reviewing a ticket before shape, when "is this the right problem" would be useful, or any time a proposal smells like a symptom fix instead of a root-cause fix. Trigger: /ceo-review, /challenge, /premise-check.
Run and repair scry's actual quality gates. The ship gate is GitHub Actions Quality Checks merge-gate, with pnpm local parity and Lefthook as defense in depth. This repo does not use Dagger; never scaffold it or describe it as canonical here. Bounded self-heal may fix lint, formatting, stale generated artifacts, and obvious focus markers, but must not lower coverage, weaken TypeScript, disable tests, or bypass audit. Use when: "run ci", "check ci", "fix ci", "audit ci", "is ci passing", "run the gates", "why is ci failing", "strengthen ci", "tighten ci", "ci is red", "gates failing". Trigger: /ci, /gates.
Parallel multi-agent code review for scry. Launch reviewer team, synthesize findings, auto-fix blocking issues, loop until clean. Use when: "review this", "code review", "is this ready to ship", "check this code", "review my changes". Trigger: /code-review, /review, /critique.
scry inner-loop composer. Takes one file-driven backlog item from backlog.d/ to merge-ready code by composing /shape -> /implement -> {/code-review + /ci + /refactor + /qa as applicable}. Stops at merge-ready. Does not push, merge, deploy, archive backlog tickets, or inject backlog-closing trailers; /ship owns closure. Use when: building one shaped backlog item, "deliver this", "make it merge-ready", driving one scry ticket through implementation, review, verification, and evidence. Trigger: /deliver.
Deploy scry to its real production surface: Convex backend first, validation second, Vercel frontend last. This skill is approval-gated for every command that can mutate non-local Convex or Vercel state. It stops at a healthy deploy receipt and hands ongoing observation to /monitor. Use when: "deploy scry", "ship to production", "release", "run the production deploy", "deploy this merged ref". Trigger: /deploy, /ship-it, /release.
| name | convex-migrate |
| description | Safe Convex schema/data migrations in scry, including schema removals, dry-runs, diagnostics, target verification, and production approval gates. |
| trigger | /convex-migrate |
Use this skill for any scry Convex schema or data migration. scry treats convex/schema.ts as an API contract: data shape changes must be deliberate, observable, reversible where possible, and verified before and after execution.
Before planning or editing a migration, read these anchors:
.spellbook/repo-brief.mdconvex/schema.tsconvex/migrations.tsscripts/run-migration.shscripts/validate-migration-output.shdocs/guides/writing-migrations.mddocs/runbooks/production-deployment.mdIf docs and live scripts disagree, prefer live repo code, then note the drift in the migration plan.
./scripts/run-migration.sh <migration> production, pnpm convex:deploy, npx convex deploy --yes --cmd-url-env-var-name UNSET, ./scripts/deploy-production.sh, pnpm build:prod, and any command that mutates non-local Convex or Vercel state.amicable-lobster-935.uncommon-axolotl-639.uncommon-axolotl-639, stop.source .env.production; load the production deploy key with grep CONVEX_DEPLOY_KEY .env.production | cut -d= -f2 and verify it starts with prod:.Every migration must have these components before it can run outside local exploration:
dryRun argument that computes the same candidate set and stats without writing.'fieldName' in (doc as any), not doc.fieldName !== undefined..take(limit) or explicit batchSize; do not add unbounded .collect() to runtime paths.For scry's current migration module, convex/migrations.ts already exposes backfillTotalPhrasings and diagnosticBackfillTotalPhrasings; preserve that dry-run/diagnostic pairing when adding new work.
Field removal in scry is always three phases:
Optional
Change the schema field from required to v.optional(...) in convex/schema.ts. Deploy this compatibility schema only after approval if the target is production.
Dry-run, backfill, diagnostic
Add the migration and diagnostic in convex/migrations.ts. Run dry-run first, inspect the expected count, run the actual migration only after approval, then run the diagnostic until it reports zero remaining records. Use runtime checks such as 'deprecatedField' in (doc as any) while the stale field may still exist in stored documents.
Remove
Only after diagnostic success, remove the field from convex/schema.ts and deploy the clean schema. If schema validation reports an extra field, revert to optional, rerun the migration workflow, and diagnose before trying removal again.
Do not collapse these phases into one commit or one deployment. The optional phase is what lets Convex accept both old documents and migrated documents while the migration runs.
State the migration invariant. Name the table, field or data relation, expected old shape, expected new shape, and the diagnostic success condition.
Implement backend first.
Update convex/schema.ts first when entering the optional phase. Add or update the convex/migrations.ts mutation/query next. Do not wire UI or product behavior before schema/query/mutation readiness.
Use the repo runner.
Prefer ./scripts/run-migration.sh <migrationName> dev for dev execution. It runs dry-run first, asks for manual confirmation, runs the write pass, then tries <migrationName>Diagnostic and falls back to checkMigrationStatus.
Validate with the helper.
Use ./scripts/validate-migration-output.sh when the migration affects concepts/phrasings or the historical question-to-concept migration path. If the helper's hardcoded checks do not match the migration, add a migration-specific diagnostic query rather than trusting dashboard inspection alone.
Production is operator-gated.
For production, present the exact command and expected target (uncommon-axolotl-639) and wait for explicit approval before execution. Dry-run on production is still a production migration command and needs approval.
Cite this repo gate statement in every migration plan and pre/post migration report:
The ship gate is GitHub Actions
Quality Checksmerge-gate:pnpm lint,pnpm typecheck,pnpm audit --audit-level=critical, no focused tests via the.onlygrep, andpnpm test:cimust pass; local parity ispnpm lint && pnpm tsc --noEmit && pnpm test:ci, withpnpm test:contractforconvex/**,pnpm buildfor build/config/workflow/dependency surfaces, andpnpm audit --audit-level=criticalfor dependency or lockfile changes.
For migration work, run or require:
pnpm lint, pnpm tsc --noEmit, pnpm test:ci, and pnpm test:contract.convex/** change.dryRun is true.'field' in (doc as any) everywhere stale stored data is possible.amicable-lobster-935 for dev, uncommon-axolotl-639 for prod.