SpyBara
Go Premium

plugins/mods/create.md 2026-09-30 23:00 UTC to 2026-10-01 20:02 UTC

This page contains 375 additions and 0 deletions.

2026
Thu 1 21:02

Create a mod

Have Claude write a Claude Code mod from a description, or write one yourself that counts tool calls and adds a command. Learn the reload and validate loop.

A mod is a Claude Code plugin with an entry file, called the hooks module: a JavaScript or TypeScript file whose functions Claude Code calls when events happen. There are two ways to make one:

  • Ask Claude to write it: describe what you want in a Claude Code session
  • Write it yourself: follow the tutorial to learn how a mod's code works. You don't need Node.js, a bundler, or a build step, because Claude Code loads .js and .ts files directly.

If you haven't decided whether a mod is the right tool, read the comparison on the overview first.

Ask Claude for a mod

Describe the mod you want in an interactive Claude Code session, and Claude writes it. Claude works from a built-in skill named plugin-authoring, which tells it where to write the mod, which events and methods your version has, and how the mod gets loaded. Claude can load the skill when you ask for a mod, or you can load it yourself by running /plugin-authoring at the Claude Code prompt.

The mod runs once you approve it, except in sessions where a mod Claude writes can't load.

1

Describe the mod

Ask for the mod in your own words, for example make a mod that shows the current git branch above the prompt. Claude writes the mod in a directory of its own in the session's mods folder, which is ~/.claude/dev-mods/ followed by the session's ID. A mod's full path looks like ~/.claude/dev-mods/3f2a9c1e-5b7d-4e8a-9c21-6d0f4b8a7e13/git-branch/.

2

Approve the mod

When Claude saves the first file, Claude Code asks whether to enable hot reloading for the session. Hot reloading runs the mods Claude writes in this session and picks up each later change.

Choose one of these answers:

  • Enable for this session: the mods in the session's mods folder load when the turn ends, and reload at the end of each turn that changes them. Your answer lasts for the session, including after you resume it.
  • Not now: nothing loads for now. The files stay where Claude wrote them, and the mods load the next time that session starts. To keep a mod from ever loading, delete its directory.
3

Check that the mod loaded

Run /plugin at the Claude Code prompt and press Tab until the Installed tab is selected. It lists the mod, and you can turn it off there.

4

Try the mod

Use what you asked for. For the example prompt, the current branch name appears above the prompt box. If the mod doesn't do what you wanted, tell Claude what to change. The mod reloads at the end of each turn that changes its files, so you can try the change as soon as Claude finishes.

Use the mod in other sessions

A mod Claude wrote loads only in the session that made it, and Claude Code deletes that session's mods folder once it's older than cleanupPeriodDays. To keep the mod, copy its directory out of the mods folder to a place of your own, such as ~/mods/git-branch. Then choose how to load it:

  • In a session you start: in your shell, run claude --plugin-dir ~/mods/git-branch
  • For other people: add it to a marketplace so they can install it

Sessions where a mod Claude writes can't load

A mod Claude writes loads only after you approve it, in a trusted workspace where mods are allowed to run. In these sessions it doesn't load:

  • Nobody is there to approve: the session can't show you a prompt, as in a claude -p run or dontAsk mode
  • The workspace isn't trusted: you haven't accepted the trust prompt for the directory
  • Mods are stopped: you started with --safe-mode or --bare, you set disableAllHooks, or your organization's managed settings block it

Write a mod yourself

In this tutorial you build a mod named first-mod that counts the tool calls Claude makes, shows the count beside the spinner while Claude works, and adds a /tally command that prints it. You then read the type declarations Claude Code writes beside your mod and run claude plugin validate. Together they show you the events and methods your version offers and what Claude Code reads from your code.

This recording shows the finished mod. The spinner counts tool calls, /tally prints the count, and an edit to the code takes effect while the session runs: