modscode EN

modscode / 図鑑 / your-call

your-call

Choice UI tool (select, multi, rank, compare matrix, wizard, regenerate), in-thread charts from fenced viz blocks, plus skills ask-dont-guess, show-dont-tell, phone-a-friend and ask-the-audience

確かめやすいコードターミナル+デスクトップペイントーストBoxButtonInputText

何をするか

  • 欄・トーストを描く
  • ツールの呼び出しを見張る
  • prompt.compose・session.start・ui.closeにフックする

良いところ

  • ネットワークに出ない
  • プロセスを起こさない
  • TypeScript で書かれている
  • デスクトップ専用の分岐がある

作り始めるためのコード

2 種類あります。上のデザインから modscode が書いた雛形と、その Mod 自身のコードのうち描いている部分です。

雛形(register.tsx)

register.tsx
import type { Register } from 'claude-code'

// Drawn like your-call by Daniel Riddell (pane, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/danielriddell21-your-call/
// 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: "‹title›" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Text, Button, Input } = $.ui.resolve(e)
    const title = '…'
    const length = '…'
    const question = '…'
    const l = '…'
    const l2 = '…'
    const l3 = '…'
    const name = '…'
    const map = '…'
    const name2 = '…'
    const map2 = '…'
    const name3 = '…'
    const map3 = '…'
    const map4 = '…'
    const mark = '…'
    const label = '…'
    const detail = '…'
    const p = '…'
    const p2 = '…'
    const p3 = '…'
    const c = '…'
    const c2 = '…'
    const c3 = '…'
    const detail2 = '…'
    const p4 = '…'
    const p5 = '…'
    const p6 = '…'
    const c4 = '…'
    const c5 = '…'
    const c6 = '…'
    const detail3 = '…'
    const p7 = '…'
    const p8 = '…'
    const p9 = '…'
    const c7 = '…'
    const c8 = '…'
    const c9 = '…'
    return (
      <Box flexDirection="column">
        <Text>
          {title}
          {" "}
          {`(01/${length})`}
        </Text>
        <Text>
          {question}
        </Text>
        <Box flexDirection="column">
          <Text dimColor>
            {l}
          </Text>
          <Text dimColor>
            {l2}
          </Text>
          <Text dimColor>
            {l3}
          </Text>
        </Box>
        <Box flexDirection="column">
          <Text dimColor>
            {name}
            {": "}
            {map}
          </Text>
          <Text dimColor>
            {name2}
            {": "}
            {map2}
          </Text>
          <Text dimColor>
            {name3}
            {": "}
            {map3}
          </Text>
          <Text dimColor>
            {"total: "}
            {map4}
          </Text>
        </Box>
        <Box flexDirection="column">
          <Button label={`${mark} ${label}`} />
          <Text dimColor>
            {" "}
            {detail}
          </Text>
          <Text dimColor>
            {" + "}
            {p}
          </Text>
          <Text dimColor>
            {" + "}
            {p2}
          </Text>
          <Text dimColor>
            {" + "}
            {p3}
          </Text>
          <Text dimColor>
            {" - "}
            {c}
          </Text>
          <Text dimColor>
            {" - "}
            {c2}
          </Text>
          <Text dimColor>
            {" - "}
            {c3}
          </Text>
          <Input label="    tweak:" placeholder="optional note" value="" submitLabel="save" />
        </Box>
        <Box flexDirection="column">
          <Button label={`${mark} ${label}`} />
          <Text dimColor>
            {" "}
            {detail2}
          </Text>
          <Text dimColor>
            {" + "}
            {p4}
          </Text>
          <Text dimColor>
            {" + "}
            {p5}
          </Text>
          <Text dimColor>
            {" + "}
            {p6}
          </Text>
          <Text dimColor>
            {" - "}
            {c4}
          </Text>
          <Text dimColor>
            {" - "}
            {c5}
          </Text>
          <Text dimColor>
            {" - "}
            {c6}
          </Text>
          <Input label="    tweak:" placeholder="optional note" value="" submitLabel="save" />
        </Box>
        <Box flexDirection="column">
          <Button label={`${mark} ${label}`} />
          <Text dimColor>
            {" "}
            {detail3}
          </Text>
          <Text dimColor>
            {" + "}
            {p7}
          </Text>
          <Text dimColor>
            {" + "}
            {p8}
          </Text>
          <Text dimColor>
            {" + "}
            {p9}
          </Text>
          <Text dimColor>
            {" - "}
            {c7}
          </Text>
          <Text dimColor>
            {" - "}
            {c8}
          </Text>
          <Text dimColor>
            {" - "}
            {c9}
          </Text>
          <Input label="    tweak:" placeholder="optional note" value="" submitLabel="save" />
        </Box>
        <Input label="none fit? say what you want instead:" placeholder="then Enter to regenerate" value="" submitLabel="regenerate" />
        <Box>
          <Button label="Back" />
          <Button label="Review" />
          <Button label="Skip" />
        </Box>
      </Box>
    )
  })

  on('session.start', async ($, e, next) => {
    await $.ui.toast(`your-call: widen the terminal or reopen to answer`)
    return next(e)
  })
}

Mod 自身のコード

Mod のライセンス(MIT)に従って載せています。全文は下にあります。写すときは著作権表示を残してください。

plugins/your-call/hooks/register.tsx 166〜313 行 · ペイン
  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
    const { Box, Text, Button, Input } = $.ui.resolve(e)
    const v = await read($, view)

    if (!v) return <Text dimColor>No decision pending.</Text>

    const set = (fn: (x: View) => View) => update($, view, x => (x ? fn(x) : x))
    const step = v.steps[v.idx]
    const picks = v.picks[step.id] ?? []

    const toggle = (id: string) =>
      set(x => {
        const cur = x.picks[step.id] ?? []
        const next_ =
          step.kind === 'many' ? (cur.includes(id) ? cur.filter(c => c !== id) : [...cur, id]) : [id]
        return { ...x, picks: { ...x.picks, [step.id]: next_ } }
      })

    const move = (id: string, d: number) =>
      set(x => {
        const o = [...(x.picks[step.id] ?? [])]
        const i = o.indexOf(id)
        const j = i + d
        if (j < 0 || j >= o.length) return x
        ;[o[i], o[j]] = [o[j], o[i]]
        return { ...x, picks: { ...x.picks, [step.id]: o } }
      })

    const decisions = () =>
      v.steps.map(s => ({
        step: s.id,
        picks: v.picks[s.id],
        notes: Object.fromEntries(
          Object.entries(v.notes).filter(([k]) => k.startsWith(`${s.id}:`)).map(([k, t]) => [k.slice(s.id.length + 1), t]),
        ),
      }))

    if (v.phase === 'review') {
      return (
        <Box flexDirection="column">
          <Text>{v.title}: review</Text>
          {v.steps.map(s => (
            <Text key={`r-${s.id}`}>
              {s.question} {'->'} {(v.picks[s.id] ?? []).map(id => s.options.find(o => o.id === id)?.label ?? id).join(', ') || '(none)'}
            </Text>
          ))}
          <Box>
            <Button key="back" label="Back" onPress={() => set(x => ({ ...x, phase: 'step' }))} />
            <Button key="confirm" label="Confirm" onPress={() => finish?.({ decisions: decisions() })} />
          </Box>
        </Box>
      )
    }

    const ready = step.kind === 'rank' || picks.length > 0
    const isLast = v.idx === v.steps.length - 1
    const total = (id: string) => (step.criteria ?? []).reduce((a, c) => a + (c.scores[id] ?? 0), 0)

    return (
      <Box flexDirection="column">
        <Text>
          {v.title} {v.steps.length > 1 ? `(${v.idx + 1}/${v.steps.length})` : ''}
        </Text>
        <Text>{step.question}</Text>

        {step.viz && (
          <Box flexDirection="column">
            {textLines(step.viz, step.options, picks).map((l, i) => (
              <Text key={`v-${i}`} dimColor>{l}</Text>
            ))}
          </Box>
        )}

        {step.kind === 'compare' && step.criteria && (
          <Box flexDirection="column">
            {step.criteria.map(c => (
              <Text key={`c-${c.name}`} dimColor>
                {c.name}: {step.options.map(o => `${o.label} ${c.scores[o.id] ?? '-'}`).join(' | ')}
              </Text>
            ))}
            <Text dimColor>total: {step.options.map(o => `${o.label} ${total(o.id)}`).join(' | ')}</Text>
          </Box>
        )}

        {step.kind === 'rank'
          ? picks.map((id, i) => {
              const o = step.options.find(x => x.id === id)
              return (
                <Box key={`k-${id}`}>
                  <Text>
                    {i + 1}. {o?.label ?? id}{' '}
                  </Text>
                  <Button key={`u-${id}`} label="Up" onPress={() => move(id, -1)} />
                  <Button key={`d-${id}`} label="Down" onPress={() => move(id, 1)} />
                </Box>
              )
            })
          : step.options.map(o => {
              const on_ = picks.includes(o.id)
              const mark = step.kind === 'many' ? (on_ ? '[x]' : '[ ]') : on_ ? '(*)' : '( )'
              return (
                <Box key={`o-${o.id}`} flexDirection="column">
                  <Button key={`p-${o.id}`} label={`${mark} ${o.label}`} onPress={() => toggle(o.id)} />
                  {o.detail && <Text dimColor>    {o.detail}</Text>}
                  {o.pros?.map(p => <Text key={`+${o.id}${p}`} dimColor>    + {p}</Text>)}
                  {o.cons?.map(c => <Text key={`-${o.id}${c}`} dimColor>    - {c}</Text>)}
                  {on_ && (
                    <Input
                      key={`n-${step.id}-${o.id}`}
                      label="    tweak:"
                      placeholder="optional note"
                      value={v.notes[`${step.id}:${o.id}`] ?? ''}
                      submitLabel="save"
                      onInput={t => set(x => ({ ...x, notes: { ...x.notes, [`${step.id}:${o.id}`]: t } }))}
                      onSubmit={() => undefined}
                    />
                  )}
                </Box>
              )
            })}

        <Input
          key="regen"
          label="none fit? say what you want instead:"
          placeholder="then Enter to regenerate"
          value={v.regen}
          submitLabel="regenerate"
          onInput={t => set(x => ({ ...x, regen: t }))}
          onSubmit={t => finish?.({ regenerate: t.trim() || 'propose different options' })}
        />

        <Box>
          {v.idx > 0 && <Button key="prev" label="Back" onPress={() => set(x => ({ ...x, idx: x.idx - 1 }))} />}
          <Button
            key="next"
            label={isLast ? (v.steps.length > 1 ? 'Review' : 'Confirm') : 'Next'}
            onPress={() => {
              if (!ready) return
              if (!isLast) return set(x => ({ ...x, idx: x.idx + 1 }))
              if (v.steps.length > 1) return set(x => ({ ...x, phase: 'review' }))
              finish?.({ decisions: decisions() })
            }}
          />
          <Button key="skip" label="Skip" onPress={() => finish?.({ cancelled: true })} />
        </Box>
      </Box>
    )
  })
ライセンスの全文(MIT)
MIT License

Copyright (c) 2026 Daniel Riddell

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.

コードが呼ぶもの

ツール呼び出し

コードから読み取ったデザイン

読み取ったコミットのソースから描いたもので、動かした結果ではありません。一覧は 3 回描き、条件はデスクトップアプリで描く最初の分岐を取り、動かしたときにだけ決まる値は仮の例(点線の下線)にするか省きます。色と書体はこのサイトのものです。

コードから読めること

2026-10-06 に読んだコミット aed7eae9870c のソースから。最初のまとまりが載せる条件で、残りは自分で判断するための材料です。後のコミットは、次に読むまで見ていません。

載せる条件: 確かめやすいコード
入口を読んだhooks/hooks.json が名指すモジュールをすべて読んだ。plugins/your-call/hooks/register.tsx
解析できるすべてのファイルが TypeScript か JavaScript として解析できる。2 ファイルを解析
コードが 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 danielriddell21/skills
/plugin install your-call@danielriddell21-skills

入るのはマーケットプレイスの最新のコミットで、ここで読んだもの(aed7eae9870c)と違うことがあります。入れる前に見比べてください。

Claude に聞く

modscode のコネクタを入れると、Claude がこのデザイン・コードが触るもの・コードを読んで、それをもとに作れます。たとえば:

modscode のデザイン「danielriddell21-your-call」をコードごと読んで、同じようなペインを作って

Claude から探す: MCP コネクタ

似たデザイン