r/ClaudeCode • • 6h ago

Discussion I made a Claude Code skill for the decisions hidden inside “add Spotify shuffle”

A coding agent can write a shuffle function and still miss what the user expects from “shuffle.”

In this runnable example, six tracks come from Eminem, Drake, and The Weeknd—two per artist. A random-comparator shortcut, Fisher–Yates, and an artist-aware approach produce 3, 1, and 0 adjacent artist repeats for the example’s fixed choices. Fisher–Yates is the fair uniform shuffle; it just doesn’t promise artist variety.

SeniorMode is an open-source skill Claude Code can consult for relevant engineering guidance. Instead of expecting the user to specify an algorithm and every edge case, it helps Claude Code uncover the product decision, consider constraints such as an unbalanced playlist, and make the behavior checkable.

Try the example: node examples/shuffle.mjs

Repo: https://github.com/EnesKeremAYDIN/SeniorMode

If you want Claude Code to make better-informed implementation decisions, please ⭐ the repo. That helps other Claude Code users find the skill too.

Would you want Claude Code to preserve uniform randomness here, or prioritize artist variety when the playlist allows it?

1 Upvotes

3 comments sorted by

•

u/AutoModerator 6h ago

Hey! Thanks for posting to r/ClaudeCode

While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.

For help, project discussions, tips, and general chat, join the ClaudeCode Discord.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/PreviousSchedule5697 6h ago

Six morceaux, deux par artiste, et on en tire trois algorithmes. Refais le test avec une playlist où t'as 80 titres du même artiste et on verra lequel des trois rend quelque chose d'écoutable.

1

u/EKAlojix 6h ago

Six tracks are just a small illustration, not a claim about the average playlist. The point is that a genuinely mixed playlist can still feel broken when a normal shuffle puts the same artist back to back. An artist-aware shuffle aims to reduce those repeats as much as the playlist allows, while still playing every track and keeping the order varied. With 80 tracks by one artist, repeats are unavoidable, that tests a different case.