flutter-hive-persistence-engineering
Skill8 starsChanged 48 days agoMITView on GitHub
Design, implement, review, migrate, debug, secure, test, and optimize local persistence in Flutter/Dart applications using Hive or Hive CE. Use this skill whenever a task involves choosing Hive vs Hive CE, boxes, TypeAdapters, type IDs, field IDs, schema evolution, versioned migrations, encrypted boxes, Hive → Hive CE migration, normal vs LazyBox tradeoffs, repositories/caching/offline storage, IsolatedHive, Flutter Web/IndexedDB, corruption recovery, storage growth/compaction, or any persisted-model change—even if the request is framed as a simple model refactor or package upgrade.
In this repository70 other files it gives its agents.
- camerawesome-flutterSkill
- dart-args-production-cliSkill
- dart-flutter-equatable-engineeringSkill
- dart-flutter-ffi-systems-engineeringSkill
- dart-metaSkill
- document-camera-frameSkill
- document-scan-flutterSkill
- figma-to-flutter-expertSkill
- flutter-animations-production-engineeringSkill
- flutter-app-hardening-reverse-engineeringSkill
- flutter-app-icon-engineeringSkill
- flutter-application-security-engineeringSkill
- flutter-app-links-deep-link-engineeringSkill
- flutter-cachingSkill
- flutter-concurrency-memory-performanceSkill
- flutter-confetti-engineeringSkill
- flutter-dart-package-engineeringSkill
- flutter-design-system-from-design-mdSkill
- flutter-dio-cache-interceptor-engineeringSkill
- flutter-dio-engineeringSkill
- flutter-doc-scannerSkill
- flutter-drift-persistence-engineeringSkill
- flutter-expert-tipsSkill
- flutter-firebase-analyticsSkill
- flutter-firebase-core-engineeringSkill
- flutter-firebase-messagingSkill
- flutter-get-it-injectable-dependency-injectionSkill
- flutter-go-router-engineeringSkill
- flutter-image-performanceSkill
- flutter-image-picker-production-engineeringSkill
- flutter-lints-static-analysis-engineeringSkill
- flutter-local-notifications-production-engineeringSkill
- flutter-memory-leak-engineeringSkill
- flutter-mobile-developmentSkill
- flutter-motion-engineeringSkill
- flutter-multi-environmentSkill
- flutter-native-splash-engineeringSkill
- flutter-package-plugin-selectionSkill
- flutter-path-provider-production-storageSkill
- flutter-performance-jank-optimizationSkill
- flutter-permission-handler-engineeringSkill
- flutter-pinputSkill
- flutter-production-build-releaseSkill
- flutter-production-engineeringSkill
- flutter-production-loggingSkill
- flutter-pro-image-editor-engineeringSkill
- flutter-secure-storage-security-engineeringSkill
- flutter-sentry-engineeringSkill
- flutter-share-plus-engineeringSkill
- flutter-skeletonizer-engineeringSkill
- flutter-squadron-concurrency-engineeringSkill
- flutter-supabase-engineeringSkill
- flutter-svg-engineeringSkill
- flutter-ui-performance-engineeringSkill
- flutter-url-launcher-engineeringSkill
- flutter-video-player-production-engineeringSkill
- flutter-webview-production-engineeringSkill
- freezed-production-engineeringSkill
- html-to-flutterSkill
- hydrated-blocSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
72 rules. About 0 are common, 56 are distinctive, and 16 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈56
Distinctive · estimate
This author's own choices. Worth a look.
16
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 8
Treat Hive/Hive CE persistence as a long-lived data contract, not a transient implementation detail.
- Distinctive: line 23
Treat box names, key formats, type IDs, field IDs, encryption configuration, and generated schema metadata as migration-sensitive.
- Distinctive: line 24
Never reuse a retired type ID for a different persisted type.
- Distinctive: line 25
Never renumber existing field IDs for aesthetics or source-order cleanup.
- Distinctive: line 28
Commit the schema version only after validation succeeds.
- Distinctive: line 32
Keep Hive details behind repository/local-data boundaries in nontrivial applications.
- Distinctive: line 34
Do not force relational/query-heavy workloads into Hive.
- Distinctive: line 36
Keep Hive encryption keys outside Hive, normally in platform-secure storage.
- Distinctive: line 37
Do not store high-value credentials in ordinary Hive merely because it is convenient.
- Distinctive: line 39
Never delete valuable storage as generic exception handling.
- Very specific: line 41
Use Hive CE IsolatedHive only when supported multi-isolate persistence is genuinely required.
- Distinctive: line 42
Treat Flutter Web as browser/IndexedDB persistence with different durability and security semantics.
- Distinctive: line 47
Before changing code, inspect:
- Distinctive: line 67
Do not infer compatibility from package names alone.
- Distinctive: line 70
Read only what the task needs:
- Distinctive: line 76
Always read reference 02 plus the historical-fixture testing sections of reference 04 for persisted-schema changes.
- Distinctive: line 78
Before modifying an existing project, inventory the contract.
- Distinctive: line 145
only a few primitive settings.
- Distinctive: line 155
If broad scans over a large box are the primary query architecture, reconsider the storage engine.
- Very specific: line 177
Do not leak Box into unrelated presentation/business code unless project scope deliberately justifies it.
- Very specific: line 188
Only block startup on storage required for first-screen correctness or schema safety.
- Distinctive: line 190
Do not reopen an existing box expecting to replace its encryption, lazy/normal semantics, generic type, or lifecycle policy.
- Distinctive: line 193
Avoid one giant mixed-purpose box and hundreds of tiny boxes without lifecycle value.
- Distinctive: line 194
Treat box names as stable persisted identifiers.
- Very specific: line 196
Prefer Box<T> for frequently accessed values that fit memory and benefit from synchronous reads.
- Very specific: line 197
Consider LazyBox<T> for large values read sparsely when async backend access is acceptable.
- Distinctive: line 198
Do not use lazy storage as a universal performance setting.
- Distinctive: line 200
Use primitives for simple stable settings.
- Distinctive: line 201
Use typed persistence models/adapters for durable structured records.
- Distinctive: line 202
Prefer persistence-specific DTOs when domain/server schemas evolve independently, cache metadata is storage-specific, or migrations should …
- Distinctive: line 203
Avoid long-lived dynamic maps as the application-wide schema.
- Distinctive: line 220
do not assume property renames retain field identity automatically.
- Distinctive: line 222
never hand-edit generated adapters.
- Distinctive: line 269
Never delete valuable source data before successful destination validation.
- Distinctive: line 280
Do not combine package migration, adapter-generation redesign, box rename, and schema redesign in one release for valuable data unless …
- Distinctive: line 282
Prefer stable domain IDs as box keys for synchronized/domain entities.
- Very specific: line 283
Use auto-increment keys only for records whose identity is genuinely local/append-like.
- Very specific: line 285
Do not use getAt(index) as durable entity identity.
- Distinctive: line 286
Use keyed access instead of whole-box materialization when possible.
- Very specific: line 289
Use bulk APIs when they reduce repeated operations and match semantics.
- Very specific: line 290
Use flush() at deliberate durability boundaries, especially migration commits, not after every trivial write.
- Distinctive: line 292
If a business invariant requires all-or-nothing multi-record updates, use one aggregate record, serialized mutation/recovery, a write-ahead …
- Distinctive: line 307
Do not describe persisted cache data as automatic offline sync.
- Distinctive: line 316
Never hardcode, log, or co-store the encryption key with the data it protects.
- Distinctive: line 317
Do not silently generate a replacement key when critical encrypted data already exists and the old key is missing.
- Very specific: line 318
Use platform-secure storage directly for small high-value credentials/private key material when appropriate.
- Very specific: line 319
Treat encryption-key rotation as a copy/validate/switch migration, not an in-place magic operation.
- Very specific: line 327
Do not assume ordinary Hive access from several isolates is safe.
- Distinctive: line 330
Prefer default compaction behavior first.
- Distinctive: line 332
Use manual/custom compaction only for measured growth problems and avoid forcing expensive compaction into startup without evidence.
- Distinctive: line 333
Keep large media in files/object storage and persist metadata in Hive.
- Distinctive: line 335
Treat browser storage as IndexedDB with browser-controlled quota, eviction, site-data clearing, private-mode behavior, and origin lifetime.
- Distinctive: line 336
Do not assume native filesystem or Keychain/Keystore semantics.
- Very specific: line 340
Do not turn every storage exception into null.
- Distinctive: line 341
Before classifying corruption, check initialization, path/backend, adapter registration, type IDs, generic/lazy mismatch, encryption key, …
- Distinctive: line 345
Critical local data: do not auto-delete; preserve original data, stop destructive writes, collect sanitized diagnostics, and enter explicit …
- Distinctive: line 349
write → close → reopen → read.
- Distinctive: line 350
every persisted field round-trips.
- Distinctive: line 369
Use deterministic test-only keys.
- Very specific: line 371
Test Web and IsolatedHive on relevant real targets when used.
- Distinctive: line 372
Use unique native test directories and clean them up.
- Distinctive: line 388
only necessary boxes block startup.
- Very specific: line 390
no unnecessary toMap()/full-box copies.
- Distinctive: line 391
no giant blobs in general-purpose boxes.
- Distinctive: line 422
Read reference 05 for the full 30-item anti-pattern catalog and checklists.
- Distinctive: line 428
Document realistic size and access patterns.
- Distinctive: line 439
Add fresh/reopen and historical-fixture test strategy.
- Very specific: line 442
Run analysis/tests/platform checks.
- Distinctive: line 453
Remove legacy data/read paths only after supported upgrade paths no longer require them.
- Distinctive: line 468
Do not call a persisted-model change safe without compatibility evidence.
- Distinctive: line 474
only required boxes block startup.
- Distinctive: line 493
If any item is unknown, treat the persistence change as incomplete.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Flutter Hive Persistence Engineering
Mission
Treat Hive/Hive CE persistence as a long-lived data contract, not a transient implementation detail. Use this loop:
Classify data/access pattern
→ inspect deployed storage contract
→ choose storage/box/model strategy
→ design compatibility + recovery
→ implement smallest safe change
→ test old persisted data + failures
→ measure startup/memory/storage/write costHighest-priority invariant:
Persisted data is part of the application's long-lived external contract. A Dart model change is not safe merely because the new code compiles.
Operating Rules
- Inspect pinned package versions and existing storage before editing persistence.
- Treat box names, key formats, type IDs, field IDs, encryption configuration, and generated schema metadata as migration-sensitive.
- Never reuse a retired type ID for a different persisted type.
- Never renumber existing field IDs for aesthetics or source-order cleanup.
- Design migrations before shipping incompatible schema changes.
- Make migrations sequential, restartable/idempotent, validated, and historical-fixture tested.
- Commit the schema version only after validation succeeds.
- Preserve valuable source data until the replacement is safely written and validated.
- Register adapters deterministically before opening boxes containing those types.
- Open boxes through a deliberate owner and reuse them;
openBoxis lifecycle configuration, not a query. - Keep Hive details behind repository/local-data boundaries in nontrivial applications.
- Choose
Box<T>vsLazyBox<T>from measured memory and access patterns. - Do not force relational/query-heavy workloads into Hive.
- Await important writes; do not assume arbitrary multi-record/cross-box operations are atomic.
- Keep Hive encryption keys outside Hive, normally in platform-secure storage.
- Do not store high-value credentials in ordinary Hive merely because it is convenient.
- Recover differently for disposable cache, reconstructable data, and critical local user data.
- Never delete valuable storage as generic exception handling.
- Debounce/batch high-frequency writes and persist critical edits before termination.
- Use Hive CE
IsolatedHiveonly when supported multi-isolate persistence is genuinely required. - Treat Flutter Web as browser/IndexedDB persistence with different durability and security semantics.
- Preserve Hive CE generated schema metadata in version control.
- Separate package migration from schema redesign when valuable production data exists.
- Re-run historical compatibility tests after adapter, generator, encryption, or package changes.
Version Gate
Before changing code, inspect:
Flutter SDK
Dart SDK
hive or hive_ce
hive_flutter or hive_ce_flutter
hive_generator or hive_ce_generator
build_runner
pubspec.lock/workspace lockAlso determine whether the project uses:
original Hive
Hive CE
manual adapters
@HiveType/@HiveField generation
GenerateAdapters
encrypted boxes
IsolatedHiveDo not infer compatibility from package names alone. For new Dart 3+ work whose access model fits Hive, prefer Hive CE unless a concrete constraint requires original Hive. For an existing original-Hive production app, preserve compatibility first and evaluate CE migration with production-format fixtures.
Reference Routing
Read only what the task needs:
references/01-selection-architecture-boxes.md— package choice, alternatives, architecture, initialization, box design/ownership, normal vs lazy boxes, persistent models.references/02-adapters-schema-migrations.md— adapters, stable IDs, schema evolution, migration architecture, crash safety, large migrations, Hive → Hive CE.references/03-access-cache-security-concurrency.md— keys, reads/writes, watchers, repositories, cache/offline policy, encryption, compaction, lifecycle, concurrency, isolates.references/04-platform-testing-debugging.md— Web, error/recovery, diagnostics, DI/Bloc integration, tests, code generation, monorepos, debugging.references/05-antipatterns-workflows-checklists.md— anti-patterns, implementation/review workflows, migration/performance/security checklists, production gates. Always read reference 02 plus the historical-fixture testing sections of reference 04 for persisted-schema changes.
Repository Inspection
Before modifying an existing project, inventory the contract.
Package and initialization
Find:
Hive.init
Hive.initFlutter
IsolatedHive
registerAdapter / registerAdapters
openBox / openLazyBox
Hive.boxRecord initialization order, storage backend/path, and startup-critical boxes.
Boxes
For each box record:
name
generic type
normal/lazy
encryption
owner/lifetime
data importance
size/access pattern
compaction policySchema
For each custom persisted type record:
type
typeId
field IDs
manual/generated strategy
retired IDs
registration point
historical versionsFor Hive CE automatic generation, inspect generated schema metadata and its version history.
Lifecycle
Map:
source of truth
→ write/read
→ cache/TTL/sync
→ migration
→ logout/account switch
→ deletion/recoveryRisk search
Search for:
Hive.box/openBox in widgets or blocs
Box<dynamic>
Map<dynamic, dynamic>
HiveAesCipher / generateSecureKey
unawaited writes
clear/deleteBoxFromDisk
toMap / full-box scans
Uint8List/base64/media blobs
watch subscriptions
manual compact()Storage-Engine Decision Gate
Choose Hive/Hive CE when access is mostly stable key → value, moderate object collections, local caches/offline snapshots, and small-to-moderate persistent state.
Choose another mechanism when dominated by:
- joins/relational constraints;
- rich indexed filtering/sorting/aggregation;
- strong transactional multi-record invariants;
- large binary/media payloads;
- only a few primitive settings;
- high-value credentials/private key material. Typical alternatives:
few settings → preferences
secrets → platform secure storage
relational/query-heavy data → SQLite/Drift or suitable DB
large media → filesystem/object storage + metadata
transient state → memoryIf broad scans over a large box are the primary query architecture, reconsider the storage engine.
Architecture Boundary
Default flow:
UI
↓
Bloc / Cubit / ViewModel
↓
Repository
↓
Local Data Source
↓
Hive / Hive CEPersistence infrastructure owns:
- box names/keys;
- adapter registration;
- migrations;
- encryption configuration;
- box lifecycle;
- low-level storage failures.
Repositories own cache/offline semantics and remote/local coordination.
Do not leak
Boxinto unrelated presentation/business code unless project scope deliberately justifies it.
Initialization and Box Ownership
Use this order:
initialize Hive/backend
→ register adapters
→ open migration metadata/legacy readers
→ run required migrations
→ open current-schema boxes
→ start consumersOnly block startup on storage required for first-screen correctness or schema safety. Lazy-open large feature-only boxes. Assign one owner for each box's open/close/delete lifecycle. Do not reopen an existing box expecting to replace its encryption, lazy/normal semantics, generic type, or lifecycle policy.
Box Design
Separate boxes when lifecycle, security, size/access pattern, migration ownership, or cleanup/reconstruction policy differs materially. Avoid one giant mixed-purpose box and hundreds of tiny boxes without lifecycle value. Treat box names as stable persisted identifiers; renaming requires migration.
Normal vs Lazy
Prefer Box<T> for frequently accessed values that fit memory and benefit from synchronous reads.
Consider LazyBox<T> for large values read sparsely when async backend access is acceptable.
Do not use lazy storage as a universal performance setting; it can trade memory for repeated I/O.
Persistent Model Design
Use primitives for simple stable settings. Use typed persistence models/adapters for durable structured records. Prefer persistence-specific DTOs when domain/server schemas evolve independently, cache metadata is storage-specific, or migrations should not dictate domain architecture. Avoid long-lived dynamic maps as the application-wide schema.
Adapter and ID Invariants
Persisted identity rules:
existing typeId → never change
retired typeId → reserve forever
existing field ID → never renumber
retired field ID → never reuse for unrelated semanticsDeclaration order is not schema identity. A renamed source property is compatible only if persisted identity and representation remain compatible. Changing field type/nullability/enum representation, box name, key format, type ID, or encryption configuration is a migration problem unless proven otherwise.
Hive CE Generated Schema
When using GenerateAdapters:
- preserve generated schema metadata in source control;
- reserve IDs already owned by legacy/manual adapters;
- inspect generated schema diffs after persistent model changes;
- do not assume property renames retain field identity automatically;
- regenerate with compatible runtime/generator versions;
- never hand-edit generated adapters.
Schema Evolution Gate
Lower-risk examples:
- new optional/defaultable field with a new unused ID;
- source rename with deliberately preserved manual field identity. High-risk examples:
- new required field without old-record handling;
- field type/nullability/enum representation change;
- generated-field rename with uncertain mapping;
- model split/merge;
- box/key rename;
- adapter-generation strategy change;
- encryption/key/cipher change. Critical defects:
- changing a deployed type ID;
- reusing retired type/field IDs;
- destructively resetting irreplaceable data without recovery design.
Migration Protocol
Maintain explicit schema metadata such as:
storage_meta.schema_version
storage_meta.migration_cursorRun:
vN
→ migrate N→N+1
→ validate
→ persist/flush N+1
→ repeatMigration requirements:
- sequential;
- idempotent/resumable;
- old-data readable long enough to migrate;
- bounded memory;
- sanitized observability;
- safe after interruption;
- validated before version commit. For destructive transformations prefer:
read old
→ write new
→ validate new
→ commit metadata
→ delete old laterNever delete valuable source data before successful destination validation. For large datasets, migrate in chunks and persist progress so restart resumes safely.
Hive → Hive CE Migration Gate
For existing original Hive production data:
- Inventory versions, boxes, lazy/normal state, encryption, adapters, IDs, and migrations.
- Capture fixtures written by released original-Hive builds.
- Replace package family/imports deliberately.
- Preserve box names, keys, type IDs, field IDs, and encryption behavior.
- Preserve adapter behavior first.
- Prove old data can open, read, write, close, reopen, and migrate.
- Modernize generation/schema only afterward where practical. Do not combine package migration, adapter-generation redesign, box rename, and schema redesign in one release for valuable data unless unavoidable and comprehensively tested.
Keys and Access
Prefer stable domain IDs as box keys for synchronized/domain entities.
Use auto-increment keys only for records whose identity is genuinely local/append-like.
Encode composite identities deterministically and unambiguously.
Do not use getAt(index) as durable entity identity.
Use keyed access instead of whole-box materialization when possible.
Writes and Application Atomicity
Await important writes and handle failures.
Use bulk APIs when they reduce repeated operations and match semantics.
Use flush() at deliberate durability boundaries, especially migration commits, not after every trivial write.
Hive does not make arbitrary cross-box sequences an application transaction.
If a business invariant requires all-or-nothing multi-record updates, use one aggregate record, serialized mutation/recovery, a write-ahead pattern, or a transactional database.
Protect read-modify-write sequences from concurrent callers too.
Caching and Offline Policy
Hive stores values; it does not provide TTL, stale policy, remote synchronization, conflicts, or retry semantics. Explicitly define:
freshness/expiry
cache invalidation
stale fallback
sync cursor
pending operations
retry/idempotency
conflict resolution
account scopeDo not describe persisted cache data as automatic offline sync.
Encryption and Secret Boundary
For encrypted boxes:
platform-secure key store
→ random 32-byte Hive encryption key
→ HiveAesCipher
→ encrypted boxNever hardcode, log, or co-store the encryption key with the data it protects. Do not silently generate a replacement key when critical encrypted data already exists and the old key is missing. Use platform-secure storage directly for small high-value credentials/private key material when appropriate. Treat encryption-key rotation as a copy/validate/switch migration, not an in-place magic operation.
Lifecycle, Concurrency, and Isolates
Persist critical information while it changes; app termination callbacks are not a reliable sole save point. On logout/account switch:
- flush/cancel pending writes as policy requires;
- close or clear user-scoped boxes deliberately;
- prevent previous-user cache exposure;
- preserve data that policy intentionally retains.
Do not assume ordinary Hive access from several isolates is safe.
With Hive CE, use
IsolatedHivewhen multiple isolates truly need supported persistence access, and account for communication overhead. If one isolate can own storage, central ownership plus messages may remain simpler.
Compaction and Storage Growth
Prefer default compaction behavior first. Investigate growth from live value size, overwrite/delete churn, stale cache, abandoned migration copies, uncleaned user data, or media stored in boxes. Use manual/custom compaction only for measured growth problems and avoid forcing expensive compaction into startup without evidence. Keep large media in files/object storage and persist metadata in Hive.
Flutter Web Gate
Treat browser storage as IndexedDB with browser-controlled quota, eviction, site-data clearing, private-mode behavior, and origin lifetime. Do not assume native filesystem or Keychain/Keystore semantics. For Hive CE Web/WASM, test target browsers and large-integer identity behavior where values can exceed JavaScript's exact integer range. Prefer string identities when exactness matters. Critical browser-local data needs server sync/export/backup or explicit product acceptance of browser-local durability.
Error and Recovery Gate
Do not turn every storage exception into null.
Before classifying corruption, check initialization, path/backend, adapter registration, type IDs, generic/lazy mismatch, encryption key, interrupted migration, and package changes.
Then classify data:
- Disposable cache: reset/refetch can be acceptable after diagnosis.
- Reconstructable server data: preserve pending local mutations/account/sync metadata before reset.
- Critical local data: do not auto-delete; preserve original data, stop destructive writes, collect sanitized diagnostics, and enter explicit recovery/export flow.
Testing Gate
For shipped persistence, fresh CRUD tests are not enough.
Required core tests
- write → close → reopen → read;
- every persisted field round-trips;
- missing/default behavior;
- deletion/cleanup policy;
- important write failures.
Historical fixtures
Store fixtures created by previous released versions. Test:
historical fixture
→ current runtime/adapters
→ migration
→ validate
→ close/reopen
→ validate againCover oldest supported and immediately previous schemas.
Migration failures
Simulate interruption and verify safe rerun/resume.
Encryption
Use deterministic test-only keys; test correct-key reopen and wrong-key behavior.
Platform/concurrency
Test Web and IsolatedHive on relevant real targets when used.
Use unique native test directories and clean them up.
Performance Gate
Measure before changing persistence semantics. Inspect separately:
Hive init
adapter registration
box-open duration
migration duration
compaction
domain hydration
resident value memory
write rate
storage sizePerformance checks:
- only necessary boxes block startup;
- large infrequently-read data considered for lazy storage;
- no unnecessary
toMap()/full-box copies; - no giant blobs in general-purpose boxes;
- high-frequency writes are debounced/batched;
- watchers are scoped to relevant keys/events;
- stale cache is actually removed;
- query-heavy datasets have not outgrown Hive;
- migration is chunked if large;
- Web is measured independently from native.
Anti-Patterns to Reject
Reject by default:
- direct box access scattered across widgets/business code;
- opening boxes per read;
- one giant mixed-purpose box;
- one box per tiny preference without lifecycle value;
- persisting domain/UI models without schema reasoning;
- reusing or renumbering IDs;
- incompatible field-type changes without migration;
- deleting data because migration is inconvenient;
dynamic/raw maps everywhere;- secrets in plain Hive;
- hardcoded/logged encryption keys;
- huge media in boxes;
- full-box copies for keyed access;
- LazyBox everywhere “for performance”;
- per-keystroke writes without durability reasoning;
- saving only on app termination;
- assumptions of automatic TTL/offline synchronization;
- marking schema version before validation;
- hand-editing generated adapters;
- adapter changes without old-data fixtures;
- cross-box atomicity assumptions;
- unsupported direct multi-isolate access. Read reference 05 for the full 30-item anti-pattern catalog and checklists.
New Feature Workflow
- Decide whether persistence is required.
- Choose storage technology from access/query/transaction/security/payload needs.
- Choose Hive vs Hive CE intentionally.
- Classify data: disposable, reconstructable, critical local, or secret.
- Document realistic size and access patterns.
- Design boxes by lifecycle/security/access/migration ownership.
- Choose normal vs lazy.
- Design persistence DTO/schema.
- Allocate stable IDs or configure CE schema generation/reservations.
- Define key strategy.
- Define encryption/key lifecycle if needed.
- Assign box ownership.
- Implement storage/repository boundary appropriate to project size.
- Define cache/offline/sync behavior explicitly.
- Define recovery policy.
- Add fresh/reopen and historical-fixture test strategy.
- Review write rate/startup/memory/storage growth.
- Generate adapters and inspect schema diff.
- Run analysis/tests/platform checks.
Existing-Code Refactor Workflow
- Record package and SDK versions.
- Inventory boxes, keys, types, IDs, adapters, generated schema, encryption, and owners.
- Capture historical fixtures before changing schema/package family.
- Characterize current migration/recovery behavior.
- Refactor direct UI/Bloc storage access without changing persisted layout first.
- Perform package migration separately where possible.
- Perform schema migration separately where possible.
- Preserve legacy read capability until migration completes.
- Validate startup, reopen, logout/account switch, recovery, and old fixtures.
- Remove legacy data/read paths only after supported upgrade paths no longer require them.
Reporting Format
For persistence implementation/review, report:
Repository baseline
Data classification
Storage/box design
Schema contract
Migration impact
Security/key management
Concurrency/lifecycle
Performance impact
Historical + failure tests
Risks/unresolved decisionsDo not call a persisted-model change safe without compatibility evidence.
Production Gate
Before release verify:
- storage engine fits the access model;
- package choice and pinned versions are known;
- box names/owners/lifetimes are explicit;
- only required boxes block startup;
- adapters register before reads;
- type/field IDs remain stable and retired IDs remain reserved;
- generated CE schema metadata is preserved/current;
- incompatible changes have versioned migrations;
- migrations are restartable and validated before version commit;
- historical deployed fixtures upgrade successfully;
- important writes are awaited;
- cross-record/cross-box atomicity is not assumed;
- high-frequency writes are bounded;
- normal/lazy choice fits actual workload;
- storage growth/compaction is understood;
- encryption keys are securely managed and never logged;
- missing critical encryption keys cannot silently orphan data;
- logout/account switching cannot leak prior-user data;
- valuable data is not auto-deleted on generic errors;
- multi-isolate access uses a supported strategy;
- Web durability/security differences are handled;
- fresh, reopen, migration, recovery, and relevant platform tests pass. If any item is unknown, treat the persistence change as incomplete.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

