data-export-and-restore

Implements versioned backup, validated restore, and safe CSV/JSON/PDF export for offline-first apps.

Updated Aug 22, 2026
One-click install
npx skills add https://github.com/zakariaf/NearlyStop --skill data-export-and-restore-zakariaf
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: data-export-and-restore
Source: https://github.com/zakariaf/NearlyStop/tree/main/.claude/skills/data-export-and-restore
Command: npx skills add https://github.com/zakariaf/NearlyStop --skill data-export-and-restore-zakariaf

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires path_provider, share_plus, file_selector, crypto, and includes references (resource) components.

What problem does it solve? In an offline-first app with no server, the export file is the only copy of user data that can outlive the phone, and restore is the only recovery path. A lossy export silently becomes someone's backup, and a half-applied restore destroys the database it was meant to protect. This Skill enforces strict separation between machine backups and human exports, plus an all-or-nothing restore that never corrupts the live database. ## Core Features & Use Cases - Versioned backup envelope: Every backup carries formatVersion, schemaVersion, appVersion, exportedAtUtc, and a SHA-256 payload checksum, so restore refuses files from a newer app instead of misreading them. - Staging-based restore: Imports into a staging database, validates through a seven-rung ladder, migrates older payloads forward, then publishes by atomic rename with rollback — the live database is never edited in place. - Safe export formats: Canonical machine values (integer minor units, ISO-8601 UTC, stable UUIDs), RFC 4180 CSV quoting plus formula-injection escaping, streamed writes published by atomic rename, and share/save behind an injected Gateway. - Use Case: When adding a backup/restore feature to a Flutter app, use this Skill to design the envelope format, the validate-stage-swap restore flow, and the round-trip tests on a hostile fixture containing RTL text, emoji, and DST-ambiguous instants. ## Quick Start Ask the AI to design a backup and restore flow for my offline Flutter app following the data-export-and-restore rules, including the versioned envelope and staging-database swap.

Frequently Asked Questions about data-export-and-restore

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement backup and restore in an offline-first app?

Write backups as a versioned envelope containing formatVersion, schemaVersion, appVersion, exportedAtUtc, and a payload checksum. Restore by importing into a staging database, validating everything, then publishing by atomic rename so the live database is never edited in place.

How do I prevent CSV formula injection in spreadsheet exports?

Neutralize any cell starting with =, +, -, @, tab, or CR before quoting, so a spreadsheet renders the text instead of executing it. Combine this with RFC 4180 quoting for fields containing delimiters, quotes, or newlines — the two escapes are independent and both are required.

Should CSV exports be restorable as backups?

No. CSV is a lossy interop format with no envelope, types, or versioning, and must be refused as a restore source. Only the versioned envelope format with a checksum should be accepted by restore, otherwise a readability-focused format becomes someone's only copy of their data.

Why does restoring directly into the live database cause data loss?

A mid-import failure leaves a partially written state with no rollback path that neither the user nor the developer can reproduce. Importing into a staging database and swapping by atomic rename guarantees the live data stays byte-unchanged on any failure.

Can I use autoincrement row IDs in export files?

No. Exportable rows need stable content-assigned ids such as UUID or ULID minted at creation. Re-importing a file with autoincrement ids duplicates every record instead of being idempotent under merge-by-id.

How do I handle restoring a backup from a newer app version?

Refuse it outright with a typed failure naming the app version that wrote the file, never best-effort parse it. Older payloads are migrated forward through the same migration path as the app database, but newer schemaVersions cannot be safely interpreted.