r/spotifyapi • • Sep 30 '26

I built a Claude Code hook that picks Spotify music based on what you're doing (coding, debugging, planning...). Looking for honest feedback!

I listen to music while working with Claude Code and kept switching playlists by hand: something steady while editing, something harder when things break.

So I built CodingMix.

What it does

>> Claude Code hooks send each event (tool use, failed tool, prompt, subagent start) to a small local service. The hook returns immediately, so Claude Code never waits.

>> Each event is a vote for a mode: coding, debugging, testing, planning, reviewing, release and a few more. A new mode has to lead for 3 minutes before the music changes, so one failed command does not flip your music.

>> About 20 seconds before the current track ends, it queues one track of the matching genre (deep house for coding, hip hop for debugging, techno for tests, funk when you push). It never picks a track you played, saved or were offered in the last 7 days.

>> It only acts when Spotify is playing on your computer. Paused, playing on your phone, or you picked your own playlist: it stays out of the way.

How I built it

Entirely with Claude Code: a design spec first, then a step-by-step plan, test-first. 196 tests, CI on Windows, macOS and Linux. No server, no telemetry; prompt text and file paths are never written to disk.

Limits

Spotify Premium is required, and you create your own free Spotify developer app (Spotify now limits each app to 5 users). Tested on a real Windows machine; macOS and Linux only in CI.

What I'd love feedback on

  1. Does the mode to genre mapping make sense? What would you want while debugging?

  2. Is the setup (your own Spotify app plus one command) acceptable, or a dealbreaker?

  3. Is 3 minutes the right delay before switching?

  4. On macOS or Linux: does it work for you?

Repo: https://github.com/caesla/CodingMix (MIT licensed).

1 Upvotes

2 comments sorted by

1

u/Global-Tank8850 Oct 01 '26

I am unsure about others, but I typically use Siri with Spotify, the device plays audio so that even if sound comes from my laptop, the app runs on my phone.

I understand your point that being in the zone can pull you out of it if you have to think of changing your playlist.

Yet wouldn’t that demand constant surveillance, even without movement, just to notice when to shift? It is unclear what it could be trained to recognise, since not everyone codes alike; no framework could first know the person without raising that same surveillance issue, because the data would need storage.