Claude Code · plugin mods

Twenty words,
one mod.

Everything you need to read a Claude Code mod: how it loads, how it draws a pane, and the TypeScript underneath. Scroll down.

20terms
3chapters
1example: a usage pane
Chapter 1

Anatomy of a mod

A mod is a small bundle. The engine reads a config file, loads one TypeScript file, and that file wires up everything.

hooks.jsonnames the file to load
→
hooks moduleone .ts file
→
register()runs at load
→
hooksone per event
→
panedrawn beside chat
01

Mod

A Claude Code plugin that changes the app's interface or behaviour, like your subagent-spend.

02

Pane

A side panel a mod draws beside the chat, like your Usage window.

03

Hooks module

One TypeScript file exporting register, which attaches code to engine events.

07

hooks.json

Small config file telling the engine which hooks module file to load.

06

register

The function a hooks module exports; it adds every hook when the mod loads.

Chapter 2

How data reaches the pane

Follow one number, your usage, from the API response to a bar on screen.

API responselatest reply
→
$.session.usage()free call
→
session.measureevent + hook
→
Atomstored value
→
ui.renderredraw
Usagelive
Context fill62%
5-hour limit41%
Weekly limit78%
10

$.session.usage()

Free call returning context fill and rate limits from the last API response.

20

Rate limit

Your plan's usage cap per window, here 5-hour and weekly percentages.

09

Button / onPress

A clickable element; onPress is the code that runs when clicked.

12

Atom

A stored value a pane reads; changing it makes the pane redraw.

04

Hook

A function the engine runs when its event fires, like a tool call or prompt.

05

Event

Something the engine announces, such as session.measure, ui.render or tool.call.

11

session.measure

Event fired when usage figures move; the mod stores them for the pane.

08

ui.render

The event that asks a mod what to draw inside a pane.

Chapter 3

The language stack

You write TypeScript. The checker catches mistakes. What actually runs is plain JavaScript.

mod.tsxtypes + JSX
→
tscchecks types
→
strip typesJSX → calls
→
mod.jsruns
const used: number = 62;
const label: string = "Context";
const hot: boolean = used > 80;
const days: number[] = [1, 2];

// JSX: tags that describe what to draw
return <Box>{label}</Box>;
.tsTypeScript file
.tsxSame, plus JSX tags allowed
.jsWhat the engine runs

The : number label is a type annotation.

13

TypeScript

JavaScript with types added, checked before running, then stripped to plain JavaScript.

14

JavaScript

The programming language browsers and many tools run; TypeScript compiles into it.

15

tsc

The TypeScript checker; it finds type mistakes before the code ever runs.

16

.ts / .tsx

TypeScript file endings; .tsx also allows JSX tags inside the code.

17

JSX

HTML-like tags such as <Box> written inside code to describe what to draw.

18

Types

Kinds of values, such as number, string, boolean, lists, or object shapes.

numberstringbooleanlist
19

Type annotation

The : number label after a name, saying which type it holds.

Quick reference

All 20 terms

Jump back to any term. Colour shows the chapter: clay is anatomy, blue is data flow, green is language.