Agent skill

Lastfm

by magnus919 in magnus919/agent-skills

Interact with the Last.fm music data API: lookup user listening history, get artist/album/track metadata, discover similar music via collaborative filtering, explore global and per-country charts…

MITAuto-check passedData & Analytics

Install Lastfm

skills CLI
$ npx skills add magnus919/agent-skills --skill lastfm -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install magnus919/agent-skills lastfm --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/magnus919/agent-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/lastfm .claude/skills/lastfm && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
lastfm
GitHub stars
115
Token cost
~2.3k tokens
SKILL.md length
699 words
Files
6 (incl. scripts, references)
Skills in repo
131
Repo updated
First seen
Licence
MIT

At a glance

Interact with the Last.fm music data API: lookup user listening history, get artist/album/track metadata, discover similar music via collaborative filtering, explore global and per-country charts…

  • Works in 5 steps: Get user's top artists/tracks from Last.fm → For each artist, find similar artists… → For each track, find similar tracks for… → …
  • The user asks about music data
  • SKILL.md covers Setup, Essential Commands, Reference Files and Music Discovery Pipeline —…, plus 7 more sections
  • Runs Shell scripts from its folder; calls jq, bash and python3; reaches last.fm; needs LASTFM_SESSION_KEY and LASTFM_API_KEY

What it does

Lastfm is an agent skill from magnus919/agent-skills. Interact with the Last.fm music data API: lookup user listening history, get artist/album/track metadata, discover similar music via collaborative filtering, explore global and per-country charts, search by artist/album/track, manage tags, and scrobble listening events. Use when the user asks about music data, listening statistics, music recommendations, similar artists, charts, or wants to scrobble or love tracks. Do not use this skill for unrelated requests; route to the nearest named specialist.

Its SKILL.md is about 2.3k tokens, which your agent loads only when the skill is triggered. The skill folder holds 8 other files, including scripts and reference files (for example `README.md`, `evals/evals.json` and `references/auth-flow.md`). Compatibility notes: Requires a Last.fm API key in the LASTFMAPIKEY env var. For write operations (scrobble, love, now-playing), also needs LASTFMAPISECRET and LASTFMSESSIONKEY…

It sits in Data & Analytics, covering Statistics. The repository describes itself as: Curated collection of AI agent skills for Hermes and other agent frameworks. The licence is MIT.

When your agent uses it

  • The user asks about music data
  • Listening statistics
  • Music recommendations
  • Similar artists

Example prompts

  • “/lastfm”

Requirements

  • Python 3
  • A Bash shell
  • A credential in LASTFM_API_KEY
  • A credential in LASTFM_API_SECRET
  • Compatibility (from SKILL.md): Requires a Last.fm API key in the LASTFM_API_KEY env var. For write operations (scrobble, love, now-playing), also needs LASTFM_API_SECRET and LASTFM_SESSION_KEY. The `lastfm-cli` CLI tool must be on PATH.

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. Get user's top artists/tracks from Last.fm
  2. For each artist, find similar artists via Last.fm's collaborative filtering
  3. For each track, find similar tracks for more granular recommendations
  4. Cross-reference against what they've already scrobbled (recent-tracks) to filter out already-heard material.
  5. Check against the user's own collection (via Radarr/Sonarr/jellyfin or Spotify library) to see what's already in the library vs genuinely…

What it can do on your machine

Read from SKILL.md and the folder at commit 22b4723. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 2 files in scripts/ (Shell), which the agent can run.

    Shell commands in SKILL.md call:

    • jq
    • bash
    • python3

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • last.fm

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • LASTFM_SESSION_KEY
    • LASTFM_API_KEY
    • LASTFM_API_SECRET

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Requires a Last.fm API key in the LASTFM_API_KEY env var. For write operations (scrobble, love, now-playing), also needs LASTFM_API_SECRET and LASTFM_SESSION_KEY. The `lastfm-cli` CLI tool must be on PATH.

    From compatibility in the SKILL.md frontmatter.

Context cost

Lastfm loads about 2.3k tokens when it runs, and up to ~2.9k if it reads all its reference files. Until then it costs about 128 tokens; SKILL.md has 699 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~128
When it runs · the whole SKILL.md, loaded when a task matches
~2.3k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~2.9k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from magnus919/agent-skills at commit 22b4723, republished under its MIT licence (© magnus919). 699 words, ~2,308 tokens.

Download SKILL.mdSave it as .claude/skills/lastfm/SKILL.md (or your agent's skills folder). This skill also uses 5 other files; get the full folder from GitHub.
name
lastfm
description
Interact with the Last.fm music data API: lookup user listening history, get artist/album/track metadata, discover similar music via collaborative filtering, explore global and per-country charts, search by artist/album/track, manage tags, and scrobble listening events. Use when the user asks about music data, listening statistics, music recommendations, similar artists, charts, or wants to scrobble or love tracks. Do not use this skill for unrelated requests; route to the nearest named specialist.
compatibility
Requires a Last.fm API key in the LASTFM_API_KEY env var. For write operations (scrobble, love, now-playing), also needs LASTFM_API_SECRET and LASTFM_SESSION_KEY. The `lastfm-cli` CLI tool must be on PATH.
license
MIT
metadata.tags
music, lastfm, scrobbling, api-client, music-discovery
metadata.source
https://www.last.fm/api

Last.fm

Setup

bash
export LASTFM_API_KEY="your_api_key_here"
# For write operations only:
export LASTFM_API_SECRET="your_api_secret"
export LASTFM_SESSION_KEY="your_session_key"

Get an API key at https://www.last.fm/api/account/create (free, requires a Last.fm account).

Essential Commands

User queries — "what am I listening to"

Configurable via LASTFM_USERNAME env var. Defaults to <username> if unset.

bash
lastfm-cli user info <username>                      # Profile + stats
lastfm-cli user recent-tracks <username> --limit 10   # Recent listening
lastfm-cli user top-artists <username> --period 7day  # Weekly top artists
lastfm-cli user top-tracks <username> --period overall # All-time faves
lastfm-cli user loved-tracks <username>               # Loved tracks
lastfm-cli user friends <username>                    # Social graph
lastfm-cli user weekly-charts <username>              # Available chart periods
Music Discovery — "what's similar to X"
bash
lastfm-cli artist similar <artist> --limit 10         # Taste graph neighbors
lastfm-cli artist info <artist>                       # Bio, stats, tags
lastfm-cli artist top-tracks <artist>                 # Their most popular
lastfm-cli track similar <artist> "<track>"           # Track-level similarity
lastfm-cli album info <artist> "<album>"              # Tracklist, metadata
lastfm-cli tag top-artists <tag>                      # Genre browsing
bash
lastfm-cli chart top-artists --limit 20               # Global
lastfm-cli geo top-artists "Japan" --limit 20         # Per-country
lastfm-cli geo top-tracks "Germany" --limit 20
lastfm-cli tag top-tracks "electronic" --limit 15     # By genre tag
Search — "find that thing"
bash
lastfm-cli artist search "Radiohead"                  # Find by name
lastfm-cli album search "OK Computer"                 # Find albums
lastfm-cli track search "Karma Police"                # Find tracks
Write operations (require session auth)
bash
lastfm-cli track scrobble "Artist" "Song" --album "Album"
lastfm-cli track now-playing "Artist" "Song"
lastfm-cli track love "Artist" "Song"
Auth flow (one-time setup)
bash
# 1. Get a token
lastfm-cli auth get-token

# 2. User visits: https://www.last.fm/api/auth/?api_key=KEY&token=TOKEN

# 3. Exchange for session key
lastfm-cli auth get-session <token>
# → Set export LASTFM_SESSION_KEY=<key>

Reference Files

  • references/auth-flow.md — Full walkthrough for setting up write operation auth (scrobble, love, now-playing). Read this before attempting write operations.

Music Discovery Pipeline — "find me new stuff I'll like"

The core flow for turning liked tracks into recommendations:

  1. Get user's top artists/tracks from Last.fm:

    bash
    lastfm-cli user top-artists <username> --period 1month --limit 5 --json
    lastfm-cli user top-tracks <username> --period 1month --limit 10 --json
    lastfm-cli user loved-tracks <username> --json
  2. For each artist, find similar artists via Last.fm's collaborative filtering:

    bash
    lastfm-cli artist similar "<artist>" --limit 5 --json
  3. For each track, find similar tracks for more granular recommendations:

    bash
    lastfm-cli track similar "<artist>" "<track>" --limit 5 --json
  4. Cross-reference against what they've already scrobbled (recent-tracks) to filter out already-heard material.

  5. Check against the user's own collection (via Radarr/Sonarr/jellyfin or Spotify library) to see what's already in the library vs genuinely new discovery.

Using with --json for Machine Processing

bash
# Pipe to jq for structured queries
lastfm-cli artist similar "Radiohead" --limit 5 --json | jq '.similarartists.artist[] | {name, match}'

# Get a user's all-time top artists with playcounts
lastfm-cli user top-artists <username> --period overall --limit 3 --json | jq '.topartists.artist[] | {name, playcount}'

# Find most popular tracks by a genre
lastfm-cli tag top-tracks "electronic" --limit 10 --json | jq '.tracks.track[] | {name, artist: .artist.name, listeners}'

Known Gotchas

  • API key required for EVERY request. The key is free — get one at the Last.fm API account page.
  • Rate limit is ~5 req/sec sustained. The API docs say "be reasonable" — if you're making several calls per second continuously, your account may be suspended. Add small delays in loops.
  • User-Agent header matters. The CLI sends lastfm-cli/1.0 (hermes-agent). Last.fm's docs explicitly ask for an identifiable User-Agent.
  • XML is the default response format. The CLI requests format=json. Without it, responses come back as XML.
  • Artist names can be misspelled. Use --autocorrect flag on artist commands to let Last.fm correct misspellings.
  • Write operations need auth setup. scrobble, love, and now-playing require a full auth flow (token → session key). Read-only endpoints don't.
  • The collaborative filtering graph is NOT social. artist.getSimilar returns algorithmic similarity based on aggregate listening patterns, not human-curated recommendations.
  • Timestamps for scrobbles are UNIX epoch seconds. If omitted, uses current time.
  • --from and --to on recent-tracks accept ISO 8601 date strings (e.g., 2026-05-27).
  • Period values: overall, 7day, 1month, 3month, 6month, 12month.

When to Reach for This Tool

  • User asks "what's [person] listening to lately?"
  • User wants music discovery: "find me artists similar to..."
  • User wants listening statistics: top artists, tracks, albums by period
  • User wants geographic music trends: "what's popular in [country]"
  • User wants genre exploration via tags
  • User wants to scrobble or love tracks programmatically
  • Any question about music metadata, artist info, album tracklists
Show full SKILL.md (302 more words)Show less

Available Scripts

ScriptPurposeInvocation
scripts/lastfm-cliThe CLI tool this skill drives: read-only queries (user info/recent-tracks/top-artists/top-tracks/loved-tracks/friends/weekly-charts), discovery (artist similar, track similar), charts and geo charts, search, tags, and — with session auth — scrobble, now-playing, and love. Run it for every Last.fm data question above; see Essential Commands for the full command surface.scripts/lastfm-cli user top-artists <username> --period 7day --limit 10
scripts/test-lastfm.shShell test suite covering the CLI's argument handling and output formatting without network calls. Run it after modifying scripts/lastfm-cli or when auditing a change to its behavior; CI runs it via scripts/check-skill-tests.py.bash scripts/test-lastfm.sh

Prerequisites

  • A free Last.fm API key exported as LASTFM_API_KEY (create one at https://www.last.fm/api/account/create); every request fails without it.
  • For write operations only: LASTFM_API_SECRET plus a session key from the one-time auth flow in references/auth-flow.md, exported as LASTFM_SESSION_KEY.
  • Python 3 on PATH — invoke the bundled tool as python3 scripts/lastfm-cli ... if it is not executable directly; the SKILL.md examples assume lastfm-cli resolves on PATH.
  • Optional: LASTFM_USERNAME to set the default user for user queries; jq when piping --json output for structured processing.

Limitations

  • Read-only endpoints need only the API key; scrobble, now-playing, and love require the full token → session-key auth flow and will fail without it.
  • Sustained call rates above ~5 req/sec risk account suspension — add small delays in loops.
  • Similarity endpoints are algorithmic collaborative filtering over aggregate listening patterns, not social or human-curated recommendations.
  • Period values are fixed to overall, 7day, 1month, 3month, 6month, and 12month; arbitrary date ranges are only available via --from/--to on recent-tracks.
  • Misspelled artist names return empty or wrong results unless --autocorrect is used.

When not to use

Do not use this skill for music playback control (local players, streaming queues), for non-Last.fm catalog data (MusicBrainz, Spotify metadata), or as a lyrics source — the API covers listening history, metadata, charts, tags, similarity, and scrobbling only.

© magnus919, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 5 other files (scripts, references) in lastfm of magnus919/agent-skills.

  • SKILL.md
  • README.md
  • evals/evals.json
  • references/auth-flow.md
  • scripts/lastfm-cli
  • scripts/test-lastfm.sh

Open the folder on GitHubat commit 22b4723

Compare with similar skills

Lastfm next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Lastfm compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Lastfm this skillmagnus919/agent-skills115—~2.3kAutomated safety check: PassMIT
Sandbox Benchvercel/next.js143k—~4.1kAutomated safety check: PassMIT
Statistical Analysisspacering-net/codeg3.9k3 repos~5kAutomated safety check: PassMIT
StatsmodelszLanqing/codex-claude-academic-skills4.7k15 repos~4.9kAutomated safety check: PassBSD-3-Clause
AI Daily DigestvigorX777/ai-daily-digest1.6k—~1.3kAutomated safety check: PassNone
Statistical Powerspacering-net/codeg3.9k1 repos~3.6kAutomated safety check: NotesMIT

Similar skills

  • Sandbox Bench

    vercel/next.js

    Official

    Benchmark React or Next.js changes on Vercel Sandbox VMs with paired A/B statistics: react PR/commit vs base, or Next.js PR/commit vs base, measured end-to-end through the bench/render-pipeline app…

    143k GitHub stars~4.1k tokensUpdated today
    Data & AnalyticsAuto-check passed
  • Statistical Analysis

    spacering-net/codeg

    Guided statistical analysis for research data - test selection, assumption checking, effect sizes, power analysis, Bayesian alternatives, and APA-formatted reporting.

    3.9k GitHub starsUsed in 3 repos~5k tokens
    Data & AnalyticsAuto-check passed
  • Statsmodels

    zLanqing/codex-claude-academic-skills

    Statistical models library for Python. An agent skill from zLanqing/codex-claude-academic-skills.

    4.7k GitHub starsUsed in 15 repos~4.9k tokens
    Data & AnalyticsAuto-check passed
  • AI Daily Digest

    vigorX777/ai-daily-digest

    Fetches RSS feeds from 90 top Hacker News blogs (curated by Karpathy), uses AI to score and filter articles, and generates a daily digest in Markdown with Chinese-translated titles, category…

    1.6k GitHub stars~1.3k tokensUpdated 7 mo ago
    Data & AnalyticsAuto-check passed
  • Statistical Power

    spacering-net/codeg

    Sample-size and statistical power calculations for planning studies.

    3.9k GitHub starsUsed in 1 repo~3.6k tokens
    Data & AnalyticsAuto-check: notes
  • Agent Session Monitor

    higress-group/higress

    Real-time agent conversation monitoring - monitors Higress access logs, aggregates conversations by session, tracks token usage.

    9.5k GitHub stars~3.3k tokensUpdated 2 days ago
    Data & AnalyticsAuto-check passed

More from magnus919/agent-skills

All 131 skills in this repo
  • Artifact Pyramids

    magnus919/agent-skills

    Organize durable agent research outputs as summaries, analysis, and evidence dossiers.

    119 GitHub stars~2.7k tokensUpdated today
    Auto-check passed
  • Ascii City Engine

    magnus919/agent-skills

    Build portable, first-person colored ASCII city engines and small GIS-derived city packs.

    119 GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Color Management

    magnus919/agent-skills

    Manage color workflows with ICC profiles, working spaces, gamut mapping, and color science.

    119 GitHub stars~2.6k tokensUpdated today
    Auto-check: notes
  • Data Scientist

    magnus919/agent-skills

    A skill your agent uses for PhD-level expertise in data science, statistics, and machine learning: rigorous statistical analysis, experimental design, causal inference, advanced modeling, research…

    119 GitHub stars~4.1k tokensUpdated today
    Auto-check passed
  • Docker Compose

    magnus919/agent-skills

    Use Docker Compose to define, run, debug, and harden multi-container applications.

    119 GitHub stars~2k tokensUpdated today
    Auto-check: notes
  • Fpga Development

    magnus919/agent-skills

    Design, review, simulate, and verify FPGA logic using explicit RTL contracts, clock and reset models, CDC analysis, timing constraints, and reproducible implementation evidence.

    119 GitHub stars~2.7k tokensUpdated today
    Auto-check passed

Questions about Lastfm

What does Lastfm do?

Interact with the Last.fm music data API: lookup user listening history, get artist/album/track metadata, discover similar music via collaborative filtering, explore global and per-country charts…. Lastfm is an agent skill from magnus919/agent-skills.fm music data API: lookup user listening history, get artist/album/track metadata, discover similar music via collaborative filtering, explore global and per-country charts, search by artist/album/track, manage tags, and scrobble listening events.

When should I use Lastfm?

Lastfm fits situations like: the user asks about music data; listening statistics; music recommendations; similar artists.

How do I install Lastfm in Claude Code?

Run `npx skills add magnus919/agent-skills --skill lastfm -a claude-code`. Or copy the skill folder (lastfm in magnus919/agent-skills) into .claude/skills/lastfm in your project. Claude Code loads it when a task matches its description.

How do I install Lastfm in Codex?

Run `npx skills add magnus919/agent-skills --skill lastfm -a codex`. Or copy the skill folder (lastfm in magnus919/agent-skills) into .agents/skills/lastfm in your project. Codex loads it when a task matches its description.

Can I use Lastfm in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add magnus919/agent-skills --skill lastfm -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/lastfm, .gemini/skills/lastfm, .github/skills/lastfm and .opencode/skills/lastfm in your project.

What does Lastfm need to run?

Going by SKILL.md and its folder, Lastfm needs a shell for the scripts in its folder, the command-line tools its instructions call (jq, bash and python3) and credentials named LASTFM_SESSION_KEY, LASTFM_API_KEY and LASTFM_API_SECRET. Our summary lists: Python 3; A Bash shell; A credential in LASTFM_API_KEY; A credential in LASTFM_API_SECRET. Compatibility (from SKILL.md): Requires a Last.fm API key in the LASTFM_API_KEY env var. For write operations (scrobble, love, now-playing), also needs LASTFM_API_SECRET and LASTFM_SESSION_KEY. The `lastfm-cli` CLI tool must be on PATH..

Does Lastfm access the network?

SKILL.md names 1 domain. In commands or code: last.fm; the agent is likely to contact it when it follows the instructions. This is read from the text; nothing was executed.

Is Lastfm safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Lastfm use?

Lastfm is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Lastfm use?

About 2.3k tokens (SKILL.md is roughly 9.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 636 tokens, read only when the agent opens those files.

What are the alternatives to Lastfm?

Skills that share tags, products or a category with Lastfm: Sandbox Bench (vercel/next.js, 143k stars), Statistical Analysis (spacering-net/codeg, 3.9k stars), Statsmodels (zLanqing/codex-claude-academic-skills, 4.7k stars) and AI Daily Digest (vigorX777/ai-daily-digest, 1.6k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Lastfm?

magnus919 (a GitHub user) maintains it in magnus919/agent-skills, which has 115 GitHub stars. The repository holds 131 skills in this directory. The repository was last updated on October 10, 2026.

Source: magnus919/agent-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.