Play Music on Alexa with Claude Code¶
| Category | Creative & Real-World AI Builds |
| Status | ๐ก Partially completed |
| Repo | nextwork-play-music-on-alexa-with-claude-code |
| Original NextWork guide | nextwork.ai |
Learning project
Practice work following a NextWork guide, separate from my production projects.
๐ NextWork learning project. This is a practice project I built while working through NextWork's Play Music on Alexa with Claude Code guide. It is part of my Learning portfolio and is fully separate from my production projects.
Category: Learning โบ Creative & Real-World AI Builds
Status: ๐ก Partially completed
Overview¶
The skill should never make the music public. Every track URL it hands the speaker is signed and expires in minutes. I built the library, the signer and the skill handler, then drove them with request JSON in the same shape a real Echo sends.
Summary¶
I built the whole flow locally with my own code and mock requests, instead of an Echo, the Alexa developer console, R2 and Claude Code. There are three tracks I generated myself, with a searchable catalog. A private library server refuses unsigned, tampered or expired links (403) and streams a fresh HMAC-signed link (200). A voice-model file covers play-by-title, play-by-artist and shuffle. A skill handler takes real Alexa request JSON and answers with AudioPlayer.Play directives carrying short-lived signed URLs. For the secret mission, PlaybackNearlyFinished queues a different random track (ENQUEUE with expectedPreviousToken), still through signed links. All 12 checks pass. Partial: no Echo, Alexa account, R2 bucket or Claude Code session. The requests are mock JSON, the signing is my own HMAC scheme rather than R2 presigning, and Claude Code didn't write this code.
The checks behind this are in docs/verification.txt.
Skills & tools¶
Python, Flask, HMAC signed URLs, Alexa Skills Kit request/response JSON, AudioPlayer interface
What I built¶
make_tracks.py: makes three short tone tracks I own andlibrary/catalog.json(title and artist).library_server.py: the private library./t/<file>needsexpandsig(HMAC-SHA256 with a key from theLIB_KEYenvironment variable); anything else gets 403.skill.py: the voice-skill handler. Launch, PlayTrackIntent (title or artist search), ShuffleIntent, Stop, and AudioPlayer.PlaybackNearlyFinished for auto-queue.models/en-US.json: my interaction model (invocation name, intents, sample utterances).requests/*.json: mock Alexa requests.tests/e2e.pyruns everything with a throwaway key;docs/e2e-run.txtanddocs/sample-responses.jsonhold the results.
How to run¶
python make_tracks.py
python tests/e2e.py # 12 checks, makes a throwaway signing key
LIB_KEY=... python library_server.py 5190
python skill.py requests/play_title.json
Verification¶
I ran the verification command on 2026-12-03. The full output is in docs/verification.txt.
/workspace/nextwork-portfolio/.venv/bin/python tests/e2e.py | tail -1 | grep -q 'ALEXA MOCK OK' && echo ALEXA OK
What isn't done, and why¶
There's no Echo, Alexa developer account, Cloudflare R2 bucket or AWS Lambda, so the requests are mock JSON sent straight to the handler, not real speech. The signed links use my own HMAC scheme instead of R2 presigned URLs. The guide has Claude Code write the code; here I wrote it.
Original project: https://nextwork.ai/projects/a97c5e17-9ddd-4877-9010-d3139742389a ยท Part of my NextWork Learning portfolio (hub).
Verification output¶
From docs/verification.txt:
$ /workspace/nextwork-portfolio/.venv/bin/python tests/e2e.py | tail -1 | grep -q 'ALEXA MOCK OK' && echo ALEXA OK
ALEXA OK
[exit code 0]