Spotify
它能做什么
对你的 Spotify 账户执行操作,例如搜索、制作播放列表、保存曲目和控制播放。它适用于希望用命令而非屏幕管理音乐的听众。
适用场景
- ✓当你想根据一份歌单创建播放列表的时候。
- ✓当你想查看现在正在播放什么的时候。
- ✓当你想把曲目加入资料库或关注某个播放列表的时候。
技能链接
https://github.com/danielmiessler/LifeOS/blob/main/LifeOS/install/skills/Spotify/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请创建一份轻快独立音乐的 Spotify 播放列表,并加入我上周喜欢的歌曲。”
每周 5 个新技能,1 分钟读完。
工作原理
该技能通过命令行工具直接调用 Spotify 网络接口。访问令牌会自动刷新,每个请求都会按你的要求更改账户。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Spotify
Acts on the principal's real Spotify account through Tools/Spotify.ts — a deterministic CLI that calls the Spotify Web API directly. No MCP, no server process, no session registration: any session can invoke it via Bash immediately.
bun ~/.claude/skills/Spotify/Tools/Spotify.ts <command> [flags] # --help for the full list
Ideal State
- Every requested account change (follow, playlist build, library read, queue, playback) is one
Tools/Spotify.tscall keyed by IDs or URIs, and the account state afterwards matches the request. - Auth is set up once and never repeated by hand: tokens refresh per invocation, and a dead token or redirect mismatch is traced to its real fix (re-run
auth, or fix the dashboard URI). - Playback is attempted only on a Premium account with an active device, so a Free account still gets search, playlists and library.
Intent Routing
| Intent | Trigger | File |
|---|---|---|
| Authorize | "set up spotify", "authorize spotify", "connect spotify", auth broken | Intents/Authorize.md |
| Manage | play / search / playlists / queue / library ops | Intents/Manage.md |
| File | Read when |
|---|---|
Setup.md |
first-time install: the developer app, the three .env keys, the proof command |
Tools/ |
Spotify.help.md is the full flag reference (same as --help); EnvText.ts is the pure env-file helper Spotify.ts writes tokens with |
Data & Config
This skill reads no files under LIFEOS/USER/. Credentials are env-only: SPOTIFY_CLIENT_ID, SPOTIFY_CLIENT_SECRET and SPOTIFY_REFRESH_TOKEN in ~/.claude/.env (names only here, never values). First-time setup, the Spotify developer app and the proof command are in Setup.md. Tokens auto-refresh per invocation; a missing refresh token means run Intents/Authorize.md. With the credentials missing, the tool exits 1 and points at Setup.md.
Gotchas
searchworks before user auth (client-credentials fallback); every other command needs the refresh token.- 401 on every call → the refresh token died (password change, revoked access); re-run
auth(Intents/Authorize.md). The tool persists rotated refresh tokens automatically. /me/playlistsreturnstracks: nullon playlist rows (observed) — never assumetracks.totalexists; the CLI omits the count when absent.
Examples
- "Add this playlist link to my Spotify" → Manage → the playlist is followed with
follow-playlist --id <ID>(ID from the URL) and shows inplaylists. - "Make me a focus-music playlist and fill it" → Manage → a new playlist from
create-playlist, holding the trackssearchresolved, added withadd-tracks. - "What's playing?" → Manage → the
now-playingresult. - "Skip this / turn it down" → Manage →
next/volume --percent 30on the active Premium device.
常见问题
需要付费的 Spotify 账户吗?
播放控制需要带有可用设备的 Premium 账户;搜索、播放列表和资料库功能在免费账户上也可用。
我需要先设置吗?
需要。它需要一次性设置,包括一个 Spotify 开发者应用和三个密钥。
如果连接停止工作怎么办?
重新运行授权步骤通常能解决,或者需要在开发者控制台中更正重定向地址。
详情
作者的原始描述
Acts on the principal's Spotify account via a deterministic CLI (Tools/Spotify.ts): search, playlists, now-playing, library, and playback across devices. USE WHEN spotify, play on spotify, add to my spotify, follow this playlist, save playlist, create a spotify playlist, add tracks, what's playing, my playlists, queue this, skip track, set volume, spotify search, control spotify, my spotify library. NOT FOR music taste or recommendations, generating songs, editing audio (AudioEditor).
repo: danielmiessler/LifeOS
热度
- GitHub 星标
- 20k
- 排名
- #10459
- 许可证
- MIT
- 更新时间
- 2026/10/28
评论
- …