writing-migrations

Writes and tests Moonfish runtime migrations for storage layout changes during upgrades.

2|Updated Jan 19, 2026
One-click install
npx skills add https://github.com/manuelmauro/moonbeam-skills --skill writing-migrations
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: writing-migrations
Source: https://github.com/manuelmauro/moonbeam-skills/tree/main/skills/writing-migrations
Command: npx skills add https://github.com/manuelmauro/moonbeam-skills --skill writing-migrations

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Writes and tests runtime migrations for Moonbeam state transitions during upgrades to preserve storage integrity and avoid runtime breakages.

Core Features & Use Cases

  • Migration generation: Create on-runtime upgrade migrations for storage layout changes and pallet modifications.
  • Testing & verification: Provide unit tests and try-runtime checks to validate migrations across networks (Moonbase/Moonriver/Moonbeam).
  • Lifecycle management: Demonstrates how to register, apply, and remove migrations after deployment.

Quick Start

Create and run a migration that updates storage layout and verify it with tests.

Frequently Asked Questions about writing-migrations

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write runtime migrations for Moonbeam storage layout changes?

Moonbeam runtime migrations manage state transitions during upgrades to preserve storage integrity and avoid breakages. They handle pallet renaming, index changes, and format updates across Moonbase, Moonriver, and Moonbeam networks using on-runtime upgrade hooks.

How do I test Substrate runtime migrations before deployment?

You validate Substrate runtime migrations using unit tests and try-runtime checks to verify storage layout changes. This includes running pre/post-upgrade checks to ensure migrations apply correctly across Moonbase, Moonriver, and Moonbeam networks.

What is the try-runtime feature used for in Moonbeam upgrades?

Try-runtime validation checks Moonbeam runtime migrations by simulating storage layout changes against existing chain states. It executes pre/post-upgrade hooks to ensure pallet renaming and index modifications preserve storage integrity.

Does this approach support pallet renaming and index changes across Moonriver and Moonbase?

Yes, runtime migrations support pallet renaming, index changes, and format updates across Moonbase, Moonriver, and Moonbeam. They apply storage layout modifications via on-runtime upgrade hooks during network upgrades.

How do I manage the migration lifecycle after applying a runtime upgrade?

Managing the migration lifecycle involves registering migrations before the upgrade, applying them during the runtime upgrade, and removing them after deployment. This ensures storage modifications execute only once without bloating future runtime logic.

Why do runtime upgrades break storage integrity, and how do migrations prevent this?

Runtime upgrades break storage integrity when pallet indices or storage formats shift without state transitions. Migrations prevent this by executing on-runtime upgrade hooks that explicitly transform old storage layouts into the new expected format.