SuperAPI AI Directory

buddy-reroll

General & other

View repository

Updated 10-15 17:24

About this skill

Claude Code Buddy Reroll

Help the user reroll a custom Claude Code /buddy buddy combination.

How It Works

The buddy is hash(userID + SALT) deterministically generated. SALT = friend-2026-401. The hash function depends on the installation method:

Installation Method Runtime Hash Function Command to Run
npm install Node.js FNV-1a node scripts/buddy-reroll.js
Official native Bun Bun.hash bun scripts/buddy-reroll.js

Using the wrong runtime gives completely wrong results!

Step 0: Check Version

/buddy The feature requires Claude Code v2.1.88 or above.

Run claude --version to check the current version. If it is below v2.1.88, prompt the user to update first:

  • npm users:npm update -g @anthropic-ai/claude-code
  • native users:claude update

If the version is insufficient, stop the subsequent process and continue after the user finishes updating.

Step 1: Determine Installation Method

Read the ~/.claude.json field of installMethod :

  • "global" → npm → use node
  • "native" → official → use bun

Step 2: View Current Buddy

Read ~/.claude.json, buddy seed field priority:

  • oauthAccount.accountUuid exists → use this
  • otherwise → use userID
node scripts/buddy-reroll.js --check <值>

Display the current buddy's species, rarity, eyes, hat, shiny, stats, and name.

Step 3: Choose Buddy Configuration

Core principle: display all options at once, and let the user directly tell you in natural language what combination they want. Do not use AskUserQuestion to select categories (the option count limit prevents displaying them all).

3.1 Display the Full Option List

Output the complete buddy option reference, displaying everything at once, and guide the user to the codex page to see previews. Format example:

🐾 宠物配方大全

👉 不确定选什么?打开图鉴页面看看每个宠物的样子:
   https://baikemark.github.io/claude-buddy-reroll/

【稀有度】
  普通 ★ (60%) | 非凡 ★★ (25%) | 稀有 ★★★ (10%) | 史诗 ★★★★ (4%) | 传奇 ★★★★★ (1%)

【物种(18种)】
  鸭子  鹅  史莱姆  猫  龙  章鱼  水豚  机器人
  猫头鹰  企鹅  乌龟  蜗牛  幽灵  美西螈  仙人掌  兔子  蘑菇  胖猫

【眼睛】
  默认·  星星✦  晕眩×  大眼◉  机械@  惊讶°

【帽子】(普通稀有度固定无帽子)
  无  皇冠  高礼帽  螺旋桨  光环  巫师帽  毛线帽  小鸭子

【闪光】1% 概率,搜索时间更长,名字会标记为"格外特别"

告诉我你想要的组合,比如"传奇猫 皇冠 星星眼 闪光"。
想看某个物种的 ASCII 样子,也可以直接说。

Note: You must display all options at once; do not paginate, do not split into rounds, and do not use AskUserQuestion to select.

3.2 User Selection

The user directly answers in natural language with the combination they want (for example "legendary cat crown star eyes", "I want a shiny dragon"). If the user is interested in a species and wants to see what it looks like, read references/sprites.md to render the corresponding ASCII sprite.

If the user does not specify rarity, default to no restriction. If they do not specify eyes/hat, default to no restriction (random). Common rarity automatically skips the hat.

3.3 Shiny and Stats

Use AskUserQuestion to pop up two questions at once, shiny and stats (switch left and right):

  • Shiny: no / want shiny (1% probability, longer search)
  • Stat Requirement: unrestricted (default ≥90) / high stats (≥95) / max (=100)

If the user already said in 3.2 that they want shiny or specified stats, skip this step.

3.4 Summary Confirmation

Summarize the configuration based on the user's choices, display it, then start searching.

Step 4: Search for the Target Buddy

Convert the Chinese options into English parameters:

Chinese→English mapping:

Species: duck=鸭子, goose=鹅, blob=史莱姆, cat=猫, dragon=龙, octopus=章鱼, owl=猫头鹰, penguin=企鹅, turtle=乌龟, snail=蜗牛, ghost=幽灵, axolotl=美西螈, capybara=水豚, cactus=仙人掌, robot=机器人, rabbit=兔子, mushroom=蘑菇, chonk=胖猫

Eyes: default=·, star=✦, dizzy=×, big eye=◉, mechanical=@, surprised=°

Hat: none=无, crown=皇冠, tophat=高礼帽, propeller=螺旋桨, halo=光环, wizard=巫师帽, beanie=毛线帽, tinyduck=小鸭子

Rarity: common=普通, uncommon=非凡, rare=稀有, epic=史诗, legendary=传奇

node scripts/buddy-reroll.js --species cat --rarity legendary --eye '✦' --hat crown

Other parameters:--shiny(shiny),--min-stats 95(high stats),--min-stats 100(extreme stats)

After the search results are displayed, use AskUserQuestion to let the user choose which uid to apply (usually 3 results, which is just ≤4 options).

Step 5: Handle name and personality

Important: Do not directly delete the companion block! First read the current companion's name and personality, then ask the user.

Read ~/.claude.json 's companion block to get the current name (if any).

Use AskUserQuestion to ask:

你的宠物当前名字是"咪呜"。
你想怎么处理名字和性格?
  1. 保留原名(不改名字和性格)
  2. 自定义名字(支持中文和英文)
  3. 让 Claude Code 重新生成(基于新宠物的稀有度、物种、属性自动生成)

Option descriptions:

A. Keep original name — only replace the uid, do not touch the companion block. If the companion block does not exist, keep it empty.

B. Custom name — the user inputs a custom name and personality (supports Chinese and English). Update the companion block:

"companion": {
  "name": "用户输入的名字",
  "personality": "用户输入的性格描述",
  "hatchedAt": 1775015300069
}

If the user only inputs a name without a personality, let Claude Code automatically generate the personality. If the user provides a personality description, use the user's.

C. Let Claude Code regenerate — delete the entire companion block; after restart, Claude Code will call the LLM to automatically generate a name and personality based on the new pet's rarity, species, attributes, and the 156-word inspiration library.

Step 6: Write configuration

Only modify ~/.claude.json one file.

Which field to modify:

  • oauthAccount.accountUuid exists → modify this
  • Otherwise → modify userID

Complete flow: read configuration → determine seed field → replace with search results → update/keep/delete companion based on user choice → confirm write with AskUserQuestion (confirm / cancel) → prompt to restart and /buddy

Attribute descriptions

DEBUGGING, PATIENCE, CHAOS, WISDOM, SNARK. Each pet has 1 highest attribute and 1 lowest attribute. Attributes affect the name and personality generated by the LLM.

Notes

  • Script path:scripts/buddy-reroll.js(relative to this skill)
  • shiny currently has no visual difference, but will be marked as "especially special" during name generation
  • Changing userID/accountUuid does not affect the API key, conversation history, or local configuration