Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

local-data-migrations

БесплатноБез исполняемых скриптовНе проверен

Rules for changing Klex config schemas, SQLite schemas, persisted JSON, store metadata, local-data definitions, or migration and recovery code.

stagewise-ioот stagewise-io★ 44 звезды на GitHub

Об этом скилле

Local data migrations

Read apps/klex/src/local-data/architecture.md before changing persistent state.

Required workflow

  1. Establish the released baseline before editing. Inspect release tags and the store definition, schemas, nested schemas, defaults, and migration helpers at the relevant released commits. Compare against the latest release and the release that introduced the affected version. Do not infer release status from comments, the branch name, the current package version, or an agent's earlier claim. A withdrawn or deleted release still counts. If history is unavailable or ambiguous, treat the contract as released and report the uncertainty.
  2. Classify the change as one of:
    • No representation change.
    • Compatible additive change.
    • Schema migration.
    • Compatibility-floor increase.
  3. Update the store definition in its owning module as required by the classification. For a schema migration, add a new schema and one new forward step from the current version. Compatible additive changes may retain versions only when older readers preserve and safely ignore the addition. Keep the old schema and old steps intact. Review shared dependencies for accidental changes to historical behavior.
  4. Confirm the definition remains present in local-data-registry.
  5. Add old/current/newer fixtures and downgrade, failure, and recovery tests appropriate to the classification. Follow the regression checklist below.
  6. Run local-data tests, the owning module tests, typecheck, lint, executable build, and native smoke verification. Report failures and skipped checks explicitly. Do not describe a parser-only test as startup verification.
  7. Include the released baseline, change classification, old and new schema/compatibility versions, minimum supported binary version, and validation results in the PR or handoff. Explain any manual recovery needed before the updater can start.

Released contracts are immutable

A stored version is a permanent contract with data already on users' machines. Never fix a new feature by rewriting that contract.

  • History freezes on merge, including nightly-only migrations. Never edit an existing file in apps/klex/src/local-data-migrations/ (except append-only updates to the literal LOCAL_DATA_MIGRATIONS registry) or apps/klex/src/local-data-migration-fixtures/, or reuse its version number. Append a new contiguous step in local-data-migrations/<store>/vN-to-vN+1/, containing migration.ts and self-contained raw input/output schemas and helpers. Name exports by persisted version, such as configV6Schema and configV6ToV7. Do not share contracts across transitions. The live config schema belongs in config/schema.ts, without migration-only parsers or historical schemas.
  • Append imports and array entries in the literal LOCAL_DATA_MIGRATIONS registry; retain every existing import identity and array prefix. Wire the owning store directly to those arrays and increment its latest schema version. Register new stores with migrations in history as well.
  • Historical files may import only helpers/schemas inside the same transition folder, Zod, and type-only JsonMigration/SqliteMigration interfaces from @/local-data. Never import current application code, even a pure helper or nested schema. Do not use require, side-effect imports or dynamic imports. Deliberate schema duplication is required.
  • Run node --test scripts/check-local-data-migrations.test.mjs and node scripts/check-local-data-migrations.mjs <trusted-target-ref> as well as startup/owning-module tests. CI compares with the trusted PR base, not a PR-editable manifest. See the architecture document for the bootstrap and branch-protection requirement.
  • Never narrow a historical validator to the current runtime shape. Keep explicit historical schemas, including their nested schemas and defaults. A shared helper or schema edit can change old versions even when the version registry is untouched.
  • Removing an optional property, rejecting an empty legacy list, changing a persisted enum or discriminator, or moving a field is a representation change. Runtime code no longer using a field does not make existing stored data invalid.
  • Keep historical fixtures as evidence. Do not remove legacy fields, change their metadata to the new version, or regenerate their expected shape from the current parser just to make tests pass. Add a separate current fixture.
  • If a broken binary has already shipped, account for both the pre-existing released shape and any shape the broken binary could have written. Preserve valid data in each case. Do not silently accept arbitrary corruption.

Required regression checks

Use literal or frozen fixtures whose expected historical shape is independent of the current parser. Include realistic selections and options, not just an empty default config.

  • Validate the old fixture with its historical schema and assert that any existing migration still produces its released outp
Полный SKILL.md на GitHub

Установить local-data-migrations в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл local-data-migrations?

Rules for changing Klex config schemas, SQLite schemas, persisted JSON, store metadata, local-data definitions, or migration and recovery code.

Как установить скилл local-data-migrations?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл local-data-migrations запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить local-data-migrations с