Skip to content

doc(skills): refine agent skills from icskills PR 183 feedback#6083

Merged
Kamirus merged 3 commits intomasterfrom
skills/refine-from-icskills-feedback
May 5, 2026
Merged

doc(skills): refine agent skills from icskills PR 183 feedback#6083
Kamirus merged 3 commits intomasterfrom
skills/refine-from-icskills-feedback

Conversation

@Kamirus
Copy link
Copy Markdown
Contributor

@Kamirus Kamirus commented May 5, 2026

Summary

Pulls in the genuinely missing content surfaced by dfinity/icskills#183 and refines it during local review. Three skill files are touched; nothing renamed, no frontmatter restructure, no reference-file split.

What changes for agents

writing-motoko

  • New section: transient field semantics — works on both let and var, with stable var (M0218) warning.
  • New section: M0220 explanation — what happens when --default-persistent-actors isn't set.
  • New Pitfalls section (2 items):
    • M0141 declarations before actor body — recommends types.mo extraction (consistent with the architecture pattern earlier in the skill); shows a whois function example so there's no field-initializer ambiguity.
    • Always parenthesize variant tag arguments — written as a positive rule rather than a precedence warning.
  • New Reserved Keywords section listing all 53 reserved words, sourced from src/mo_frontend/source_lexer.mll. Replaces the previous single-keyword (label) note in the error table with a generalised entry pointing here.
  • Single consolidated heads-up under Critical Requirements that under --enhanced-migration, actor fields cannot have initializers — declare as var x : T; and set initial values in the first migration.
  • Error-pattern table gains M0220, M0141, M0218 rows.

writing-motoko/examples.md

  • Single heads-up at the top about the same field-initializer constraint, so agents reading examples in isolation aren't surprised.

migrating-motoko-enhanced

  • Bug fix: replaces the older [canisters.backend].args = ["--enhanced-migration=migrations"] pattern with the modern [canisters.backend.migrations] block. This matches what the mops-cli skill (in the mops repo) already recommends, and mops auto-injects --enhanced-migration — adding it to args causes a mops error.

What was deliberately not adopted from icskills#183

  • Skill rename writing-motokomotoko, frontmatter additions (license, compatibility, metadata.*), upstream-sync comment blocks — icskills catalog metadata, not relevant upstream.
  • Reference-file split (references/{control-flow,type-conversions}.md) — would be a larger restructure than warranted.
  • migrating-motoko skill changes — purely cosmetic in icskills (rename of "Resources" → "References", added "What This Is").
  • Text.join parameter order, List.get vs List.at, do ? { } for !, M0145 incomplete-pattern pitfall — judged either belonging in mo:core docs or obvious from the error message.

Kamirus and others added 2 commits May 5, 2026 10:56
Pulls in the genuinely missing content surfaced by dfinity/icskills#183
and refines it during local review.

migrating-motoko-enhanced
- Replace older `[canisters.backend].args = ["--enhanced-migration=..."]`
  pattern with the modern `[canisters.backend.migrations]` block
  (matches what the mops-cli skill recommends; mops auto-injects
  `--enhanced-migration` and errors if also set in args).

writing-motoko
- Add `transient` field semantics (works on let and var) plus M0218
  warning on `stable var`.
- Add M0220 explanation for `--default-persistent-actors`.
- New Pitfalls section: M0141 (types belong in types.mo, with a
  whois-function example to avoid the field-initializer dilemma) and
  always-parenthesize-variant-tag-arguments.
- New Reserved Keywords section listing all 53 reserved words sourced
  from src/mo_frontend/source_lexer.mll.
- Single consolidated heads-up that under `--enhanced-migration` actor
  fields cannot have initializers.
- Error-pattern table: add M0220, M0141, M0218 rows; generalise the
  `unexpected token 'label'` row to any keyword.

writing-motoko/examples.md
- Single heads-up at the top about field-initializer constraint under
  enhanced migration.

Co-authored-by: Cursor <cursoragent@cursor.com>
The "When to Use" section still mentioned the older
`--enhanced-migration=migrations` args pattern, inconsistent with the
mops.toml setup section earlier in the same file.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

Comparing from ce88f16 to 467dceb:
The produced WebAssembly code seems to be completely unchanged.
In terms of gas, no changes are observed in 5 tests.
In terms of size, no changes are observed in 5 tests.

@Kamirus Kamirus marked this pull request as ready for review May 5, 2026 10:05
@Kamirus Kamirus requested a review from a team as a code owner May 5, 2026 10:05
@Kamirus Kamirus enabled auto-merge May 5, 2026 12:21

Complete working examples demonstrating modern Motoko patterns. All examples verified with moc 1.5.0.

> **Heads-up — enhanced migration:** the actor examples below declare fields with initializers (`let users = List.empty(); var nextId = 0;`). Under `--enhanced-migration`, actor fields **cannot** have initializers — declare them as `var nextId : Nat;` and set initial values in the first migration file. See the `migrating-motoko-enhanced` skill.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

first migration file? or should we make it more specific like the migration file that introduces them?

Comment thread .agents/skills/writing-motoko/SKILL.md Outdated
- Enhanced orthogonal persistence (state persists without `stable`)
- Principled architecture — `types.mo`, `lib/`, `mixins/`, `main.mo`
**For actor upgrades/migrations:** load `migrating-motoko` for inline migration or `migrating-motoko-enhanced` for multi-migration with `--enhanced-migration`.
**For actor upgrades/migrations:** load `migrating-motoko` for inline migration or `migrating-motoko-enhanced` for multi-migration with `--enhanced-migration`. Under `--enhanced-migration`, actor fields **cannot** have initializers — declare them as `var x : T;` and set initial values in the first migration. The actor examples in this skill use initializers and would need adjustment for enhanced-migration projects.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

Copy link
Copy Markdown
Contributor

@alexandru-uta alexandru-uta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks ok, maybe rephrase the "first migration function" phrasing

@Kamirus Kamirus added this pull request to the merge queue May 5, 2026
@alexandru-uta alexandru-uta removed this pull request from the merge queue due to a manual request May 5, 2026
@Kamirus Kamirus enabled auto-merge May 5, 2026 14:19
@Kamirus Kamirus added this pull request to the merge queue May 5, 2026
Merged via the queue into master with commit 93fc13d May 5, 2026
20 checks passed
@Kamirus Kamirus deleted the skills/refine-from-icskills-feedback branch May 5, 2026 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants