--- name: buddy-sings description: > Use when user wants their Claude Code pet (/buddy) to sing a song. Triggers on "buddy sings", "let my buddy sing", "buddy sing", "make my pet sing", "宠物唱歌", "让宠物唱首歌", "让buddy唱歌", "buddy来一首", "我的宠物会唱歌吗", "pet sings", "let my companion sing", or any request that combines the concept of their Claude Code buddy/pet/companion with singing or music. license: MIT metadata: version: "1.0" category: creative --- # Buddy Sings — Let Your Claude Code Pet Sing Turn your Claude Code pet into a singer. Each pet gets a unique vocal identity based on its name and personality — the same pet always sounds the same. **Requires**: `minimax-music-gen` skill (for playback scripts and prompt guide) ## Prerequisites - **mmx CLI** (required for music generation): **Install:** ```bash npm install -g mmx-cli ``` **Authenticate (first time only):** ```bash mmx auth login --api-key ``` Get your API key from [MiniMax Platform](https://platform.minimaxi.com/). --- ## Workflow Overview ``` Check pet → Build vocal identity → Choose mode → Generate music → Play ``` ## Language Detection Detect the user's language from their message at the start of the session: - Chinese (中文) → Set `LANG=zh` — all interactions in Chinese, generate Chinese lyrics - English → Set `LANG=en` — all interactions in English, generate English lyrics Pass `--lang $LANG` to ALL script invocations throughout the workflow. Respond to the user in their detected language. Use the matching template below. --- ## Step 1: Check for Pet Read `~/.claude.json` and look for the `companion` field: ```python import json with open(os.path.expanduser("~/.claude.json")) as f: data = json.load(f) companion = data.get("companion", {}) ``` If no companion is found or the field is empty, tell the user: **If LANG=zh:** ``` 🐾 你还没有宠物呢!输入 /buddy 领养一只,然后再来找我让它唱歌吧。 ``` **If LANG=en:** ``` 🐾 You don't have a pet yet! Type /buddy to adopt one, then come back to let it sing. ``` Stop here and wait for the user to adopt a pet. Do not proceed without a pet. If a companion exists, extract its profile: - `name` — the pet's name - `personality` — the pet's personality description Present the pet to the user: **If LANG=zh:** ``` 🐾 找到你的宠物了! 名字: 个性: ``` **If LANG=en:** ``` 🐾 Found your pet! Name: Personality: ``` --- ## Step 2: Build Vocal Identity Based on the pet's **name** and **personality** text, creatively design a unique vocal identity. No template lookups — interpret the personality freely. ### How to interpret personality into voice Read the personality text and craft vocal attributes: - **Timbre (音色)**: What does this personality sound like? e.g., "few words" → low, warm, deliberate; "energetic" → bright, punchy; "mysterious" → breathy, dark; "legendary chonk" → thick, warm, cozy - **Singing style (演唱风格)**: How would they deliver a song? e.g., "of few words" → sparse, dramatic pauses; "playful" → bouncy, rhythmic; "poetic" → flowing, legato - **Mood (情绪基调)**: What emotional tone fits? e.g., "chill" → relaxed, laid-back; "fierce" → intense, powerful Construct a `prompt_fragment` that describes the vocal style in English, e.g.: ``` Vocal: warm low female voice with cozy thick timbre, sparse minimalist delivery with dramatic pauses giving each word weight, relaxed laid-back mood. ``` ### Voice caching The vocal identity must be **cached** so the pet always sounds the same. - Cache file: `~/.claude/skills/buddy-sings/voices/.json` - Cache format: ```json { "name": "Moth", "personality": "A legendary chonk of few words.", "prompt_fragment": "Vocal: warm low female voice...", "cached_at": "2026-04-07T19:52:15" } ``` **First time**: No cache exists → interpret personality → save to cache file. **Subsequent calls**: Read cache → use the saved `prompt_fragment` directly. Do NOT re-interpret — consistency matters. **Cache invalidation**: If the `personality` in `~/.claude.json` differs from what's cached, the pet has changed — regenerate and save a new cache. **Manual regeneration**: If the user says "换个声音" or "regenerate voice": delete the cache file and re-interpret from scratch. ### Present the voice to the user **If LANG=zh:** ``` 🎤 的专属嗓音: 🎵 音色: 🎶 风格: