migrating-motoko

Official

Migrate Motoko actor state safely

Authorcaffeinelabs
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This Skill solves the problem of upgrading an Internet Computer canister written in Motoko without losing or corrupting actor state when the actor’s fields or types change.

Core Features & Use Cases

  • Inline actor migration: Attach a (with migration = ...) expression to an actor to define how old state transforms into new state during upgrades.
  • Implicit compatibility migration: Rely on runtime compatibility for safe changes like adding/removing fields, changing mutability, and widening types.
  • Explicit migration rules: Use a migration function with persistable, non-generic record input/output types, with clear guidance for renames, type changes, restructuring, and collection/value transformations.

Quick Start

Use (with migration = Migration.run) immediately before your actor definition, and implement run(old : { ... }) : { ... } to convert your previous record shape into the new record shape for the fields that changed.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: migrating-motoko
Download link: https://github.com/caffeinelabs/motoko/archive/main.zip#migrating-motoko

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.