What this prompt does
This prompt positions the AI as a principal engineer designing a social media news feed for a platform with [user_count] users where [dau_percentage] are daily active. It covers six steps: requirements and consistency targets, the fan-out strategy, the ranking algorithm, the storage layer, real-time updates, and content moderation. The centerpiece is a hybrid fan-out: fan-out-on-write for users below [follower_threshold] followers and fan-out-on-read for celebrities above it, justified with back-of-the-envelope math.
The structure works because feed systems live or die on the write-versus-read fan-out tradeoff. Pushing every post to all followers' caches in [feed_cache] is fast to read but catastrophic when a celebrity with millions of followers posts — hence the threshold split at [follower_threshold]. The ranking step scores a candidate pool of [candidate_pool_size] posts using age decay, author affinity, content-type preference, engagement velocity, and a diversity factor via [ranking_model], so the feed is personalized rather than purely chronological. Meanwhile [realtime_technology] pushes lightweight notifications so active clients prepend new posts without a full reload, and offline users get their feed cache marked stale for refresh on next open.
When to use it
- You're architecting a feed or activity stream and need the fan-out decision pinned down first
- You want the write-versus-read tradeoff justified with rough capacity math
- You need a ranking design beyond reverse-chronological order
- You're choosing storage for the social graph, feed lists, and post content separately
- You want real-time feed updates without forcing full reloads
- You need content moderation designed into the fan-out path, not bolted on later
- You're reasoning about consistency within a
[consistency_window]rather than strict guarantees
Example output
Expect a design document: the requirements and consistency window, a fan-out section with back-of-the-envelope calculations defending the hybrid approach against the [follower_threshold] split, a ranking pipeline listing the scoring features, a storage breakdown mapping the social graph to [primary_database], feed lists to [feed_cache], and content to [content_store], a real-time update flow using [realtime_technology], and a moderation pipeline with automated classification, a human-review queue, an appeals workflow, and an audit trail. It reads as an architecture walkthrough, not code.
Pro tips
- Set
[follower_threshold]thoughtfully — it's the dial that balances write amplification against read-time merge cost - Keep
[candidate_pool_size]bounded; ranking more posts improves quality but raises feed-generation latency - Use
[feed_cache]for post-ID lists, not full post bodies; store content in[content_store]and hydrate at read time - Be realistic about
[consistency_window]— strict consistency on a feed is expensive and rarely worth it - Put moderation before fan-out so flagged content never reaches caches; cleaning it up after is far harder
- Force the fan-out math early; the numbers, not intuition, should decide your
[follower_threshold]