kaininx/PlainTab / .agents/skills/storage-migration
storage-migration
VerifiedUse before changing PlainTab persistent storage, including localStorage keys, IndexedDB keys or record formats, `LS_VERSION`, `DB_VERSION`, `ptab_schema_version`, migration code, backup/import/export storage shape, wallpaper cache cleanup, or any task that may affect old users upgrading across versions.
PlainTab Storage Migration
Use this skill as a red-line checklist for storage changes. User data safety and jump-upgrade behavior matter more than implementation neatness.
First Reads
- Read
.claude/rules/00-core.md. - Read
.claude/rules/10-storage.md. - If wallpaper rendering, first paint, settings UI, language, search, or command palette storage is touched, read the matching rule file from
.claude/rules/README.md.
Version Rules
DB_VERSIONis only for IndexedDB structure: object stores, indexes, keyPath, or autoIncrement.LS_VERSION/ptab_schema_versionis for PlainTab application data semantics.- If an IndexedDB-only change affects key names, record shape, references, old data cleanup, or jump upgrades, bump
LS_VERSIONand add aWallpaperData.migrate()path. - Do not use IndexedDB version upgrades for application-level migration decisions.
- Pure discardable cache changes do not need
LS_VERSIONif missing or stale cache cannot be misread and does not require cleanup.
Migration Discipline
Before production edits, write or update a focused check in docs/ai-tasks/ and watch it fail for the missing migration behavior.
For each migration step:
- Detect from persisted data, not app release numbers. Prefer
ptab_schema_version, legacyptab_version, old key presence, and current model facts. - Make the step idempotent. A browser close midway must be safe to retry.
- Write large data first, then write references.
- Never write references to missing Blob records.
- Remove references before deleting large data.
- Mark migration complete only after required new data and cleanup succeed.
- Do not overwrite non-default data already created by a newer version.
- Keep runtime modules reading only the current schema after migration.
Cleanup Rules
- Delete obsolete localStorage keys after successful migration.
- Delete obsolete IndexedDB keys with targeted deletes. Do not delete the whole
PlainTabdatabase while current data uses the same store. - Avoid permanent top-level marker keys for one-off migrations. If cleanup truly needs an idempotent retry marker, keep it scoped to an existing owned model, document why persisted facts are insufficient, and include a cleanup/removal path.
- Keep old migration code for enough releases to support users who skip versions.
Validation
Run the focused migration check, then JS syntax validation:
node docs\ai-tasks\<migration-test>.js
Get-ChildItem -Recurse js -Include *.js | ForEach-Object { node --check $_.FullName }
git diff --check -- js docs/ai-tasks .claude/rules
If storage behavior changes, update .claude/rules/10-storage.md in the same change.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |
| requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirements | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |
| using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |
| verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |