Mods 개요
Blog

Mods 개요

2026.10.07
·Web·by Mineru
#Claude Code#JavaScript#Mods#Plugins#TypeScript

Key Points

  • 1Mods are JavaScript or TypeScript-based plugins for Claude Code that allow users to customize behavior by intercepting events, such as tool calls or UI rendering, through event handlers.
  • 2Unlike standard settings hooks or MCP servers, mods operate internally within the Claude Code environment, enabling developers to create custom interface elements like windows, buttons, and status indicators.
  • 3Because mods execute with user-level permissions and have broad access to session data and system files, they should only be installed from trusted sources after validating their capabilities via the plugin CLI.

Claude Code "Mods" are a plugin architecture designed to extend the capabilities and interface of the Claude Code environment by executing JavaScript or TypeScript event handlers directly within the application's process. Unlike settings-based hooks, skills, or MCP servers—which operate externally—mods possess the ability to manipulate the internal state, rendering logic, and event flow of the Claude Code CLI and Desktop application.

Core Methodology and Technical Implementation

The mod architecture is fundamentally event-driven, utilizing a registration pattern that allows developers to intercept and modify the execution lifecycle. A typical mod is composed of a plugin.json manifest, a hooks.json configuration file mapping events to code, and a register.js module.

The registration function uses an on method to subscribe handlers to specific lifecycle events (e.g., tool.call or ui.render). These handlers receive a context object ($), the event data (e), and a next function to manage middleware propagation. The technical workflow allows for three primary operational modes:

  1. Observation: Recording event data (e.g., tracking token usage or tool invocation frequency) without altering the outcome.
  2. Transformation (Rewriting): Modifying the event payload before it proceeds. For instance, the ui.render hook can inject a suffix into existing component properties:
Render(eprops)→Render(eprops∪{suffix:custom_data})\text{Render}(e_{props}) \to \text{Render}(e_{props} \cup \{ \text{suffix}: \text{custom\_data} \})
  1. Intervention: Blocking or overriding default Claude Code behavior, such as preventing a tool call or substituting it with a custom command.

Interface and System Access

Mods can interact with the Claude Code user interface by invalidating and requesting redraws via $.ui.invalidate('ui.render'). This enables the creation of persistent dashboard elements, such as sidebars or status-line modifications, that reflect real-time session metadata.

From a security perspective, mods execute with the same privileges as the user. They are not sandboxed; therefore, they can access local file systems, environment variables (including sensitive API keys), and network resources. The documentation emphasizes the importance of verifying plugins via claude plugin validate before execution, which generates a report of all hooks and calls the plugin will utilize.

Operational Scenarios

  • Capability Augmentation: Creating custom /commands that execute local functions or system processes outside of the Claude turn-based loop.
  • State Persistence: Sharing variables across disparate hooks within the same mod to maintain session-wide state (e.g., aggregating token counts or tracking complex task progress).
  • Environment Context: While mods function across most environments (Terminal, Desktop App), their UI rendering capabilities are scoped. For instance, while terminal and desktop sessions support custom UI elements, VS Code extensions and Agent SDK contexts may limit visual outputs while still allowing hook-based logic execution.

Management and Lifecycle

Mods are managed via the /plugin interface within the session. They are inherently distinct from built-in internal mods (e.g., cc-plugin-diff), though they share the same event-driven paradigm. Control mechanisms, such as disableAllHooks in settings.json or the --safe-mode CLI flag, allow users and administrators to globally or locally suppress hook execution, providing a safety layer against potentially malicious or incompatible plugins.