Skills · Data & AI

Recsys Pipeline Architect

Unverified31/40

Design composable recommendation, ranking, and feed pipelines using the six-stage Source→Hydrator→Filter→Scorer→Selector→SideEffect framework popularized by xAI's open-sourced X For You algorithm. Use when building any system that picks "the top K items for a (user, context)" — content feeds, search ranking, RAG rerankers, task prioritizers, notification triage, ad selection.

Originally by wshobson · MIT

Claude CodePartialHas SKILL.md but declares no allowed-tools — Claude Code will ask for permission each time
CursorPartialPlain prose you can paste in — but no Cursor rules file
CodexPartialPlain prose you can paste in — but no AGENTS.md
Gemini CLIPartialPlain prose you can paste in
CopilotPartialPlain prose you can paste in — but no Copilot instructions file
npx agentalley add recsys-pipeline-architect

This command does not work yet — the CLI is still being built. Until then, use Raw in the reader below to take the file.

Who is stuck, and on what

Design composable recommendation, ranking, and feed pipelines using the six-stage Source→Hydrator→Filter→Scorer→Selector→SideEffect framework popularized by xAI's open-sourced X For You algorithm. Use when building any system that picks "the top K items for a (user, context)" — content feeds, search ranking, RAG rerankers, task prioritizers, notification triage, ad selection.

The whole source

No sign-in, no blur, nothing truncated
recsys-pipeline-architect/SKILL.md126 lines8.0 KBRawView on GitHub
Frontmatter — 2 properties
namerecsys-pipeline-architect
descriptionDesign composable recommendation, ranking, and feed pipelines using the six-stage Source→Hydrator→Filter→Scorer→Selector→SideEffect framework popularized by xAI's open-sourced X For You algorithm. Use when building any system that picks "the top K items for a (user, context)" — content feeds, search ranking, RAG rerankers, task prioritizers, notification triage, ad selection.
1---
2name: recsys-pipeline-architect
3description: Design composable recommendation, ranking, and feed pipelines using the six-stage Source→Hydrator→Filter→Scorer→Selector→SideEffect framework popularized by xAI's open-sourced X For You algorithm. Use when building any system that picks "the top K items for a (user, context)" — content feeds, search ranking, RAG rerankers, task prioritizers, notification triage, ad selection.
4---A5No allowed-tools declared — no way to tell what this skill may touch
5 
6# Recsys Pipeline Architect
7 
8A spec-and-scaffold skill for building composable recommendation, ranking, and feed pipelines. Encodes the six-stage pattern popularized by xAI's open-sourced [For You algorithm](https://github.com/xai-org/x-algorithm) (Apache 2.0) and applies it to any "top K for (user, context)" problem.
9 
10## Overview
11 
12Most "recommendation systems" in production aren't exotic ML — they're *pipelines*: fetch candidates from one or more sources, enrich them with metadata, drop the ineligible, score the rest, sort and pick the top K, then fire async side effects. The pattern is universal. The scoring function and the items change; the pipeline shape doesn't.A4This skill pulls in web or user content but never says to treat that content as data. A signal, not proof.
13 
14This skill is an independent reimplementation of the pattern (MIT) — no code copied from the original.
15 
16## When to Use This Skill
17 
18- Building any system that returns "the top K items for a user/context"
19- Designing or refactoring a personalized feed (content, search results, notifications)
20- Wrapping an LLM/ML scorer in proper pipeline plumbing (sources, hydration, filters, side effects)
21- Adding multi-action prediction with tunable weights (instead of a single relevance score)
22- Building a RAG retrieval reranker (cheap retrieval → expensive rerank)
23- Designing a task prioritizer or alert triage system
24 
25## The Six-Stage Framework
26 
27| # | Stage | Job | Parallel? |
28|---|---|---|---|
29| 1 | **Source** | Fetch candidates from one or more origins | Yes — multiple sources run in parallel |
30| 2 | **Hydrator** | Enrich candidates with metadata needed for filtering and scoring | Yes — independent hydrators run in parallel |
31| 3 | **Filter** | Drop ineligible candidates (blocked, expired, duplicate, ineligible) | Sequential — each filter sees fewer items |
32| 4 | **Scorer** | Assign each surviving candidate one or more scores | Sequential — later scorers see earlier scores |
33| 5 | **Selector** | Sort by final score, return top K | Single op |
34| 6 | **SideEffect** | Cache, log, emit events, update served-history | Async — must never block the response |
35 
36### Why this exact order
37 
38- Sources before hydration: know what candidates exist before paying to enrich
39- Hydration before filtering: many filters need metadata the source didn't provide
40- Filtering before scoring: scoring is the expensive stage — drop the ineligible first
41- Scorer chain (not single scorer): real systems compose ML scoring + diversity reranking + business rules
42- Selector after scoring: keeps scoring deterministic and cacheable
43- SideEffects last and async: side effects must never block the user response
44 
45## Workflow When Invoked
46 
47Walk the user through eight steps:
48 
491. **Clarify the use case** (one round, three questions only if missing): items being ranked, input context, language/runtime
502. **Identify the candidate sources** (usually in-network + out-of-network, but single-source also valid)
513. **List required hydrations** — for each filter and scorer, what data does it need that the source didn't provide?
524. **List the filters** — cheap before expensive, universal before user-specific (duplicate, self, age, block/mute, previously-served, eligibility)
535. **Design the scorer chain** — primary ML/heuristic → combiner (multi-action with weights) → diversity → business rules
546. **Selector** — sort descending by final score, take top K (or stratified mix)
557. **SideEffects** — cache served IDs, emit impression events, update counters, log analytics; all fire-and-forget
568. **Generate the scaffold** in the user's stack
57 
58## Key Trade-offs to Surface
59 
60Never default silently on these — they are product decisions disguised as technical ones.
61 
62### 1. Single score vs multi-action prediction
63 
64- **Single score:** train one model to predict relevance. To change behavior → retrain.
65- **Multi-action:** predict `P(action)` for many actions (`P(read)`, `P(like)`, `P(share)`, `P(skip)`, `P(report)`), combine with weights at serving time. To change behavior → change weights. No retraining.
66 
67The X For You algorithm uses multi-action with both positive and negative weights. Recommend multi-action when the user expects to tune frequently.
68 
69### 2. Candidate isolation vs joint scoring
70 
71- **Isolated:** each candidate scored independently. Deterministic, cacheable.
72- **Joint:** candidates attend to each other during scoring (e.g., transformer over the whole batch). More expressive but non-deterministic across batches.
73 
74Default to isolation. Joint only when there's a specific reason (e.g., explicit batch-aware diversity).
75 
76### 3. Online vs offline batch
77 
78- **Request-time (online):** pipeline runs on each request. Latency budget: 100–300ms.
79- **Pre-computed (offline batch):** pipeline runs periodically, results cached. Lower latency, lower freshness.
80- **Hybrid:** candidate retrieval offline, ranking online.
81 
82## Hard Rules
83 
841. **Do not invent benchmark numbers.** "How fast is this?" → "depends on workload, run it yourself."
852. **Attribution discipline.** Attribute the pattern as "popularized by xAI's open-sourced For You algorithm" / `github.com/xai-org/x-algorithm` (Apache 2.0).
863. **No trademark use.** Don't name the user's artifact "X-like" or use "For You" branding. Use neutral names: "candidate pipeline", "feed pipeline", "ranking pipeline".
874. **Surface trade-offs.** Multi-action vs single, isolation vs joint, online vs offline — never default silently.
885. **The generated scaffold must run.** No pseudocode passing as code.
896. **Filter order matters.** Cheap before expensive. Universal before user-specific.
907. **Side effects never block.** Wrap in fire-and-forget patterns (goroutines / promises without await / asyncio tasks).
91 
92## Anti-Patterns
93 
94- ❌ Scoring before filtering (wastes compute on candidates that will be dropped)
95- ❌ Synchronous side effects (cache writes / impression emits blocking the response)
96- ❌ A single "relevance" score when the product needs multi-objective tuning
97- ❌ Joint scoring as default (non-deterministic, uncacheable, doesn't compose with reranking)
98- ❌ Pseudocode "for illustration" — the scaffold must actually run
99 
100## Common Use Cases
101 
102### Content feed (Strapi v5 plugin, TypeScript)
103 
104User has a CMS with 50k articles, wants a personalized "for you" feed. Walk through 8 steps → generate a Strapi plugin scaffold with multi-action scoring, author diversity, standard filters, async side-effect lane.
105 
106### RAG retrieval reranker (Python async)
107 
108User's RAG returns top-50 chunks from a vector DB, wants to rerank with a more expensive scorer and return top-5. Single-source pipeline with a scorer chain (cheap retrieval + expensive rerank).
109 
110### Task prioritizer (FastAPI service)
111 
112User has a queue of incoming task suggestions, wants to rank by "what should this user work on next" considering their past patterns. Items reversed (tasks instead of content), same shape applies.
113 
114### Notification triage (offline-batch job)
115 
116User wants a daily digest that picks the top 10 from the last 24h queue. Offline-batch pipeline. Source = queue, filters = age/dedup/eligibility, scorer = urgency × user-affinity, selector = top 10, side effect = email send (still async).
117 
118## Upstream
119 
120This skill is a single-file adapter for the upstream repository, which ships 5 load-on-demand reference docs and 3 runnable example scaffolds (Strapi v5 / Go / Python — every one green on its test suite, 9/9 tests total).
121 
122- **Upstream:** https://github.com/mturac/recsys-pipeline-architect
123- **Release:** v0.1.0 (MIT)
124- **References:** interfaces in 4 languages (TS/Go/Python/Rust), multi-action scoring, candidate isolation, filter cookbook (12 patterns), scorer cookbook
125- **Cross-platform install:** `npx skills add mturac/recsys-pipeline-architect`
126 

Reviews

Installed this one?Write the first review and take the Trailblazer badge.

Reviews only open after a real install, so this is empty — and we leave it empty rather than invent one.

Alternatives

Also in Data & AI