StartupCities







Recently Spotify changed their APIs and broke lots of open source tools.
So I built a new Spotify CLI for my AI agents to build playlists and DJ for me.
The tool was also an experiment in how to make a command line tool maximally useful to AI agents. Here's what I learned.
Most CLIs stream text for human eyes. But agents can more easily use JSON to chain commands. So Spotify CLI streams JSON to stdout:
spotify track saved --limit 5 | jq '.items[].track.name'
Structured errors go to stderr with error codes, so agents can programmatically handle failures instead of parsing error messages.
Agents waste lots of cycles guessing commands. Adding great --help text at each layer aids agent discoverability and speed. Every command and subcommand in Spotify CLI has detailed help text that tells the agent exactly what's available and how to use it.
The data itself needs to be understandable by an LLM. Unfortunately, Spotify's API speaks in a language of giant random strings. These don't help communicate the domain to the LLM (or the human).
So Spotify CLI resolves these IDs into actual track names, artists, and albums automatically. The tool also adds fuzzy text search so intuitive commands like spotify queue add "bohemian rhapsody" work automagically.
--help text at every layerOpen source, 40 commands, PKCE auth, MIT licensed, single binary: spotify-cli.zach.dev


















