meteor-methods
Skill10 starsChanged 3 months agoMITView on GitHub
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.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- wekan/wekanword for word, first seen Oct 8, 2026
Other versions1 project uses a version of this.
Word for word · 1
- wekan/wekan★ 21k100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository21 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .claude/CLAUDE.mdCLAUDE.md
- release-publishingSkill
- skill-gap-auditSkill
- skill-maintenanceSkill
- meteor-accountsSkill
- meteor-blazeSkill
- meteor-cli-installationSkill
- meteor-community-packagesSkill
- meteor-debuggingSkill
- meteor-deploymentSkill
- meteor-modern-build-stackSkill
- meteor-mongo-minimongoSkill
- meteor-nativeSkill
- meteor-pubsubSkill
- meteor-reactSkill
- meteor-securitySkill
- meteor-testingSkill
- meteor-typescriptSkill
- migrate-to-meteor-3Skill
- migrate-to-rspackSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 138
Do not assume every callAsync rejection has that shape: callback misuse, transport failures, and local stub exceptions can produce native …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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
- Is this code mutating server data? Use a method.
- 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.
- Does the method accept untrusted input? Validate every argument with
check(). Otherwise the agent should refuse to write the method. - Is the method rate-sensitive? Add a
DDPRateLimiter.addRule.
Scaffold
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
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);
}
}Optimistic UI
Define the same method on the client. The client stub runs immediately against the local Minimongo; the server's authoritative result reverts any divergence.
// 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(),
});
},
});Synchronous stubs are simplest when they only need synchronous Minimongo.
Async stubs are also supported by callAsync and are useful when the same
method definition runs on client and server with *Async collection calls.
An async stub may await microtask-based local work, but it must not wait on
fetch, timers, IndexedDB, workers, or other browser macrotask APIs. Run
external I/O outside the stub.
Rate limiting
import { DDPRateLimiter } from "meteor/ddp-rate-limiter";
DDPRateLimiter.addRule(
{
type: "method",
name: "addItem",
userId: (userId) => Boolean(userId),
},
5, // operations
10000, // per 10s
);Meteor 3.5+ permits async matcher functions for database-backed decisions. On Meteor 3.0 through 3.4, matchers must stay synchronous; use a fixed rule, precomputed synchronous state, or upgrade instead of awaiting Mongo in a matcher.
Meteor awaits async matchers sequentially on the incoming connection's message queue. Project only required fields and keep the lookup fast. A rejected matcher Promise errors the invocation; test that path explicitly.
See references/rate-limiting.md for the rule-object schema and
per-connection vs per-user keys.
Error handling
Throw Meteor.Error(code, reason, details?) for an intentional client-visible
failure. A plain Error is logged on the server and sanitized for the client
as Meteor.Error(500, "Internal server error"); its original message and
stack are not exposed. Meteor.Error carries its code, reason, and details.
Do not assume every callAsync rejection has that shape: callback misuse,
transport failures, and local stub exceptions can produce native or arbitrary
errors. Narrow the caught value before reading Meteor-specific fields.
Anti-patterns
- Methods without
check()on every argument. Reject the method in code review. - Reusing a method for both authenticated and unauthenticated calls. Split into two methods.
- Awaiting browser macrotask APIs such as
fetchor timers inside a client stub. Async stubs are valid, but those APIs let unrelated code run before the optimistic simulation finishes. - Calling
Meteor.user()inside an async method body. Usethis.userId.
See also
references/check-and-validate.mdreferences/rate-limiting.mdreferences/eval-cases.md
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

