Home
cd ../playbooks
Media ProductionAdvanced

Spotify Integration & Analytics

Automate Spotify music playback, playlist management, and audio analysis workflows

10 minutes
By communitySource
#spotify#music#playlist#audio#entertainment

Managing Spotify playlists, analyzing listening trends, and integrating music data into your workflows requires repetitive API calls and manual curation. This playbook automates Spotify playback control, playlist management, audio feature analysis, and listening analytics.

Who it's for: music curators automating playlist creation and management based on audio features, podcast producers integrating Spotify analytics into their production workflow, music data analysts studying listening patterns and audio feature trends, content creators building mood-based or activity-based playlist generators, developers integrating Spotify data into music recommendation or fitness applications

Example

"Create an automated workout playlist based on BPM and energy levels" → Spotify pipeline: Spotify API authentication and library scanning, audio feature analysis (tempo, energy, danceability) across saved tracks, automated playlist creation filtering by BPM range and energy threshold, track ordering for warm-up to peak intensity progression, and listening analytics dashboard showing playlist performance

CLAUDE.md Template

New here? 3-minute setup guide → | Already set up? Copy the template below.

# Spotify Automation

Automate Spotify music playback, playlist management, and discovery workflows.

## Core Capabilities

### Playback Control
```yaml
playback_commands:
  - play_track: "spotify:track:xxx"
  - pause
  - next_track
  - previous_track
  - set_volume: 75
  - set_shuffle: true
  - set_repeat: "context"  # track, context, off
  - seek_position: 30000  # milliseconds
  - transfer_playback:
      device_id: "device_xxx"
```

### Playlist Management
```yaml
playlist_operations:
  create:
    name: "{{playlist_name}}"
    description: "{{description}}"
    public: false
    collaborative: false
    
  add_tracks:
    playlist_id: "xxx"
    tracks:
      - "spotify:track:xxx"
      - "spotify:track:yyy"
    position: 0  # optional
    
  smart_playlist:
    name: "Workout Mix"
    criteria:
      energy: "> 0.8"
      tempo: "> 120"
      genres: ["electronic", "pop"]
    limit: 50
    refresh: weekly
```

### Music Discovery
```yaml
recommendations:
  seed_tracks: ["track_id_1", "track_id_2"]
  seed_artists: ["artist_id"]
  seed_genres: ["pop", "rock"]
  
  target_features:
    energy: 0.8
    danceability: 0.7
    valence: 0.6  # positiveness
    
  limit: 20
```

### Audio Analysis
```yaml
audio_features:
  - acousticness: 0.0-1.0
  - danceability: 0.0-1.0
  - energy: 0.0-1.0
  - instrumentalness: 0.0-1.0
  - liveness: 0.0-1.0
  - loudness: -60 to 0 dB
  - speechiness: 0.0-1.0
  - tempo: BPM
  - valence: 0.0-1.0 (mood)
  - key: 0-11 (C to B)
  - mode: 0 (minor) or 1 (major)
```

## Workflow Examples

### Daily Mix Generator
```yaml
workflow:
  trigger: daily at 6:00 AM
  steps:
    - get_recently_played: 50
    - analyze_mood: based_on_audio_features
    - get_recommendations: 
        based_on: recent_tracks
        mood: current_time_appropriate
    - create_playlist: "Today's Mix - {{date}}"
    - add_tracks: recommended
```

### Party Mode
```yaml
party_playlist:
  trigger: "party mode"
  actions:
    - get_top_tracks:
        time_range: medium_term
        limit: 20
    - get_recommendations:
        seed: top_tracks
        energy: "> 0.8"
        danceability: "> 0.7"
    - shuffle_and_play
    - set_crossfade: 5  # seconds
```

## API Examples

```javascript
// Search and Play
const results = await spotify.search("Bohemian Rhapsody", ["track"]);
await spotify.play({ uris: [results.tracks.items[0].uri] });

// Create Smart Playlist
const recs = await spotify.getRecommendations({
  seed_genres: ["chill"],
  target_energy: 0.4,
  limit: 30
});
const playlist = await spotify.createPlaylist("Chill Vibes", {
  description: "AI-curated relaxation",
  public: false
});
await spotify.addTracksToPlaylist(playlist.id, recs.tracks.map(t => t.uri));
```

## Best Practices

1. **Rate Limits**: Respect Spotify API limits
2. **Caching**: Cache frequently accessed data
3. **User Consent**: Request appropriate scopes
4. **Fallbacks**: Handle unavailable tracks gracefully
README.md

What This Does

Automate Spotify music playback, playlist management, and discovery workflows.


Quick Start

Step 1: Create a Project Folder

mkdir -p ~/Documents/SpotifyAutomation

Step 2: Download the Template

Click Download above, then:

mv ~/Downloads/CLAUDE.md ~/Documents/SpotifyAutomation/

Step 3: Start Working

cd ~/Documents/SpotifyAutomation
claude

Best Practices

  1. Rate Limits: Respect Spotify API limits
  2. Caching: Cache frequently accessed data
  3. User Consent: Request appropriate scopes
  4. Fallbacks: Handle unavailable tracks gracefully

$Related Playbooks

Media Production

Social Media Clip Creator

Repurpose long-form video and audio into short-form clips with optimized captions, hooks, and hashtags for TikTok, Reels, and Shorts.

10 minutes
Beginner
Media Production

TikTok Short Creator

Turn long screen recordings or demo videos into punchy 60-second TikTok edits with AI-powered scene analysis, voiceover scripts, and automated ffmpeg cuts.

10 minutes
Intermediate
Media Production

Transcript Fixer

Correct speech-to-text errors with dictionary rules and AI analysis — fixing homophones, garbled technical terms, and mixed Chinese/English — while building a personalized correction database that learns from each fix.

10 minutes
Intermediate
Media Production

Video Comparer

Compare two videos to analyze compression results or quality differences — generate an interactive HTML report with PSNR/SSIM metrics and frame-by-frame visual comparisons.

10 minutes
Intermediate
Media Production

Audio Transcription Automation

Automate audio/video transcription, meeting notes, subtitle generation, and content processing

10 minutes
Advanced
Media Production

YouTube Channel Automation

Automate YouTube content workflows including video management, analytics, scheduling, and channel optimization

10 minutes
Advanced
Media Production

ASR Transcribe to Text

Transcribe audio and video to text with Qwen3-ASR — local MLX inference on Apple Silicon (no API key, 15–27x realtime) or a remote API endpoint, auto-detecting the best path.

10 minutes
Intermediate
Media Production

Claude Video: Let Claude Watch Any Video

Turns a video URL or local file into frames plus a timestamped transcript, so Claude answers from what it saw and heard instead of the title

10 minutes
Intermediate
Media Production

Panel Moderator Guide

Generate a complete moderator guide - sharp questions, minute-by-minute agenda, follow-ups, and audience prompts for any panel.

5 minutes
Intermediate
Media Production

Podcast Creator System

Full podcast production workflow from episode ideation and guest research to show notes, SEO optimization, and promotional content.

10 minutes
Intermediate
Media Production

Podcast Production Assistant

Automate podcast production workflows including recording, editing, publishing, and distribution

10 minutes
Advanced

Browse all Media Production playbooks →