agentleFS
derrickmehaffyderrickmehaffy/brain-template/.claude/skills/brain-write-mod/SKILL.md

brain-write-mod

Skill2 starsChanged 12 days agoMITView on GitHub

Create, change or fix one of this brain's mods in .claude/mods/<prefix>-<name>/: a change to Claude Code's own interface or behaviour, such as a pane beside the chat, a band above the prompt, a status-line word, a toast, a slash command or a hook on tool calls. Starts it from the template's mod kit, keeps it read-only unless the person asks otherwise, tests it with claude plugin test, links it so sessions load it, and records what it shows, reads and writes. Use when someone asks for a panel, pane, sidebar, band, live view beside the chat, status line, notification, slash command or tool-call guard, when a mod does nothing or misbehaves, or when the skill gate refuses a write under .claude/mods/. Does NOT write a skill, which is brain-write-skill; does NOT write a script a mod runs, which is brain-write-script; and does NOT change the kit in _meta/modkit/, which is brain-upstream.

  • Reads credentials

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 2 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Fail quiet and visible: No hook throws: a failed read keeps the last good one and shows a Failed line with Try again.

    line 66
  2. Very specific:

    When brain.json role is template, mods are the kit itself: _meta/modkit/gallery/ (the kit and its gallery) and _meta/modkit/starter/.

    line 81
  3. Very specific:

    Do not install a mod in the person's user settings or CLAUDE_CODE_PLUGIN_DIRS: it would load in every session everywhere.

    line 88
  4. Distinctive:

    Do not let a mod block what the skill gate or a settings hook already decides.

    line 90
  5. Distinctive:

    Do not open a pane at session start unasked.

    line 92
  6. Very specific:

    Do not edit through the link (.claude/skills/<prefix>-<name>/…) or make it by hand: write under .claude/mods/, and let mods new or mods …

    line 93

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Write a mod for this brain

A mod is code that runs inside Claude Code with the person's permissions, on every surface they use. Doing it well means drawing something useful everywhere, reading without side effects, and failing where the person can see it, never silently and never by breaking the session.

Where this sits

<!-- where:begin — generated by _meta/brain routing sync; do not edit -->

Runs after: brain-retro

Hand to next: brain-sync · brain-write-script

Reserved output: writing .claude/mods/<prefix>-*/** needs this skill to have run.

<!-- where:end -->

Call it directly when: the person asks for something Claude Code should show or do by itself (a pane, a band, a command, a guard), or the gate refused a write under .claude/mods/; step 1 still applies.

Sequence

  1. Does it earn a mod? A mod draws in Claude Code or reacts to its events. Instructions are a skill (brain-write-skill), a query is a script (brain-write-script), a fact is a practice. Nothing a mod does may be the only way something happens: the skill gate stays the enforcer, and what a pane shows can also be had from a command or a script. Run _meta/brain mods ready: a Claude Code older than 2.1.287, or the desktop app in a WSL session, runs no mods; say so.
  2. Shape it with the person, in their words: where it shows (pane, band, status line, toast, command reply, a tool-call hook), what it reads and from where, what it writes (by default nothing), when it reads (start, a command, a button, a timer), and whether everyone who clones the brain gets it or it is opt-in. Read _meta/modkit/README.md for the kit, its pieces and the surface facts.
  3. Start or open it. New: _meta/brain mods new <name> --dry-run, then without --dry-run; it writes .claude/mods/<prefix>-<name>/ from the starter, copies the kit and makes the link .claude/skills/<prefix>-<name>. Existing: read its README.md and hooks/register.tsx first.
  4. Write it. Replace hooks/health.ts with the mod's own data source and delete the starter's parts it does not need. Grep the types the engine lays in .claude-plugin/types/ for the event or method at hand; they are this build's contract. A script the mod runs goes in ./scripts/ through brain-write-script, and the mod calls it with an argument list.
  5. Test it. tests/<prefix>-<name>.test.ts: each hook on terminal and desktop at least, the empty, failed and nothing-to-show states, that a forged button press does nothing, and that a read-only mod writes nothing. Run _meta/brain mods check <name> until both steps pass.
  6. See it. The session reloads a linked mod when its files are saved; a terminal session can load one with claude --plugin-dir .claude/mods/<prefix>-<name>. Ask the person to look at it in the app they use, in the light and the dark theme. A dim transcript line naming the mod is a hook that failed: read it, fix the cause, look again.
  7. Record and hand on. Fill the README table: what it shows, what it reads, what it writes, which surfaces draw it, how to turn it off. An opt-in mod sets "defaultEnabled": false in its plugin.json, and the README says how to turn it on. _meta/brain lint reports nothing about it; then hand to brain-sync.

Rules a mod keeps

  • Read-only unless the person asked. A button that asks Claude for something fills the prompt ($.prompt.fill) for the person to send; it never submits and never runs a write itself. An act that changes something outside the mod shows what it will do and asks first (Confirm).
  • No secrets. A mod never reads .env, never puts a key in its state, a log line, a toast or a drawing, and never sends one anywhere. A system that needs a key is reached through a script that loads it, or _meta/brain secret run.
  • Every press is validated. A button carries a small act ({ do: 'refresh' }) that one function checks before anything runs: never free text, a path, a URL or a command.
  • Fail quiet and visible. No hook throws: a failed read keeps the last good one and shows a Failed line with Try again. A hook that guards (refuses a tool call, a prompt) gets a .catch that refuses too, so a broken guard fails closed.
  • Cheap where it runs often. ui.render only reads state; process, file and network work runs in the background from a command, a button, session.start or a throttled timer, with a time limit. Hooks on tool.call and prompt.submit observe and pass on unless guarding is the point.
  • Every surface gets something. Text where an element is missing, a command whose reply is text, and nothing drawn in the band when there is nothing to say (return next(e)).
  • State lives in $.state, declared in types/index.d.ts; change a value's shape tag when its fields change.
  • Never edit hooks/kit/. _meta/brain mods sync replaces it. A piece the kit lacks is built in the mod's own files, or proposed for the kit through brain-upstream.

In the template

When brain.json role is template, mods are the kit itself: _meta/modkit/gallery/ (the kit and its gallery) and _meta/modkit/starter/. Change them here, run claude plugin test _meta/modkit/gallery and the template's tests, and add a changelog entry. Steps 3 and 7's link and lint do not apply.

Do not

  • Do not install a mod in the person's user settings or CLAUDE_CODE_PLUGIN_DIRS: it would load in every session everywhere. A brain's mods load through their link, in the brain's sessions.
  • Do not let a mod block what the skill gate or a settings hook already decides; it adds a view, not a second set of rules.
  • Do not open a pane at session start unasked; open it on a command, a button, or work that needs it.
  • Do not edit through the link (.claude/skills/<prefix>-<name>/…) or make it by hand: write under .claude/mods/, and let mods new or mods link make the link. The gate reads a write through the link as a skill write too.

Done when

  • .claude/mods/<prefix>-<name>/ holds the manifest, hooks/hooks.json, the hooks module, the kit copy, types/index.d.ts, tests and a README whose table is filled in.
  • _meta/brain mods check <name> passes validate and test, and _meta/brain lint reports nothing about the mod.
  • .claude/skills/<prefix>-<name> links to it, and the person has seen it work in their app.
  • It writes nothing the person did not ask for, and no secret appears in its code, state or output.
  • Handed to brain-sync.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.