domain-modeling
Write a glossary, record ADRs, and clarify vague terms.
MAmattpocock/skills336k5,004 new stars in the last 7 days
Use when the user asks you to make, change, rebuild, switch off or remove a ThinkRail extension — agent tools with their own chat cards, settings or skills, added to ThinkRail as a package — or asks why one they made did not load. You write it to a local folder, build it with @thinkrail/extension-sdk and install it yourself by editing extensions.json. Not for plain pi packages, MCP servers, or ThinkRail's own built-in extensions.
A ThinkRail extension is an npm-style package with a thinkrail manifest. Its server half gives the
agent tools (pi registerTool), boolean settings, interactive tools and skills; its web half draws a
card in chat for a tool call. Either half may be missing: a web-only extension can give cards to tools
that come from elsewhere (a pi package, an MCP server). It cannot add panels, commands, menus,
non-boolean settings or translations — say so instead of faking them.
The user asked you to write it and install it: do both, without asking for a confirmation click.
managing-mcp-servers skill). An MCP server is not an extension.node --version # needs >= 22.19
npm --version
node <this skill's directory>/scripts/extensions.mjs where
where prints the data dir ($THINKRAIL_DATA_DIR, which ThinkRail gives every agent shell; otherwise
~/.thinkrail), the paths of extensions.json and status.json, api — the extension API this
ThinkRail loads (for example "1.0") — and hostReported, when the host last wrote its status. If both
are null, ThinkRail is older than this skill or not running: use "1.0" and verify in Settings →
Extensions.
npm view "@thinkrail/extension-sdk@~<api>.0" version
A version printed → go on. A network error → tell the user npm is unreachable. An E404 or no output →
the SDK is not on npm yet (it is published with the first ThinkRail release that supports extensions)
or not for this API:
reference/troubleshooting.md § SDK from a checkout) and go on;~/thinkrail-extensions/<slug>/ unless the user names one. Never inside the current
workspace, a chat folder or the data dir: ThinkRail deletes worktrees and owns
<data dir>/extensions/, and the folder is the user's source code.thinkrail-ext-<slug> (lowercase, npm rules). It is the extension's identity — the key
of its on/off switch and settings — so do not rename it later.word-count → wordcount), lowercase a–z.snake_case, specific to the extension (dice_roll, not roll). A name that a built-in
tool or an earlier extension already registers stays theirs, so never reuse a name from your own tool
list (read, bash, edit, write, …).<folder>/
package.json the manifest
.npmrc omit=peer
server/index.ts server half (TypeScript, loaded as source)
web/index.tsx web half entry (bundled by the build)
dist/web.js written by the build
dist/web.css written by the build
Start from the complete, working example in reference/example.md and change it. Details:
reference/server-half.md and reference/web-half.md. Leave out a half you do not need, together
with its manifest keys (no web half → no web, styles, scripts.build).
The thinkrail manifest — the host rejects the extension unless:
name is a valid npm name and not a built-in's; the server descriptor's name is exactly it;api is "major.minor" equal to api from step 1 (the SDK build accepts only its own API; the host
refuses another major or a newer minor);server / web; styles only together with web;.., no backslash: server ends in .ts/.mts/.cts/
.js/.mjs/.cjs, web in .js/.mjs, styles in .css;title / image, if present, are non-empty strings;@earendil-works/* and typebox are peerDependencies, never dependencies (ThinkRail provides
its own; the build fails otherwise). Put @thinkrail/extension-sdk in devDependencies and use
type-only SDK imports in the server half (export default { … } satisfies ServerExtension).cd <folder>
npm install --omit=peer # SDK from a checkout: npm install --save-dev --omit=peer <tarball>
npm run build # = thinkrail-extension build --prefix <prefix>
--omit=peer keeps ThinkRail's own pi and typebox out of the folder (it provides them). A server-only
extension has no web build; its SDK types are only needed during development. For a web half, check
before installing that the build exited 0 and dist/web.js and dist/web.css exist. Build errors — an import of a package you forgot to install among them —
name the file and the rule (reference/web-half.md § Build errors). The build does not type-check,
and the host loads the server half by stripping types: type errors do not stop it, runtime errors do —
step 7 shows them.
node <this skill's directory>/scripts/extensions.mjs add <folder>
It adds the absolute folder path to <data dir>/extensions.json (creating { "extensions": [] } if
missing, keeping every other entry and key, writing atomically; it refuses to touch a file that is not
valid JSON), waits for the host to read it and prints the extension's status entry. Without node,
edit the file the same way by hand: parse it, append the path, write a temporary file and rename it over —
never leave invalid JSON, because the host then ignores the whole file and refuses to rewrite it.
The host watches the file, loads the folder in place and lists it in Settings → Extensions & skills. Open chats get the new tools when their current turn ends — your own chat included, so the tool is not callable in this turn. Do not try to call it now.
The printed entry comes from <data dir>/extensions/status.json, which the host rewrites after every
change: { api, updatedAt, fileError?, extensions: [{ source, name, version, state, error?, tools?, shadowed? }] }.
loaded and tools lists your tool names → done. A loaded server half with a tool missing from
tools threw or skipped registerTool in its factory — fix it. A name in shadowed is one ThinkRail
already owns: its own tool wins and yours never runs — rename it.failed, incompatible, or a top-level fileError → reference/troubleshooting.md, fix, rebuild and
run reload. Do not hand the user a broken extension.node <this skill's directory>/scripts/extensions.mjs reload <folder>. The host reloads a folder only
when package.json or a manifest file (server entry, web, styles) changed; reload touches
package.json, so edits to the entry and the TypeScript files it imports are picked up too. After
changing a dependency or a plain-JavaScript file the entry imports, ask the user to restart ThinkRail:
the host keeps its first copy of such a module. Open chats see it after their turn.node <this skill's directory>/scripts/extensions.mjs remove <folder> (or the
Remove button). The folder stays — it is the user's; delete it only if they ask.Write a glossary, record ADRs, and clarify vague terms.
MAmattpocock/skills336k5,004 new stars in the last 7 days
MAmattpocock/skills336k5,004 new stars in the last 7 days
MAmattpocock/skills336k5,004 new stars in the last 7 days
MAmattpocock/skills336k5,004 new stars in the last 7 days
MAmattpocock/skills336k5,004 new stars in the last 7 days
OBobra/superpowers331k5,757 new stars in the last 7 days