modscode JA

modscode / Gallery / spotify

spotify

Spotify inside Claude Code: player pane with album art and a visualizer, synced lyrics, a Claude DJ that learns your taste, a chime when Claude finishes or needs you, a focus timer, your library, a session recap, and a settings page.

Code you can checkTerminal + desktopPaneBandStatus lineToastBoxButtonInputText

What it does

  • Draws a band above the prompt, a pane, the status line, toasts
  • Adds /spotify
  • Watches tool calls and can refuse them
  • Hooks classic.Notification, prompt.submit, session.start, turn.complete and 2 more
  • Keeps its own state between turns

Good points

  • Written in TypeScript
  • Has a desktop-specific branch
  • Handles errors
  • Writes no files

Code to start from

Two kinds: a starter modscode writes from the design above, and the lines of the mod's own code that draw it.

Starter (register.tsx)

register.tsx
import type { Register } from 'claude-code'

// Drawn like spotify by jewdev (pane, band, status, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/jewdev-spotify/
// Written by modscode from that reading, not copied from the mod: use it as you like.
// Each value below stands for one the mod works out at run time; put in your own.
export const register: Register = on => {
  // the band above the prompt; what else goes there is drawn under it
  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
    const { Box, Text, Button } = $.ui.resolve(e)
    const shout = '…'
    const clockLeft = '…'
    const title = '…'
    const artists = '…'
    const clock = '…'
    const clock2 = '…'
    const busyText = '…'
    const line = '…'
    return (
      <Box flexDirection="column">
        <Text bold wrap="wrap">
          {shout}
        </Text>
        <Box flexDirection="row" gap={1}>
          <Text color="yellow" bold>
            ◎ Focus
            {" "}
            {clockLeft}
          </Text>
          <Button label="stop" plain dimColor />
        </Box>
        <Box flexDirection="row" gap={1}>
          <Text>
            ♫
          </Text>
          <Box flexShrink={1}>
            <Text wrap="truncate-end">
              <Text bold>
                {title}
              </Text>
              <Text dimColor>
                {" — "}
                {artists}
              </Text>
            </Text>
          </Box>
          <Text dimColor>
            {clock}
            /
            {clock2}
          </Text>
          <Button label={`${busyText}`} plain />
          <Button label={`${busyText}`} plain />
          <Button label={`${busyText}`} plain />
          <Button label={`${busyText}`} plain />
          <Button label="☰" plain dimColor />
        </Box>
        <Text italic dimColor wrap="truncate-end">
          {"  ♪ "}
          {line}
        </Text>
        {await next(e)}
      </Box>
    )
  })

  // the pane: open it with $.ui.open({ id: 'my-pane', title: "Spotify" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Button, Text, Input } = $.ui.resolve(e)
    const title = '…'
    const artists = '…'
    const album = '…'
    const clock = '…'
    const clock2 = '…'
    const repeat = '…'
    const line = '…'
    const busyText = '…'
    const message = '…'
    const playLabel = '…'
    const title2 = '…'
    const subtitle = '…'
    const title3 = '…'
    const subtitle2 = '…'
    const title4 = '…'
    const subtitle3 = '…'
    const title5 = '…'
    const subtitle4 = '…'
    const title6 = '…'
    const subtitle5 = '…'
    const title7 = '…'
    const subtitle6 = '…'
    const name = '…'
    const type = '…'
    return (
      <Box flexDirection="column" gap={1}>
        <Box flexDirection="row" flexWrap="wrap" columnGap={1}>
          <Button label="Player" hotkey="1" variant="primary" />
          <Button label="Lyrics" hotkey="2" variant="primary" />
          <Button label="DJ" hotkey="3" variant="primary" />
          <Button label="Recap" hotkey="4" variant="primary" />
          <Button label="Library" hotkey="5" variant="primary" />
          <Button label="Settings" hotkey="6" variant="primary" />
        </Box>
        <Box flexDirection="row" gap={2}>
          <Box flexDirection="column" flexShrink={1}>
            <Text bold wrap="truncate-end">
              {"♫ "}
              {title}
            </Text>
            <Text wrap="truncate-end">
              {artists}
            </Text>
            <Text dimColor wrap="truncate-end">
              {album}
            </Text>
            <Text>
              <Text>
                ━━━━━━━━●────────
              </Text>
              <Text dimColor>
                {" "}
                {clock}
                {" / "}
                {clock2}
              </Text>
            </Text>
            <Text dimColor wrap="truncate-end">
              unknown device
              {" · vol "}
              ?
              {"% · shuffle "}
              on
              {" · repeat "}
              {repeat}
            </Text>
            <Text italic dimColor wrap="truncate-end">
              {"♪ "}
              {line}
            </Text>
          </Box>
        </Box>
        <Box flexDirection="row" flexWrap="wrap" columnGap={1}>
          <Button label={`${busyText}`} hotkey="b" />
          <Button label={`${busyText}`} hotkey="p" variant="primary" />
          <Button label={`${busyText}`} hotkey="n" />
          <Button label={`${busyText}`} hotkey="d" />
          <Button label={`${busyText}`} hotkey="u" />
          <Button label={`${busyText}`} hotkey="s" />
          <Button label={`${busyText}`} hotkey="r" />
          <Button label={`${busyText}`} hotkey="l" />
        </Box>
        <Text wrap="wrap">
          {message}
        </Text>
        <Input label="Search" placeholder="song · artist: … · album: … · playlist: …" submitLabel={`${busyText}`} />
        <Box flexDirection="column">
          <Box flexDirection="row" gap={1}>
            <Text bold>
              Results
            </Text>
            <Button label="clear" plain dimColor />
          </Box>
          <Box flexDirection="row" gap={1}>
            <Button label={`${playLabel}`} plain />
            <Text>
              {" "}
            </Text>
            <Box flexShrink={1}>
              <Text wrap="truncate-end">
                {title2}
                <Text dimColor>
                  {" — "}
                  {subtitle}
                </Text>
              </Text>
            </Box>
          </Box>
          <Box flexDirection="row" gap={1}>
            <Button label={`${playLabel}`} plain />
            <Text>
              {" "}
            </Text>
            <Box flexShrink={1}>
              <Text wrap="truncate-end">
                {title3}
                <Text dimColor>
                  {" — "}
                  {subtitle2}
                </Text>
              </Text>
            </Box>
          </Box>
          <Box flexDirection="row" gap={1}>
            <Button label={`${playLabel}`} plain />
            <Text>
              {" "}
            </Text>
            <Box flexShrink={1}>
              <Text wrap="truncate-end">
                {title4}
                <Text dimColor>
                  {" — "}
                  {subtitle3}
                </Text>
              </Text>
            </Box>
          </Box>
        </Box>
        <Box flexDirection="column">
          <Text bold>
            Up next
          </Text>
          <Text wrap="truncate-end" dimColor>
            01
            {". "}
            {title5}
            {" — "}
            {subtitle4}
          </Text>
          <Text wrap="truncate-end" dimColor>
            01
            {". "}
            {title6}
            {" — "}
            {subtitle5}
          </Text>
          <Text wrap="truncate-end" dimColor>
            01
            {". "}
            {title7}
            {" — "}
            {subtitle6}
          </Text>
        </Box>
        <Box flexDirection="column">
          <Box flexDirection="row" gap={1}>
            <Text bold>
              Devices
            </Text>
            <Button label={`${busyText}`} plain dimColor />
          </Box>
          <Text>
            {`▶ ${name} (${type})`}
          </Text>
          <Text>
            {`▶ ${name} (${type})`}
          </Text>
          <Text>
            {`▶ ${name} (${type})`}
          </Text>
          <Button label={`${busyText}`} plain />
          <Button label={`${busyText}`} plain />
          <Button label={`${busyText}`} plain />
        </Box>
        <Box>
          <Button label={`${busyText}`} plain dimColor />
        </Box>
      </Box>
    )
  })

  on('session.start', async ($, e, next) => {
    const title = '…'
    const artists = '…'
    const errText = '…'
    await $.ui.status(`♫ ${title} — ${artists}`)
    await $.ui.toast(`Spotify login failed: ${errText}`)
    await $.ui.toast(`♫ ${title} — ${artists}`)
    return next(e)
  })
}

The mod's own code

Shown under the mod's licence (MIT); its text is below. Keep the notice if you copy these lines.

spotify/hooks/register.tsx lines 1887–1941 · Band
  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
    if (e.props.hasSurvey) return next(e)
    const s = await read($, settings)
    const GREEN = accentOf(s)
    const shout = await read($, flash)
    const f = await read($, focus)
    const left = f ? await read($, focusLeft) : 0
    const p = isOn(s, 'band') ? await read($, player) : null
    if (!p && !shout && !f) return next(e)
    const { Box, Text, Button } = $.ui.resolve(e)
    const line = p && isOn(s, 'bandLyrics') ? await currentLyric($) : undefined
    const canControl = (await read($, premium)) !== false
    const busy = await read($, busyKeys)

    return (
      <Box flexDirection="column">
        {shout !== '' && (
          <Text color={GREEN} bold wrap="wrap">
            {shout}
          </Text>
        )}
        {f && (
          <Box flexDirection="row" gap={1}>
            <Text color={f.phase === 'focus' ? GREEN : 'yellow'} bold>
              {f.phase === 'focus' ? '◎ Focus' : '☕ Break'} {clockLeft(left * 1000)}
            </Text>
            <Button key="focus-stop" label="stop" plain dimColor onPress={() => quiet(stopFocus($))} />
          </Box>
        )}
        {p && (
          <Box flexDirection="row" gap={1}>
            <Text color={GREEN}>{p.isPlaying ? '♫' : '⏸'}</Text>
            <Box flexShrink={1}>
              <Text wrap="truncate-end">
                <Text bold>{p.title}</Text>
                <Text dimColor> — {p.artists}</Text>
              </Text>
            </Box>
            {isOn(s, 'bandTime') && e.props.bodyColumns > 70 && <Text dimColor>{clock(p.progressMs)}/{clock(p.durationMs)}</Text>}
            {canControl && isOn(s, 'bandControls') && <Button key="band-prev" label={busyText(busy, 'band-prev', '⏮', '…')} plain onPress={() => quiet(withBusy($, 'band-prev', () => back($)))} />}
            {canControl && isOn(s, 'bandControls') && <Button key="band-toggle" label={busyText(busy, 'band-toggle', p.isPlaying ? '⏸' : '▶', '…')} plain onPress={() => quiet(withBusy($, 'band-toggle', () => toggle($)))} />}
            {canControl && isOn(s, 'bandControls') && <Button key="band-next" label={busyText(busy, 'band-next', '⏭', '…')} plain onPress={() => quiet(withBusy($, 'band-next', () => skip($)))} />}
            {isOn(s, 'bandControls') && <Button key="band-like" label={busyText(busy, 'band-like', p.liked ? '♥' : '♡', '…')} plain onPress={() => quiet(withBusy($, 'band-like', () => like($, undefined)))} />}
            {isOn(s, 'bandControls') && <Button key="band-open" label="☰" plain dimColor onPress={() => quiet(openPane($, undefined))} />}
          </Box>
        )}
        {line !== undefined && p?.isPlaying && (
          <Text italic color={GREEN} dimColor wrap="truncate-end">
            {'  ♪ '}
            {line}
          </Text>
        )}
      </Box>
    )
  })
spotify/hooks/register.tsx lines 1944–2103 · Pane
  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
    const ui = $.ui.resolve(e)
    const { Box, Text, Button } = ui
    const width = Math.max(20, e.props.bodyColumns)
    paneColumns = width
    const height = e.viewport?.rows ?? 30
    const isAuthed = await read($, authed)
    const message = await read($, notice)
    const busy = await read($, busyKeys)
    const s = await read($, settings)
    const GREEN = accentOf(s)
    const good = message.startsWith('✓')
    const messageLine = message !== '' && (
      <Text color={good ? GREEN : undefined} dimColor={!good} wrap="wrap">
        {message}
      </Text>
    )

    if (!isAuthed) {
      return (
        <Box flexDirection="column" gap={1}>
          <Text bold color={GREEN}>Spotify</Text>
          <Text>Not connected.</Text>
          <Box flexDirection="column">
            <Text dimColor wrap="wrap">1. Create an app at developer.spotify.com/dashboard (Web API, redirect URI {REDIRECT_URI})</Text>
            <Text dimColor>2. /spotify setup &lt;client-id&gt;</Text>
            <Text dimColor>3. Press Log in, or run /spotify login</Text>
          </Box>
          <Box>
            <Button key="login" label={busyText(busy, 'login', 'Log in', 'Opening browser…')} variant="primary" hotkey="l" onPress={() => quiet(withBusy($, 'login', () => pressLogin($)))} />
          </Box>
          {messageLine}
        </Box>
      )
    }

    const current = await read($, tab)
    const p = await read($, player)
    const free = (await read($, premium)) === false
    const tabButton = (key: SpotifyTab, label: string, hotkey: string) => (
      <Button
        key={`tab-${key}`}
        label={label}
        hotkey={hotkey}
        variant={current === key ? 'primary' : undefined}
        dimColor={current !== key}
        onPress={() => quiet(showTab($, key))}
      />
    )
    const tabs = (
      <Box flexDirection="row" flexWrap="wrap" columnGap={1}>
        {tabButton('player', 'Player', '1')}
        {tabButton('lyrics', 'Lyrics', '2')}
        {tabButton('dj', 'DJ', '3')}
        {tabButton('recap', 'Recap', '4')}
        {tabButton('library', 'Library', '5')}
        {tabButton('settings', 'Settings', '6')}
      </Box>
    )
    const header = p ? (
      <Text wrap="truncate-end">
        <Text color={GREEN}>{p.isPlaying ? '♫ ' : '⏸ '}</Text>
        <Text bold>{p.title}</Text>
        <Text dimColor> — {p.artists}</Text>
      </Text>
    ) : (
      <Text dimColor>Nothing playing.</Text>
    )
    const playLabel = (key: string, isCurrent: boolean) => busyText(busy, key, free ? '↗' : isCurrent && p?.isPlaying ? '♫' : '▶', '…')

    // ----- lyrics tab -----
    if (current === 'lyrics') {
      const l = await read($, lyrics)
      const idx = await read($, lyricIndex)
      const offset = await read($, lyricOffset)
      const room = Math.max(5, Math.min(24, height - 10))
      let body
      if (!isOn(s, 'lyrics')) body = <Text dimColor>Lyrics are off. Turn them on in Settings (6).</Text>
      else if (!p) body = <Text dimColor>Start a track to see its lyrics.</Text>
      else if (!l || l.trackId !== p.id || l.status === 'loading') body = <Text dimColor>Looking up lyrics…</Text>
      else if (l.status === 'instrumental') body = <Text dimColor>♪ Instrumental ♪</Text>
      else if (l.status === 'missing') body = <Text dimColor>No lyrics found on LRCLIB for this track.</Text>
      else if (l.status === 'error') body = <Text dimColor>Could not reach LRCLIB.</Text>
      else if (l.status === 'plain') {
        body = (
          <Box flexDirection="column">
            <Text dimColor italic>Unsynced lyrics</Text>
            {l.lines.slice(0, room).map(x => <Text wrap="wrap">{x.text || ' '}</Text>)}
          </Box>
        )
      } else {
        const start = Math.max(0, Math.min(Math.max(0, idx) - Math.floor(room / 3), l.lines.length - room))
        body = (
          <Box flexDirection="column">
            {l.lines.slice(start, start + room).map((x, k) => {
              const i = start + k
              return (
                <Button
                  key={`ly-${i}`}
                  plain
                  label={`${i === idx ? '▶ ' : '  '}${x.text || '♪'}`}
                  dimColor={i !== idx}
                  onPress={() => quiet(seekTo($, x.t - offset))}
                />
              )
            })}
            <Box flexDirection="row" columnGap={1}>
              <Text dimColor>timing{offset !== 0 ? ` ${offset > 0 ? '+' : ''}${offset / 1000}s` : ''}:</Text>
              <Button key="ly-earlier" label="earlier" hotkey="z" plain dimColor onPress={() => quiet(nudgeLyrics($, 500))} />
              <Button key="ly-later" label="later" hotkey="x" plain dimColor onPress={() => quiet(nudgeLyrics($, -500))} />
              {offset !== 0 && <Button key="ly-reset" label="reset" hotkey="c" plain dimColor onPress={() => quiet(nudgeLyrics($, null))} />}
            </Box>
            <Text dimColor>press a line to jump there · lyrics from lrclib.net</Text>
          </Box>
        )
      }
      return (
        <Box flexDirection="column" gap={1}>
          {tabs}
          {header}
          {body}
        </Box>
      )
    }

    // ----- DJ tab -----
    if (current === 'dj') {
      const d = await read($, dj)
      const auto = isOn(s, 'autopilot')
      return (
        <Box flexDirection="column" gap={1}>
          {tabs}
          {header}
          <Box flexDirection="column">
            <Text bold>Claude DJ</Text>
            {d.status === 'idle' && <Text dimColor wrap="wrap">Picks music for what you are working on in this session, then plays or queues it.</Text>}
            {d.status === 'thinking' && <Text color={GREEN}>Reading the session and digging through crates…</Text>}
            {d.status === 'error' && <Text color="yellow" wrap="wrap">{d.reason}</Text>}
            {d.status === 'done' && (
              <Box flexDirection="column">
                <Text>
                  <Text color={GREEN} bold>{d.vibe}</Text>
                  <Text dimColor> · {d.source === 'autopilot' ? 'autopilot' : 'on request'} at {hhmm(d.at)}</Text>
                </Text>
                <Text italic wrap="wrap">{d.reason}</Text>
              </Box>
            )}
          </Box>
          {d.picks.length > 0 && (
            <Box flexDirection="column">
              {d.picks.map((x, i) => (
                <Box flexDirection="row" gap={1}>
                  <Button key={`dj-play-${i}`} label={playLabel(`dj-play-${i}`, p?.uri === x.uri)} plain onPress={() => quiet(withBusy($, `dj-play-${i}`, () => playPick($, x)))} />
                  <Box flexShrink={1}>
                    <Text wrap="truncate-end">
                      {x.title}
                      <Text dimColor> — {x.subtitle}</Text>
                    </Text>
                  </Box>
                </Box>
Licence text (MIT)
MIT License

Copyright (c) 2026 jewdev

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

What its code calls

networkruns programsreads filesenv varsdrives Claudetool callsremembers

The design, read from code

Drawn from the mod's source at the commit read, not from a run: a list is drawn three times, a condition takes its first branch that draws in the desktop app, and a value only the run time knows is shown as a made-up sample (dotted underline) or left out. Colours and type are this site's.

What its code shows

Read from the source at commit 2bafca309239 on 2026-10-06. The first group decides whether a mod is listed; the rest is for you to weigh. A later commit is not read until the next crawl.

Decides the listing: code you can check
Entry readEvery module hooks/hooks.json names was read.spotify/hooks/register.tsx
ParsesEvery file parses as TypeScript or JavaScript.5 files parsed
All its code is in the modEvery import is a file of the mod or the engine's own module; no packages, no require.all its code is in the mod
ReadableNo minified lines, no eval or new Function, no import of a computed path, no encoded blobs.no minified code, no eval, no encoded blobs
Calls in the openNetwork and programs are reached as $.http.fetch and $.process.run in place, never passed around.every call outside goes through $ in the open
For you to weigh before installing
Where it drawsThe terminal, the desktop app, both, or nothing (hooks only: a guard or a prompt rewriter), as its code says. Shown, never a reason to leave a mod out.draws in the terminal and the desktop app, the same in both
Install lineWhether its repository's own .claude-plugin/marketplace.json lists it, so it installs from that marketplace with the lines on its page.listed in its repository's .claude-plugin/marketplace.json: installs from there
Programs on WindowsWhether every program it starts through $.process exists on Windows (tail, date, open, osascript, /usr/… do not).runs no program a Windows PC lacks
NetworkWhether every fetch names its https host in the code.spotify/hooks/register.tsx:484 fetch(`${ACCOUNTS}/api/token`); spotify/hooks/register.tsx:654 fetch(`${API}${path}`); spotify/hooks/register.tsx:656 fetch(`${API}${path}`)
ProgramsWhether every program it starts is named in the code and is not a shell, an interpreter or a network tool.spotify/hooks/register.tsx:340 powershell.exe (a shell or interpreter); spotify/hooks/register.tsx:358 powershell.exe (a shell or interpreter); spotify/hooks/register.tsx:539 powershell.exe (a shell or interpreter); spotify/hooks/register.tsx:558 powershell.exe (a shell or interpreter); spotify/hooks/register.tsx:959 powershell.exe (a shell or interpreter)
Reads and sendsWhether it both reads files or environment variables and reaches the network.reads environment variables and files and reaches the network
Keys in the sourceWhether the source holds what looks like an API key or a private key.no keys in the source
LicenceAn open licence (MIT, Apache-2.0, BSD, ISC, Unlicense, 0BSD, CC0) with its text lets modscode show its code; otherwise the code is linked.MIT

This is a reading of the code text, not a security review: it does not run the mod, and it cannot see what a program the mod starts does. The check before installing is yours. How mods are chosen

Install it

Check it yourself before you install it. Mods run unsandboxed, with your permissions, and modscode does not vouch for what this code does. Read the code below (or run claude plugin validate . in its folder), weigh what it reaches, and install the commit you read.

Its repository is its marketplace. Add that marketplace (in the terminal with these commands, or in the desktop app's plugin settings) and install the mod from it:

/plugin marketplace add jewdev/claude-spotify-mod
/plugin install spotify@claude-spotify-mod

This installs the marketplace's latest commit, which may not be the one read here (2bafca309239). Compare them before you install.

Ask Claude about it

With the modscode connector added, Claude can read this design, what its code reaches and its code, and build on them. Ask it like this:

Read the modscode design "jewdev-spotify" with its code and make me a pane like it

Search them from Claude: the MCP connector

Similar designs