← ClaudeAtlas

catchlaw-reference-databaselisted

Governs CatchLaw's two-database split and the pre-seeded reference asset — reference.db read-only and replaced wholesale, user.db writable and migrated forward-only, LazyDatabase over NativeDatabase.createInBackground readOnly, the assets/db/reference.db.gz payload, its reference.build.json sidecar and a generated kReferenceBuildId, an INSTALLED stamp over the circular content_meta read, temp-file plus atomic rename with orphan sweep and sha256 check, a 6-second determinate first-launch budget outside the 1.2-second cold start, catch rows denormalising scientific_name, citation_text and content_version, and refusal when user_version exceeds schemaVersion. Use when writing ReferenceDatabase or ReferenceInstaller, awaiting an open near runApp, replacing the shipped rule pack, adding a column to catches, bumping schemaVersion, picking a path_provider directory, reaching for ATTACH, or reviewing first-launch progress.
zakariaf/CatchLaw · ★ 0 · Data & Documents · score 55
Install: claude install-skill zakariaf/CatchLaw
# CatchLaw Reference Database CatchLaw ships two SQLite files with opposite lifecycles. `reference.db` is CONTENT — pre-seeded at build time by the content tool, opened read-only, never migrated, disposable, and replaced wholesale on update. `user.db` is the fisher's own RECORD — writable, migrated forward-only, never touched by a content update. This skill owns that split, the asset extraction contract and the first-launch budget. It does not own Drift itself. Read the reference for the task at hand: - `references/two-database-contract.md` — the file/table split, ownership matrix, directory and backup policy, denormalised catch columns, `user_version` refusal, the ATTACH ban. - `references/extraction-and-first-launch.md` — the circular build-date check, sidecar asset and generated constant, temp plus atomic rename, orphan sweep, sha256 verification, progress budget, failure ladder. Run `scripts/check_reference_db.sh` before a PR. Drift mechanics — `@DriftDatabase` wiring, DAO shape, transactions, keyset pagination, generated `*.drift.dart` — live in `persistence-drift`; the forward-only migration ritual and `MigrationStrategy` steps live in `run-migration`; `build_runner` invocation lives in `codegen-and-toolchain`; how the content tool BUILDS `reference.db` lives in `catchlaw-content-pipeline`. This skill owns only what is unique to shipping TWO databases, one of which is content. ## Non-negotiable rules 1. **Two databases, two lifecycles, and NEVER one file.** `refer