← ClaudeAtlas

meteor-methodslisted

Use when authoring or debugging Meteor methods (Meteor.methods, Meteor.call, Meteor.callAsync). Triggers on argument validation with check(), optimistic UI stubs, latency compensation, Meteor.Error handling, and DDPRateLimiter. Use this skill when the user asks about server-side mutation, asks about rate limiting RPC, or asks about wrapping a method with auth checks.
meteor/agent-skills · ★ 7 · AI & Automation · score 74
Install: claude install-skill meteor/agent-skills
# Meteor methods Methods are Meteor's primitive for server-side mutation called from the client. In Meteor 3 they are async on the server. Latency compensation still works via client-side stubs. ## Decision flow 1. Is this code mutating server data? Use a method. 2. Does the client need to read the result before the server replies? Write a client stub with the same name; it mutates the local Minimongo collection and the change is reverted if the server disagrees. 3. Does the method accept untrusted input? Validate every argument with `check()`. Otherwise the agent should refuse to write the method. 4. Is the method rate-sensitive? Add a `DDPRateLimiter.addRule`. ## Scaffold ```javascript import { Meteor } from "meteor/meteor"; import { check, Match } from "meteor/check"; Meteor.methods({ async addItem(payload) { check(payload, { title: String, qty: Match.Integer, }); if (!this.userId) { throw new Meteor.Error("not-authorized"); } const _id = await Items.insertAsync({ ...payload, ownerId: this.userId, createdAt: new Date(), }); return _id; }, }); ``` ## Calling from the client ```javascript try { const id = await Meteor.callAsync("addItem", { title: "Hi", qty: 1 }); setLocalId(id); } catch (err) { if (err && typeof err === "object" && "error" in err) { console.error(err.error, err.reason, err.details); } else { console.error("local or transport failure", err); } } ``` ## Opt