modscode JA

modscode / Gallery / prompt-quest

prompt-quest

An RPG layer for Claude Code: earn XP from sharp prompts and lean token use, spend skill points on perks, and learn AI lore.

Code you can checkTerminal + desktopPaneBandToastBoxButtonText

What it does

  • Draws a band above the prompt, a pane, toasts
  • Adds /quest
  • Watches tool calls and can refuse them
  • Hooks prompt.compose, prompt.submit, session.compact, session.end and 2 more
  • Keeps its own state between turns

Good points

  • No network calls
  • Written in TypeScript
  • Has a desktop-specific branch
  • Handles errors

Code to start from

Two kinds: a starter modscode writes from the design above, and the lines of the mod's own code that draw it.

Starter (register.tsx)

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

// Drawn like prompt-quest by tomikng (pane, band, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/tomikng-prompt-quest/
// 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 band above the prompt; what else goes there is drawn under it
  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
    const { Box, Text } = $.ui.resolve(e)
    const CLASS_ICON = '…'
    const level = '…'
    const titleOf = '…'
    const into = '…'
    const need = '…'
    const streak = '…'
    const rank = '…'
    const xp = '…'
    const notes = '…'
    const m = '…'
    const m2 = '…'
    const m3 = '…'
    const length = '…'
    const upgrade = '…'
    const tips = '…'
    const inTok = '…'
    const cacheWrite = '…'
    const k = '…'
    const ratio = '…'
    const k2 = '…'
    const k3 = '…'
    return (
      <Box flexDirection="column">
        <Box gap={1}>
          <Text>
            {CLASS_ICON}
          </Text>
          <Text color="#ffd166" bold>
            {"Lv "}
            {level}
          </Text>
          <Text>
            {titleOf}
            {" "}
            novice
          </Text>
          <Text color="#a78bfa">
            ########--------
          </Text>
          <Text dimColor>
            {into}
            /
            {need}
            {" XP"}
          </Text>
          <Text color="#fde047" bold>
            +
            {" skill point"}
            s
            : /quest skills
          </Text>
          <Text color="#fb923c">
            {"🔥 "}
            {streak}
            d
          </Text>
        </Box>
        <Box>
          <Text color="#111111" bold>
            {" "}
            {rank}
            {" "}
          </Text>
          <Text color="#5fff87" bold>
            {" "}
            +
            {xp}
            {" XP"}
          </Text>
          <Text dimColor wrap="truncate-end">
            {" · "}
            {notes}
          </Text>
        </Box>
        <Box gap={1}>
          <Text color="#ff9f43" bold>
            🎯 Missing:
          </Text>
          <Text backgroundColor="#3a3a52" color="#ffd166">
            {" "}
            {m}
            {" "}
          </Text>
          <Text backgroundColor="#3a3a52" color="#ffd166">
            {" "}
            {m2}
            {" "}
          </Text>
          <Text backgroundColor="#3a3a52" color="#ffd166">
            {" "}
            {m3}
            {" "}
          </Text>
          <Text dimColor>
            (
            {length}
            {" tips: /quest)"}
          </Text>
        </Box>
        <Text color="#5fff87" wrap="truncate-end">
          {"✏️ Try: "}
          {upgrade}
        </Text>
        <Text color="#5fb3ff" wrap="truncate-end">
          {"💡 "}
          {tips}
        </Text>
        <Text dimColor wrap="truncate-end">
          {"🪙 in "}
          {`${inTok}${cacheWrite}`}
          {" · cache "}
          {k}
          {" ("}
          {ratio}
          {"%) · out "}
          {k2}
          {" · session out "}
          {k3}
          {`/${k}`}
        </Text>
        {await next(e)}
      </Box>
    )
  })

  // the pane: open it with $.ui.open({ id: 'my-pane', title: "Prompt Quest" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Button } = $.ui.resolve(e)
    const label = '…'
    const i = '…'
    return (
      <Box flexDirection="column" gap={1}>
        <Box gap={1}>
          <Button label={`${label}`} hotkey={`${i}`} variant="primary" />
          <Button label={`${label}`} hotkey={`${i}`} variant="primary" />
          <Button label={`${label}`} hotkey={`${i}`} variant="primary" />
          <Button label="Close" hotkey="x" role="dismiss" />
        </Box>
      </Box>
    )
  })

  on('session.start', async ($, e, next) => {
    const name = '…'
    const b = '…'
    const titleOf = '…'
    await $.ui.toast(`📜 Quest complete: ${name}  +50 XP`)
    await $.ui.toast(`✨ LEVEL UP! You are now level ${b} (${titleOf}). +1 skill point. /quest skills`)
    return next(e)
  })
}

The mod's own code

Shown under the mod's licence (MIT); its text is below. Keep the notice if you copy these lines.

plugins/prompt-quest/hooks/register.tsx lines 404–462 · Band
  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
    const s = await read($, saveA)
    if (!s.showBand || e.props.hasSurvey) return next(e)
    const ss = await read($, sessionA)
    const { Box, Text } = $.ui.resolve(e)
    const lv = levelOf(s.xp)
    const cls = heroClass(s)
    const pts = points(s)
    const last = ss.last
    const g = last?.grade
    const purse = isActive(s, 'purse') && last
    const tips = last?.tips ?? []
    const missing = g?.missing ?? []
    const total = last ? last.inTok + last.cacheRead + last.cacheWrite : 0
    const ratio = total && last ? Math.round((last.cacheRead / total) * 100) : 0
    const els = $.ui.resolve(e) as Record<string, any>
    const Raster = e.surface === 'terminal' ? els.Raster : undefined
    if (Raster && e.requestId) bandRequest = e.requestId
    const hitNow = moodNow(await $.clock.now())
    return (
      <Box flexDirection="column">
        <Box gap={1}>
          <Text>{CLASS_ICON[cls]}</Text>
          <Text color="#ffd166" bold>Lv {lv.level}</Text>
          <Text>{titleOf(lv.level)} {className(cls)}</Text>
          {Raster
            ? <Raster key="xpbar" {...barCells(lv.into / lv.need, 20, 0x8b5cf6, 0xf472b6, frame, hitNow.mood === 'hit' ? lostShare(s.xp, hitNow.t) : 0)} />
            : <Text color="#a78bfa">{textBar(lv.into, lv.need)}</Text>}
          <Text dimColor>{lv.into}/{lv.need} XP</Text>
          {pts > 0 && <Text color="#fde047" bold>+{pts} skill point{pts > 1 ? 's' : ''}: /quest skills</Text>}
          {s.streak > 1 && <Text color="#fb923c">🔥 {s.streak}d</Text>}
        </Box>
        {g && last && (
          <Box>
            <Text backgroundColor={RANK_COLOR[g.rank]} color="#111111" bold> {g.rank} </Text>
            <Text color={last.xp >= 0 ? '#5fff87' : '#ff5f5f'} bold> {last.xp >= 0 ? '+' : ''}{last.xp} XP</Text>
            <Text dimColor wrap="truncate-end"> · {last.notes.join(', ')}</Text>
          </Box>
        )}
        {missing.length > 0 && (
          <Box gap={1}>
            <Text color="#ff9f43" bold>🎯 Missing:</Text>
            {missing.map(m => <Text backgroundColor="#3a3a52" color="#ffd166"> {MISSING_LABEL[m] ?? m} </Text>)}
            {tips.length > 1 && <Text dimColor>({tips.length} tips: /quest)</Text>}
          </Box>
        )}
        {g?.upgrade && <Text color="#5fff87" wrap="truncate-end">✏️ Try: {g.upgrade}</Text>}
        {!g?.upgrade && tips.length > 0 && (
          <Text color="#5fb3ff" wrap="truncate-end">💡 {tips[0]}</Text>
        )}
        {purse && last && (
          <Text dimColor wrap="truncate-end">
            🪙 in {k(last.inTok + last.cacheWrite)} · cache {k(last.cacheRead)} ({ratio}%) · out {k(last.outTok)} · session out {k(ss.outTok)}
            {isActive(s, 'budget') ? `/${k(s.budget)}` : ''}
          </Text>
        )}
      </Box>
    )
  })
plugins/prompt-quest/hooks/register.tsx lines 466–501 · Pane
  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
    const s = await read($, saveA)
    const ss = await read($, sessionA)
    const tab = await read($, tabA)
    const { Box, Text, Button } = $.ui.resolve(e)
    const width = e.props.bodyColumns
    const terminal = e.surface === 'terminal'
    look = { ...look, cls: heroClass(s), mood: ss.mood, moodAt: ss.moodAt, dmg: ss.dmg ?? look.dmg, rank: ss.last?.grade?.rank ?? look.rank, bar: levelOf(s.xp).into / levelOf(s.xp).need }
    paneLive = terminal

    const tabs: [Tab, string][] = [['hero', 'Hero'], ['skills', 'Skills'], ['quests', 'Quests'], ['lore', 'Lore'], ['rules', 'Rules']]
    const header = (
      <Box gap={1}>
        {tabs.map(([id, label], i) => (
          <Button key={`tab-${id}`} label={label} hotkey={String(i + 1)}
            variant={tab === id ? 'primary' : 'secondary'} onPress={() => update($, tabA, () => id)} />
        ))}
        <Button key="close" label="Close" hotkey="x" role="dismiss"
          onPress={async () => { paneLive = false; await $.ui.close({ id: PANE }) }} />
      </Box>
    )

    let body
    if (tab === 'skills') body = await skillsTab($, e, s)
    else if (tab === 'quests') body = questsTab($, e, s)
    else if (tab === 'lore') body = await loreTab($, e, s)
    else if (tab === 'rules') body = rulesTab($, e, ss)
    else body = await heroTab($, e, s, ss, width, terminal)

    return (
      <Box flexDirection="column" gap={1}>
        {header}
        {body}
      </Box>
    )
  })
Licence text (MIT)
MIT License

Copyright (c) 2026 tomikng

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.

What its code calls

runs programsdrives Claudetool callsremembers

The design, read from code

Drawn from the mod's source at the commit read, not from a run: a list is drawn three times, a condition takes its first branch that draws in the desktop app, and a value only the run time knows is shown as a made-up sample (dotted underline) or left out. Colours and type are this site's.

What its code shows

Read from the source at commit e287f2efb99c on 2026-10-06. The first group decides whether a mod is listed; the rest is for you to weigh. A later commit is not read until the next crawl.

Decides the listing: code you can check
Entry readEvery module hooks/hooks.json names was read.plugins/prompt-quest/hooks/register.tsx
ParsesEvery file parses as TypeScript or JavaScript.3 files parsed
All its code is in the modEvery import is a file of the mod or the engine's own module; no packages, no require.all its code is in the mod
ReadableNo minified lines, no eval or new Function, no import of a computed path, no encoded blobs.no minified code, no eval, no encoded blobs
Calls in the openNetwork and programs are reached as $.http.fetch and $.process.run in place, never passed around.every call outside goes through $ in the open
For you to weigh before installing
Where it drawsThe terminal, the desktop app, both, or nothing (hooks only: a guard or a prompt rewriter), as its code says. Shown, never a reason to leave a mod out.draws in the terminal and the desktop app, the same in both
Install lineWhether its repository's own .claude-plugin/marketplace.json lists it, so it installs from that marketplace with the lines on its page.listed in its repository's .claude-plugin/marketplace.json: installs from there
Programs on WindowsWhether every program it starts through $.process exists on Windows (tail, date, open, osascript, /usr/… do not).runs no program a Windows PC lacks
NetworkWhether every fetch names its https host in the code.no network
ProgramsWhether every program it starts is named in the code and is not a shell, an interpreter or a network tool.plugins/prompt-quest/hooks/register.tsx:880 a program named at run time
Reads and sendsWhether it both reads files or environment variables and reaches the network.reaches no network
Keys in the sourceWhether the source holds what looks like an API key or a private key.no keys in the source
LicenceAn open licence (MIT, Apache-2.0, BSD, ISC, Unlicense, 0BSD, CC0) with its text lets modscode show its code; otherwise the code is linked.MIT

This is a reading of the code text, not a security review: it does not run the mod, and it cannot see what a program the mod starts does. The check before installing is yours. How mods are chosen

Install it

Check it yourself before you install it. Mods run unsandboxed, with your permissions, and modscode does not vouch for what this code does. Read the code below (or run claude plugin validate . in its folder), weigh what it reaches, and install the commit you read.

Its repository is its marketplace. Add that marketplace (in the terminal with these commands, or in the desktop app's plugin settings) and install the mod from it:

/plugin marketplace add tomikng/prompt-quest
/plugin install prompt-quest@prompt-quest

This installs the marketplace's latest commit, which may not be the one read here (e287f2efb99c). Compare them before you install.

Ask Claude about it

With the modscode connector added, Claude can read this design, what its code reaches and its code, and build on them. Ask it like this:

Read the modscode design "tomikng-prompt-quest" with its code and make me a pane like it

Search them from Claude: the MCP connector

Similar designs