Learning resourcesReviewed · Anthropic

Create a mod: Claude Code authoring guide

Create a mod is a guide for Claude Code users who want custom commands and interface behavior, but compatibility and loading depend on their installed version and session permissions. It explains how to ask Claude to generate a mod or write one in JavaScript or TypeScript, then validate, test and share it.

Researched 15 Nov 2026

In short.

Create a mod is a practical guide for Claude Code users and developers who want to customize their coding assistant, with version-specific APIs and permission-dependent loading as its main constraints. It specifies Claude Code v2.1.287 or later and demonstrates a plugin that counts tool calls, changes the spinner and adds a /tally command. The page covers generated mods, manual authoring, hot reloading, static validation, simulated-event tests and sharing. Runtime behavior and compatibility have not been independently assessed, and pricing and reuse licenses are not established.

Researched and written by an AI model and checked by a second AI model. How it works

Coverage comprises the complete selected page at [https://code.claude.com/docs/en/plugins/mods/create.md], captured as selected-page.txt on 15 November 2026 with source revision sha256:d75d7e3fa6eb90bffc6697baa373ba8fa2ac2376f7afa8a3a11e5995b4561bc6. The page's version requirement, loading and approval notices, code, validation restrictions, tests and sharing guidance are included. Linked documentation and source examples are excluded. The embedded video's textual description is available, but the video itself was not examined. No code, commands, tests or interactive behavior were executed or independently verified.

The overview

Identity

The resource is the Claude Code documentation page Create a mod at [https://code.claude.com/docs/en/plugins/mods/create.md]. It teaches a customization feature rather than supplying a finished extension for installation.

A mod is described as a Claude Code plugin with a JavaScript or TypeScript hooks module: an entry file containing functions that Claude Code calls when events occur. The tutorial's example is named first-mod.

Assessment

The guide provides enough concrete material to follow a small authoring exercise: a manifest, module configuration, complete hooks code, loading commands and an automated test. It also explains why hooks run and how their return values affect Claude Code.

Its strongest practical feature is the connection between implementation and diagnosis: generated type declarations describe the installed API, validation reports recognized hooks and API calls, and tests exercise event responses. The supplied successful outputs are documentation examples; actual behavior, reliability and runtime overhead remain unverified.

Users

Claude Code users can begin by describing a desired customization in an interactive session. The built-in plugin-authoring skill supplies authoring guidance and can be invoked explicitly with /plugin-authoring.

Developers who know basic JavaScript or TypeScript can follow the manual route and inspect the event handlers directly. The guide is especially relevant to people adding commands, observing tool calls or modifying interface elements. It assumes access to the Claude Code command line and local files.

Capabilities

The example registers /tally, increments a counter before tool calls and adds that count beside the working spinner. It demonstrates event filtering, interface redraw requests, command responses and changes to interface properties.

The page also documents loading a local plugin directory, reloading edits, generating version-specific type declarations, inspecting source with claude plugin validate and running automated tests with claude plugin test. Sharing options include a directory or ZIP, marketplaces and organizational installation.

Using it

Requirements

The page specifies Claude Code v2.1.287 or later and suggests checking the installed version with claude --version. Claude Code loads JavaScript and TypeScript files directly, so the tutorial does not require Node.js, a bundler or a build step.

Loading also depends on session conditions. A mod Claude writes does not load in an interactive session whose workspace trust prompt has not been accepted. Mods can be disabled by --safe-mode, --bare, disableAllHooks or organizational managed settings. The page does not establish operating-system coverage or compatibility with every later Claude Code release.

Mechanism

The plugin manifest supplies metadata, and the modules entry in hooks/hooks.json points to the hooks module. Claude Code calls that module's exported register(on) function. Each on call registers a handler for a named event, optionally narrowed by a matcher.

Handlers receive the mods API as $, event data as e and a continuation function named next. Returning next(e) passes the event onward. Returning a result without calling next answers the event directly. Passing modified event data to next changes what subsequent handlers and Claude Code receive.

The example uses session.start to register /tally, tool.call to increment the counter, command.run to return the tally and ui.render to alter the spinner. Because counting happens before the tool runs, the tally records observed tool-call events rather than successful tool results.

Setup

The manual exercise creates first-mod/.claude-plugin/plugin.json, first-mod/hooks/hooks.json and first-mod/hooks/register.js. The configuration points modules to ./register.js. Start a session with claude --plugin-dir ./first-mod to load the directory without installing it.

For generated mods, Claude writes under ~/.claude/dev-mods/ followed by the session ID and mod directory. In default and acceptEdits modes, protected-path file creation requires approval, and the first saved file prompts for permission to enable session hot reloading. The Installed tab of /plugin shows whether the mod loaded.

Generated mods belong to their originating session. To retain one for other sessions, copy its directory elsewhere and load that copy with --plugin-dir. The original session directory is subject to cleanupPeriodDays.

Example

The documented exercise asks Claude to list files and read a README. The spinner displays the accumulating tool-call count, and /tally prints the count since the mod loaded. Editing the spinner suffix demonstrates hot reloading. Reloading resets the module-level counter to zero.

The supplied automated test simulates one Bash call and one Read call, intercepts both with stub results, then checks that /tally reports two calls. The stubs prevent those tools from actually running. This illustrates testing event handling; the displayed passing result is not an independently verified execution.

Assessment & evidence

Limitations

Hooks modules must follow rules that let static analysis identify their behavior. Event names must be string literals, mods API calls must use explicit namespace and method paths, and register must not shadow on. Modules use ES imports, with relative imports confined to the plugin directory and claude-code as the permitted bare import. Dynamic imports, require and API namespace aliases are not supported by the described rules.

Newly generated mods cannot load in certain sessions, including dontAsk mode and a non-interactive default or acceptEdits run that cannot present the hot-reload question. Conversely, auto and bypassPermissions modes can enable hot reloading without asking, and eligible existing session mods can load on resume. Choosing Not now defers loading; the mods still load the next time that same session starts or is resumed, unless you delete their directory.

Module variables reset on reload. Installed plugins are cached by version, so editing an installed copy does not provide the same development loop as --plugin-dir; the page directs authors to increment the version and install again. Cross-version stability and behavior under multiple interacting mods are not established.

Reasoning

The guide is a useful starting point when the desired customization needs code to respond to Claude Code events, add commands or alter interface behavior. Its small counter example makes the event flow visible without requiring a large extension.

Validation and tests answer different questions. Validation checks the manifest and statically recognized hooks and API calls without running the module. Tests fire events and inspect responses. Neither alone establishes that a particular interface change behaves correctly in an interactive session, so an actual session remains a separate evaluation step.

Alternatives

The page offers two authoring routes within the same mod system: ask Claude to generate the files using plugin-authoring, or write the manifest, configuration and hooks yourself. The manual route explains the implementation; the generated route starts from a plain-language request.

It links to a comparison of mods, settings hooks, skills and MCP servers, and to built-in mod source examples. Those linked pages are outside the supplied evidence, so their tradeoffs and implementations cannot be assessed here.

Evidence

The evidence is the complete captured Create a mod page at [https://code.claude.com/docs/en/plugins/mods/create.md]. It includes source listings, command examples, explanatory prose, sample validation output and a simulated-event test with sample passing output.

These materials support an explanation of the documented authoring process. They do not supply independent runtime measurements, compatibility results or evidence that the examples work in another installation. Nothing was executed.

Access & freshness

Costs

The page gives no subscription prices, model charges, usage allowances or separate mod fees. The cost of using Claude Code or asking Claude to author and revise a mod is unknown from this evidence.

It states that claude plugin test can run without a session, sign-in or network connection. That describes the test runner's requirements and does not establish that Claude Code usage or mod development is free.

Rights

The selected page does not supply an explicit license for its documentation or example code. Permission to reuse or redistribute those materials is therefore unknown.

Its sharing instructions explain how authors can distribute their own mods through directories, ZIP files, marketplaces or managed organizational settings. Those technical instructions do not establish a license for the tutorial's source materials.

Freshness

The page was captured on 15 November 2026. No publication or last-update date is supplied. Its stated minimum is Claude Code v2.1.287, and it explicitly warns that events and methods can change between releases.

Interactive loading generates declarations under .claude-plugin/types/ for the installed build, including events, API methods and tool schemas. The page says these declarations take precedence over documentation when they disagree. This makes checking the installed build's declarations an essential part of adapting the example.

Actions

Check claude --version and whether managed settings permit mods. Choose either the generated route or the three-file tutorial; for the generated route, check whether the session mode permits loading and, in an interactive session, whether the workspace trust prompt has been accepted. Then inspect the mod in /plugin and compare its code with the generated declarations.

Run claude plugin validate ./first-mod to inspect recognized hooks, API calls and reported errors. Run claude plugin test from the mod directory for the supplied test, then separately try the spinner and /tally in an interactive session.

Before retaining or sharing a mod, move session-generated files to a durable directory, document the Claude Code version actually used and follow the version increment and reinstall procedure for installed updates.

Evidence for this report

selected-page.txtselected · checked 2026-11-15