motoko-dot-notation-migration
Motoko dot notation migration
Purpose
Convert Motoko function calls from the old Module.func(self, ...) style to the new self.func(...) dot notation, for all functions in the core package whose first parameter is named self.
This skill was created from a successful migration of the motoko-bitcoin project. It contains the complete function catalog for core 2.2.0, a battle-tested Python conversion script, and all the critical pitfalls that must be handled.
When to Use
- When migrating a Motoko project from
basetocore, or upgradingcoreversions - When the user asks to convert function calls to dot notation
- When the user asks to modernize Motoko call syntax
Background
In Motoko's core package (successor to base), many module functions declare their first parameter as self. These functions support dot notation: instead of writing Module.func(self, arg2, arg3), you can write self.func(arg2, arg3).
Only functions whose first parameter is literally named self support this. Factory functions like Array.tabulate, Array.fromVarArray, Blob.fromArray, etc. do NOT have self as first parameter and must NOT be converted.
More from research-ag/motoko-skills
motoko-core-code-improvements
Optional, modular cleanups and style improvements to apply on new mo:core projects (or after mo:core migration). Covers import ordering, unused import cleanup, and single‑expression return removal, with detection checks and automation recipes.
33motoko-general-style-guidelines
Load when working with contents in *.mo files
32motoko-performance-optimizations
General performance optimization techniques for Motoko. Reducing allocations, efficient Text building, fixed-width arithmetic, block processing, async patterns, and more. Load when you need to improve hot paths or reduce overhead without changing behavior.
31motoko-benchmarks-generation
How to write benchmarks in Motoko using bench‑helper. Covers project setup (mops.toml), bench file layout in bench/*.bench.mo, the Bench.Schema rows/cols model, and safe patterns for encode/decode, hashing, crypto, and allocation benches.
31motoko-base-to-core-migration
Complete, AI-ready playbook to migrate Motoko projects from mo:base to mo:core — phases, renames, data structure changes, agent strategy, verification scripts, upgrade tests, and production rollout.
27motoko-compiler-warnings-fixes
Guidelines for fixing Motoko compiler warnings (moc). Use when asked to fix, suppress, or clean up Motoko compiler warnings from `dfx build --check`.
23