agentleFS
fabioc-alohafabioc-aloha/spotify-skill/.github/copilot-instructions.md

spotify-skill

Copilot instructions17 starsChanged 13 months agoApache-2.0View on GitHub

This project is an example of Claude Desktop Skills - specifically demonstrating how to create production-ready skills that extend Claude's capabilities. The Spotify API Skill serves as a comprehensive reference implementation for building API integration skills. This is a Complete Skill Development Toolkit that includes: Skills are modular, self-contained packages that extend Claude's capabilities by providing: Official Documentation: For up-to-date information on creating custom skills, see:

  • Reads credentials
  • In this repositoryOne other file it gives its agents.

The file

Show its rules and text

We split this copilot-instructions.md into the rules it gives an agent

56 rules. About 0 are common, 44 are distinctive, and 12 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈44

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 12

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Single Source of Truth: - No duplicated information across files

    line 64
  2. Distinctive:

    Document sizes and purposes

    line 135
  3. Distinctive:

    Single Source of Truth: No duplication

    line 157
  4. Distinctive:

    Document constraints (rate limits, auth, environment)

    line 188
  5. Distinctive:

    Guide/ folder is the curriculum: Treat it as authoritative documentation

    line 303
  6. Distinctive:

    Start with clear YAML frontmatter (name, description)

    line 312
  7. Distinctive:

    Keep under 5,000 words (~500 lines)

    line 316
  8. Distinctive:

    Use concise code examples over verbose explanations

    line 317
  9. Distinctive:

    Write long prose when code examples suffice

    line 323
  10. Very specific:

    Update SKILL.md: if APIs change

    line 460
  11. Distinctive:

    Regenerate .skill package: if distributing

    line 461
  12. Very specific:

    Follow the 6-Step Process from SKILL_CREATION_GUIDE.md:

    line 465
  13. Very specific:

    Structure: Create SKILL.md outline

    line 469
  14. Distinctive:

    Implement: Write scripts and references

    line 470
  15. Very specific:

    Use SKILL_CREATION_WORKBOOK.md for step-by-step planning.

    line 474
  16. Very specific:

    Structure: Create folder with SKILL.md

    line 587
  17. Distinctive:

    Implement: Add scripts/references as needed

    line 588
  18. Very specific:

    User-facing changes: Update SKILL.md first

    line 594
  19. Very specific:

    API changes: Update references/api_reference.md

    line 595
  20. Very specific:

    Setup changes: Update references/authentication_guide.md

    line 596
  21. Very specific:

    New features: Add to SKILL.md workflows, update README

    line 597
  22. Distinctive:

    App Registration: Create app at developer.spotify.com/dashboard

    line 605
  23. Distinctive:

    Ensure you're running from correct directory

    line 642
  24. Distinctive:

    Add scripts folder to Python path

    line 643
  25. Distinctive:

    Verify credentials from Spotify dashboard

    line 647
  26. Distinctive:

    Check environment variables are set

    line 648
  27. Very specific:

    Call refresh_access_token() with refresh token

    line 652
  28. Distinctive:

    Use batch operations (up to 100 items)

    line 659
  29. Distinctive:

    Use Spotify skill as concrete API integration example

    line 729
  30. Distinctive:

    Use Spotify as API integration template

    line 742
  31. Distinctive:

    Update both implementation and documentation

    line 751
  32. Distinctive:

    Keep Guide/ and examples/ content in sync

    line 752
  33. Distinctive:

    Lesson: Always verify all required API scopes before implementing features

    line 803
  34. Distinctive:

    Must repackage skill WITHOUT credentials before GitHub release

    line 833
  35. Very specific:

    Best Practice: Document credential setup steps in QUICK_START.md and authentication_guide.md

    line 835
  36. Distinctive:

    When adding major features, integrate as tools within existing skill rather than creating separate skills

    line 892
  37. Distinctive:

    Create execution guides specifically for AI systems

    line 897
  38. Distinctive:

    Document edge cases and error recovery strategies

    line 900
  39. Distinctive:

    Test features with actual use cases (e.g., long playlist titles)

    line 903
  40. Distinctive:

    Document lessons learned in troubleshooting guides

    line 905
  41. Distinctive:

    Always review package contents before distribution

    line 908
  42. Distinctive:

    Never include credentials, tokens, or personal data

    line 909
  43. Distinctive:

    Document credential setup process clearly

    line 910
  44. Very specific:

    Use .gitignore and validation checks

    line 911
  45. Distinctive:

    Keep Spotify API scope list updated as API evolves

    line 996
  46. Distinctive:

    Update LLM guide as Claude's capabilities evolve

    line 998
  47. Distinctive:

    Use it effectively rather than trying to replace it

    line 1102
  48. Distinctive:

    When space is limited, prioritize:

    line 1116
  49. Distinctive:

    Never confuse these boundaries

    line 1126
  50. Distinctive:

    Document explicitly in multiple places

    line 1127
  51. Distinctive:

    Don't try to replace what already works

    line 1179
  52. Distinctive:

    Don't defend the system, redesign it

    line 1184
  53. Distinctive:

    A: Search first (genre/mood) → get audio features → filter in Python (125-130 BPM example)

    line 1193
  54. Distinctive:

    Search query templates for common use cases

    line 1219
  55. Distinctive:

    When working with this project:

    line 1232
  56. Distinctive:

    Recent Focus (October 2025): Search-driven workflow optimization demonstrating the principle of trusting platform intelligence over custom …

    line 1242

≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
copilot-instructions.md

Copilot Instructions - Spotify Skill Project

Project Overview

This project is an example of Claude Desktop Skills - specifically demonstrating how to create production-ready skills that extend Claude's capabilities. The Spotify API Skill serves as a comprehensive reference implementation for building API integration skills.

What This Project Is

  • Primary Purpose: Educational example and template for creating Claude Desktop Skills
  • Secondary Purpose: Production-ready Spotify API integration skill
  • Audience: Developers learning to create custom Claude skills
  • Status: Complete, production-ready, fully documented

Project Type

This is a Complete Skill Development Toolkit that includes:

  1. A complete working skill (Spotify API integration)
  2. Automated development tools (init, validate, package) - NEW!
  3. Official specifications (Agent Skills Spec v1.0) - NEW!
  4. Comprehensive guides for creating any type of skill
  5. Interactive workbooks and templates
  6. Advanced patterns and examples
  7. Best practices and troubleshooting

What Are Claude Desktop Skills?

Definition

Skills are modular, self-contained packages that extend Claude's capabilities by providing:

  • Specialized workflows for specific domains
  • Tool integrations (APIs, file formats, services)
  • Domain expertise and procedural knowledge
  • Bundled resources (scripts, references, assets)

Official Documentation: For up-to-date information on creating custom skills, see:

Skill Architecture

skill-name/
├── SKILL.md                    # Required: Main documentation with YAML frontmatter
├── scripts/                    # Optional: Executable Python/JS code
│   ├── main_script.py
│   └── helper_script.py
├── references/                 # Optional: Reference documentation
│   ├── api_reference.md
│   └── authentication_guide.md
└── assets/                     # Optional: Templates, images, etc.
    └── template.docx

Core Principles of Skill Creation

  1. Concise is Key - Context window is shared; only include what Claude doesn't know
  2. Set Appropriate Degrees of Freedom - Match specificity to task complexity
  3. Progressive Disclosure - Load content as needed (metadata → SKILL.md → resources)
  4. Single Source of Truth - No duplicated information across files

Project Structure

Main Components

Spotify-Skill/
├── README.md                   # Main repository documentation
├── SPOTIFY_SKILL_README.md     # Complete project overview
├── USER_GUIDE.md               # Complete usage guide
├── QUICK_START.md              # 5-minute setup guide
├── agent_skills_spec.md        # Official Agent Skills Spec v1.0
├── spotify-api.skill           # Packaged skill (git ignored)
│
├── .github/                    # Repository assets
│   ├── copilot-instructions.md # AI assistant instructions
│   ├── banner-dark.svg         # Dark theme banner
│   └── banner-light.svg        # Light theme banner
│
├── tools/                      # Skill development utilities
│   ├── init_skill.py           # Create new skills from template
│   ├── validate_skill.py       # Validate skill structure
│   ├── package_skill.py        # Package skills for distribution
│   └── README.md               # Tool documentation
│
├── examples/                   # Curated skill examples
│   ├── README.md               # Pattern comparison and selection guide
│   └── EXAMPLES_REFERENCE.md   # Detailed analysis of 6 example patterns
│
├── spotify-api/                # Skill source files
│   ├── SKILL.md                # Main skill documentation (REQUIRED)
│   ├── .env                    # Spotify credentials (git ignored)
│   ├── scripts/
│   │   ├── spotify_client.py  # Core API wrapper (40+ methods)
│   │   └── playlist_creator.py # High-level playlist utilities
│   └── references/
│       ├── api_reference.md    # Spotify API reference
│       └── authentication_guide.md # OAuth 2.0 setup
│
└── Guide/                      # Skill creation education
    ├── 00_START_HERE.md        # Entry point for learning
    ├── INDEX.md                # Navigation guide
    ├── SKILL_CREATION_GUIDE.md # Complete skill creation guide
    ├── SKILL_CREATION_WORKBOOK.md # Interactive planning templates
    ├── ADVANCED_SKILL_EXAMPLES.md # Patterns and examples
    └── SPOTIFY_CREDENTIALS_SETUP.md # Credential setup guide

Guide Folder Knowledge

The Guide/ folder contains the complete educational curriculum for skill creation:

1. Navigation Documents

00_START_HERE.md - Primary entry point

  • Explains what's in the package
  • Provides learning paths based on goals
  • Recommends reading order
  • Estimated time commitments

INDEX.md - Comprehensive navigation

  • Quick reference table for all documents
  • Goal-based navigation ("I want to...")
  • Learning paths (Beginner → Intermediate → Advanced)
  • Document sizes and purposes

2. Core Educational Content

SKILL_CREATION_GUIDE.md (~15 KB, 1116 lines) - THE MAIN GUIDE

Complete education on skill creation including:

Section 1: What Are Skills?

  • Definition and purpose
  • Types of skills (API, document processing, code generation, etc.)
  • What skills provide vs. what Claude already knows

Section 2: Core Principles (CRITICAL)

  1. Concise is Key - Challenge every sentence, share context window
  2. Set Appropriate Degrees of Freedom:
    • High freedom: Text-based guidance (blog posts, creative work)
    • Medium freedom: Pseudocode with parameters (data processing)
    • Low freedom: Exact scripts (fragile operations)
  3. Context Window Efficiency: Progressive disclosure (metadata → SKILL.md → resources)
  4. Single Source of Truth: No duplication

Section 3: Skill Architecture

  • Directory structure requirements
  • SKILL.md with YAML frontmatter (required)
  • Scripts folder (optional, for reusable code)
  • References folder (optional, for detailed docs)
  • Assets folder (optional, for templates/images)

Section 4: 6-Step Creation Process

  1. Define scope and purpose
  2. Identify required resources
  3. Create SKILL.md structure
  4. Implement scripts/resources
  5. Package the skill
  6. Test and iterate

Section 5-10: Planning, implementation, best practices, real examples, patterns, troubleshooting

3. Interactive Planning

SKILL_CREATION_WORKBOOK.md (~12 KB, 709 lines)

Fill-in-the-blank templates for planning YOUR skill:

Phase 1: Discovery

  • Define the problem and solution
  • Identify use cases (triggers, goals, requirements)
  • Document constraints (rate limits, auth, environment)

Phase 2: Planning

  • Resource inventory (scripts, docs, assets)
  • Feature matrix (scope, complexity, priority)
  • Documentation structure outline
  • Decision trees for common choices

Phase 3-7: Development checklist, validation, packaging, testing

4. Advanced Patterns

ADVANCED_SKILL_EXAMPLES.md (~18 KB, 872 lines)

Five complete skill patterns with code:

  1. API Wrapper Skills (like Spotify)

    • Client class pattern
    • Token management
    • Error handling and retries
    • Rate limiting awareness
  2. Document Processing Skills

    • Template-based generation
    • Asset management
    • Format conversion
  3. Multi-Domain Skills

    • Organizing complex capabilities
    • Cross-referencing sections
    • Navigation strategies
  4. Code Generation Skills

    • Boilerplate and scaffolding
    • Parameter substitution
    • Framework-specific patterns
  5. Learning/Reference Skills

    • Structured educational content
    • Progressive curriculum design
    • Interactive elements

Each example includes:

  • Complete directory structure
  • SKILL.md template
  • Script patterns
  • Best practices
  • Common pitfalls

The Spotify Skill Example

What It Does

A production-ready skill that enables Claude to:

  1. Create intelligent playlists (5 methods):
    • By artist/band name
    • By theme/mood keywords
    • By lyrical content
    • From specific song lists
    • From AI recommendations
  2. Manage playlists (CRUD operations)
  3. Search music (tracks, artists, albums, playlists)
  4. Control playback (play, pause, skip, volume, shuffle)
  5. Access user data (profile, top items, listening history)

Technical Implementation

spotify_client.py (570 lines, 20 KB)

  • 40+ methods covering Spotify Web API
  • OAuth 2.0 authentication with auto-refresh
  • Comprehensive error handling
  • Rate limiting awareness
  • Token lifecycle management

playlist_creator.py (332 lines, 12 KB)

  • High-level intelligent playlist creation
  • Deduplication and batch processing
  • Five creation strategies
  • Analytics and statistics

SKILL.md (240 lines, 7 KB)

  • YAML frontmatter with name and description
  • Quick start examples
  • Four complete workflows
  • References to detailed guides

References/ (31 KB total)

  • authentication_guide.md - Complete OAuth setup (10 KB)
  • api_reference.md - Endpoints and error handling (9 KB)

Key Patterns Demonstrated

  1. Progressive Disclosure: Metadata → Quick start → Deep documentation
  2. Single Source of Truth: API details in reference, not duplicated
  3. Appropriate Freedom: High-level methods (medium freedom) + exact scripts (low freedom)
  4. Context Efficiency: Concise SKILL.md, detailed references on-demand

Key Learnings for AI Assistants

When Working on This Project

  1. This is an educational project: The primary goal is teaching skill creation, not just building a Spotify integration
  2. The Spotify skill is the example: It demonstrates best practices, not an end in itself
  3. Guide/ folder is the curriculum: Treat it as authoritative documentation
  4. Patterns are transferable: The Spotify patterns apply to ANY API integration skill

Skill Creation Best Practices (from Guide)

Writing SKILL.md

✅ DO:

  • Start with clear YAML frontmatter (name, description)
  • Provide immediate quick start code
  • Show 3-5 common workflows with examples
  • Link to detailed references, don't duplicate
  • Keep under 5,000 words (~500 lines)
  • Use concise code examples over verbose explanations

❌ DON'T:

  • Explain what Claude already knows
  • Duplicate information across files
  • Write long prose when code examples suffice
  • Include every edge case in main doc
  • Exceed context window budget

Scripts Strategy

Include scripts when:

  • Code is written repeatedly (boilerplate elimination)
  • Operations are fragile or must be consistent
  • Performance matters (avoid re-generation)
  • Complex multi-step procedures

Keep as instructions when:

  • Multiple valid approaches exist
  • Customization is expected
  • Code is simple/obvious
  • Token cost > benefit

Resource Organization

SKILL.md (Essential)
├─ Quick overview and navigation
├─ Common patterns (3-5 examples)
└─ Links to deeper resources

scripts/ (Reusable code)
├─ Main client/wrapper
└─ Utility functions

references/ (Detailed docs)
├─ API reference (load on-demand)
└─ Setup/configuration guides

assets/ (Templates/images)
└─ Output templates, logos, etc.

Common Skill Types

From ADVANCED_SKILL_EXAMPLES.md:

  1. API Wrapper Skills (Spotify example) - External service integration
  2. Document Processing - DOCX, PDF, XLSX manipulation
  3. Code Generation - Framework boilerplate and scaffolding
  4. Business Logic - Company processes and workflows
  5. Data Analysis - Database schemas and query templates
  6. Specialized Tools - Domain-specific utilities
  7. Brand Guidelines - Templates and style standards
  8. Learning Materials - Educational content and tutorials

Development Tools (NEW!)

The project includes automated utilities from the Anthropic Skills repository for skill development:

Available Tools

  1. tools/init_skill.py - Skill Initializer

    • Creates new skill directories with proper structure
    • Generates SKILL.md with YAML frontmatter template
    • Creates example scripts/, references/, assets/ directories
    • Provides TODO markers and guidance comments
    • Usage: python tools/init_skill.py <skill-name> --path <output-path>
  2. tools/validate_skill.py - Skill Validator

    • Validates SKILL.md format and content
    • Checks YAML frontmatter (name, description required)
    • Verifies naming conventions (hyphen-case)
    • Ensures skill name matches directory name
    • Detects incomplete TODO placeholders
    • Usage: python tools/validate_skill.py <skill-directory>
  3. tools/package_skill.py - Skill Packager

    • Creates distributable .zip packages
    • Automatically validates before packaging
    • Excludes system files and cache directories
    • Maintains proper directory structure
    • Usage: python tools/package_skill.py <skill-directory> [output-dir]

Tool Usage Workflow

# 1. Create a new skill
python tools/init_skill.py my-new-skill --path ./

# 2. Edit the generated SKILL.md and add your code
# (Replace TODOs, add scripts, references, assets)

# 3. Validate before distribution
python tools/validate_skill.py ./my-new-skill

# 4. Package for sharing
python tools/package_skill.py ./my-new-skill ./dist

Integration Details

  • Source: Anthropic Claude Skills repository (skill-creator skill)
  • License: Apache 2.0
  • Documentation: See tools/README.md for complete guide
  • Integration Summary: See INTEGRATION_SUMMARY.md for full details
  • Official Spec: See agent_skills_spec.md for format requirements

Development Workflow

Using the Development Tools

Create New Skills:

python tools/init_skill.py my-api-skill --path ./
# Edit generated files, then validate and package

Validate Existing Skills:

python tools/validate_skill.py ./spotify-api

Package for Distribution:

python tools/package_skill.py ./spotify-api ./dist

For Modifying the Spotify Skill

  1. Edit source files in spotify-api/ folder
  2. Test scripts directly with Python
  3. Update SKILL.md if APIs change
  4. Regenerate .skill package if distributing

For Creating New Skills

Follow the 6-Step Process from SKILL_CREATION_GUIDE.md:

  1. Define: Scope, purpose, use cases
  2. Identify: Required resources (scripts, docs, assets)
  3. Structure: Create SKILL.md outline
  4. Implement: Write scripts and references
  5. Package: Bundle into .skill file
  6. Test: Validate with real use cases

Use SKILL_CREATION_WORKBOOK.md for step-by-step planning.

For Helping Users Learn

Beginner Path (2-3 hours):

  1. Read SKILL_CREATION_GUIDE.md sections 1-3
  2. Review SPOTIFY_SKILL_README.md
  3. Skim ADVANCED_SKILL_EXAMPLES.md (Example 1)

Intermediate Path (4-6 hours):

  1. Complete full SKILL_CREATION_GUIDE.md
  2. Study ADVANCED_SKILL_EXAMPLES.md patterns
  3. Work through SKILL_CREATION_WORKBOOK.md

Advanced Path (2-3 hours):

  1. Deep dive into specific patterns
  2. Study error handling strategies
  3. Implement complex multi-domain skills

Technology Stack

Spotify Skill Implementation

  • Language: Python 3.x
  • API: Spotify Web API (REST)
  • Authentication: OAuth 2.0 Authorization Code Flow
  • Dependencies: requests (HTTP), base64, json
  • Key Libraries: None (pure Python + requests)

Skill Format

  • Package Format: ZIP archive with .skill extension
  • Required File: SKILL.md with YAML frontmatter
  • Optional Folders: scripts/, references/, assets/
  • Encoding: UTF-8 text files

File Relationships

Documentation Hierarchy

Entry Points:
├─ README.md ──→ "Repository landing page"
├─ SPOTIFY_SKILL_README.md ──→ "Complete project overview"
├─ USER_GUIDE.md ──→ "Complete usage guide"
├─ QUICK_START.md ──→ "5-minute setup"
├─ Guide/00_START_HERE.md ──→ "New to skills? Start here"
└─ Guide/INDEX.md ──→ "Need navigation? Go here"

Main Educational Content:
├─ Guide/SKILL_CREATION_GUIDE.md ──→ Complete textbook
├─ Guide/SKILL_CREATION_WORKBOOK.md ──→ Interactive planning
└─ Guide/ADVANCED_SKILL_EXAMPLES.md ──→ Pattern library

Example Skills:
├─ examples/README.md ──→ Pattern comparison and selection
└─ examples/EXAMPLES_REFERENCE.md ──→ Detailed analysis of 6 patterns

Spotify Skill Documentation:
├─ spotify-api/SKILL.md ──→ Main skill doc (loaded by Claude)
├─ spotify-api/references/authentication_guide.md ──→ OAuth setup
└─ spotify-api/references/api_reference.md ──→ API details

Code Relationships

spotify_client.py (Base client)
├─ Handles authentication
├─ Provides 40+ API methods
├─ Token management
└─ Error handling

playlist_creator.py (High-level utilities)
├─ Uses spotify_client.py
├─ Implements 5 creation strategies
└─ Adds convenience features

SKILL.md (Orchestration)
├─ References both scripts
├─ Shows usage patterns
└─ Links to detailed guides

Common Tasks

Testing the Spotify Skill Locally

# Set environment variables
$env:SPOTIFY_CLIENT_ID = "your_client_id"
$env:SPOTIFY_CLIENT_SECRET = "your_client_secret"
$env:SPOTIFY_REDIRECT_URI = "http://localhost:8888/callback"

# Run OAuth flow (one-time setup)
python spotify-api/scripts/spotify_client.py

# Test playlist creation
python -c "from playlist_creator import PlaylistCreator; from spotify_client import SpotifyClient; ..."

Creating a New Skill (Quick Reference)

  1. Plan: Fill out SKILL_CREATION_WORKBOOK.md Phase 1-2
  2. Structure: Create folder with SKILL.md
  3. Implement: Add scripts/references as needed
  4. Test: Validate use cases
  5. Package: ZIP with .skill extension

Updating Documentation

  • User-facing changes: Update SKILL.md first
  • API changes: Update references/api_reference.md
  • Setup changes: Update references/authentication_guide.md
  • New features: Add to SKILL.md workflows, update README

Authentication & Security Notes

Spotify OAuth 2.0 Flow

  1. App Registration: Create app at developer.spotify.com/dashboard
  2. Authorization: User visits authorization URL, grants permissions
  3. Token Exchange: Exchange auth code for access + refresh tokens
  4. Token Refresh: Access tokens expire in 1 hour, refresh automatically
  5. Storage: Store refresh token securely (environment variables recommended)

Required Scopes

playlist-modify-public     # Create/edit public playlists
playlist-modify-private    # Create/edit private playlists
user-library-read          # Access saved tracks
user-library-modify        # Save/remove tracks
user-read-private          # Read user profile
user-read-email            # Read user email
user-top-read              # Read top artists/tracks
user-read-currently-playing # Read current playback
user-modify-playback-state # Control playback
user-read-playback-state   # Read playback state

Security Best Practices

  • ✅ Store credentials in environment variables
  • ✅ Use HTTPS redirect URIs in production
  • ✅ Never commit tokens to version control
  • ✅ Implement token refresh before expiry
  • ✅ Handle authorization errors gracefully

Troubleshooting

Common Issues

"No module named 'spotify_client'"

  • Ensure you're running from correct directory
  • Add scripts folder to Python path

"Invalid client_id/client_secret"

  • Verify credentials from Spotify dashboard
  • Check environment variables are set

"Token expired"

  • Call refresh_access_token() with refresh token
  • Implement automatic refresh in long-running processes

"Rate limit exceeded"

  • Implement exponential backoff
  • Reduce request frequency
  • Use batch operations (up to 100 items)

Learning Path Issues

"Don't know where to start" → Read Guide/00_START_HERE.md, follow your goal's path

"Overwhelmed by content" → Start with SKILL_CREATION_GUIDE.md sections 1-3 only

"Need a specific pattern" → Search ADVANCED_SKILL_EXAMPLES.md for your skill type


Additional Context

Official Documentation

For the most current and official guidance on creating Claude Desktop Skills, always refer to:

This project's Guide folder provides in-depth educational content that complements the official documentation with detailed patterns, examples, and best practices.

Project History

This project serves as:

  1. Reference implementation of skill creation best practices
  2. Educational resource for developers learning skill creation
  3. Production example showing real-world complexity
  4. Template for API integration skills

Design Decisions

Why Spotify?

  • Popular, well-documented API
  • Complex enough to demonstrate real patterns
  • Simple enough to remain understandable
  • Multiple interaction styles (search, CRUD, playback)

Why This Structure?

  • Separates learning (Guide/) from implementation (spotify-api/)
  • Demonstrates progressive disclosure
  • Shows single source of truth
  • Balances completeness with conciseness

Why Include Full Guides?

  • Makes project self-contained
  • Provides context for design decisions
  • Enables learning without external resources
  • Documents the "why" behind patterns

When Assisting Users

If They Want to Learn Skill Creation:

  1. Direct them to the official Claude documentation for current specifications
  2. Point them to the official skills examples repository for more examples
  3. Direct them to examples/ for curated example patterns
  4. Guide them to Guide/00_START_HERE.md for in-depth learning
  5. Recommend the appropriate learning path based on experience
  6. Reference specific sections from SKILL_CREATION_GUIDE.md
  7. Use Spotify skill as concrete API integration example

If They Want to Use the Spotify Skill:

  1. Direct them to QUICK_START.md
  2. Help with OAuth setup from authentication_guide.md
  3. Show examples from SKILL.md
  4. Reference API details from api_reference.md

If They Want to Create Similar Skills:

  1. Help them choose a pattern from examples/README.md
  2. Study detailed analysis in examples/EXAMPLES_REFERENCE.md
  3. Use Spotify as API integration template
  4. Apply patterns from ADVANCED_SKILL_EXAMPLES.md
  5. Work through SKILL_CREATION_WORKBOOK.md
  6. Reference core principles from SKILL_CREATION_GUIDE.md

If They Want to Modify This Project:

  1. Understand the educational purpose
  2. Maintain the skill creation patterns
  3. Update both implementation and documentation
  4. Keep Guide/ and examples/ content in sync

Recent Development History & Lessons Learned

Version 0.9.0 Development Journey

This section documents key learnings from the v0.9.0 development cycle, including feature development, packaging considerations, and release preparation.

Cover Art Generation Feature (Major Addition)

Development Context:

  • Added comprehensive cover art generation capability to the Spotify skill
  • Integrated as a tool within the main skill (not a separate skill)
  • Required new dependencies: cairosvg and Pillow

Key Technical Learnings:

  1. Text Wrapping for Long Titles
    • Challenge: Long playlist titles (e.g., "My Ultimate Workout Power Hour") were being cut off or squished
    • Solution: Implemented automatic text wrapping at word boundaries with max 20 characters per line
    • Implementation:
      def wrap_text(text, max_chars=20):
          words = text.split()
          lines = []
          current_line = []
          current_length = 0
          
          for word in words:
              if current_length + len(word) + len(current_line) > max_chars:
                  if current_line:
                      lines.append(' '.join(current_line))
                      current_line = [word]
                      current_length = len(word)
              else:
                  current_line.append(word)
                  current_length += len(word)
          
          if current_line:
              lines.append(' '.join(current_line))
          return lines
    • Typography Specs: Font sizes 60-96px, line height 110%, text width 80% of canvas
  2. Missing Spotify Scope Discovery
    • Issue: 401 Unauthorized errors when uploading cover art
    • Root Cause: Missing ugc-image-upload scope in OAuth token
    • Fix Required: Users must re-run get_refresh_token.py to get new token with proper scopes
    • Documentation Updated: authentication_guide.md, COVER_ART_LLM_GUIDE.md, and COVER_ART_TROUBLESHOOTING.md
    • Lesson: Always verify all required API scopes before implementing features
  3. Comprehensive LLM Execution Guide
    • Purpose: Enable Claude to generate cover art despite not having native image generation capabilities
    • Created: COVER_ART_LLM_GUIDE.md (835 lines)
    • Key Sections:
      • Step-by-step execution process
      • Handling vague user requests
      • 20+ themes, 15+ genres, 10+ artist moods
      • Edge case handling (long titles, special characters)
      • Accessibility considerations (WCAG 2.1 AA compliance)
      • Quality assurance checklists
    • Lesson: Detailed execution guides are critical for complex multi-step AI operations
  4. Design Specifications Evolution
    • Initial: Basic text rendering
    • Enhanced: Larger typography (60-96px), 80% width text, proper spacing
    • Final: Multi-line text wrapping, dynamic font scaling, theme variety
    • Lesson: Iterative design improvements based on real-world testing

Repository Health & Best Practices

Packaging & Distribution Considerations:

  1. Credentials in Package Files
    • Critical Issue: .env file with user credentials accidentally included in spotify-api.skill package
    • Security Risk: Personal OAuth tokens and client secrets would be distributed publicly
    • Solution:
      • .env files already in .gitignore (lines 2-4)
      • .skill packages already in .gitignore (line 64)
      • Must repackage skill WITHOUT credentials before GitHub release
    • Lesson: NEVER include credentials in packaged distributions
    • Best Practice: Document credential setup steps in QUICK_START.md and authentication_guide.md
  2. Repository Visibility & Health
    • Initial State: Repository was private, missing key community files
    • Actions Taken:
      • Made repository public via gh repo edit
      • Added Apache 2.0 LICENSE
      • Created CONTRIBUTING.md with guidelines
      • Added issue templates (bug_report.yml, feature_request.yml)
      • Enabled GitHub Discussions
      • Added 12 relevant topics/tags
    • Result: Professional, discoverable, community-ready repository
    • Lesson: Repository health matters for open source adoption
  3. Professional Branding
    • Challenge: Project needed a clear, professional name
    • Analysis: Considered "Spotify Claude Skill", "Claude Spotify Integration", etc.
    • Decision: "Spotify Skills for Claude"
      • Clear it's for Claude Desktop
      • "Skills" plural reflects both the Spotify skill AND the toolkit
      • Professional and searchable
      • Works well in all contexts
    • Updated: SVG banners, all documentation, repository description
    • Lesson: Project naming impacts discoverability and perception

Release Preparation Best Practices

v0.9.0 Release Checklist:

  1. Version Documentation
    • ✅ Added version: 0.9.0 to SKILL.md YAML frontmatter
    • ✅ Created CHANGELOG.md following Keep a Changelog format
    • ✅ Created comprehensive RELEASE_NOTES.md (1,500+ lines)
    • ✅ Updated all badges in README with v0.9.0
    • ✅ Added release links to documentation
  2. Documentation Consistency
    • ✅ Unified project name across all files
    • ✅ Fixed broken emojis (� → 🎨, 🎵)
    • ✅ Updated feature lists with cover art capabilities
    • ✅ Cross-referenced new documentation files
  3. Package Validation
    • ✅ Ran python tools/validate_skill.py ./spotify-api
    • ✅ All validation checks passed
    • ⚠️ Must repackage WITHOUT .env before release
    • ✅ Package size: ~50KB (without credentials)
  4. Git Hygiene
    • ✅ All changes committed with descriptive messages
    • ✅ Clean working directory
    • ✅ All commits pushed to GitHub
    • ✅ Ready for tag creation: git tag -a v0.9.0 -m "Release v0.9.0"

Key Development Patterns Discovered

1. Feature Integration Strategy

  • When adding major features, integrate as tools within existing skill rather than creating separate skills
  • Maintain single cohesive package for related functionality
  • Example: Cover art generation integrated into spotify-api skill, not separate spotify-cover-art skill

2. LLM-Friendly Documentation

  • Create execution guides specifically for AI systems
  • Include step-by-step processes, not just reference information
  • Provide concrete examples for vague user requests
  • Document edge cases and error recovery strategies

3. Iterative Design with Real Testing

  • Test features with actual use cases (e.g., long playlist titles)
  • Iterate based on real-world failures
  • Document lessons learned in troubleshooting guides

4. Security-First Packaging

  • Always review package contents before distribution
  • Never include credentials, tokens, or personal data
  • Document credential setup process clearly
  • Use .gitignore and validation checks

5. Professional Open Source Standards

  • LICENSE file (Apache 2.0 for compatibility)
  • CONTRIBUTING.md with clear guidelines
  • Issue templates for consistent reporting
  • CHANGELOG.md for version history
  • Comprehensive README with badges
  • GitHub Discussions for community

Common Pitfalls to Avoid

  1. Including Credentials in Packages
    • ❌ Don't package .env files with OAuth tokens
    • ❌ Don't commit credentials to git
    • ✅ Document setup process instead
    • ✅ Use environment variables
  2. Incomplete OAuth Scopes
    • ❌ Don't assume basic scopes are sufficient
    • ✅ Test all features to identify required scopes
    • ✅ Document all scopes in authentication guide
    • ✅ Provide clear error messages for missing scopes
  3. Text Rendering Without Wrapping
    • ❌ Don't assume titles will fit on one line
    • ✅ Implement automatic text wrapping
    • ✅ Test with real-world long titles
    • ✅ Use word boundary breaks, not character breaks
  4. Publishing Without Health Checks
    • ❌ Don't release without LICENSE
    • ❌ Don't skip validation checks
    • ✅ Run repository health assessment (gh repo view)
    • ✅ Add all necessary community files
  5. Inconsistent Documentation
    • ❌ Don't update one file and forget others
    • ✅ Search for all occurrences when changing names
    • ✅ Update banners, badges, and metadata
    • ✅ Cross-reference new features across docs

Files Created/Modified in v0.9.0

New Core Files:

  • spotify-api/scripts/cover_art_generator.py (565 lines) - SVG generation with text wrapping
  • spotify-api/references/COVER_ART_LLM_GUIDE.md (835 lines) - AI execution guide
  • spotify-api/COVER_ART_TROUBLESHOOTING.md - 401 error solutions
  • spotify-api/requirements.txt - Added cairosvg, pillow dependencies

New Repository Health Files:

  • LICENSE - Apache 2.0 full text
  • CONTRIBUTING.md - Contribution guidelines
  • CHANGELOG.md - Version history
  • RELEASE_NOTES.md - Comprehensive v0.9.0 documentation
  • .github/ISSUE_TEMPLATE/bug_report.yml - Bug reporting template
  • .github/ISSUE_TEMPLATE/feature_request.yml - Feature request template
  • .github/ISSUE_TEMPLATE/config.yml - Issue template configuration

Updated Files:

  • README.md - Rebranded, v0.9.0 badges, cover art features
  • USER_GUIDE.md - Cover art generation section
  • GETTING_STARTED.md - Updated branding and examples
  • spotify-api/SKILL.md - Version 0.9.0, fixed emojis, cover art workflows
  • spotify-api/references/authentication_guide.md - Added ugc-image-upload scope
  • .github/banner-dark.svg - Updated project name
  • .github/banner-light.svg - Updated project name
  • get_refresh_token.py - Added ugc-image-upload scope

Package Status:

  • spotify-api.skill - 51.5KB with credentials (DO NOT DISTRIBUTE)
  • Need to repackage without .env before GitHub release
  • Target size: ~50KB without credentials

Technical Debt & Future Considerations

For v1.0.0:

  1. Automated credential validation tool
  2. Cover art template library expansion
  3. Batch playlist operations
  4. Performance optimizations for large libraries
  5. Additional example skills in different domains
  6. Video tutorial for skill creation

Maintenance Notes:

  • Keep Spotify API scope list updated as API evolves
  • Monitor Python dependency versions (cairosvg, Pillow)
  • Update LLM guide as Claude's capabilities evolve
  • Track community feedback via GitHub Discussions

Post-v0.9.0: Search-Driven Optimization (October 2025)

This section documents the transformation from complex manual curation to search-driven workflows, along with comprehensive search feature documentation.

Core Transformation: From Manual to Search-Driven

User Pain Point: "The workflow still is painful with too many interactions"

Response: Complete paradigm shift in playlist creation philosophy.

Before (Complex Manual Curation):

  • Two-mode system (Search-Based vs Curated)
  • Track-by-track selection with reasoning
  • Emotional narrative journey planning
  • 20+ API calls per playlist
  • 2-3 minutes per playlist
  • Philosophy: "Be smart about music curation"

After (Search-Driven Approach):

  • Single search-driven workflow
  • 3-5 focused searches → combine results → batch add
  • Trust Spotify's algorithm (billions of data points)
  • 5-7 API calls per playlist
  • 10-15 seconds per playlist
  • Philosophy: "Trust Spotify's search - it's better than you think"

Impact:

  • 4x fewer interactions (20+ → 5-7 API calls)
  • 12x faster execution (2-3 minutes → 10-15 seconds)
  • Equal or better quality (leverages Spotify's proven algorithm)

Key Insight:

"Sometimes the most sophisticated solution is to trust the platform's intelligence rather than over-engineer our own."

Search Feature Documentation Completeness

Discovery: Documentation drift had removed important capabilities. Only 4 operators documented when 8+ were available.

Comprehensive Documentation Added:

Field Filters (8 total):

  • artist:name - Specific artist
  • album:name - Specific album
  • track:name - Specific track title
  • genre:genre - Genre filter
  • year:YYYY or year:YYYY-YYYY - Release year/range
  • tag:new - Recent releases
  • tag:hipster - Less mainstream tracks
  • isrc:code, upc:code - Catalog codes

Operators (3 types):

  • -term or NOT term - Exclude results
  • term1 OR term2 - Either term
  • term1 term2 - Both terms (AND implicit)

Audio Features (11 available):

  • tempo - BPM (50-200)
  • energy - 0.0-1.0 (calm to energetic)
  • danceability - 0.0-1.0
  • valence - 0.0-1.0 (sad to happy)
  • acousticness - 0.0-1.0
  • instrumentalness - 0.0-1.0
  • speechiness - 0.0-1.0
  • liveness - 0.0-1.0
  • loudness - dB (-60 to 0)
  • key - 0-11 (musical key)
  • mode - 0 (minor) or 1 (major)

The Two-Step Tempo/BPM Filtering Pattern

Discovery: Spotify doesn't support direct BPM filtering in search queries.

Solution Pattern:

Step 1: Search (broad net)
- Use genre/mood keywords
- Example: "running electronic energy" (limit=20)

Step 2: Filter (precise net)  
- Get audio features for results (getMultipleAudioFeatures, max 100)
- Filter in Python by tempo, energy, danceability, etc.
- Example: 125 <= tempo <= 130 and energy > 0.7

Why It Works:

  • Search: Excellent semantic matching and relevance
  • Audio Features: Precise numerical data
  • Python: Complex filtering logic
  • Combined power > either alone

Real-World Examples:

  • Running playlist: "running electronic" → filter 125-130 BPM + high energy
  • Happy upbeat: "dance party" → filter 140 BPM + high valence
  • Chill focus: "ambient study" → filter 90-100 BPM + high instrumentalness

Key Learnings from Optimization Session

1. Trust Platform Intelligence

  • Spotify's search represents years of refinement and billions of user interactions
  • Use it effectively rather than trying to replace it
  • Multiple focused searches provide natural variety

2. Documentation Drift Prevention

  • Regular audits of documentation against actual API capabilities
  • As we optimize/condense, capabilities can be accidentally removed
  • Validate completeness periodically

3. Concrete Examples Beat Abstract Capabilities

  • "125-130 BPM running playlist" > "you can filter by tempo"
  • Specific numbers and real use cases stick in memory
  • Provide actionable examples with expected results

4. Character Budget Management

  • When space is limited, prioritize:
    1. Examples over explanations
    2. "How" over "why"
    3. Action over description
    4. Specifics over generalities
  • Result: 6857/8000 chars in INSTRUCTIONS.md (14% headroom)

5. Clear API + Code Interpreter Separation

  • GPT makes API calls (has OAuth tokens)
  • Python processes results (complex logic, no auth)
  • Never confuse these boundaries
  • Document explicitly in multiple places

6. Progressive Disclosure Architecture

  • INSTRUCTIONS.md: Quick reference (6857 chars)
  • PLAYLIST_CURATION_STRATEGIES.md: Detailed workflows
  • CODE_INTERPRETER_REFERENCE.md: Complete code samples
  • Each level serves different needs without overwhelming

Files Modified in Optimization Session

Updated Files (3 total):

  • CustomGPT/spotify-playlist-action.json - Added comprehensive search operator documentation to OpenAPI spec
  • CustomGPT/INSTRUCTIONS.md - Expanded Discovery Methods, added tempo filtering workflow (6857 chars)
  • CustomGPT/PLAYLIST_CURATION_STRATEGIES.md - Added "Advanced Search Filters" and "Tempo/BPM Filtering" sections with examples

New Documentation:

  • SESSION_LEARNINGS.md - Comprehensive reflection on search-driven transformation (246 lines)

Commit History Pattern:

Optimize → Fix → Clarify → Simplify → Educate → Transform → Complete

8 Commits Total:

  1. 5a9b052 - Optimize INSTRUCTIONS.md (7940→4139 chars)
  2. 2b9f71f - Add re-authorization commands
  3. 7aaa8fd - Document audio features 403 errors
  4. 50d6c26 - Remove cover art upload API (simplify)
  5. fa3f17c - Clarify Python/API separation
  6. 653adf2 - Fix OpenAPI description lengths
  7. 9a542fb - Refine curation to search-driven (major shift)
  8. cf8f350 - Add comprehensive search filters
  9. 896a282 - Add SESSION_LEARNINGS.md

Design Patterns Validated

1. Search-First Workflow

1. Create playlist (save playlist_id)
2. Make 3-5 focused searches with operators
   - "workout genre:electronic year:2020s -remix"
   - "gym motivation pop"
   - "running upbeat 2020s"
3. Optional: Get audio features → filter by tempo/energy
4. Combine results, deduplicate
5. Batch add (max 100 per request)
6. Done in 10-15 seconds

2. API Integration Essence

  • Know what the platform does well (search, recommendations)
  • Know what you do well (combining results, filtering, user context)
  • Don't try to replace what already works
  • Focus on the gaps and the glue

3. User Pain Points as Gold

  • "Too many interactions" → Complete workflow redesign
  • Don't defend the system, redesign it
  • User complaints show where friction exists

Memory Anchors for AI Assistants

Q: How should playlists be created? A: Make 3-5 focused searches with smart operators → combine results → batch add → done in seconds

Q: How to filter by tempo/BPM? A: Search first (genre/mood) → get audio features → filter in Python (125-130 BPM example)

Q: What can Spotify search do? A: 8 field filters + 3 operators + 11 audio features, all documented with examples

Q: Why search-driven vs manual curation? A: Spotify's algorithm has billions of data points. Trust it. Use it well. 4x fewer interactions, 12x faster.

Anti-Patterns Avoided

❌ Building complex manual curation when excellent search already exists
❌ Trying to outsmart Spotify's billion-data-point algorithm
❌ Documentation without examples (abstract capabilities don't stick)
❌ Assuming completeness without API audits (documentation drift)
❌ Mixing API and processing concerns (GPT auth vs Python logic)

Future Monitoring

Watch For:

  1. New Spotify search operators or audio features
  2. User feedback on search quality vs manual curation
  3. Edge cases where search-driven approach struggles
  4. Character budget in INSTRUCTIONS.md (currently 14% headroom)
  5. Documentation drift (schedule regular API audits)

Potential Enhancements:

  1. Search query templates for common use cases
  2. Audio feature presets (high energy = energy > 0.7, danceability > 0.6)
  3. Smart search combinations (automatic keyword variation)
  4. Performance metrics tracking (actual interaction counts)

Summary for AI Assistants

This project is a teaching tool first, Spotify integration second.

The Spotify API Skill is the flagship example demonstrating how to create professional Claude Desktop Skills. The Guide/ folder contains a complete curriculum teaching skill creation principles, patterns, and best practices.

When working with this project:

  • Respect the educational purpose - changes should maintain instructional value
  • Follow the documented patterns - they're intentional teaching examples
  • Reference the guides - they contain the "why" behind decisions
  • Maintain consistency - between implementation and documentation
  • Think transferability - patterns should work for other skill types

The goal is helping developers create their own high-quality skills using this as a reference.

Recent Focus (October 2025): Search-driven workflow optimization demonstrating the principle of trusting platform intelligence over custom complexity.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.