social-feed-graph-ranking-and-notifications
Use when building the core of a social system: feed and timeline architecture including fan-out on write versus read and the celebrity problem, the social graph and its storage and traversal, ranking and recommendation (signals, candidate generation, engagement objectives and their failure modes), and notifications and real-time delivery including push, batching, digesting and WebSocket fan-out.
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 5
- Forks
- 3
01 前言 Front Matter
- name
- social-feed-graph-ranking-and-notifications
- description
- Use when building the core of a social system: feed and timeline architecture including fan-out on write versus read and the celebrity problem, the social graph and its storage and traversal, ranking and recommendation (signals, candidate generation, engagement objectives and their failure modes), and notifications and real-time delivery including push, batching, digesting and WebSocket fan-out.
03 SKILL.md 正文
Social Media Engineering: Feed Architecture, the Social Graph, Ranking, and Notifications
Part 2 of 5 of the Social Media Engineering reference (plugin
social-media-engineering), covering §3–§6. Sibling skills:social-platform-apis-and-open-protocols(§0–§2),social-moderation-abuse-and-regulation(§7–§9),social-media-analytics-privacy-and-presence(§10–§13),social-reference(§14–§19). Section numbers are shared across the set; a reference written as §N →skillpoints into that sibling skill.Currency: Verified August 2026. See §16 →
social-referencefor the currency snapshot and what goes stale first.
How to read this. The title spans two things and this document covers both, weighted toward the first: §1–§12 →
social-platform-apis-and-open-protocols,social-moderation-abuse-and-regulation,social-media-analytics-privacy-and-presenceare about building and integrating with social systems; §13 →social-media-analytics-privacy-and-presenceis about your own presence as a developer. Skip to §13 →social-media-analytics-privacy-and-presenceif that's what you came for.Three markers:
- [DURABLE] — architecture, ranking, moderation, and abuse dynamics. Most of §2–§10 →
social-platform-apis-and-open-protocols,social-moderation-abuse-and-regulation,social-media-analytics-privacy-and-presence.- [VERSIONED] — platform terms, pricing, protocols, regulation. ⚠️ Verify all of it; this is the fastest-moving material in the collection after AI.
- [CONTESTED] — genuine disagreement.
⚠️ GOTCHA boxes mark what breaks, gets you banned, or gets you fined.
The three framings that organize everything below:
- ⚠️ Building on a platform API is building on rented land, and the rent changed. The 2023–2026 period established that platforms will reprice or withdraw access with weeks of notice and no obligation. Architect for that from day one (§1 →
social-platform-apis-and-open-protocols).- The hard problems are social, not technical. Fan-out and ranking are solved engineering; moderation, abuse, and incentive design are not, and they scale worse than your database does (§7 →
social-moderation-abuse-and-regulation, §8 →social-moderation-abuse-and-regulation).- ⚠️ Compliance is now an architecture input, not a legal afterthought. Age assurance, transparency reporting, and appeals mechanisms have to be designed in — and regulators have started saying explicitly that self-declaration is not sufficient (§9 →
social-moderation-abuse-and-regulation).
§3. Feed and Timeline Architecture
[DURABLE] The canonical distributed-systems problem in this domain, and the trade-off is stable.
FAN-OUT ON WRITE (push) FAN-OUT ON READ (pull)
Write to every follower's Query followers' posts at read time
timeline at post time
✓ Reads are fast and cheap ✓ Writes are cheap
✗ ⚠️ A 50M-follower account ✗ Reads are expensive and hard to cache
means 50M writes
✗ Storage amplification ✗ Latency scales with following count
[DURABLE] Every real system is hybrid: fan-out on write for normal accounts, fan-out on read for high-follower accounts, merged at read time. ⚠️ The threshold is a tuning parameter, and "celebrity accounts" are a distinct architectural case you must plan for rather than discover.
The implementation vocabulary: timeline as a materialized list of post IDs (⚠️ store IDs, hydrate content at read — content changes, deletions, and blocks all become tractable), Redis or a purpose-built store for the timeline itself, async fan-out through a queue, cursor-based pagination (⚠️ never offset — new posts shift the window and you get duplicates and gaps), and backfill and repair jobs because fan-out will drop things.
⚠️ The details that bite: deletion and edit propagation through already-fanned-out timelines; block and mute enforcement at read time (⚠️ applying blocks at write time means a later block doesn't retroactively clean the timeline); the "new follower backfill" question (do they see history?); and the cold-start empty feed, which is a product problem disguised as an engineering one.
§4. The Social Graph
[DURABLE] Directed (follow: Twitter, Instagram) vs undirected (friend: Facebook) — ⚠️ and the choice cascades into privacy, feeds, and moderation in ways that are painful to reverse.
Storage: adjacency lists in a KV store, a relational table with careful indexing, a graph database (Neo4j, or Meta's TAO-style approach), or an adjacency-list service with heavy caching — ⚠️ which is what most large systems actually build, because a general graph database is usually the wrong tool for a workload that is 99% "get followers of X."
⚠️ The operations that hurt: follower counts on celebrity accounts (⚠️ counting is expensive — cache approximately, and accept eventual consistency), "do these two users follow each other" at scale, mutual-follow and friends-of-friends queries, and the fact that graph traversal depth explodes combinatorially — two hops from a well-connected node is most of the network.
Privacy is a graph problem: blocks must be bidirectional in effect; ⚠️ private accounts mean visibility checks on every read path, and getting one path wrong is a data leak rather than a bug.
§5. Ranking and Recommendation
[DURABLE] The structure is stable even as the models change.
CANDIDATE GENERATION → thousands of candidates from many sources (follows,
engagement-based, embedding-similarity, trending, ads)
↓
RANKING → a model scores each; predicted engagement, dwell, quality
↓
RE-RANKING / POLICY → diversity, freshness, source variety, safety filters,
author-frequency caps, business rules
↓
BLENDING → merge organic, ads, recommendations
⚠️ The problems that are genuinely hard and remain so: the feedback loop — you
train on what you showed, so the model learns your past choices as much as user preference;
engagement ≠ satisfaction, and optimizing for the former reliably degrades the latter
(⚠️ outrage, cliffhangers, and low-quality-but-clickable content all win on engagement
metrics); cold start for new users and new content; filter bubbles and diversity,
which need explicit objectives because they never emerge from engagement optimization;
and ⚠️ explainability, which is now partly a regulatory requirement (§9 → social-moderation-abuse-and-regulation).
[DURABLE] The design lesson that matters most: what you measure becomes what you build. Choosing your objective function is a product-values decision wearing an engineering costume, and "we just show people what they engage with" is a choice, not a neutrality.
§6. Notifications and Real-Time
Delivery: WebSocket or SSE for in-app, APNs/FCM for push, email and SMS for fallback. ⚠️ Push tokens expire and rotate — handle invalidation or you leak delivery failures forever.
[DURABLE] The engineering that separates good from awful: batching and digest (⚠️ notification fatigue causes permission revocation, and a revoked push permission is very hard to win back), deduplication and collapsing ("5 people liked your post", not five notifications), per-user preferences at real granularity, quiet hours and timezone awareness, and read-state sync across devices.
⚠️ The ethics are load-bearing here. Notifications are the most direct attention lever you have, and engagement-maximizing notification strategy is where product pressure most often produces something the team wouldn't defend out loud. Design the default you'd want applied to you.
Real-time presence (typing indicators, online status) is expensive and ⚠️ a privacy surface people underestimate — "last seen" reveals more than users expect.
04 同仓库更多 Skills
white-paper-writing
Use when writing white papers, technical reports, policy documents, thought leadership pieces, or any long-form authoritative document. Triggers on requests to write, structure, outline, or review white papers, technical reports, position papers, policy briefs, or evidence-driven arguments. Also use for B2B content marketing strategy, technical documentation requiring authority, academic-style reports, or any document that must educate while persuading. Use when someone asks "how should I structure this" for a long-form document.
prose-technical-mechanics
Use when editing or writing prose at a technical/mechanical level: choosing between Anglo-Saxon and Latinate diction, placing information in topic vs stress positions, writing periodic vs cumulative sentences, handling sentence rhythm, punctuation as logic, transitions, paragraph structure, or phonesthetics. Use when someone wants to understand WHY prose works or doesn't, not just surface-level style advice. Triggers on word choice, sentence structure, emphasis, rhythm, diction, or any deep writing mechanics question.
prose-mechanics
Use when writing, editing, or analyzing prose style; when trying to avoid generic AI-sounding writing; when applying specific prose styles such as journalistic, academic, narrative, KJV biblical, Hemingway plain, Latinate/Jamesian, Orwellian, Augustan, Victorian, Early Modern (Bacon, Browne, Milton), or free indirect discourse; or when coaching someone on writing voice and mechanics. Triggers on any request to improve, analyze, or write in a specific prose style, to fix "AI-sounding" writing, to make prose more vivid or concrete, to vary sentence rhythm, or to understand how a particular writer achieves their effects.
narrative-structure
Use when structuring stories, pitches, presentations, white papers, or any persuasive narrative; analyzing the hero's journey in fiction or non-fiction; applying StoryBrand for business communication; designing narrative arcs for thought leadership; or understanding Vogler, Snyder, Propp, or Campbell frameworks. Triggers on any narrative structure, storytelling, pitch structure, StoryBrand, hero's journey, three-act structure, Freytag, Save the Cat, narrative arc, or "how should I structure this story/pitch/presentation" request.
legal-brief-writing
Use when writing legal briefs, motions, or any court filing; when analyzing judicial cognition and persuasion; when applying elite brief-writing techniques from Roberts, Clement, Kagan, Garner; or when structuring legal arguments for maximum persuasion. Also use for autistic/neurodivergent advocates who need to understand how their natural communication style maps to elite legal advocacy. Triggers on any legal writing, brief drafting, motion preparation, or legal argument structuring request.
journal-publishability-criteria
Use whenever a research paper, article or preprint is being written, revised, reviewed or published, and specifically before every publication of docs/paper.md. Covers what legitimate journals actually gate on, in order of gating — the editor's desk screen (scope, novelty, package problems), what reviewers judge (methodological soundness, claims the evidence can carry, statistical and qualitative reporting), EQUATOR reporting guidelines, the ICMJE authorship criteria, COPE's view of text recycling, the near-universal generative-AI policy (no AI author, disclosure, author responsibility), TOP 2025 transparency standards, how to verify a journal is legitimate, submitting without an institution, and a pre-submission checklist. Triggers on requests to evaluate, review, prepare or submit a paper, to judge publishability, to write a declarations or data-availability section, to disclose AI use, or to check a journal.