avatars
Claude speaks a short version of each reply through ElevenLabs, as a narrator or a cast of characters with animated portraits above the prompt
何をするか
- 欄・トーストを描く
- /avatar を足す
- mcp__avatars__search_voices・mcp__avatars__my_voices・mcp__avatars__audition・mcp__avatars__paths の呼び出しを見張る(止めることがある)
- session.start・turn.completeにフックする
- ネットワークに出る
良いところ
- TypeScript で書かれている
- デスクトップ専用の分岐がある
- エラーを扱う
作り始めるためのコード
2 種類あります。上のデザインから modscode が書いた雛形と、その Mod 自身のコードのうち描いている部分です。
雛形(register.tsx)
import type { Register } from 'claude-code'
// Drawn like avatars by Dead Money (pane, band, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/dead-money-avatars/
// 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 pane: open it with $.ui.open({ id: 'my-pane', title: "Avatars" })
on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
const { Box, Text, Select, Button } = $.ui.resolve(e)
const description = '…'
const voice = '…'
const model = '…'
const note = '…'
return (
<Box flexDirection="column" gap={1}>
<Box flexDirection="column">
<Text>
{"Spoken replies: "}
<Text bold>
on
</Text>
{" "}
{"API key: "}
<Text color="green">
set
</Text>
</Text>
<Text dimColor>
Set it with /plugin (Avatars, configure), or export ELEVENLABS_API_KEY and restart.
</Text>
</Box>
<Box flexDirection="column">
<Select label="Mode " autoFocus value="off" options={[{"label":"‹option›"},{"value":"off","label":"Off"}]} />
<Text dimColor>
{description}
</Text>
</Box>
<Select label="Voice " value={`${voice}`} />
<Button dimColor>
Load my ElevenLabs voices
</Button>
<Select label="Model " value={`${model}`} />
<Select label="Scenario " value="" options={[{"value":"","label":"Pick one to play"},{"label":"‹option›"}]} />
<Box flexDirection="row" gap={1} flexWrap="wrap">
<Button hotkey="t" variant="primary">
Test
</Button>
<Button hotkey="r">
Replay
</Button>
<Button hotkey="s">
Stop
</Button>
<Button hotkey="o">
Turn off
</Button>
<Button hotkey="d">
Save as default
</Button>
<Button hotkey="c">
Check setup
</Button>
<Button role="dismiss">
Close
</Button>
</Box>
<Text>
{note}
</Text>
<Text dimColor>
{"New modes: ask Claude to create one (the create-mode skill), or see "}
.
</Text>
</Box>
)
})
on('session.start', async ($, e, next) => {
const error = '…'
await $.ui.toast(`avatars: ${error}`)
await $.ui.toast(`avatars: ${error}`)
return next(e)
})
}
Mod 自身のコード
Mod のライセンス(MIT)に従って載せています。全文は下にあります。写すときは著作権表示を残してください。
plugins/avatars/hooks/register.tsx 889〜971 行 · ペイン
on('ui.render', { component: 'Pane', requestId: MENU }, async ($, e) => {
const { Box, Text, Button, Select } = $.ui.resolve(e)
const mode = await modeOf($)
const isOn = await isEnabled($)
const model = await modelOf($)
const voice = await voiceOf($, mode)
const voices = await read($, libraryVoices)
const note = await read($, menuNote)
const hasKey = (await apiKey($)) !== undefined
const scenarios = [...modes.values()].flatMap(m => Object.entries(m.scenarios ?? {}).map(([key, s]) => ({ key, title: `${m.title}: ${s.title}` })))
const act = (work: () => Promise<string>) => () => {
void work().then(text => update($, menuNote, () => text)).catch(err => update($, menuNote, () => String(err)))
}
const voiceOptions = [
...(mode?.voice ? [{ value: mode.voice, label: `${mode.title} default` }] : []),
...(voices ?? []).filter(v => v.id !== mode?.voice).map(v => ({ value: v.id, label: v.name })),
]
if (voice && !voiceOptions.some(o => o.value === voice)) voiceOptions.unshift({ value: voice, label: voice })
return (
<Box flexDirection="column" gap={1}>
<Box flexDirection="column">
<Text>
Spoken replies: <Text bold>{isOn ? 'on' : 'off'}</Text>
{' '}API key: {hasKey ? <Text color="green">set</Text> : <Text color="red">missing</Text>}
</Text>
{!hasKey && <Text dimColor>Set it with /plugin (Avatars, configure), or export ELEVENLABS_API_KEY and restart.</Text>}
</Box>
<Box flexDirection="column">
<Select
key="mode"
label="Mode "
autoFocus
value={mode?.name ?? 'off'}
options={[...[...modes.values()].map(m => ({ value: m.name, label: m.title })), { value: 'off', label: 'Off' }]}
onSelect={value => act(() => setMode($, value))()}
/>
{mode && <Text dimColor>{mode.description}</Text>}
</Box>
{mode && !mode.call && voiceOptions.length > 0 && (
<Select key="voice" label="Voice " value={voice} options={voiceOptions} onSelect={value => act(() => setVoice($, value))()} />
)}
{mode && !mode.call && voices === null && hasKey && (
<Button key="load-voices" dimColor onPress={() => void refreshLibrary($)}>
Load my ElevenLabs voices
</Button>
)}
<Select
key="model"
label="Model "
value={model}
options={[...new Set([model, ...MODELS])].map(m => ({ value: m, label: `${m}${hasTags(m) ? ' (audio tags)' : ''}` }))}
onSelect={value => act(() => setModel($, value))()}
/>
{scenarios.length > 0 && (
<Select
key="scenario"
label="Scenario "
value=""
options={[{ value: '', label: 'Pick one to play' }, ...scenarios.map(s => ({ value: s.key, label: s.title }))]}
onSelect={value => value && act(() => playScenario($, value))()}
/>
)}
<Box flexDirection="row" gap={1} flexWrap="wrap">
<Button key="test" hotkey="t" variant="primary" onPress={act(() => playDemo($, ''))}>Test</Button>
<Button key="replay" hotkey="r" onPress={act(async () => {
const last = await read($, lastSaid)
if (!last) return 'Nothing spoken yet.'
background($, say($, last))
return 'Replaying.'
})}>Replay</Button>
<Button key="stop" hotkey="s" onPress={act(async () => (await stop(), 'Stopped.'))}>Stop</Button>
<Button key="toggle" hotkey="o" onPress={act(() => setEnabled($, !isOn))}>{isOn ? 'Turn off' : 'Turn on'}</Button>
<Button key="default" hotkey="d" onPress={act(() => saveDefaults($))}>Save as default</Button>
<Button key="doctor" hotkey="c" onPress={act(() => doctor($))}>Check setup</Button>
<Button key="close" role="dismiss" onPress={() => void $.ui.close({ id: MENU })}>Close</Button>
</Box>
{note !== '' && <Text>{note}</Text>}
<Text dimColor>New modes: ask Claude to create one (the create-mode skill), or see {userModesDir}.</Text>
</Box>
)
})ライセンスの全文(MIT)
MIT License Copyright (c) 2026 Dead Money 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.
コードが呼ぶもの
通信プログラム起動ファイル書き込み環境変数Claude を動かすツール呼び出し
コードから読み取ったデザイン
読み取ったコミットのソースから描いたもので、動かした結果ではありません。一覧は 3 回描き、条件はデスクトップアプリで描く最初の分岐を取り、動かしたときにだけ決まる値は仮の例(点線の下線)にするか省きます。色と書体はこのサイトのものです。
コードから読めること
2026-10-06 に読んだコミット 3e573da398fc のソースから。最初のまとまりが載せる条件で、残りは自分で判断するための材料です。後のコミットは、次に読むまで見ていません。
| 載せる条件: 確かめやすいコード | |
|---|---|
| 入口を読んだ | hooks/hooks.json が名指すモジュールをすべて読んだ。plugins/avatars/hooks/register.tsx |
| 解析できる | すべてのファイルが TypeScript か JavaScript として解析できる。6 ファイルを解析 |
| コードが Mod の中で完結 | import は Mod 自身のファイルかエンジンのモジュールだけ。パッケージも require もない。コードはすべて Mod の中 |
| 読める | 圧縮した行・eval・new Function・計算した道の import()・符号化した塊がない。圧縮・eval・符号化した塊なし |
| 呼び出しが見える | 通信とプログラム起動はその場で $.http.fetch・$.process.run と書き、他へ渡さない。外への呼び出しはすべてその場の $ で |
| 入れる前に自分で判断する材料 | |
| 描く場所 | コードから読んだ、描く先。ターミナル・デスクトップアプリ・両方・何も描かない(フックだけ: 見張りやプロンプトの書き換え)のどれか。出すだけで、外す理由にはしない。ターミナルとデスクトップアプリに同じように描く |
| 入れる手順 | リポジトリ自身の .claude-plugin/marketplace.json にこの Mod が載っていて、ページに書いた手順でそのマーケットプレイスから入れられるか。リポジトリの .claude-plugin/marketplace.json に載っており、そこから入れられる |
| Windows のプログラム | $.process で起動するプログラムが Windows にあるか(tail・date・open・osascript・/usr/… などは無い)。Windows にないプログラムを使わない |
| 通信 | fetch の送り先(https のホスト)がコードに書いてあるか。plugins/avatars/hooks/register.tsx:508 fetch(`${API}/v1/voices/add/${owner}/${voice}`); plugins/avatars/hooks/register.tsx:703 fetch(`${API}${path}`); plugins/avatars/hooks/register.tsx:740 fetch(`${API}/v1/voices/${voice}`); plugins/avatars/hooks/register.tsx:1105 fetch(`${API}/v1/voices/${voice}`) |
| プログラム | 起動するプログラムの名前がコードに書いてあり、シェル・インタプリタ・通信用の道具でないか。plugins/avatars/hooks/register.tsx:458 実行時に決まるプログラム; plugins/avatars/hooks/register.tsx:726 実行時に決まるプログラム |
| 読んで送る | ファイルや環境変数を読み、かつ通信するか。reads environment variables and files and reaches the network |
| ソースの鍵 | ソースに API キーや秘密鍵らしきものがあるか。ソースに鍵なし |
| ライセンス | オープンなライセンス(MIT・Apache-2.0・BSD・ISC・Unlicense・0BSD・CC0)で全文があれば、modscode にコードを載せる。違えばリンクだけ。MIT |
コードの文面を読んだだけで、安全の審査ではありません。動かしてはおらず、起動するプログラムの中で何が起きるかも見えません。入れる前の確認はあなたの役目です。 載せる条件
入れる
入れる前に、必ず自分で確かめてください。Mod はサンドボックスなしで、あなたの権限で動きます。modscode はこのコードの安全を保証しません。下のコードを読み(またはフォルダーで claude plugin validate .)、触るものを見て、読んだコミットを入れてください。
リポジトリがそのままマーケットプレイスです。このマーケットプレイスを足し(ターミナルでは次のコマンド、デスクトップアプリではプラグインの設定)、そこから Mod を入れます。
/plugin marketplace add dead-money/claude-plugins/plugin install avatars@dead-money入るのはマーケットプレイスの最新のコミットで、ここで読んだもの(3e573da398fc)と違うことがあります。入れる前に見比べてください。
Claude に聞く
modscode のコネクタを入れると、Claude がこのデザイン・コードが触るもの・コードを読んで、それをもとに作れます。たとえば:
modscode のデザイン「dead-money-avatars」をコードごと読んで、同じようなペインを作って似たデザイン
-
Claude に頼む…Xcodebuild · App · 31/3◐ Rendering App…Write↻ Re-render (r) r✦ Ask Claude (x) x◀ (h) h▶ (l) lOpen (o) o
-
Claude に頼む…Skins0 Your promptadd rate limiting to the hub api0 Tool rows: finished, running, failedYour prompt Spinner0 Folded group of reads and searches●main · note 3 · note 3 · note 30 Edit diff cardDesktop only; the terminal keeps Claude Code's diff.0 Shell output cardDesktop only.0 Code block cardDesktop only; the terminal keeps Claude Code's markdown.0 TableAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentCopyAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentCopyAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentCopy0 SpinnerAccent SpinnerSpinnerSpinner… 2h 10m0 Band above the prompt: normal, then nudging to compact█████░░░ 42% build█████░░░ 42% build█████░░░ 42% buildContext is 42% full0 Compact now0 Band above a questionTable BashBashBash0 Turn footer (terminal)3 build in 2h 10m · Grep · +3 −3
-
Claude に頼む…agent-discoverbuildbuildbuildRefreshMCP Browse/3Tab / shift+Tab move · Enter presses · ↑↓ scroll · Esc back to the promptBrowse...Audit asks:DeclineAcceptDeclineCancelAudit asks:DeclineAcceptDeclineCancelAudit asks:DeclineAcceptDeclineCancel
-
Claude に頼む…Fanyi settingsOnAPI · OpusenOn this MacAPIHost src/ SaveKey K · paste a new one, Enter SaveOpus↻ RefreshCustom model model id, for an API that lists none UseFanyi settingsHostClose
-
● pace Write · Park to1 park 12 dismiss 2pace: resume point 2h 10m · Fix login · 33 resume 34 discard 45 all 3 5pace: Park to resume point older than 7 days6 clear 6Claude に頼む…
-
Claude に頼む…Model routerLast reply: Fix login → a1b2c3dKept off Opus to save the cache. Start a prompt with @Opus to force it.OnOffRoutes model and effort for each kind of prompt0 Fix loginbuildbuildbuildbuildbuildbuild0 Fix loginbuildbuildbuildbuildbuildbuild0 Fix loginbuildbuildbuildbuildbuildbuildYour rules checked firstNo rules yet. Pick a model and effort, type the words, press Add rule.Tasksa1b2c3d✕Tasksa1b2c3d✕Tasksa1b2c3d✕words, for example landing page, redesign Add rulebuildbuildbuildbuildbuildbuildOptions CoolingWhen still broken after xhigh, move tobuildbuildbuildCache saver: skip one-off model switches in long chatsbuildbuildbuildOne prompt only: start it with @opus, @max or @hardReset