.agents/skills/work-issue-migrations/migration-template.md

Migration descriptor schema (version 1)

Copy the fenced document into docs/migrations/<target-version>-<migration-id>.md, replace placeholders and fill every section with concrete instructions. The consumer migrate command reads these instruction documents through the release index; they are not unattended executable scripts. Paths in the resulting document resolve from its location, not from this template.

Required YAML metadata:

Field Contract
schema_version Integer 1, identifying this descriptor format, not the task format or plugin version.
migration_id Stable unique lowercase hyphenated identifier; preserve it across documentation fixes.
target_version Exact plugin version whose migration step establishes the target contract; not evidence migration has run.
target_layout Recognizable destination paths/format and completion invariants.

Version/layout metadata describes only the target. A project several versions behind follows every intervening release's migration instructions in ascending semantic-version order, verifying each target before the next; do not define source-version allowlists, source-layout selectors or prerequisite-ID graphs. Use the project's last verified migration/version checkpoint, not the newly installed plugin version, to find the starting point. If progress is unknown, reconstruct it read-only before writing. Every shipped version needs an indexed descriptor: a release that changes no records gets an explicit no-record-migration step that verifies the previous target and writes only its checkpoint, since migrate defaults to the installed version and rejects unindexed targets. Missing instructions are not proof that a step can be skipped. When a release has multiple descriptors, state their order in the guide.

All body sections below are required. State why an item is inapplicable rather than omitting its safety decision. Published descriptors must not contain unresolved template placeholders. Keep project-specific inventory, approvals, checkpoints and backups outside tracked product files; these are execution evidence, not edits to this reusable descriptor. A developer approves each project's exact preview; publication is not that approval.

---
schema_version: 1
migration_id: "<stable-migration-id>"
target_version: "<target-version>"
target_layout: "<destination-paths-and-format>"
---

# <Update migration title>

## Applicability and exclusions

<Why needed; release impact; when this target's step runs in the sequential upgrade. Verify all earlier required steps before starting, without a source-version allowlist. Define fresh-project, already-applied and partially-applied outcomes, target invariants and handling of unexpected/conflicting records.>

## Artifacts and preservation

<Every affected record/configuration/path and its destination. What changes and what must remain byte-identical: IDs, history, custom content, reservation metadata and exact approval/artifact evidence. Separate storage relocation from schema changes and new approvals.>

## Preconditions and read-only preview

<Required access/tools, writers to pause, inventory coverage and missing-coverage blockers. Inventory must not fetch, initialize storage or mutate records. Any remote refresh is separately authorized before inventory. Show exact sources, destinations, differences, conflicts and required developer decisions.>

## Approval and backup

<Explicit approval of the project-specific preview before mutation. External backup of every source variant and existing destination, verification of backup completeness, and a checkpoint identifying version/ref/checkout/inventory. Separate product cleanup approval from record copying; no implicit commit/push or live-project authorization.>

## Ordered migration instructions

<Concrete ordered manual or automated actions, link repairs and conflict handling. Re-read sources before writes; changes since preview invalidate it. Never overwrite unexpected destinations or delete sources before verified copies. Explain which commands are illustrative versus executable.>

## Verification and completion

<Observable success criteria for each affected artifact, preserved history/approval, target layout, resume references and product-tree effects. Record a completed target-version/migration-ID checkpoint only after verification; do not advance past partial or failed steps. Read-only checks, remaining blockers and required handoff. No automatic task execution or new approval.>

## Repeat runs and interrupted migration

<Recognize verified completed steps without writes or duplicate log entries. Resume partial progress against the approved inventory, stop on unexpected changes, and prevent historical copies from overwriting newer records.>

## Rollback and recovery

<Pause writers, export current/new work before restoring backups, reconcile divergence and preserve approvals. Prior plugin availability and compatibility checks; never run incompatible old/new writers concurrently. Recovery cannot discard newer work or rewrite product history.>

## Maintainer verification

<Historical fixtures, sequential multi-version upgrade ordering and target invariants, conflict/partial/repeat/recovery cases, verification commands and evidence location. Distinguish procedure-primitive checks from end-to-end agent execution; report unavailable checks.>
Original Markdown, including metadata
# Migration descriptor schema (version 1)

Copy the fenced document into `docs/migrations/<target-version>-<migration-id>.md`, replace placeholders and fill every section with concrete instructions. The consumer `migrate` command reads these instruction documents through the release index; they are not unattended executable scripts. Paths in the resulting document resolve from its location, not from this template.

Required YAML metadata:

| Field | Contract |
| --- | --- |
| `schema_version` | Integer `1`, identifying this descriptor format, not the task format or plugin version. |
| `migration_id` | Stable unique lowercase hyphenated identifier; preserve it across documentation fixes. |
| `target_version` | Exact plugin version whose migration step establishes the target contract; not evidence migration has run. |
| `target_layout` | Recognizable destination paths/format and completion invariants. |

Version/layout metadata describes only the target. A project several versions behind follows every intervening release's migration instructions in ascending semantic-version order, verifying each target before the next; do not define source-version allowlists, source-layout selectors or prerequisite-ID graphs. Use the project's last verified migration/version checkpoint, not the newly installed plugin version, to find the starting point. If progress is unknown, reconstruct it read-only before writing. Every shipped version needs an indexed descriptor: a release that changes no records gets an explicit no-record-migration step that verifies the previous target and writes only its checkpoint, since `migrate` defaults to the installed version and rejects unindexed targets. Missing instructions are not proof that a step can be skipped. When a release has multiple descriptors, state their order in the guide.

All body sections below are required. State why an item is inapplicable rather than omitting its safety decision. Published descriptors must not contain unresolved template placeholders. Keep project-specific inventory, approvals, checkpoints and backups outside tracked product files; these are execution evidence, not edits to this reusable descriptor. A developer approves each project's exact preview; publication is not that approval.

```markdown
---
schema_version: 1
migration_id: "<stable-migration-id>"
target_version: "<target-version>"
target_layout: "<destination-paths-and-format>"
---

# <Update migration title>

## Applicability and exclusions

<Why needed; release impact; when this target's step runs in the sequential upgrade. Verify all earlier required steps before starting, without a source-version allowlist. Define fresh-project, already-applied and partially-applied outcomes, target invariants and handling of unexpected/conflicting records.>

## Artifacts and preservation

<Every affected record/configuration/path and its destination. What changes and what must remain byte-identical: IDs, history, custom content, reservation metadata and exact approval/artifact evidence. Separate storage relocation from schema changes and new approvals.>

## Preconditions and read-only preview

<Required access/tools, writers to pause, inventory coverage and missing-coverage blockers. Inventory must not fetch, initialize storage or mutate records. Any remote refresh is separately authorized before inventory. Show exact sources, destinations, differences, conflicts and required developer decisions.>

## Approval and backup

<Explicit approval of the project-specific preview before mutation. External backup of every source variant and existing destination, verification of backup completeness, and a checkpoint identifying version/ref/checkout/inventory. Separate product cleanup approval from record copying; no implicit commit/push or live-project authorization.>

## Ordered migration instructions

<Concrete ordered manual or automated actions, link repairs and conflict handling. Re-read sources before writes; changes since preview invalidate it. Never overwrite unexpected destinations or delete sources before verified copies. Explain which commands are illustrative versus executable.>

## Verification and completion

<Observable success criteria for each affected artifact, preserved history/approval, target layout, resume references and product-tree effects. Record a completed target-version/migration-ID checkpoint only after verification; do not advance past partial or failed steps. Read-only checks, remaining blockers and required handoff. No automatic task execution or new approval.>

## Repeat runs and interrupted migration

<Recognize verified completed steps without writes or duplicate log entries. Resume partial progress against the approved inventory, stop on unexpected changes, and prevent historical copies from overwriting newer records.>

## Rollback and recovery

<Pause writers, export current/new work before restoring backups, reconcile divergence and preserve approvals. Prior plugin availability and compatibility checks; never run incompatible old/new writers concurrently. Recovery cannot discard newer work or rewrite product history.>

## Maintainer verification

<Historical fixtures, sequential multi-version upgrade ordering and target invariants, conflict/partial/repeat/recovery cases, verification commands and evidence location. Distinguish procedure-primitive checks from end-to-end agent execution; report unavailable checks.>
```