Builds versioned, checksummed backup files with all-or-nothing restore and safe CSV export. Use when adding backup, restore, import, export, or CSV file features.
Ships in react-native. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
A backup is a versioned, checksummed file of the user's tables that this app (and only a backup) can restore; a restore checks the whole file first, keeps a safety copy, then replaces every table in one transaction or changes nothing; a CSV export is guarded against broken rows and formula injection; files leave or enter the app only through ports, from a press; tests prove the round trip byte for byte.
not-a-backup). Why: the moment a CSV restores, a
format built for reading becomes someone's only copy, with no versions, types or checksum.format, formatVersion, schemaVersion, appVersion,
exportedAt (UTC), payloadSha256, in that order, then the canonical payload last;
BACKUP_SCHEMA_VERSION = LATEST_DB_VERSION. Why: an unversioned file can only be misread, never
refused, and header first lets a truncated file of ours be called damaged. (envelope-header,
schema-version)MAX_BACKUP_BYTES, which export also refuses to exceed), readable, ours, strict
header, checksum before any row, not newer than the build, every row through its schema (text bounds
in code points, as SQLite counts), ids unique and parents present. The name and MIME type are never
trusted. Why: a broken file must fail with its own reason, not half-way through the rows.
(checksum-first, newer-refused)previewSafetyCopy), because no picker
can reach the private folder. Why: a half-restored database is worse than a failed restore, and the
copy is the undo for restoring the wrong file. (restore-transaction, safety-copy-first)BACKUP_PAYLOAD or in BACKUP_EXCLUDED_TABLES with its reason; entitlements, diagnostics and
secrets are never backed up or restored. Why: a forgotten table is data lost on the next restore, and
a restorable entitlement is a free purchase for anyone who edits the file. (backup-coverage,
restore-protected)upgrade-chain, backup-fixture)'test1' survives everything and proves nothing. (round-trip-test). decimals, ISO-8601 UTC or epoch ms,
date keys, codes, untranslated column names; localization happens on screen. Why: 12,5, ١٢٫٥ and
12.5 are one number and three parses. (canonical-values)= + - @, tab or CR
gets an apostrophe, then RFC 4180 quoting (quotes doubled, spaces and newlines kept), CRLF, UTF-8 with
a BOM for spreadsheets. Why: a hand-joined cell breaks on a comma and runs as a formula in the
recipient's spreadsheet. (csv-guard, csv-hand-rolled)atomic-write)sdk-behind-port, user-action-only)typed-failures)SqlDriver, migrations,
contracts/persistence.json, AppData) and the Result module from error-handling-typed-results. Then
npx expo install expo-file-system expo-sharing expo-document-picker (SDK 57: ~57.0.7,
~57.0.22, ~57.0.3; verified 2026-10-10; re-verify with npx expo install --check).examples/contracts/architecture.json into the app's contracts/architecture.json and add both to
VENDOR_SDK_PATHS in eslint.config.mjs in the same commit
(references/platform-behaviour.md, section 7).templates/src/core/portable/, templates/src/data/backup/ (with
fixtures/backup-v1.json), templates/src/services/{export-files,share-sheet,file-picker}/,
templates/test/portable/, templates/test/sqlite/{sqlite-backup-repository,backup-round-trip}.test.ts
(skip the synced files the app already has from their owners). Replace __APP_SLUG__ (the format
marker and file names). Replace the Tasks tables with the app's own in backup-schema.ts, the SQLite
backup repository (literal SELECT/DELETE/INSERT per table, children of a skipped parent left out in
readAll), consistencyFailure, tasks-csv.ts, the frozen fixture and the tests; list every other
table in BACKUP_EXCLUDED_TABLES with its reason. Set FIRST_BACKUP_SCHEMA_VERSION in
backup-envelope.ts to the app's current LATEST_DB_VERSION (the template's 1 fits only an app
whose database is still at version 1); it never changes after the first release with backups. No
upgrade steps or fixtures exist for versions before it: never invent them to satisfy the checker.FIRST_BACKUP_SCHEMA_VERSION): export with the
app over hostile rows (quotes, =1+2, CRLF, RTL with marks, emoji at the maximum length, blanks, a
gap in ids) and commit it as src/data/backup/fixtures/backup-v<N>.json with its FIXTURES entry,
replacing the template's backup-v1.json when N > 1. Never edit it afterwards.createDeviceServices (fakes in createTestServices), and
backup: createBackupService({ ..., isPersistent: database.isPersistent }) in the data layer's device
opener as a member of AppData (platform-behaviour.md, section 7).examples/src/features/backup/ (model, pure view, one message per failure
kind): one action at a time with the busy state painted first, an iPad anchor per share button, the
confirmation naming "replace", both counts and the date formatted on screen, the "Restore the data
from before your last restore" row, skippedRows and currentSkippedRows shown, a failed phase
when a job throws (never stuck on working), and the restore run through the store
layer's updateAndPublish so every store re-reads. CSV and reports:
references/csv-and-formats.md.examples/backup-v2/, in the same change as the migration.npx jest src/core/portable src/data/backup src/services/export-files src/services/share-sheet src/services/file-picker test/sqlite --ci
and npm run typecheck.node ${CLAUDE_SKILL_DIR}/scripts/check-backup.mjs .; fix every FAIL line and rerun until it
prints RESULT: PASS. For a user's file: node ${CLAUDE_SKILL_DIR}/scripts/inspect-backup.mjs <file> --format <slug>.backup --schema <N>.payloadSha256 its SHA-256; BACKUP_SCHEMA_VERSION = LATEST_DB_VERSION.readBackup runs the whole ladder with one failure kind per reason, the checksum before any row,
newer files refused; the picked file's size is checked before it is read, and export refuses a
backup above the same MAX_BACKUP_BYTES or one that fails rung 7.previewSafetyCopy.FIRST_BACKUP_SCHEMA_VERSION is the database version of the first release with backups; every
schema version since has its upgrade step and its frozen backup-vN.json in FIXTURES; the parity
test runs for every older fixture.toCsv; machine formats hold canonical values only.contracts/architecture.json
and ESLint; export, share, pick and restore run only from presses.node ${CLAUDE_SKILL_DIR}/scripts/check-backup.mjs . prints RESULT: PASS. Expected only before
the database layer exists: SKIP src/data/migrations [upgrade-chain] not yet created (persistence-and-migrations creates it) and the same for [backup-fixture]. An app with no backup
folder and no share, pick or CSV code prints NOT APPLICABLE: no src/data/backup/, and no source file imports expo-sharing or expo-document-picker or writes text/csv.-wal sidecars corrupt the new file; replace inside one transaction.v.maxLength on backed-up text. It counts UTF-16 units; a 200-emoji title the table holds can
never be restored. Count code points.shareAsync resolves.
A crash publishes a truncated "backup"; a receiving Android app may read the file after the sheet
closed. Temp file plus move; sweep on the next export.application/json.
Providers label files differently; open with */* and let the envelope decide.useEffect(() => exportBackup()), or uploading through these ports. A file leaves without the
user asking. Export from a press; an opt-in cloud backup is its own feature
(networking-and-server-state, privacy-and-store-declarations).previewSafetyCopy.shareAsync does not report where the file went; say
"Shared" or nothing.| File | What it is | Read/run when |
|---|---|---|
| references/envelope-and-ladder.md | Backup vs export, the file and its fields, canonical JSON and SHA-256 (with measured speed), the two versions, the ladder, code-point bounds, upgrades and parity, adding version N+1, frozen hostile fixtures, decisions | Workflow steps 1, 5 and 8 |
| references/restore-policy.md | Replace, one transaction vs a file swap, the safety copy, the confirmation, excluded tables, after the restore, in-memory sessions, merge and copies (fenced) | Workflow steps 1 and 7 |
| references/platform-behaviour.md | The three ports, SDK 57 APIs, iOS and Android behaviour, folders and device backups, classification and composition, the drill on named devices | Workflow steps 3, 6 and 10 |
| references/csv-and-formats.md | Choosing a format, the two CSV escapes, BOM and CRLF, canonical values, one encoder, reports, pitfalls | Workflow step 7 |
| references/testing-and-checker.md | The shipped tests, hostile data and refusals, every check-backup rule with its fix, configuration, inspect-backup, limits | Workflow steps 9 and 11 |
templates/src/core/ | portable/: sha256.ts, utf8.ts, canonical-json.ts, csv.ts and their tests (pure); result.ts (+test) synced from error-handling-typed-results (do not edit here) | Workflow step 4 |
templates/src/data/backup/ | Schema and excluded tables, failures, envelope, upgrade step and list, reader (ladder), repository type, SQLite and fake repositories, CSV export, service, frozen fixtures/backup-v1.json, and tests | Workflow steps 4-5 |
templates/src/data/sql-driver.ts | The SqlDriver port, synced from persistence-and-migrations (do not edit here) | Workflow step 4 |
templates/src/data/migrations/migration-runner.ts | The migration runner, synced from persistence-and-migrations (do not edit here) | Workflow step 4 |
templates/src/services/ | export-files/, share-sheet/, file-picker/: the three ports, their device adapters, their fakes with tests | Workflow steps 4 and 6 |
templates/test/ | portable/parse-csv.ts (a strict RFC 4180 reader), sqlite/sqlite-backup-repository.test.ts and sqlite/backup-round-trip.test.ts (real SQL: excluded tables, idempotence, rollback, round trip, fixtures, parity), and the synced sqlite/node-sqlite-sql-driver.ts and sqlite/temp-database-folder.ts (do not edit here) | Workflow steps 4 and 9 |
examples/src/features/backup/ | Model hook (press-only actions one at a time, busy state, phases, the safety-copy row, updateAndPublish), pure screen with an iPad anchor per share button and the confirmation, one message per export and restore failure kind | Workflow step 7 |
examples/contracts/architecture.json | The two vendor SDK entries to merge | Workflow step 3 |
examples/backup-v2/ | A complete schema 2 change: migration, upgrade step and list, schema, repository, frozen backup-v2.json, FIXTURES | Workflow step 8 |
scripts/check-backup.mjs | The checker (18 rules; options --backup-dir, --json; config key backupDir) | Workflow step 11, and at the end |
scripts/inspect-backup.mjs | Checks one backup file on the computer and prints its header and rows | Support, fixtures, the drill |
scripts/lib/ | The checker's rules and the Node envelope check (backup-rules.mjs, repo-rules.mjs, backup-envelope.mjs), and the synced source-scan.mjs (do not edit) | Never by hand |
scripts/check-lib.mjs | Shared script helper, synced from the library (do not edit here) | Never by hand |
scripts/selftest.mjs | Proves both scripts pass the templates and examples and catch every planted bug | After changing a script, a template or an example |
assets/shared.json | The shared files this skill copies in | When adding a shared file |
assets/template-placeholders.json | The __APP_SLUG__ value used to verify the templates | When adding a placeholder |
tests/ | The base app and the overlay fixtures of both scripts (one planted bug per rule) | When adding a rule |
persistence-and-migrations - the database, repositories, migrations and the frozen database fixtures.error-handling-typed-results - the Result type and failure design.architecture-and-boundaries - ports, adapters, SDK classification, the composition root.state-management-zustand - re-reading stores after a restore.i18n-strings-and-catalogs - the failure messages and on-screen formatting.rtl-and-direction - showing bidi text; files keep it byte for byte.value-objects-money-and-units - canonical money and units in files.dates-streaks-and-statistics - date keys and instants.in-app-purchases - restoring purchases through the store.auth-and-secure-storage - secrets that never enter a backup.settings-and-preferences - preferences, outside the backup by default.privacy-and-store-declarations - what exporting and sharing mean for privacy answers.networking-and-server-state - an opt-in cloud backup (same envelope and ladder).media-images-and-files - photos and attachments.unit-and-component-tests, e2e-maestro - test conventions and device flows.ios-simulator-build, android-emulator-build - the builds the drill installs.assets/shared.json (opens in a new tab)assets/template-placeholders.json (opens in a new tab)examples/backup-v2/src/data/backup/backup-schema.ts (opens in a new tab)examples/backup-v2/src/data/backup/backup-upgrades.ts (opens in a new tab)examples/backup-v2/src/data/backup/fixtures/backup-v2.json (opens in a new tab)examples/backup-v2/src/data/backup/sqlite-backup-repository.ts (opens in a new tab)examples/backup-v2/src/data/backup/upgrades/v0002-add-task-due-on.ts (opens in a new tab)examples/backup-v2/src/data/migrations/migrations.ts (opens in a new tab)examples/backup-v2/src/data/migrations/v0002-add-task-due-date.ts (opens in a new tab)examples/backup-v2/test/sqlite/backup-round-trip.test.ts (opens in a new tab)examples/contracts/architecture.json (opens in a new tab)examples/src/features/backup/backup-failure-messages.ts (opens in a new tab)examples/src/features/backup/backup-screen.tsx (opens in a new tab)examples/src/features/backup/components/backup-action.tsx (opens in a new tab)examples/src/features/backup/components/restore-confirmation.tsx (opens in a new tab)examples/src/features/backup/use-backup-model.ts (opens in a new tab)references/csv-and-formats.md (opens in a new tab)references/envelope-and-ladder.md (opens in a new tab)references/platform-behaviour.md (opens in a new tab)references/restore-policy.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
73 skills in this plugin
/accessibility-as-codeEnforces a11y labels, 44pt targets, 200% text, VoiceOver, TalkBack. Use when adding a pressable, swipe or a11y label, text clips when large, contrast fails or Reduce Motion is missed. Not for RTL (rtl-and-direction)./adaptive-layoutLays screens out by window, not device: breakpoints, master-detail panes, readable widths, grids. Use when making screens responsive or for tablets, iPad, foldables, rotation, split screen, orientation lock. Not for tab bars (navigation-and-routing)./admob-ads-and-consentBuilds AdMob ads behind a port - banners, interstitials, rewarded, UMP consent then ATT, pacing, ADS_MODE test IDs. Use when touching ads, consent, ATT, ad IDs or rewarded perks. Not for purchases (in-app-purchases)./react-native:data-export-and-restorefrom react-native
npx claudepluginhub zakariaf/reactnative-skills --plugin react-nativeOther plugins' skills for the same job