Skip to content
SCALE MY VIBE CODE
← All posts

What Are Claude Code Mods? How to Create One

What Claude Code mods are, what they can do, and a mod I built that keeps your CLAUDE.md up to date.

Maab Saleem
  • claude code
  • claude.md
  • tools

Anthropic just released mods for Claude Code.

And yes, they do exactly what the name tells you they do.

You can use mods to add your own features to Claude Code. Describe what you want, and Claude builds it for you and makes it part of your workflow.

Below, I cover Claude Code mods in more detail.

What Is a Claude Code Mod?

A mod is a plugin that changes how Claude Code looks or behaves.

It is built from small JavaScript or TypeScript functions called event handlers. When you create a mod, you define when you want each function to run, and what it should do.

For example, you can create a mod that runs every time you submit a prompt, and shows a pane with clickable buttons right inside Claude Code.

Mods work fully in the terminal and in the Code tab of the Claude Desktop app.

In the VS Code extension, the mod still runs, but it can’t show panes, buttons, or any other interface elements.

Mods vs. Hooks, Skills, and MCP Servers

If you have used Claude Code hooks before, the idea is similar. The main difference is where the code runs.

A regular hook runs a shell script outside Claude Code. A mod runs inside Claude Code, which means it can do things a script cannot, such as add buttons or other elements to the interface.

Mods also overlap with skills and MCP servers.

Feature What it is Pick it when
Mod Functions that run inside Claude Code You want to change something in the Claude Code interface
Settings hook A shell command, HTTP request, or prompt that runs on an event You want to block, allow, or log an event with a script you already have
Skill A markdown file of instructions Claude reads You keep pasting the same instructions into chat
MCP server An external process that gives Claude new tools Claude needs to reach an outside system, like your database or issue tracker

Read more: The Best Claude Code Features You Didn’t Know Exist

What Mods Can Do

Here’s what you can do with a mod:

  • Draw its own interface. A mod can add panels, buttons, tabs, and text fields inside Claude Code.
  • Redraw parts of Claude Code. A mod can change Claude Code’s built-in interface elements, such as the loading spinner, tool call display, or question box.
  • Control what Claude runs. A mod can step in right before Claude runs a command or edits a file. It can pause the action and ask you first, or block it outright. For example, it can stop Claude before it runs risky commands like rm -rf.
  • Add context to your prompts automatically. A mod can attach extra information to a prompt, and only Claude sees it. For example, whenever a prompt mentions a bug or an error, it can automatically attach the latest lines from your app’s error log.

Anthropic has also shared a few sample mods you can try out. token-weather shows how much of your context window you have used, while replay-theater lets you step through the edits Claude made in the previous turn.

How to Create a Mod

Here’s how you can make a mod in Claude Code:

  1. Open a Claude Code session and describe what you want. For example: “make a mod that shows the current git branch above the prompt.”
  2. Claude loads a built-in skill called plugin-authoring. It tells Claude which events and methods your version of Claude Code supports. You can also load it yourself with /plugin-authoring.
  3. Claude writes the mod into ~/.claude/dev-mods/, in a folder named after your session’s ID.
  4. When Claude saves the first file, Claude Code asks whether to turn on hot reloading. Choose Enable for this session.
  5. The mod loads when the turn ends. Run /plugin and open the Installed tab to confirm it’s there.

One thing to know: the dev-mods folder is temporary, so Claude Code may delete older mods from it automatically.

If you want to keep a mod, move or copy it somewhere permanent, such as ~/mods/git-branch, then start Claude Code with:

claude --plugin-dir ~/mods/git-branch

To share a mod with your team, add it to a plugin marketplace. They can then install it with /plugin install.

The Mod I Created: pref-notepad

The Problem

Claude Code does not automatically carry every preference from one session to the next. If you tell it “keep answers short” today, you may need to say it again later.

You can make preferences stick by adding them to your global ~/.claude/CLAUDE.md file, which Claude Code reads across sessions and projects.

The problem I was facing, though, was that I kept forgetting to add my preferences to the global CLAUDE.md.

The Idea

So I built a mod that notices these preferences while I’m working and asks if I want to save them.

Every time I send a prompt, the mod asks Haiku whether it contains a general preference for how I want Claude to work or write.

For example, if I say something like “keep answers short,” the mod turns it into a short note and shows it in the side pane inside Claude Code. Session-specific stuff like “use Postgres for this task” is ignored.

Each note has two buttons: ✓ adds it to my global CLAUDE.md, and x throws it away. Nothing gets added unless I approve it.

Any notes I haven’t reviewed yet are still there the next time I open Claude Code.

Here’s the exact prompt I gave Claude Code.

pref-notepad prompt

Build a Claude Code mod named "pref-notepad" in its own folder under the dev-mods folder. Load the plugin-authoring skill first.

Goal: catch general working preferences I state in my prompts and, once I approve them, add them to my global CLAUDE.md (~/.claude/CLAUDE.md).

Behavior:

  1. Open a side pane titled "Preference ideas" after my first prompt of each session. A /prefs slash command also opens it.
  2. On every prompt I send (skip prompts sent by plugins), ask haiku in the background, without awaiting it, whether the prompt states a general preference for how you should work or write for me in every session (e.g. "answer in plain terms", "keep answers short"). Ignore anything tied to the current task, file, bug or project. Haiku returns one instruction per line, 8 words or fewer, or NONE.
  3. Show each new note in the pane as a suggestion with two buttons:
    • "✓" appends it to CLAUDE.md, then removes it from the pane. If CLAUDE.md already has it, just remove it.
    • "x" drops it.
  4. Skip any note that matches a pending suggestion or a line already in CLAUDE.md. Ignore case, extra spaces and end punctuation when comparing.
  5. Keep pending suggestions in a $.state atom declared in types/index.d.ts. Save them with $.store after every change and load them at session start.

Other Mods You Can Try

Here are three more mods I think are worth having if you vibe code with Claude Code.

Block Pushes to Main

If Claude pushes straight to main, one bad change can go live before anyone has looked at it.

Push guard prompt

Build a Claude Code mod that refuses any git push while the current branch is main or master. In the refusal, tell Claude to create a new branch and push that instead.

Catch Fix Loops Early

If Claude fails to fix a bug twice, a third try in the same session rarely helps. The solution in such a situation is to start a new session with an improved prompt.

This mod notices when you’re going around in circles and tells you to start fresh.

Fix loop prompt

Build a Claude Code mod that notices when I'm stuck in a fix loop. On every prompt I send, ask haiku in the background, without awaiting it, whether the prompt asks Claude to fix the same problem as my last two prompts. If it does, show a band above the prompt that says this is my third attempt, and suggests I run /clear and start again with a better prompt. Include a one-line summary of what has been tried so far.

Stop Big Tasks Before They Blow Your Context

This mod:

  • Checks how full your context window is each time you send a prompt.
  • If your context is 40% full or more, asks Sonnet whether the prompt is a big task.
  • Halts a big prompt and lets you decide whether to send it anyway, cancel it, or turn it into a fresh-session prompt.

Context guard prompt

Build a Claude Code mod that warns me before I start a large task in a fuller session.

For each prompt I send, check how full the context window is. If it is under 40%, let the prompt through. If it is 40% or more, ask Sonnet whether the prompt is a large task, such as a multi-file refactor, migration, or feature with several parts.

If it is, pause the prompt and give me three options: "Send anyway", "Cancel", or "Draft a fresh-session prompt".

If I choose "Draft a fresh-session prompt", have Sonnet combine my original prompt with a short summary of the current session, then place the new prompt in the prompt box so I can send it after /clear.

Before You Install Someone Else’s Mod

Mods aren’t sandboxed. Anthropic’s own docs are direct about this: a mod runs with your permissions, inside Claude Code.

Once it loads, a mod can reach all of this:

What a mod can reach
  • Your machine: it can read and write any file your user account can, start programs, and make network requests

  • Your secrets: it can read your environment variables and settings files, including any API keys you keep there

  • Your session: it can see every prompt you send, rewrite tool calls, and approve a tool call before you're asked

Claude Code’s sandbox also does not protect you from mods. It only applies to Bash commands Claude runs. If a mod starts its own process, that process runs outside the sandbox.

So only install mods from people you trust.

Before installing one, you can check what it does without running it:

claude plugin validate ./some-mod

If a mod causes problems, start Claude Code with --safe-mode to disable all mods for that session.

To disable them in every session, set "disableAllHooks": true in ~/.claude/settings.json.

Read more: Is Your Vibe-Coded App a Security Risk? Here’s How to Find Out

Wrapping Up

Mods are a great way to make your Claude Code experience even more enjoyable.

They’re easy to build, so the community will probably come up with all kinds of useful and fun ones soon.

But before you install one, don’t forget to run claude plugin validate on it to see what it does.

Frequently asked

What is a Claude Code mod?

A mod is a plugin that runs inside Claude Code and reacts to events, such as when you send a prompt or Claude uses a tool. It can add interface elements, create commands, and change or block tool calls.

Do I need to know how to code to make a Claude Code mod?

No. You can describe what you want in a Claude Code session, and Claude can build it using the built-in plugin-authoring skill.

Which version of Claude Code supports mods?

Mods require Claude Code v2.1.287 or later and are enabled by default. Run `claude --version` to check which version you have.

Are Claude Code mods safe?

Mods run with your permissions and are not sandboxed. They can access your files, API keys, and prompts, so only install mods from people you trust. You can also run `claude plugin validate` to check what a mod does before installing it.