modscode / Code
The Claude Code mods code reference
Read real mods' code and start building from it. For each thing you may want to build: the smallest form, written by modscode, and the code of public mods that do it, with their licence. The same code runs in the terminal and the desktop app.
Check the code yourself before you copy or install it. Mods run unsandboxed, with your permissions. modscode does not vouch for what the code does.
- Pane (panel)A panel beside the transcript: buttons, lists, charts.$.ui.open · 6 examples
- Band above the promptA strip right above the prompt: state or usage in a line or two.on('ui.render', { component: 'AbovePrompt' }) · 6 examples
- Status lineOne line under the prompt, with $.ui.status.$.ui.status(text) · 6 examples
- ToastA short notice that goes away.$.ui.toast(text, { timeoutMs }) · 6 examples
- Deny a tool callBlock rm -rf or a force push. The mod form of PreToolUse.on('tool.call', { tool: 'Bash' }) · 6 examples
- Rewrite the promptFix the text before it is sent, or add a line only Claude reads.on('prompt.submit') · 6 examples
- Add a slash commandA /command that runs your code.$.command.register · 6 examples
- Keep state with $.storeSave values across sessions.$.store.get · 6 examples
- Settings (userConfig)Settings users can change, declared in plugin.json.plugin.json userConfig · 6 examples
- Add a tool for ClaudeA tool Claude can call, without an MCP server.$.tool.register · 6 examples
A mod is a plugin with a .claude-plugin/plugin.json, a hooks/hooks.json whose modules names your code, and a file that exports register(on). on(event, hook) handles an event, and each hook gets ($, e, next). See the guide; the primary source is Anthropic's official documentation.