Building an RPG inside Claude Code to learn Claude Mods

7 min read

The tools developers love longest tend to share one trait: they ship with the means to change them. Emacs is extended in its own Lisp. Spreadsheets became platforms when users could write macros. VS Code’s extensions turned an editor into whatever each team needed. When a tool ships with the tools to change it, its users invent things its makers never planned for.

Claude Code now ships with those tools.

Claude Mods are code that runs inside Claude Code itself. A mod can draw a pane beside the conversation, add a band above the prompt, register a command that runs instantly, step into a tool call, call a model, or start a process. It is the difference between extending what Claude knows and changing the tool Claude runs in.

From the outside to the inside

Claude Code has been extensible for a while, but always from the outside. Skills give Claude instructions. MCP servers give it tools. Settings hooks run a shell script when something happens. Each one feeds Claude text or tools, or reacts from a separate process.

A mod is a plugin made of JavaScript or TypeScript event handlers that Claude Code calls in its own process. When something happens — a tool call, a submitted prompt, a part of the interface being drawn — Claude Code runs the mod’s hook first, and the hook decides what happens next. It can observe the event, rewrite it, or answer it so the default behavior never runs.

That model is simple and remarkably far-reaching. According to the docs, a mod can:

  • Draw an interface you can use: a pane beside the transcript or a band above the prompt, with tabs, buttons, and text fields.
  • Redraw Claude Code’s own interface: restyle parts Claude Code draws itself, such as a tool call’s row, the spinner, or the question dialog.
  • Step into a tool call or a request: hold a tool call while asking the user a question, answer it without running the tool, or send a request to a different model.
  • Run code on a command: a /command that runs a function immediately, with no Claude turn, even while Claude is working.
  • Share data between hooks: what one hook records, another can show.

Mods run in the Claude Code CLI, the Code tab of the Desktop app, and the VS Code extension, and install from a plugin marketplace like any other plugin.

A mod in ten lines

The example from the docs captures the model well. Two hooks share one variable: one counts tool calls, the other shows the count beside the spinner.

let calls = 0

export function register(on) {
  on('tool.call', async ($, e, next) => {
    calls += 1
    $.ui.invalidate('ui.render')
    return next(e)
  })

  on('ui.render', { component: 'Spinner' }, async ($, e, next) => {
    return next({ ...e, props: { ...e.props, suffix: ' · tool calls: ' + calls + '…' } })
  })
}

Every hook receives the mods API ($), the event (e), and next, which runs everything beneath it, including Claude Code’s own behavior. Calling next(e) lets the event continue. Calling it with a changed event rewrites it. Returning without it takes the event over. It is middleware for a coding agent.

With a manifest and a one-line hooks.json, that is a complete mod.

While Claude works, the spinner now keeps score:

Claude Code at work with the tool-call counter mod: after a Bash call and two reads, the spinner reads Thinking · tool calls: 3

A developer experience built for agents

The tooling around mods is as notable as the API itself.

Claude writes mods. Claude Code ships with a plugin-authoring skill. Describe the mod you want in a session and Claude writes it, with the types for the exact build you are running.

Edits reload live. claude --plugin-dir ./my-mod loads a mod for one session and reloads it as files change.

Mods are testable. claude plugin test runs a mod’s tests against a mocked engine, with no session required.

Mods are reviewable before they run. claude plugin validate reads a mod without executing it and lists every event it handles and every call it makes — files, processes, network, models. Because a hook can only reach the outside world through the mods API, that list is complete. It also flags gating hooks, the ones that can refuse an action.

That last point matters, because mods are powerful by design. A mod runs with the user’s permissions and is not sandboxed. The platform answers this with transparency rather than restriction: validate a mod before installing it, install only from trusted marketplaces, and, for organizations, use managed settings to control which mods load.

Put together, these properties make mods unusually well suited to agentic development. A testable API, a static report of every side effect, and live reload give an agent everything it needs to build, check, and iterate on its own.

Learning Mods by Building Questline

To explore how far mods can go, Very Good Ventures built Questline: an idle ASCII role-playing game that lives inside Claude Code and is built entirely from a developer’s own sessions.

The Questline pane on the Hero tab: an ASCII gnome in its gear, level 18, an XP bar, a streak and six attributes

The premise is that Claude Code transcripts are already a game log. Every session records each prompt, tool call, error, plan, compaction, and token. Read as data, those records reveal habits: contexts that compact because they were never cleared, the same failing command run four times, a pull request merged without checking CI, and also the good patterns — a plan approved before the first edit, a search delegated to a subagent.

Questline turns that record into a hero. Its six attributes are habits such as planning before building and keeping contexts focused. Anti-patterns are monsters, each paired with its remedy. Every Claude Code feature is a spell, and the ones a developer has never used appear as runes with a hint on how to learn them.

The Bestiary tab: the Context Kraken, the Loop Goblin and the Blind Merger, each with its remedy

The Spellbook tab: learned spells, then uncast runes with how to learn each

Each day brings three quests targeted at the habits that need work, and Sonnet writes a short chronicle of the previous day from its numbers alone. An Opus research agent, the Loremaster, reads the Claude Code changelog after each update and adds spells and quests for new features. A single line above the prompt opens each day, then gets out of the way.

The Quests tab: habit, discovery and stretch quests, a forged item's quest, and three Mirror prophecies

The Chronicle tab: the previous day's story as the Oracle tells it, the Sage's counsel, and the Loremaster's new runes from the changelog

The dawn band above the Claude Code prompt

The game exercises almost the entire mods surface: a pane with six tabs, a band above the prompt, toasts, a slash command, model calls, a background agent, files, and processes. It also had to meet a strict rule — outside the moments it is opened, it must be invisible. Meeting that rule shows how the mods API rewards careful design:

  • Few hooks, all non-blocking. Questline listens only to session start, turn start and end, its own command, and its own drawing. It never hooks tool calls or prompts, calls next() before doing its own work, and every hook fails open.
  • Context stays clean. A command’s reply enters the model’s context, so /quest returns one line of about five tokens. Everything else lives in the pane.
  • Zero-token reading. Transcripts are parsed with plain code, never sent to a model. Model calls are capped and shown in the pane as a monthly budget.
  • Self-imposed sandboxing. Every file and process call goes through one module with read and write allow-lists, and a build check fails if anything goes around it.
  • Verified end to end. Beyond 172 unit tests, a gate script drives the mod in a real Claude Code through a pseudo-terminal and checks every screen. The screenshots in this post come from the same harness.

That gate is what let Claude build Questline largely on its own, in a loop of implement, verify, and fix, in about a day. A game that teaches Claude Code, built by Claude Code, running inside Claude Code.

Questline is internal to VGV for now. If you want to try it, get in touch or ask us on LinkedIn or X.

What mods make possible

Questline is a game, but the pattern is general: read what Claude Code already records, compute something useful locally, and show it where developers already work. That opens several directions:

  • Coaching without surveillance. Measure planning, delegation, and CI discipline locally, and share only aggregates.
  • Guardrails that teach. Hold a risky command, explain the habit behind it, and track whether it recurs.
  • Team-specific onboarding. A spellbook for a team’s own stack, with quests for its skills, commands, and conventions.
  • Workflow surfaces. Views across every running session and repository — VGV’s Switchboard mod, for example, shows which sessions are waiting on a permission prompt and which two are about to commit each other’s work.

For most of software history, changing how a development tool behaves meant waiting for its vendor. Mods move that power to the people who use the tool every day.

Getting started

The fastest way in is to look at what already exists. Claude Code’s own /diff pane is a built-in mod, and its source is public. Anthropic also publishes sample mods: token-weather draws a forecast of the context window above the prompt, blast-radius holds a risky shell command and shows what it would change, and replay-theater steps through the edits Claude made in the last turn.

From there, the Claude Mods documentation covers panes, events, the full API, testing, and organization controls. Or open Claude Code and describe the mod you wish existed.

One detail from Questline seems fitting. Its spellbook includes a spell called Modcraft, learned the first time a developer writes a mod. Learning it drops a Cat of Curiosity into the inventory.

It is a good time to earn one.

About the Author

David DeRemer

Co-Founder & CEO

ExecutiveFounder

David DeRemer is the founder and CEO of Very Good Ventures, the firm behind Flutter's flagship apps and Google's top-recommended Flutter partner. Drawing on over two decades of technology, innovation, and consulting experience, he focuses on where digital product experiences are heading as engineering shifts from hand-built interfaces to generative and agentic ones. When he's not thinking about what's next, he's building apps with his kids on Claude, having coffee with interesting people, or on the water with a fishing rod.

Frequently Asked Questions

What are Claude Mods?

Claude Mods are code that runs inside Claude Code itself. A mod is a plugin made of JavaScript or TypeScript event handlers that Claude Code calls in its own process. It can draw a pane beside the conversation, add a band above the prompt, register a command that runs instantly, step into a tool call, call a model, or start a process. See the Claude Mods documentation.

How are Claude Mods different from Claude Code hooks, skills, and MCP servers?

Skills give Claude instructions, MCP servers give it tools, and settings hooks run a shell script when something happens. Each one feeds Claude text or tools, or reacts from a separate process. A mod runs inside Claude Code's own process, so it can observe an event, rewrite it, or answer it so the default behavior never runs.

Are Claude Mods safe to install?

A mod runs with the user's permissions and is not sandboxed. The platform answers this with transparency rather than restriction: claude plugin validate lists every event a mod handles and every call it makes before it runs. Validate a mod before installing it, install only from trusted marketplaces, and, for organizations, use managed settings to control which mods load.

What is Questline?

Questline is an idle ASCII role-playing game that Very Good Ventures built inside Claude Code to explore how far mods can go. It reads a developer's own session transcripts and turns them into a hero: good habits become attributes, anti-patterns become monsters, and Claude Code features become spells.

Can I try Questline?

Questline is internal to VGV for now. If you want to try it, get in touch or ask us on LinkedIn or X. For agentic engineering work like this on your own team, see our agentic AI solutions.

Which Claude Code best practices does Questline reward?

Questline treats planning before building and keeping contexts focused as core habits. It rewards good patterns, such as approving a plan before the first edit and delegating a search to a subagent. It flags anti-patterns, such as the same failing command run four times, a context that compacts because it was never cleared, and a pull request merged without checking CI. Each anti-pattern appears as a monster paired with its remedy. For more on structured Claude Code workflows, see the VGV Wingspan workflow and how AskUserQuestion improves AI-assisted development.

How do I install a Claude Mod?

A mod is a plugin, so it installs from a plugin marketplace like any other plugin. To try your own, run claude --plugin-dir ./my-mod to load it for one session, and Claude Code reloads it as the files change. Before installing someone else's mod, run claude plugin validate to see every event it handles and every call it makes.

How do I build a Claude Mod?

Look at what already exists: Claude Code's built-in /diff pane is a mod with public source, and Anthropic publishes sample mods. Then read the Claude Mods documentation, or open Claude Code and describe the mod you want. Its plugin-authoring skill writes it for you. For a look at packaging Claude Code tooling as a plugin, see how we built VGV Wingspan, our Claude Code plugin.