Reroll Claude Code /buddy companion to a target species and rarity, or rename/customize companion name and personality. Triggers on "reroll buddy", "change buddy", "legendary buddy", "new companion", "buddy hack", "rename buddy", "buddy name", "buddy personality", "换宠物", "重新抽", "传说宠物", "改名", "宠物名字", "バディ変更", "伝説バディ", "バディ名前", or similar.
Brute-force a new /buddy companion by finding a userID that hashes to the desired species and rarity.
Claude Code generates companions deterministically: hash(userID + SALT) → mulberry32 PRNG → rarity, species, eyes, hat, shiny. Same userID = same companion, always.
To reroll: replace userID in ~/.claude.json, clear companion field, restart.
Critical: Claude Code is Bun-bundled, so Bun.hash() (xxHash64) is the correct hash function. Node.js FNV-1a produces wrong results — the script MUST run under Bun.
Important: All scripts are located in the scripts/ subdirectory of this skill.
Agent Execution Instructions:
SKILL_DIR${SKILL_DIR}/scripts/<script-name>.mjs${SKILL_DIR} in this document with the actual pathScript Reference:
| Script | Purpose |
|---|---|
scripts/reroll.mjs | Brute-force target species+rarity, optionally apply to config |
scripts/oauth-setup.mjs | OAuth config helper for Pro/Max subscribers (--check/--prepare/--verify/--restore) |
scripts/rename.mjs | Change companion name and/or personality (--name/--desc) |
/buddy system was introduced in this version. The script auto-checks and exits if the version is too old.npx -y bun if not installed globally.userID in ~/.claude.json can be freely replaced.accountUuid which /buddy uses instead of userID. The OAuth method bypasses this — see workflow below.# Direct (if bun is installed globally)
bun ${SKILL_DIR}/scripts/reroll.mjs --species dragon --rarity legendary --apply
# Via npx (works even without global bun install)
npx -y bun ${SKILL_DIR}/scripts/reroll.mjs --species dragon --rarity legendary --apply
| Flag | Default | Description |
|---|---|---|
--species <name> | dragon | Target species (see list below) |
--rarity <level> | legendary | Minimum rarity: common / uncommon / rare / epic / legendary |
--max <n> | 1000000 | Max brute-force iterations |
--apply | off | Auto-write result to ~/.claude.json and clear companion |
| duck | goose | blob | cat | dragon | octopus |
| owl | penguin | turtle | snail | ghost | axolotl |
| capybara | cactus | robot | rabbit | mushroom | chonk |
| Rarity | Stars | Chance | ~Iterations to find |
|---|---|---|---|
| common | ★ | 60% | ~30 |
| uncommon | ★★ | 25% | ~72 |
| rare | ★★★ | 10% | ~180 |
| epic | ★★★★ | 4% | ~450 |
| legendary | ★★★★★ | 1% | ~1800 |
This skill can be invoked with or without arguments:
/webup-buddy-reroll): Prompts the user interactively via AskUserQuestion before running./webup-buddy-reroll dragon legendary): Skips the prompt and locks to the given species and rarity./webup-buddy-reroll dragon legendary 沧海九粟 爱打盹的小龙): Reroll, then immediately apply the given name and personality./webup-buddy-reroll 改名叫沧海九粟,个性是爱打盹的小龙): Skip reroll, only change name and/or personality.The args string is free-form text. Use NLP to extract these fields:
All four fields are optional. Any combination is valid.
Detect intent:
accountUuid exists in ~/.claude.json:
npx -y bun ${SKILL_DIR}/scripts/oauth-setup.mjs --check
accountUuid): API user or OAuth already set up. Skip to step 1.accountUuid found): Pro/Max subscriber. Run OAuth Setup below, then continue to step 1.Principle: When logging in via CLAUDE_CODE_OAUTH_TOKEN env var, Claude Code does NOT write accountUuid to ~/.claude.json. This makes /buddy fall back to userID, which can be freely replaced.
a. Tell user to open a separate terminal and run claude setup-token to get their OAuth token. Ask them to paste the token back here.
b. Once token is received, prepare the config (backup + reset):
bash npx -y bun ${SKILL_DIR}/scripts/oauth-setup.mjs --prepare
c. Tell user to run in a separate terminal (replace <TOKEN> with actual token):
bash CLAUDE_CODE_OAUTH_TOKEN=<TOKEN> claude
Wait for Claude to fully load, then exit immediately — do NOT use /buddy.
d. After user confirms they've done this, verify the config:
bash npx -y bun ${SKILL_DIR}/scripts/oauth-setup.mjs --verify
If verification fails, run --restore to restore backup and retry from step (a).
e. Continue to step 1.
If no args provided: Use AskUserQuestion to ask the user to pick a species AND a rarity in a single prompt (two questions):
description should list the remaining species so the user knows what's available via "Other", e.g. the first option's description: "Or type any of: duck, goose, blob, octopus, owl, penguin, turtle, snail, ghost, cactus, robot, rabbit, mushroom, chonk".If species/rarity parsed from args: Skip the prompt and proceed directly.
Run the script with --apply:
npx -y bun ${SKILL_DIR}/scripts/reroll.mjs --species <choice> --rarity <choice> --apply
If name or personality was parsed from args: Run the rename script immediately after reroll (no restart needed between):
npx -y bun ${SKILL_DIR}/scripts/rename.mjs --name "<parsed name>" --desc "<parsed personality>"
Omit --name or --desc if only one was parsed.
Tell user to restart Claude Code and run /buddy to hatch the new companion.
CLAUDE_CODE_OAUTH_TOKEN=<TOKEN> claude (not plain claude) to prevent accountUuid from being written back.If --apply was not used:
~/.claude.json: replace "userID" value, set "companion": null/buddyChange the companion's name and/or personality description without rerolling species or rarity.
If name and/or personality were parsed from args: Skip steps 1–3, go directly to step 4 with the parsed values. When personality is provided directly via args, use it as-is — skip the AI generation step.
AskUserQuestion to ask what the user wants to change (one question, multiSelect):
npx -y bun ${SKILL_DIR}/scripts/rename.mjs --name "<name>" --desc "<personality>"
Omit --name or --desc if only one is being changed.userID only affects telemetry bucketing and buddy seed — no impact on conversations, API keys, or local configfriend-2026-401 (Claude Code 2.1.89). Update the script if a future version changes it