mcpbeat Sign in

Algo Rec Cf Agent Skill

Implement collaborative filtering for recommendations based on user behavior patterns. Use this skill when the user needs to build a recommendation engine from user-item interaction data, find similar users or items, or predict ratings — even if they say 'users who bought this also bought', 'similar users', or 'recommend based on behavior'.

7k tokens
context cost
the whole folder, loaded on every use
4
files
instructions only
0
copies elsewhere
how many repositories repackaged it
223
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/asgard-ai-platform/skills --skill algo-rec-cf

What comes with it

24 098 bytes besides the instruction
examples/sample_scenario.md
references/implicit-feedback.md
references/matrix-factorization.md

The instruction itself

14 sections, as written by the author

Collaborative Filtering

Overview

Collaborative filtering recommends items based on collective user behavior patterns. User-based CF finds similar users; item-based CF finds similar items. Computes in O(U² × I) for user-based or O(I² × U) for item-based where U=users, I=items.

When to Use

Trigger conditions:

  • Building recommendations from user-item interaction data (ratings, clicks, purchases)
  • Finding "users like you also liked" or "frequently bought together" patterns

When NOT to use:

  • When you have no interaction data (cold start — use content-based filtering)
  • When item features matter more than behavior patterns (use content-based)

Algorithm

IRON LAW: CF Requires SUFFICIENT Interaction Data
With sparse matrices (< 1% fill rate), similarity computation is
unreliable. Minimum viable: each user has rated 5+ items, each item
has 5+ ratings. Below this, fallback to content-based or popularity.

Phase 1: Input Validation

Load user-item interaction matrix. Check sparsity level and filter users/items below minimum interaction threshold.

Gate: Matrix sparsity < 99%, minimum interaction thresholds met.

Phase 2: Core Algorithm

User-based CF:

  • Compute pairwise user similarity (cosine or Pearson correlation)
  • For target user, find top-K most similar users
  • Predict rating: weighted average of similar users' ratings

Item-based CF:

  • Compute pairwise item similarity from co-rating patterns
  • For target item, find top-K most similar items
  • Predict: weighted average of user's ratings on similar items

Phase 3: Verification

Hold out 20% of interactions for testing. Compute RMSE, MAE, or precision@K / recall@K.

Gate: RMSE below baseline (global mean predictor).

Phase 4: Output

Return top-N recommendations with predicted scores.

Output Format

{
  "recommendations": [{"item_id": "123", "predicted_score": 4.2, "similar_items_used": 5}],
  "metadata": {"method": "item-based", "similarity": "cosine", "k_neighbors": 20, "sparsity": 0.97}
}

Examples

Sample I/O

Input: 5 users × 5 items rating matrix, target: user1, item5

Expected: Predicted rating based on weighted similarity of user1's rated items similar to item5

Edge Cases

| Input | Expected | Why |

|-------|----------|-----|

| New user, no ratings | Cannot recommend | Cold start — fallback to popularity |

| Item rated by all users | Low differentiation | High popularity ≠ personalized match |

| Single shared item | Unreliable similarity | Need multiple co-ratings for stable similarity |

Gotchas

  • Scalability: User-based CF with millions of users is O(U²). Use approximate nearest neighbors (LSH) or switch to item-based CF (item catalog is usually smaller).
  • Popularity bias: Popular items have more co-ratings, inflating their similarity scores. Normalize by inverse popularity.
  • Implicit vs explicit feedback: Clicks/views (implicit) need different treatment than ratings (explicit). Use confidence weighting for implicit data.
  • Similarity metric matters: Cosine similarity ignores rating scale differences; Pearson correlation accounts for user rating biases. Choose based on data characteristics.
  • Gray sheep: Users with unusual taste patterns have no similar peers. CF fails for them — consider hybrid approaches.

References

  • For matrix factorization as a scalable alternative, see references/matrix-factorization.md
  • For implicit feedback handling, see references/implicit-feedback.md

Other skills for the same job

different authors, same section of the catalogue
Protocolsio Integration
by christophacham
×4

Integration with protocols.io API for managing scientific protocols. This skill should be used when working with protocols.io to search, create, update, or publish protocols; manage protocol steps and materials; handle discussions and comments; organize workspaces; upload and manage files; or integrate protocols.io functionality into workflows. Applicable for protocol discovery, collaborative protocol development, experiment tracking, lab protocol management, and scientific documentation.

16k tokens
Tailored Resume Generator
by frostant
×4

Analyzes job descriptions and generates tailored resumes that highlight relevant experience, skills, and achievements to maximize interview chances

3k tokens
Excalidraw Diagram Generator
by github
vendor ×3

Generate Excalidraw diagrams from natural language descriptions. Use when asked to "create a diagram", "make a flowchart", "visualize a process", "draw a system architecture", "create a mind map", or "generate an Excalidraw file". Supports flowcharts, relationship diagrams, mind maps, and system architecture diagrams. Outputs .excalidraw JSON files that can be opened directly in Excalidraw.

36k tokens scripts
Expo Dev Client
by openai
vendor ×3

Build and distribute Expo development clients locally or via TestFlight

961 tokens
Executing Plans
by ZhanlinCui
×3

Use when you have a written implementation plan to execute in a separate session with review checkpoints

542 tokens
Anndata
by christophacham
×3

Data structure for annotated matrices in single-cell analysis. Use when working with .h5ad files or integrating with the scverse ecosystem. This is the data format skill—for analysis workflows use scanpy; for probabilistic models use scvi-tools; for population-scale queries use cellxgene-census.

16k tokens
Benchling Integration
by christophacham
×3

Benchling R&D platform integration. Access registry (DNA, proteins), inventory, ELN entries, workflows via API, build Benchling Apps, query Data Warehouse, for lab data management automation.

14k tokens
Biopython
by christophacham
×3

Comprehensive molecular biology toolkit. Use for sequence manipulation, file parsing (FASTA/GenBank/PDB), phylogenetics, and programmatic NCBI/PubMed access (Bio.Entrez). Best for batch processing, custom bioinformatics pipelines, BLAST automation. For quick lookups use gget; for multi-service integration use bioservices.

24k tokens

How to use it

Copy the folder

Take asgard-ai-platform/algo-rec-cf from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.