claudelingo
Pick up a foreign language while you work with Claude
確かめやすいコードターミナル+デスクトップペインバンドトーストBoxButtonClientInputMarkdownText
何をするか
- 欄・プロンプトの上の帯を描く
- /lingo を足す
- prompt.edit・prompt.submit・session.startにフックする
- ターンをまたいで自分の状態を持つ
良いところ
- ネットワークに出ない
- プロセスを起こさない
- TypeScript で書かれている
- デスクトップ専用の分岐がある
作り始めるためのコード
2 種類あります。上のデザインから modscode が書いた雛形と、その Mod 自身のコードのうち描いている部分です。
雛形(register.tsx)
register.tsx
import type { Register } from 'claude-code'
// Drawn like claudelingo by Keisuke Yoda (pane, band, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/yodakeisuke-claudelingo/
// 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: "🌐" })
on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
const { Box, Text, Button } = $.ui.resolve(e)
const value = '…'
const turnOff = '…'
const basics = '…'
const afterSend = '…'
const live = '…'
const card = '…'
const readAloud = '…'
const saveFailed = '…'
return (
<Box flexDirection="column">
<Box flexDirection="column">
<Box alignItems="center" gap={1}>
<Box width={14} flexShrink={0}>
<Text bold>
claudelingo
</Text>
</Box>
<Box alignItems="center" gap={2}>
<Box flexShrink={0}>
<Text color="success">
{`● ${value}`}
</Text>
</Box>
<Button label={`${turnOff}`} variant="secondary" />
<Box flexShrink={0}>
<Text color="success">
✓
</Text>
</Box>
</Box>
</Box>
</Box>
<Box flexDirection="column">
<Box alignItems="center" gap={1}>
<Box width={14} flexShrink={0}>
<Text bold>
{basics}
</Text>
</Box>
<Box alignItems="center" gap={2}>
<Box flexShrink={0}>
<Text color="success">
{`● ${value}`}
</Text>
</Box>
<Button label={`${turnOff}`} variant="secondary" />
<Box flexShrink={0}>
<Text color="success">
✓
</Text>
</Box>
</Box>
</Box>
</Box>
<Box flexDirection="column">
<Box alignItems="center" gap={1}>
<Box width={14} flexShrink={0}>
<Text bold>
{afterSend}
</Text>
</Box>
<Box alignItems="center" gap={2}>
<Box flexShrink={0}>
<Text color="success">
{`● ${value}`}
</Text>
</Box>
<Button label={`${turnOff}`} variant="secondary" />
<Box flexShrink={0}>
<Text color="success">
✓
</Text>
</Box>
</Box>
</Box>
</Box>
<Box flexDirection="column">
<Box alignItems="center" gap={1}>
<Box width={14} flexShrink={0}>
<Text bold>
{live}
</Text>
</Box>
<Box alignItems="center" gap={2}>
<Box flexShrink={0}>
<Text color="success">
{`● ${value}`}
</Text>
</Box>
<Button label={`${turnOff}`} variant="secondary" />
<Box flexShrink={0}>
<Text color="success">
✓
</Text>
</Box>
</Box>
</Box>
</Box>
<Box flexDirection="column">
<Box alignItems="center" gap={1}>
<Box width={14} flexShrink={0}>
<Text bold>
{card}
</Text>
</Box>
<Box alignItems="center" gap={2}>
<Box flexShrink={0}>
<Text color="success">
{`● ${value}`}
</Text>
</Box>
<Button label={`${turnOff}`} variant="secondary" />
<Box flexShrink={0}>
<Text color="success">
✓
</Text>
</Box>
</Box>
</Box>
</Box>
<Box flexDirection="column">
<Box alignItems="center" gap={1}>
<Box width={14} flexShrink={0}>
<Text bold>
{readAloud}
</Text>
</Box>
<Box alignItems="center" gap={2}>
<Box flexShrink={0}>
<Text color="success">
{`● ${value}`}
</Text>
</Box>
<Button label={`${turnOff}`} variant="secondary" />
<Box flexShrink={0}>
<Text color="success">
✓
</Text>
</Box>
</Box>
</Box>
</Box>
<Text color="error">
{saveFailed}
</Text>
</Box>
)
})
// the band above the prompt; what else goes there is drawn under it
on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
const { Box, Text, Button, Input, Markdown } = $.ui.resolve(e)
const sample = '…'
const pron = '…'
const toField = '…'
const speakAndEnter = '…'
const tip = '…'
const coached = '…'
const part = '…'
const part2 = '…'
const part3 = '…'
const playing = '…'
const again = '…'
return (
<Box flexDirection="column" gap={1}>
<Box flexDirection="column" gap={0} paddingRight={4}>
<Box justifyContent="space-between">
<Box gap={1}>
<Text>
{sample}
</Text>
<Text dimColor italic>
{pron}
</Text>
</Box>
<Button label="✕" plain dimColor role="dismiss" />
</Box>
<Box gap={1}>
<Input placeholder={`${toField}${speakAndEnter}`} value="" autoFocus />
<Box>
<Button label="?" plain dimColor />
<Box position="absolute" display="none">
<Text inverse>
{` ${tip} `}
</Text>
</Box>
</Box>
</Box>
<Text dimColor>
{coached}
</Text>
<Box flexDirection="column">
<Box gap={1}>
<Text>
<Text color="error" underline>
{part}
</Text>
<Text color="error" underline>
{part2}
</Text>
<Text color="error" underline>
{part3}
</Text>
</Text>
</Box>
<Markdown dimColor text={`💡 ${tip}`} />
<Markdown dimColor text={`💡 ${tip}`} />
<Markdown dimColor text={`💡 ${tip}`} />
</Box>
<Box gap={1}>
<Button label={`🔊 ${sample}`} />
<Text dimColor>
{`×${playing}`}
</Text>
<Button label={`${again}`} />
</Box>
</Box>
{await next(e)}
</Box>
)
})
}
Mod 自身のコード
Mod のライセンス(MIT)に従って載せています。全文は下にあります。写すときは著作権表示を残してください。
src/hooks/register.tsx 17〜17 行 · ペイン
on('ui.render', { component: 'Pane', requestId: SETTINGS_PANE }, settingsPaneDrawn)src/hooks/features/settings/settings.tsx 44〜57 行 · ペイン
export const settingsPaneDrawn: MatchedHook<'ui.render', { component: 'Pane'; requestId: typeof SETTINGS_PANE }> = async ($, e) => {
const settings = await settingsOf($)
const w = LingoSettings.wording(settings.native)
// スマホには入力欄がないので、開く場所を案内する
if (e.surface === 'mobile') {
const { Text } = $.ui.resolve(e)
return <Text dimColor>{w.openElsewhere}</Text>
}
const t = $.ui.resolve(e)
const isTerminal = e.surface === 'terminal'
// 設定の下に、書いた語の草
const grass = grassGraph(t, w, isTerminal, Grass.of(await $.store.get('words'), Grass.day(await $.clock.now())), e.props.bodyColumns)
return settingsPane(t, w, isTerminal, settings, await read($, denied), await read($, saved), (field, value) => void changeSetting($, field, value), grass)
}src/hooks/ui/settings-pane/settings-pane.tsx 14〜69 行 · ペイン
export const settingsPane = (t: Elements[Exclude<keyof Elements, 'mobile'>], w: Wording, isTerminal: boolean, settings: Settings, denied: string, saved: string, save: Save, grass: RenderElement) => {
const { Box, Text, Button, Input, Select } = t
const room = isTerminal ? 0 : 1
const check = (key: keyof Settings) => saved === key && <Box flexShrink={0}><Text color="success">✓</Text></Box>
const field = (label: string, key: keyof Settings, control: RenderElement) => (
<Box alignItems="center" gap={1} paddingLeft={2}>
<Box width={12} flexShrink={0}><Text dimColor>{label}</Text></Box>
{control}
{check(key)}
</Box>
)
const group = (title: string, key: Switch | null, ...fields: RenderElement[]) => {
const on = key === null || settings[key]
return (
<Box flexDirection="column" gap={room}>
<Box alignItems="center" gap={1}><Box width={14} flexShrink={0}><Text bold dimColor={!on}>{title}</Text></Box>{key && onOff(key)}</Box>
{on && fields}
</Box>
)
}
const onOff = (key: Switch) => (
<Box alignItems="center" gap={2}>
<Box flexShrink={0}>{settings[key] ? <Text color="success">{`● ${w.on}`}</Text> : <Text dimColor>{`○ ${w.off}`}</Text>}</Box>
<Button key={key} label={settings[key] ? w.turnOff : w.turnOn} variant="secondary" onPress={() => save(key, !settings[key])} />
{check(key)}
</Box>
)
const model = (key: 'model' | 'liveModel' | 'cardModel') => field(w.model, key, <Select key={key} options={LingoSettings.models().map(value => ({ value }))} value={settings[key]} onSelect={value => save(key, value)} />)
const nudge = (by: 1 | -1, label: string) => <Button key={`livePause-${label}`} label={label} variant="secondary" onPress={() => save('livePause', LingoSettings.step(settings.livePause, by))} />
// 欄は数が収まる幅だけ取る。狭い面では折り返す
const pause = (
<Box alignItems="center" gap={1} flexWrap="wrap">
{nudge(-1, '-')}
<Box width={6} flexShrink={0} flexDirection="column"><Input key="livePause" value={settings.livePause} onSubmit={v => save('livePause', LingoSettings.pause(v, settings.livePause))} /></Box>
<Text>{w.seconds}</Text>{nudge(1, '+')}
</Box>
)
const text = (field: 'native' | 'target' | 'voice', placeholder?: string) => <Box width={28} minWidth={0} flexShrink={1} flexDirection="column"><Input key={field} value={settings[field]} placeholder={placeholder} onSubmit={v => save(field, LingoSettings.entered(field, v, settings[field]))} /></Box>
// 欄は minWidth 0 で狭い面に合わせて縮む。レベルは自由記述なので残りの幅を使い、書く粒度(できること・苦手なこと)を例で見せる
const level = <Box flexGrow={1} minWidth={0} flexDirection="column"><Input key="level" value={settings.level} placeholder={w.levelExample} onSubmit={v => save('level', v)} /></Box>
return (
<Box flexDirection="column" gap={room} paddingX={room * 2} paddingY={room}>
{group('claudelingo', 'enabled')}
{settings.enabled && [
// 基本のモデルは送った後の訳のほか、返事の訳・発音記号・コーチ・例文などにも使うので、いつも見える所に
group(w.basics, null, field(w.native, 'native', text('native')), field(w.target, 'target', text('target')), field(w.level, 'level', level), model('model')),
group(w.afterSend, 'afterSend'),
group(w.live, 'live', model('liveModel'), field(w.pause, 'livePause', pause)),
group(w.card, 'card', model('cardModel')),
group(w.readAloud, null, field(w.voice, 'voice', text('voice', w.voiceHint))),
grass,
]}
{denied && <Text color="error">{w.saveFailed(denied)}</Text>}
</Box>
)
}src/hooks/register.tsx 20〜20 行 · バンド
on('ui.render', { component: 'AbovePrompt' }, abovePrompt)src/hooks/features/learning/learning.tsx 286〜298 行 · バンド
export const abovePrompt: MatchedHook<'ui.render', { component: 'AbovePrompt' }> = async ($, e, next) => {
if (e.props.hasSurvey) return next(e)
// 入力欄の上の帯は端末と Desktop にしかない
const t = $.ui.resolve(e) as Parameters<typeof practiceBand>[0]
const settings = await settingsOf($)
const band = await draftBandOf($, t, e.surface === 'terminal', settings)
const opened = await read($, practice)
if (!opened || !settings.enabled) return band ?? next(e)
// 欄の文は打つたびに残す(描き直しで消えないように)。描き直しはしない
const hands = { keep: (text: string) => void update($, practice, now => SpeakingPractice.kept(now, text)), hear: (heard: string) => void hear($, heard), say: () => void say($, [opened.sample]), again: () => void showPractice($, SpeakingPractice.again), help: (text: string) => $.ui.toast(text, { timeoutMs: 15000 }), close: () => void showPractice($, () => null) }
const { Box } = t
return <Box flexDirection="column" gap={1}>{practiceBand(t, LingoSettings.wording(settings.native), e.surface === 'terminal', opened, SpeakingPractice.shown(settings.native, opened.coach), hands, (await read($, speaking))[opened.sample] ?? 0)}{band}</Box>
}src/hooks/ui/practice-band/practice-band.tsx 16〜48 行 · バンド
export const practiceBand = (t: Elements[Exclude<keyof Elements, 'mobile'>], w: Wording, isTerminal: boolean, practice: Practice, coached: Coached, hands: Hands, playing = 0) => {
const { Box, Button, Input, Markdown, Text } = t
const head = (text: string) => <Box width={8} flexShrink={0}><Text dimColor bold>{text}</Text></Box>
return (
<Box flexDirection="column" gap={isTerminal ? 0 : 1} paddingRight={isTerminal ? 4 : 0}>
<Box justifyContent="space-between">
<Box gap={1}>{head(w.sample)}<Text>{practice.sample}</Text>{practice.pron && <Text dimColor italic>{practice.pron}</Text>}</Box>
<Button key="practice-close" label="✕" plain dimColor role="dismiss" onPress={hands.close} />
</Box>
<Box gap={1}>
{head(w.attempt)}
<Input key="practice" placeholder={`${isTerminal ? w.toField : ''}${w.speakAndEnter}`} value={practice.heard ?? ''} autoFocus onInput={hands.keep} onSubmit={hands.hear} />
{/* 声は手元の音声入力で欄に入れる(mods にマイクはない)。その案内は ? のホバーと押下で出す */}
{glyph(t, 'practice-help', '?', w.voiceHelp, () => hands.help(w.voiceHelp))}
</Box>
{typeof coached === 'string' && (practice.coach === null ? ticker(t, isTerminal, 'practice-listening', 'wait', coached) : <Text dimColor>{coached}</Text>)}
{typeof coached === 'object' && (
<Box flexDirection="column">
<Box gap={1}>
{head(w.heard)}
<Text>{Restatements.parts(coached.restated).map((part, i) => (i % 2 ? <Text color="error" underline>{part}</Text> : <Text>{part}</Text>))}</Text>
</Box>
{coached.tips.map(tip => <Markdown dimColor text={`💡 ${tip}`} />)}
</Box>
)}
<Box gap={1}>
<Button key="practice-speak" label={`🔊 ${w.sample}`} onPress={hands.say} />
{playing > 0 && ticker(t, isTerminal, 'practice-sound', 'sound', playing > 1 ? `×${playing}` : '')}
<Button key="practice-again" label={w.again} onPress={hands.again} />
</Box>
</Box>
)
}ライセンスの全文(MIT)
MIT License Copyright (c) 2026 Keisuke Yoda 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 を動かす保存
コードから読めること
2026-10-06 に読んだコミット e861fc963e6a のソースから。最初のまとまりが載せる条件で、残りは自分で判断するための材料です。後のコミットは、次に読むまで見ていません。
| 載せる条件: 確かめやすいコード | |
|---|---|
| 入口を読んだ | hooks/hooks.json が名指すモジュールをすべて読んだ。src/hooks/register.tsx |
| 解析できる | すべてのファイルが TypeScript か JavaScript として解析できる。40 ファイルを解析 |
| コードが 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 のホスト)がコードに書いてあるか。通信なし |
| プログラム | 起動するプログラムの名前がコードに書いてあり、シェル・インタプリタ・通信用の道具でないか。プログラムを起動しない |
| 読んで送る | ファイルや環境変数を読み、かつ通信するか。通信しない |
| ソースの鍵 | ソースに API キーや秘密鍵らしきものがあるか。ソースに鍵なし |
| ライセンス | オープンなライセンス(MIT・Apache-2.0・BSD・ISC・Unlicense・0BSD・CC0)で全文があれば、modscode にコードを載せる。違えばリンクだけ。MIT |
コードの文面を読んだだけで、安全の審査ではありません。動かしてはおらず、起動するプログラムの中で何が起きるかも見えません。入れる前の確認はあなたの役目です。 載せる条件
入れる
入れる前に、必ず自分で確かめてください。Mod はサンドボックスなしで、あなたの権限で動きます。modscode はこのコードの安全を保証しません。下のコードを読み(またはフォルダーで claude plugin validate .)、触るものを見て、読んだコミットを入れてください。
リポジトリがそのままマーケットプレイスです。このマーケットプレイスを足し(ターミナルでは次のコマンド、デスクトップアプリではプラグインの設定)、そこから Mod を入れます。
/plugin marketplace add yodakeisuke/claudelingo/plugin install claudelingo@claudelingo入るのはマーケットプレイスの最新のコミットで、ここで読んだもの(e861fc963e6a)と違うことがあります。入れる前に見比べてください。
Claude に聞く
modscode のコネクタを入れると、Claude がこのデザイン・コードが触るもの・コードを読んで、それをもとに作れます。たとえば:
modscode のデザイン「yodakeisuke-claudelingo」をコードごと読んで、同じようなペインを作って似たデザイン
-
Claude に頼む…────────Clear doneClaude⋯└─ buildCancelCancelCancel└─ buildCancelCancelCancel└─ buildCancelCancelCancel
-
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 に頼む…Glossary BrowserGlossary openContextsContextsContexts▲ prevWrite1/Glossary▼ nextContexts
-
Claude に頼む…envbuildbuildbuild+ .env.localsrc/app.ts is not in .gitignoreWriteNo .env files in the project root yet.K = paste the value, Enter saves saveNew key: NAME, Enter to continuegenerate randomcancelMissing compared with Write:KKK
-
Claude に頼む…GitHub inboxGitHubloading…Refresh rbuildbuildbuildClose xStealth IssuesNo open issues in this view.#3 Fix login · Pinned notice · 2h 10m · Top row commentsWork on itopen#3 Fix login · Pinned notice · 2h 10m · Top row commentsWork on itopen#3 Fix login · Pinned notice · 2h 10m · Top row commentsWork on itopenPull requestsNo open pull requests.#3 Fix login · main · draft · build · HiddenChecksReviewopen#3 Fix login · main · draft · build · HiddenChecksReviewopen#3 Fix login · main · draft · build · HiddenChecksReviewopenChecks for #3Plain
-
Claude に頼む…ReviewPR #3 Fix loginbranche couranteà traiter ▸3 ▸3 ▸3 · en relecture ▸3 ▸3 ▸3▸◉3 a1b2c3d ↩ répondu obsolète → Claude Review▸◉3 a1b2c3d ↩ répondu obsolète → Claude Review▸◉3 a1b2c3d ↩ répondu obsolète → Claude Review────────fil 31/3 Review ↗ GitHub
Review@alexReview@alexReview@alexReviewRéponse : Review publierEntrée publie · Esc annule la réponse · les touches n, p… tapent dans le champ… ReviewLe panneau n'a pas le clavier : ctrl+x tab ou un clic, et les touches marchent.p préc. n suiv. t PR suiv. x démarquer a tout démarquer f corriger (3) r répondre v résoudre o web q fermer