Loading...
Loading...
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.
npx skill4agent add meteor/agent-skills meteor-methodscheck()DDPRateLimiter.addRuleimport { 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;
},
});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);
}
}// client/methods.js
import { Meteor } from "meteor/meteor";
import { Random } from "meteor/random";
Meteor.methods({
addItem(payload) {
Items.insert({
...payload,
_id: Random.id(),
ownerId: Meteor.userId(),
createdAt: new Date(),
});
},
});callAsync*Asyncfetchimport { DDPRateLimiter } from "meteor/ddp-rate-limiter";
DDPRateLimiter.addRule(
{
type: "method",
name: "addItem",
userId: (userId) => Boolean(userId),
},
5, // operations
10000, // per 10s
);references/rate-limiting.mdMeteor.Error(code, reason, details?)ErrorMeteor.Error(500, "Internal server error")Meteor.ErrorcallAsynccheck()fetchMeteor.user()this.userIdreferences/check-and-validate.mdreferences/rate-limiting.mdreferences/eval-cases.md