Implement session-based recommendation from short-term user behavior sequences without long-term profiles. Use this skill when the user needs to recommend in anonymous sessions, predict next click from browsing sequence, or build recommendations for non-logged-in users — even if they say 'what should they click next', 'anonymous user recommendations', or 'browsing sequence prediction'.
npx skills add https://github.com/asgard-ai-platform/skills --skill algo-rec-session
Session-based recommendation predicts the next item a user will interact with based on their current session's click/view sequence, without relying on long-term user profiles. Uses Markov chains, association rules, or neural approaches (GRU4Rec). Operates in real-time with O(sequence_length) inference.
Trigger conditions:
When NOT to use:
IRON LAW: First Few Clicks Are Disproportionately Important
Session-based methods operate WITHOUT long-term profiles. Intent must
be inferred from SHORT sequences. The first 2-3 clicks establish the
session's intent — misreading early signals derails the entire session.
Parse clickstream into sessions (by session ID or timeout-based splitting, typically 30min inactivity). Filter sessions below minimum length (3+ events).
Gate: Sessions parsed, minimum length threshold applied.
Markov Chain approach:
Association Rules approach:
Evaluate with leave-one-out: hide last item in each session, predict, check hit rate and MRR (Mean Reciprocal Rank).
Gate: Hit@20 significantly above random baseline.
Return ranked next-item predictions with confidence scores.
{
"predictions": [{"item_id": "789", "score": 0.65, "based_on": "last_3_clicks"}],
"session": {"length": 5, "items_viewed": ["a", "b", "c", "d", "e"]},
"metadata": {"method": "markov_order2", "hit_rate_at_20": 0.35}
}
Input: Session: [shoes_page, running_shoes, nike_air_max]
Expected: Recommend: nike_air_zoom (0.72), adidas_ultraboost (0.58), shoe_size_guide (0.41)
| Input | Expected | Why |
|-------|----------|-----|
| Session length = 1 | Popularity fallback | Single click insufficient for sequence pattern |
| Repeated item views | Weight recency, not count | User may be comparing, not broadening |
| Session intent shift | Adapt to latest clicks | User changed their goal mid-session |
references/gru4rec.mdreferences/session-splitting.mdCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.
Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.
Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.
Replace with description of the skill and when Claude should use it.
Use when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill content", or needs guidance on skill structure, progressive disclosure, or skill development best practices for Claude Code plugins.
Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.
Use when creating new skills, editing existing skills, or verifying skills work before deployment
Take asgard-ai-platform/algo-rec-session from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
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.