agentleFS
OpenMinisOpenMinis/MinisSkills/spotify-hub/SKILL.md

spotify-hub

Skill584 starsChanged 59 days agoMITView on GitHub

A skill that uses Python and spotipy to control Spotify playback. It supports play/pause, skipping tracks, volume, shuffle, searching for and playing songs, generating mixed playlists from keywords (for example, TikTok hits, a specific genre, or a specific artist), and viewing the current playback status and device list. This skill must be triggered whenever the user mentions "Spotify," "play music," "skip a track," "pause," "search for a song," "switch playlists," "spotify-hub," or any scenario that requires controlling Spotify playback.

  • Installs packages

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use the spotipy library to call the Spotify Web API, control playback, and search for music.

    line 9
  2. Distinctive:

    After authorization is complete, the browser displays "✅ Spotify authorization successful!".

    line 44
  3. Very specific:

    All operations are executed through /var/minis/skills/spotify-hub/scripts/spotify.py:

    line 48

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Spotify Hub

Use the spotipy library to call the Spotify Web API, control playback, and search for music.

Dependencies

Both scripts declare dependencies (spotipy>=2.26.0) using uv inline script. When executed with uv run, they are installed automatically, so no manual pip install is required.

Environment Requirements

The following environment variables must be set. If they are not set, guide the user to create them:

  • SPOTIPY_CLIENT_ID — Settings
  • SPOTIPY_CLIENT_SECRET — Settings
  • SPOTIPY_REDIRECT_URI — Settings

Apply for credentials at https://developer.spotify.com/dashboard → Create App → set Redirect URI to http://127.0.0.1:8888/callback

Authorization Flow (First Time or When the Token Expires)

The token is stored in ~/.config/spotify/cache and includes a refresh_token. Under normal circumstances, it remains valid indefinitely and does not require repeated authorization.

When authorization is required, start the authorization server in the background, get the URL, and give it directly to the user to click:

# Start the authorization server in the background
import subprocess, time
subprocess.Popen(["uv", "run", "--script", "--cache-dir", "/root/.cache/uv",
                              "/var/minis/skills/spotify-hub/scripts/spotify_auth.py"],
                 stdout=open("/tmp/spotify_auth.log", "w"), stderr=subprocess.STDOUT)
time.sleep(2)
url = open("/tmp/spotify_auth_url.txt").read().strip()
print(url)

Then provide the user with a clickable authorization link in the reply: [👉 Click to authorize Spotify](<url>)

After authorization is complete, the browser displays "✅ Spotify authorization successful!". Once the user informs you, you can continue.

Core Script

All operations are executed through /var/minis/skills/spotify-hub/scripts/spotify.py:

uv run --script --cache-dir /root/.cache/uv /var/minis/skills/spotify-hub/scripts/spotify.py <cmd> [args]
CommandDescription
statusCurrent playback status + device list
play / pausePlay / pause
next / prevNext track / previous track
volume <0-100>Set volume
shuffle on/offToggle shuffle
repeat off/track/contextRepeat mode
seek <seconds or mm:ss>Seek playback position
search <keyword>Search and play
play-track <id/uri>Play a specified track
play-playlist <id/uri>Play a specified playlist
save / unsaveSave / unsave the current track
liked [count]View saved tracks
recent [count]Recently played history
top [tracks/artists] [count]Most-listened tracks / artists
playlistsView my playlist list
create-playlist <name>Create a playlist
add-to-playlist <id>Add the current track to a playlist
follow <artist name>Follow an artist
followingView followed artists

Popular Playlist Scenarios (for example, "TikTok Hits" or "a Specific Genre")

Third-party public playlists will return 403. Do not attempt to read playlists. Instead, use multi-keyword search to mix and play tracks:

from scripts.spotify import get_sp, search_multi_and_play

sp = get_sp()
keywords = ["TikTok trending", "douyin trending", "tiktok viral 2024", "TikTok hit songs"]
search_multi_and_play(sp, keywords, count_each=10, market="HK")

Or call spotify.py search directly with shell_execute:

uv run --script --cache-dir /root/.cache/uv /var/minis/skills/spotify-hub/scripts/spotify.py search "TikTok trending"

Notes

  • Playback control requires an active device (Spotify is open on a phone or computer and has played before)
  • market="HK" can find more Chinese songs
  • spotipy is preinstalled (pip show spotipy can verify this)
  • In Development Mode, 403 for third-party public playlists is a normal restriction. Use search instead.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.