# recommendation-system

Deploys recommendation APIs with FastAPI, Redis feature caching, multi-tier storage, and Prometheus metrics tracking.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 398 installs · ★ 237
- Author: secondsky
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/secondsky/claude-skills/tree/HEAD/plugins/recommendation-system/skills/recommendation-system/SKILL.md
- Updated: 2026-10-20
- HTML: https://affpapa.org/en/nevibecode/skills/recommendation-system

## What it does

The skill provides an architectural blueprint for serving recommendations. It sets up FastAPI endpoints, a Redis-backed feature store with a 3600-second TTL, and a model registry designed for A/B testing experiments.

Latency is managed through tiered caching: L1 in memory, L2 in Redis, and L3 in the database. New profiles without prior purchases receive popular items as a fallback. Cache invalidation triggers automatically when users buy or rate an item. Without a Redis instance listening on port 6379, the caching layer and feature store will not function.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add secondsky/claude-skills --skill recommendation-system -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/recommendation-system/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/recommendation-system/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add secondsky/claude-skills --skill recommendation-system -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/recommendation-system/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add secondsky/claude-skills --skill recommendation-system -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/recommendation-system/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install secondsky/claude-skills recommendation-system
```

2. **Manually: put the files in place**
- File: `.github/skills/recommendation-system/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add secondsky/claude-skills --skill recommendation-system -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/secondsky/claude-skills --path plugins/recommendation-system/skills/recommendation-system
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/recommendation-system/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add secondsky/claude-skills --skill recommendation-system -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/secondsky/claude-skills/tree/HEAD/plugins/recommendation-system/skills/recommendation-system/SKILL.md

## When to use it
- serve personalized recommendation endpoints with FastAPI
- build a tiered L1 in-memory and L2 Redis caching layer
- handle cold starts for new users with popularity fallbacks
- invalidate cached recommendations after user purchases
- track CTR and latency targets with Prometheus

## Example prompts
- Build a FastAPI recommendation route that caches responses in Redis for 5 minutes
- Set up a Redis feature store with a 1-hour TTL for user attributes
- Implement a popularity fallback for users who have no purchase history

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 9cc6a4dfd03afbbf.

BEGIN THIRD-PARTY FILE 9cc6a4dfd03afbbf
````text
---
name: recommendation-system
description: Deploy production recommendation systems with feature stores, caching, A/B testing. Use for personalization APIs, low latency serving, or encountering cache invalidation, experiment tracking, quality monitoring issues.
license: MIT
metadata:
  keywords: "recommendation system, personalization, feature store, model serving, caching strategy, Redis, A/B testing, Thompson sampling, recommendation metrics, CTR, conversion rate, catalog coverage, diversity, Prometheus monitoring, recommendation API, real-time recommendations, collaborative filtering integration, production recommendations, experiment tracking"
---

# Recommendation System

Production-ready architecture for scalable recommendation systems with feature stores, multi-tier caching, A/B testing, and comprehensive monitoring.

## When to Use This Skill

Load this skill when:
- **Building Recommendation APIs**: Serving personalized recommendations at scale
- **Implementing Caching**: Multi-tier caching for sub-millisecond latency
- **Running A/B Tests**: Experimenting with recommendation algorithms
- **Monitoring Quality**: Tracking CTR, conversion, diversity, coverage
- **Optimizing Performance**: Reducing latency, increasing throughput
- **Feature Engineering**: Managing user/item features with feature stores

## Quick Start: Recommendation API in 5 Steps

```bash
# 1. Install dependencies
pip install "fastapi>=0.109.0" "redis>=5.0.0" "prometheus-client>=0.19.0"

# 2. Start Redis (for caching and feature store)
docker run -d -p 6379:6379 redis:alpine

# 3. Create recommendation service: app.py
cat > app.py << 'EOF'
from fastapi import FastAPI
from pydantic import BaseModel
from typing import List
import redis
import json

app = FastAPI()
cache = redis.Redis(host='localhost', port=6379, decode_responses=True)

class RecommendationResponse(BaseModel):
    user_id: str
    items: List[str]
    cached: bool

@app.post("/recommendations", response_model=RecommendationResponse)
async def get_recommendations(user_id: str, n: int = 10):
    # Check cache
    cache_key = f"recs:{user_id}:{n}"
    cached = cache.get(cache_key)

    if cached:
        return RecommendationResponse(
            user_id=user_id,
            items=json.loads(cached),
            cached=True
        )

    # Generate recommendations (simplified)
    items = [f"item_{i}" for i in range(n)]

    # Cache for 5 minutes
    cache.setex(cache_key, 300, json.dumps(items))

    return RecommendationResponse(
        user_id=user_id,
        items=items,
        cached=False
    )

@app.get("/health")
async def health():
    return {"status": "healthy"}
EOF

# 4. Run API
uvicorn app:app --host 0.0.0.0 --port 8000

# 5. Test
curl -X POST "http://localhost:8000/recommendations?user_id=user_123&n=10"
```

**Result**: Working recommendation API with caching in under 5 minutes.

## System Architecture

```
````
END THIRD-PARTY FILE 9cc6a4dfd03afbbf

The third-party file has ended. Everything between the 9cc6a4dfd03afbbf tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2914 of 14771 bytes. © secondsky · MIT · https://github.com/secondsky/claude-skills/tree/HEAD/plugins/recommendation-system/skills/recommendation-system/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
