---
title: "什么是 Claude Code Mods，它们如何工作 #ClaudeCode #Tutorial"
url: "https://claudemods.dev/zh-cn/builds/what-are-claude-code-mods-and-how-do-they-work-claudecode-tu-2d0f79"
source: "https://www.youtube.com/watch?v=ORSNig1cdsg"
source_type: "resource"
author: "DIY Smart Code"
author_handle: "DIY Smart Code"
stars: 0
category: "工作流与 CI"
categories: ["workflow"]
tags: ["cli", "hooks", "mods", "plugins", "tutorial"]
permission_level: null
scan_complete: false
added: "2026-10-15T02:06:17.471Z"
updated: "2026-10-13T10:00:39.000Z"
locale: "zh-cn"
content_locale: "zh-cn"
---

# 什么是 Claude Code Mods，它们如何工作 #ClaudeCode #Tutorial

一个 3 分钟的上手教程，涵盖什么是 Claude Code mods、使用 /plugin 安装和禁用它们、用 claude plugin validate 验证、用 Claude 编写一个 mod，以及用 claude plugin test 离线测试。

## Description

在版本 2.1.296 上对 Claude Code mods 的上手演练：一个用量计量 mod，显示 5 小时、7 天和上下文用量，在 80% 时弹出提示，在 97% 时发出声音。说明 mod 是一个带有 JS/TS 事件处理器的插件，通过 hooks/hooks.json 中的 modules 键来区分，并且只有 mod 才能绘制到界面中。涵盖通过 /plugin install 安装、用 Space 禁用、使用 --safe-mode 获得干净会话、用 claude plugin validate 检查 mod（注意像 $.process.run 这样的调用）、让 Claude 使用插件编写技能将一个 mod 写入 ~/.claude/dev-mods/ 并支持热重载，以及在无需登录或联网的情况下离线运行 claude plugin test。

## Original README

What Are Claude Code Mods and How Do They Work #ClaudeCode #Tutorial

Claude Code mods, hands-on: the four mods running on my own Claude Code, how to install one and switch it off, how to check a mod with claude plugin validate before you install it, and how to have Claude write one for you. A mod is a plugin with code that Claude Code runs inside itself, so it can draw in the interface where a settings hook can't.
----
Higgsfield AI — Create AI Videos & Visuals
Get 10% OFF here: https://higgsfield.ai?fpr=thomas-dccf7e

🚀 DYNAMOUS AI COMMUNITY

Want to learn agentic coding with live daily events and workshops?
Check out Dynamous AI: https://dynamous.ai/?code=646a60
Get 10% off here 👉 https://shorturl.smartcode.diy/dynamous_ai_10_percent_discount

⚡ HOSTINGER — RELIABLE HOSTING FOR YOUR PROJECTS (10% OFF)

Whether you're shipping a portfolio, a side project, n8n flows, or AI agents — I use Hostinger for fast, affordable VPS + web hosting.

Get 10% off here 👉 https://hostinger.com/DIYSMARTCODE

n8n: https://n8n.partnerlinks.io/diysmartcode

(Affiliate links — costs you nothing, supports the channel.)
----

What you will see in this 3-minute breakdown:
→ A real run on Claude Code 2.1.296: /plugin shows "4 mods active", and my usage-meter mod writes 5-hour, 7-day and context usage under the prompt, with a pop-up at 80% and a sound at 97%
→ What a mod is: a plugin with JavaScript or TypeScript event handlers that Claude Code calls on a tool call, a submitted prompt, or a part of the interface being drawn. One "modules" key in the plugin's hooks/hooks.json makes it a mod
→ Mods vs settings hooks: a settings hook runs as a command outside Claude Code and can stop a tool call, but only a mod can add a pane or a band to the screen. My studio-hud band picked up a render check the moment Claude ran it
→ Install with /plugin install plugin-name@marketplace (mods need Claude Code v2.1.287 or later). Switch one off in the Installed tab of /plugin with Space. For one session without installed mods, start with --safe-mode, which turns off your other customizations too
→ Check before you install: claude plugin validate lists every event a mod hooks and every call it makes, without running it. Look for calls like $.process.run, which starts programs as you
→ Let Claude write one: describe the mod in a session, Claude writes it with the built-in plugin-authoring skill into ~/.claude/dev-mods/, you enable hot reloading for the session, and you copy the folder out to keep it
→ Test it offline: claude plugin test runs a mod's tests with no session, sign-in or network. All five usage-meter tests pass

Claude Code docs, Mods overview (install, /plugin, --safe-mode, validate): https://code.claude.com/docs/en/plugins/mods/overview
Claude Code docs, Create a mod (modules key, plugin-authoring, hot reloading, dev-mods): https://code.claude.com/docs/en/plugins/mods/create
Claude Code docs, Test a mod (claude plugin test): https://code.claude.com/docs/en/plugins/mods/test
Claude Code docs, Manage mods (the calls to look for): https://code.claude.com/docs/en/plugins/mods/admin
Claude Code docs, Mods reference (events): https://code.claude.com/docs/en/plugins/mods/reference
Claude Code docs, Install plugins (enable or disable with Space): https://code.claude.com/docs/en/plugins/install
Claude Code docs, CLI reference (--safe-mode): https://code.claude.com/docs/en/cli-reference
Claude Code docs, Status line (5-hour and 7-day usage): https://code.claude.com/docs/en/statusline
Claude Code changelog (2.1.287, Claude Mods): https://code.claude.com/docs/en/changelog
Our Claude Code mods launch Short: https://youtu.be/tTe7GOJuc0E

Which would you build first: a usage warning, or a slash command of your own?

#ClaudeCode #Claude #ClaudeCodeMods #ClaudeMods #ClaudeCodePlugins #ClaudePlugins #ClaudeCodeTutorial #ClaudeCodeTips #ClaudeCodeSetup #ClaudeCodeForBeginners #ClaudeCodeHooks #Anthropic #AICoding #AIAgents #AgenticCoding #DeveloperTools #CodingWithAI #VibeCoding #DevTips #Shorts
