chore(upstream): sync caffeinelabs/skills 9274f9b → 38a1136 - #372
Conversation
writing-motoko 0.1.8 → 0.2.0. reviewing-motoko, migrating-motoko-actors and troubleshooting-motoko-migrations have no content changes — their pins are bumped so all four share one commit again. Body changes (upstream, applied verbatim): - Remove the Caffeine-specific "Build feedback" section (upstream #8) - Arrays DO have .contains(element) — reverses prior guidance in two places and the M0096 error-table row - Numeric conversions are toX on the source value, with a from→to mapping table; `field fromInt is deprecated` row generalizes to `field fromX` - New "Error Handling: Result" section (variant Err, no trap on caller error, chain via mapOk/chain/fromOption) - Equality reframed as "equal/compare vs ==", permitting == on primitives and shared fields (upstream #9.2) - Restore `let ages = Map.empty<Text, Nat>()` and add `type Point` to the implicit-parameter examples (upstream #9.1, #9.3) - api-reference.md regenerated from motoko-core's API lock: new Blob, Bool, Char, Error, Float, Result, Timer sections; deprecated fromX entries dropped; Principal.fromActor signature complete (upstream #5.1) Owned sections re-applied: frontmatter (compatibility → core >= 2.6.0), references/ link paths, docs.mops.one → mops-cli skill, Additional References rename + mops tooling bullet. Evals: three new cases seeded from the diff (array contains, toX conversions, Result error variants), each 100% with skill vs 1/4, 1/4 and 3/5 baseline.
Skill Validation ReportValidating skill: /home/runner/work/icskills/icskills/skills/writing-motokoStructure
Frontmatter
Tokens
Markdown
Tokens
Content Analysis
References Content Analysis
Contamination Analysis
References Contamination Analysis
Result: 3 warnings Project Checks |
There was a problem hiding this comment.
Pull request overview
Syncs the writing-motoko skill (and related upstream pin metadata) to match caffeinelabs/skills at commit 38a1136, updating Motoko guidance and regenerating the mo:core API reference so the skill stays aligned with core >= 2.6.0.
Changes:
- Updated
writing-motokoguidance (arrays.contains, equality guidance,Result-based error handling, numeric conversion rules) and removed the Caffeine-specific build feedback section. - Regenerated/expanded the
mo:coreAPI reference and updated compatibility tocore >= 2.6.0. - Added new evaluation cases targeting the updated guidance and updated the upstream pin tracking metadata.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| skills/writing-motoko/SKILL.md | Updates core guidance (contains/equality/Result/numeric conversions) and removes build-feedback section. |
| skills/writing-motoko/references/type-conversions.md | Updates conversion guidance and examples to emphasize receiver-style toX conversions. |
| skills/writing-motoko/references/equality.md | Reframes guidance on == vs equal/compare and adds an example type. |
| skills/writing-motoko/references/api-reference.md | Regenerates mo:core API signatures, omitting deprecated APIs and adding new sections. |
| evaluations/writing-motoko.json | Adds eval cases for arrays contains, toX conversions, and Result error typing. |
| .claude/upstream.md | Bumps upstream pinned commit/version and updates last-synced metadata/notes. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Checked all four Copilot comments against motoko-core and the skill's own rules. Two are already filed upstream, one is a new genuine defect now filed, and one is incorrect — its suggested fix would introduce a defect the skills classify as a Blocker. None of these are patched in this PR: per the sync policy, body content is not icskills-owned, so genuine defects in synced files are filed upstream rather than patched locally. 1.
|
| Issue | Status |
|---|---|
| #8 Caffeine "Build feedback" | Closed — fixed at 38a1136 |
#9 equality + ages regression |
Closed — all 3 points fixed |
| #5 copy-paste correctness | 2 of 3 fixed; asked upstream whether the last is intentional |
| #3 dropped Motoko items | M0141 outstanding; asked upstream whether intentional |
#10 "42".toNat() regression |
Filed |
#11 Result sharedness + query mutation |
Filed |
Correction to my review reply aboveA
// motoko-core/src/Nat.mo:68
/// This functions is meant to be used with contextual-dot notation.
/// assert "1234".toNat() == ?1234;
public let toNat : (self : Text) -> ?Nat = fromText;
// motoko-core/src/Int.mo:118
public func toInt(self : Text) : ?Int { fromText(self) };I assumed a receiver-typed function lives in the receiver's module, searched Corrections to the four review comments, restated accurately:
So: only comment 2 is actually wrong, and my reply above got comments 3 and 4 backwards. #10 is retracted and closed; the PR description is updated. Nothing in the synced content needs changing — this branch is correct as-is, and the owned-patch plan discussed offline is dropped, since there's nothing to patch. The one real gap this surfacedNot a defect in the sync, but worth tracking: which module to import is not guessable from the call site.
Raised upstream on #10 with an offer to PR it. Not blocking this sync. |
Syncs
caffeinelabs/skillsfrom9274f9b→38a1136.Closes #371
Scope
writing-motoko0.1.8→0.2.0, 4 files changedreviewing-motoko90a2433pinmigrating-motoko-actorstroubleshooting-motoko-migrationsAll four now share one pinned commit again, so the
reviewing-motokopin note about temporarily diverging pins is removed.writing-motokocontent changes.contains(element). This reverses the previous "arrays have NO.contains" guidance in two places plus theM0096error-table row. Confirmed against the generated reference:public func contains<T>(self : [T], equal : (implicit : (T, T) -> Bool), element : T) : Bool.toXon the source value.Float.fromInt64(Int64.fromNat64(Nat64.fromNat(sum)))becomessum.toFloat(), with a newfrom→tomapping table. Thefield fromInt is deprecatederror row generalizes tofield fromX.## Error Handling: Resultsection —Result<Ok, Err>with a variantErr(neverText), don't trap on caller-fixable error, chain viamapOk/chain/fromOption.equal/compareover==" to "equal/comparevs==", explicitly permitting==on primitives and shared fields — resolves writing-motoko: new equality guidance contradicts its own examples; ages.add() regression drops a declaration caffeinelabs/skills#9 (2).let ages = Map.empty<Text, Nat>()restored andtype Point = { x : Nat; y : Nat }added to the implicit-parameter examples — resolves writing-motoko: new equality guidance contradicts its own examples; ages.add() regression drops a declaration caffeinelabs/skills#9 (1) and (3).api-reference.mdregenerated from motoko-core's API lock (+169 lines): newBlob,Bool,Char,Error,Float,Result,Timersections; deprecatedfromXentries removed;Principal.fromActorsignature complete — resolves writing-motoko: copy-paste correctness (truncated Principal.fromActor, self-contradicting break note, unseparated expressions in dot-notation example) caffeinelabs/skills#5 (1).compatibilitybumped tocore >= 2.6.0.Owned sections
All re-applied, none now covered upstream: frontmatter (our
description/license/ stringcompatibility/metadata),references/link paths,docs.mops.one→ "Load themops-cliskill",## Additional Resources→## Additional Referencesplus themops toolingbullet.A note on
"42".toNat()references/type-conversions.mdnow spells Text parsing as a receiver call:This is correct.
toNat/toIntwith aTextreceiver are defined in the target modules —Nat.mo:68ispublic let toNat : (self : Text) -> ?Nat = fromText;("meant to be used with contextual-dot notation"), andInt.mo:118is the equivalent fortoInt. Our own syncedapi-reference.mdlists them at line 385 (## Nat) and line 184 (## Int), since it groups by defining module rather than by receiver type.An earlier revision of this description claimed the snippet was broken. That was my error — I searched
Text.moand the## Textsection, found nothing, and read absence as proof. Retracted upstream in caffeinelabs/skills#10.One genuine caveat survives, and it is a documentation gap rather than a defect: the module that must be imported is the one that defines the function, not the receiver's.
"42".toNat()needsimport Nat "mo:core/Nat", andbytes.toBlob()needsArray(toBlob : (self : [Nat8]) -> Bloblives there).--implicit-package=coreremoves the requirement entirely — moc describes it as "allow contextual dot and implicits resolution from all modules in the given package" — and the Caffeine template sets it, butreferences/project-setup.mddoes not mention it. Raised upstream on #10; tracked on our side for a follow-up.Evaluations
Three new cases seeded from the diff — the array
containsreversal, thetoXconversion rule, and the newResultguidance are exactly where an agent hallucinates without the updated skill.New cases — with skill vs baseline
Regression check — existing cases covering rewritten content
The
containsguidance and the equality section were both rewritten, so the two existing cases covering them were re-run:npm run validate: 30 skills, all passed (21 warnings, unchanged from baseline).