convex-backup — Claude Code skill: Convex backups with a restore drill
Sets up Convex snapshot exports and runs a restore drill into a throwaway preview, so you find out whether recovery actually works.
npx skills add convex/agent-skills --skill convex-backup -a claude-codeWhat convex-backup does
The skill covers both halves of a backup story: taking the snapshot and proving you can get it back. It exports with npx convex export --path backup-<date>.zip, adding --include-file-storage when the app stores files. Then it suggests a cadence matched to your RPO — how much data loss you can tolerate — for example a daily export through CI or cron into storage you control, with a retention window.
The restore drill is the part most setups skip. Recovery goes into a throwaway preview built from the current code: npx convex deploy --preview-create restore-drill-<date>, then npx convex import backup-<date>.zip --deployment restore-drill-<date> --replace. After the import the skill reads the data back and compares critical-table row counts plus a sample of real records against the source. A restore that reports success but lands 0 rows is a failed drill.
The drill needs a Preview Deploy Key in CONVEX_DEPLOY_KEY, which is a paid-tier feature. Without it, the skill falls back to a fresh personal dev deployment. Snapshots are real data, so local copies get deleted afterwards and the backup file must never be committed. The runbook for restoring to prod (npx convex import backup.zip --replace --prod) is gated by deploy-guard and states the post-snapshot write-loss caveat.
What it helps with
- export a Convex database snapshot to a zip file
- schedule exports around a tolerable data-loss window
- verify recovery in a throwaway preview instead of prod
- compare critical-table row counts after an import
- write a prod restore runbook gated by deploy-guard
Example prompts for the agent
- back up my Convex database and run a restore drill
- set up a daily Convex export to my own storage
- restore the snapshot into a preview and check the data came back
How to install convex-backup
1Skills CLI (Vercel)
npx skills add convex/agent-skills --skill convex-backup -a claude-code2Manually: put the files in place
~/.claude/skills/convex-backup/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/convex-backup/
1Skills CLI (Vercel)
npx skills add convex/agent-skills --skill convex-backup -a codex2Manually: put the files in place
.agents/skills/convex-backup/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add convex/agent-skills --skill convex-backup -a cursor2Manually: put the files in place
.cursor/skills/convex-backup/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install convex/agent-skills convex-backup2Manually: put the files in place
.github/skills/convex-backup/SKILL.md1Skills CLI (Vercel)
npx skills add convex/agent-skills --skill convex-backup -a gemini-cli2Platform CLI
gemini skills install https://github.com/convex/agent-skills --path skills/convex-backupManually: put the files in place
.devin/skills/convex-backup/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add convex/agent-skills --skill convex-backup -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about convex-backup
How do I install convex-backup in Claude?
Run npx skills add convex/agent-skills --skill convex-backup -a claude-code. The skill lands in ~/.claude/skills/convex-backup/SKILL.md.
What does convex-backup do?
It sets up regular Convex snapshot exports and runs a restore drill into a disposable preview. After the import it checks row counts and a sample of records against the source.
What do I need for the restore drill?
A Preview Deploy Key in CONVEX_DEPLOY_KEY, which is a paid-tier feature. Without one, the skill drills against a fresh personal dev deployment instead.
Source text
SKILL.md · Apache-2.0
--- name: convex-backup description: "Set up Convex backups and run a restore DRILL that proves recovery — snapshot, restore into a throwaway preview, assert the data came back — plus a schedule matched to your RPO and a gated recovery runbook." --- <!-- GENERATED from convex-agents content/capabilities/convex-backup.json — do not edit by hand. --> # Back up — and prove the restore works Every backup story has two halves and most people only do the first: taking the backup, and proving you can get it back. This capability does both — it sets up regular snapshot exports and then runs a RESTORE DRILL that actually recovers the data into a disposable preview and asserts it's intact. The drill reuses migrate-rehearse's exact primitives (snapshot export → preview deploy → snapshot import) pointed at recovery instead of a forward change, so the safety net is tested, not assumed. ## Workflow 1. GUARD: deploy-guard — classify + announce the deployment being backed up (reading/exporting is safe; the drill's restore target is a throwaway preview, never prod). 2. TAKE the snapshot: `npx convex export --path backup-<date>.zip` (add `--include-file-storage` if the app stores files). This is the backup artifact; treat it as sensitive real data. 3. SCHEDULE it (the ongoing half): recommend a cadence matched to how fast the data changes and how much loss is tolerable (RPO) — e.g. a daily `npx convex export` via CI/cron to durable storage the user controls, with a retention window. Convex's own platform backups exist; this adds a user-owned, portable copy. 4. RESTORE DRILL (the half almost nobody does — this is the point): (a) PRECONDITION: a Preview Deploy Key as `CONVEX_DEPLOY_KEY` (same requirement as migrate-rehearse; a paid-tier feature). If unavailable, drill against a fresh personal dev deployment instead and say so. (b) create a throwaway preview from the CURRENT code: `npx convex deploy --preview-create restore-drill-<date>`. (c) restore the snapshot into it: `npx convex import backup-<date>.zip --deployment restore-drill-<date> --replace` (import targets a deployment by NAME with `--deployment`; there is no `--preview-name` on import). (d) ASSERT recovery: read the restored data back (MCP `tables` for row counts, `data`/`runOneoffQuery` for spot-checks) and confirm the critical tables came back with the expected row counts and a sample of real records — a restore that 'succeeds' but lands 0 rows is a FAILED drill. Compare against the source's counts where available. 5. REPORT the drill result plainly: what was backed up, that the restore was ACTUALLY performed and verified (or that it FAILED and why — a failed drill is the most valuable output, found before a real disaster), the recommended schedule + retention, and the recovery runbook (the exact commands to restore to prod: `npx convex import backup.zip --replace --prod`, gated by deploy-guard, with the post-snapshot-write-loss caveat stated). 6. HYGIENE: delete local snapshot copies when done (real data); the drill preview auto-expires. Never commit a backup file. ## Rules - A backup you have never restored is a hope, not a backup — always run (or offer to run) the restore DRILL, don't just take the export. - The drill restores into a THROWAWAY preview (or dev), never prod; the restore target and the backup source are different deployments. - Assert recovery, don't assume it: a restore that lands 0 rows is a FAILED drill — check critical-table row counts + a real-record sample against the source. - A FAILED drill is the most valuable output — surface it loudly; that's the whole reason to drill before a real disaster. - Schedule matched to RPO (how much data loss is tolerable); keep a user-owned portable copy alongside Convex's platform backups, with a retention window. - Snapshots are sensitive real data: delete local copies when done, never commit them; the restore-to-prod runbook is deploy-guard-gated with the post-snapshot-write-loss caveat stated. - Shares migrate-rehearse's snapshot+preview mechanics but aims them at RECOVERY, not a forward change — a forward schema change is migrate-rehearse.
© convex · Apache-2.0 · convex/agent-skills