meteor-pubsub
Skill10 starsChanged 3 months agoMITView on GitHub
Use when authoring or debugging Meteor publications and subscriptions (Meteor.publish, Meteor.subscribe). Triggers on publication strategies (SERVER_MERGE, NO_MERGE, NO_MERGE_NO_HISTORY), the low-level publish API (added/changed/removed), cursor authorization, reactive joins, leaked documents. Use this skill when the user asks about pub/sub or asks about reactive data fetching.
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-methodsSkill
- meteor-modern-build-stackSkill
- meteor-mongo-minimongoSkill
- meteor-nativeSkill
- 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, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 145
Use cursor transforms for async joins.
≈ “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 publications and subscriptions
Publications stream a set of documents to subscribed clients and keep them live. The publication is the only place server-side authorization can filter rows before they reach the client.
Decision flow
- Does the client need this data reactively? If no, prefer a method (one-shot read). If yes, use a publication.
- Is the data user-specific? Filter by
this.userIdinside the publish function. Without that filter, documents leak across users. - Can the publication be expressed as a single cursor? Return it directly.
- Does it need one async lookup before choosing a cursor? Use an async publish handler, await the lookup, then return the cursor.
- Does it need per-document async joins, custom aggregation output, or an
external reactive source? Drop to the low-level
this.added/this.changed/this.removedAPI.
Scaffold
import { Meteor } from "meteor/meteor";
import { Items } from "/imports/api/items";
Meteor.publish("items.mine", function () {
if (!this.userId) {
return this.ready();
}
return Items.find(
{ ownerId: this.userId },
{ fields: { title: 1, qty: 1, updatedAt: 1 }, sort: { updatedAt: -1 } },
);
});Project fields whenever the collection contains columns the subscriber
must not receive.
Async publish handlers may also return a cursor:
Meteor.publish("items.byTeam", async function (teamId) {
const member = await Memberships.findOneAsync({
teamId,
userId: this.userId,
});
if (!member) return this.ready();
return Items.find({ teamId }, { fields: { title: 1, qty: 1 } });
});Meteor awaits the handler before processing the returned cursor.
Subscribing
import { Meteor } from "meteor/meteor";
const handle = Meteor.subscribe("items.mine");
// React / Blaze / Svelte hooks observe handle.ready() and the local cursor.
handle.stop();Publication strategies
Set per-collection with Meteor.server.setPublicationStrategy. Three options:
import { DDPServer } from "meteor/ddp-server";
Meteor.server.setPublicationStrategy(
"items",
DDPServer.publicationStrategies.NO_MERGE,
);| Strategy | When to use |
SERVER_MERGE | Default. Tracks merged document fields across publications and sends deltas. |
NO_MERGE | Tracks sent document IDs so unsubscribe can remove them. Use when the collection is owned by one publication. |
NO_MERGE_NO_HISTORY | Remembers nothing and sends no removals on stop. Reserve for send-and-forget queues where stale client documents are intentional. |
See references/publication-strategies.md.
Low-level publish API
For joins or async work:
Meteor.publish("feed", async function () {
const cursor = Posts.find({}, { fields: { title: 1, authorId: 1 } });
const observer = await cursor.observeChangesAsync({
added: async (id, doc) => {
const author = await Users.findOneAsync(doc.authorId, {
fields: { username: 1 },
});
this.added("feed", id, { ...doc, authorName: author?.username });
},
changed: (id, changes) => this.changed("feed", id, changes),
removed: (id) => this.removed("feed", id),
});
this.ready();
this.onStop(() => observer.stop());
});Note: cursor transform functions remain synchronous. Use a separate
publication or the low-level API for per-document async joins.
Live observer delivery does not wait for one async callback before later
changes arrive. If ordering or backpressure matters, serialize the work with a
per-subscription Promise queue. Attach an error policy and stop the observer
from this.onStop; see references/low-level-publish-api.md.
Anti-patterns
- Publish without a
this.userIdfilter when data is user-specific. - Publish sensitive or unnecessary columns. Add a
fieldsprojection when the full document is not part of the publication contract. - Confuse an async publish handler with an async cursor transform. Meteor awaits the handler Promise, but each transform callback must return a document synchronously.
- Use cursor transforms for async joins. Transforms are synchronous; the low-level API is the right tool.
- Subscribe to large unbounded collections. Page the data with
limit/skip.
See also
references/publication-strategies.mdreferences/low-level-publish-api.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.

