<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Yubolun</title>
    <description>Yubolun&apos;s DEV Blog</description>
    <link>https://yubolun.com/</link>
    <atom:link href="https://yubolun.com/feed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Thu, 05 Mar 2026 00:21:12 +0800</pubDate>
    <lastBuildDate>Thu, 05 Mar 2026 00:21:12 +0800</lastBuildDate>
    <generator>Jekyll v3.10.0</generator>
    
      <item>
        <title>在 Claude Code 中以 MCP 接入 Codex</title>
        <description>&lt;p&gt;Codex CLI 的命令行交互较为原始，沙箱环境存在不少 bug，执行命令时也受到诸多限制。相比之下，Claude Code 的设计更加完善，支持 MCP、Plugin、Skill、Agent 等多种自定义扩展形式。将 Codex 作为 MCP 服务器接入 Claude Code，可以获得更友好的用户体验和更强大的功能集成。&lt;/p&gt;

&lt;!--more--&gt;

&lt;h2 id=&quot;为什么选择-mcp-方式而非直接使用-codex-cli&quot;&gt;为什么选择 MCP 方式而非直接使用 Codex CLI&lt;/h2&gt;

&lt;h3 id=&quot;codex-cli-的局限性&quot;&gt;Codex CLI 的局限性&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;命令行交互原始&lt;/strong&gt;：缺乏现代化的交互体验，错误提示不够清晰&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;沙箱环境 bug 多&lt;/strong&gt;：执行复杂任务时容易遇到环境问题&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;命令执行受限&lt;/strong&gt;：某些操作在沙箱中无法正常执行，自由度较低&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;claude-code-的优势&quot;&gt;Claude Code 的优势&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;设计完善&lt;/strong&gt;：提供更流畅的代码编辑和 AI 交互体验&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;扩展性强&lt;/strong&gt;：支持 MCP、Plugin、Skill、Agent 等多种扩展方式&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;工具集成&lt;/strong&gt;：可以无缝整合多种工具和服务&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;用户体验友好&lt;/strong&gt;：界面直观，错误处理更完善&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;通过 MCP 方式，Codex 可以作为 Claude Code 的一个工具被调用，既保留了 Codex 的能力，又享受了 Claude Code 的完善生态。&lt;/p&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;前置要求&quot;&gt;前置要求&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;已安装 Claude Code CLI（可通过 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;claude -v&lt;/code&gt; 验证）&lt;/li&gt;
  &lt;li&gt;已安装 Codex CLI，并能在终端调用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;codex&lt;/code&gt; 命令&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;配置步骤&quot;&gt;配置步骤&lt;/h2&gt;

&lt;h3 id=&quot;一条命令完成添加用户作用域&quot;&gt;一条命令完成添加（用户作用域）&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;claude mcp add codex &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; user &lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt; codex &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt; gpt-5.3-codex &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;model_reasoning_effort&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;high&quot;&lt;/span&gt; mcp-server
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;参数说明：&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-s user&lt;/code&gt;：将服务器写入用户全局配置，所有项目可用且不会改动仓库文件&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--&lt;/code&gt;：分隔 Claude MCP 参数与实际服务器启动命令&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;codex -m gpt-5.3-codex-max&lt;/code&gt;：指定要暴露的 Codex 模型&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-c model_reasoning_effort=&quot;high&quot;&lt;/code&gt;：为 Codex 进程设置高推理强度&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mcp-server&lt;/code&gt;：启动 Codex 的 MCP 服务器模式&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;验证配置是否生效&quot;&gt;验证配置是否生效&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 列出所有 MCP 服务器&lt;/span&gt;
claude mcp list

&lt;span class=&quot;c&quot;&gt;# 查看 codex 服务器详情&lt;/span&gt;
claude mcp get codex
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;若能看到 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;type: stdio&lt;/code&gt; 且状态为 running/available，说明已成功接入。&lt;/p&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;在-claude-code-中使用&quot;&gt;在 Claude Code 中使用&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;打开 Claude Code，在对话中输入 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/mcp&lt;/code&gt; 命令&lt;/li&gt;
  &lt;li&gt;选择 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;codex&lt;/code&gt; 服务器&lt;/li&gt;
  &lt;li&gt;直接在对话中调用 Codex 暴露的工具；如需指定模型，可在提示中写明 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gpt-5.3-codex&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;现在你可以在 Claude Code 的完善环境中使用 Codex 的能力，同时享受更好的交互体验和工具集成。&lt;/p&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;常见问题&quot;&gt;常见问题&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;找不到 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;claude&lt;/code&gt; 命令&lt;/strong&gt;：确保已安装 Claude Code CLI 并已加入系统 PATH&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;找不到 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;codex&lt;/code&gt; 命令&lt;/strong&gt;：先安装 Codex CLI（参考 Codex 官方安装说明），或检查 shell PATH 配置&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;想移除服务器&lt;/strong&gt;：使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;claude mcp remove codex&lt;/code&gt; 命令&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;切换配置作用域&lt;/strong&gt;：如需改用项目级配置，先删除用户级配置，再按需添加项目级配置&lt;/li&gt;
&lt;/ul&gt;

</description>
        <pubDate>Sun, 14 Dec 2025 00:00:00 +0800</pubDate>
        <link>https://yubolun.com/tutorial/2025/12/14/codex-mcp-claude-code/</link>
        <guid isPermaLink="true">https://yubolun.com/tutorial/2025/12/14/codex-mcp-claude-code/</guid>
        
        <category>claude code</category>
        
        <category>mcp</category>
        
        <category>codex</category>
        
        
        <category>tutorial</category>
        
      </item>
    
      <item>
        <title>Claude Code 插件与 Hook 开发完整教程</title>
        <description>&lt;p&gt;Claude Code 提供了强大的插件系统，允许你通过自定义命令、代理、Hook、Skills 和 MCP 服务器来扩展功能。本文将完整介绍如何从零开始开发 Claude Code 插件和 Hook，包括创建插件、配置 Hook、发布到 Marketplace 等全流程。&lt;/p&gt;

&lt;!--more--&gt;

&lt;h2 id=&quot;为什么需要插件系统&quot;&gt;为什么需要插件系统&lt;/h2&gt;

&lt;p&gt;Claude Code 的插件系统提供了多种扩展方式：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Commands（命令）&lt;/strong&gt;：创建自定义斜杠命令，快速执行常用操作&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Agents（代理）&lt;/strong&gt;：定义专门的子代理来处理特定任务&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Skills（技能）&lt;/strong&gt;：扩展 Claude 的能力，让模型自主调用&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Hooks（钩子）&lt;/strong&gt;：在特定事件发生时自动执行脚本&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;MCP Servers&lt;/strong&gt;：集成外部工具和服务&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;通过插件系统，你可以：&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;自动化工作流&lt;/strong&gt;：在文件写入后自动格式化、运行测试&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;增强安全性&lt;/strong&gt;：拦截危险操作、验证命令&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;集成工具&lt;/strong&gt;：连接数据库、API、通知系统等&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;团队协作&lt;/strong&gt;：在项目级别配置插件，确保团队使用一致的工具&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;快速开始创建第一个插件&quot;&gt;快速开始：创建第一个插件&lt;/h2&gt;

&lt;p&gt;让我们通过创建一个简单的问候插件来熟悉插件系统。&lt;/p&gt;

&lt;h3 id=&quot;前置要求&quot;&gt;前置要求&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;已安装 Claude Code（可通过 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;claude -v&lt;/code&gt; 验证）&lt;/li&gt;
  &lt;li&gt;基本的命令行操作知识&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;步骤-1创建-marketplace-结构&quot;&gt;步骤 1：创建 Marketplace 结构&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;mkdir &lt;/span&gt;test-marketplace
&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;test-marketplace
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;步骤-2创建插件目录&quot;&gt;步骤 2：创建插件目录&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;mkdir &lt;/span&gt;my-first-plugin
&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;my-first-plugin
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;步骤-3创建插件清单文件&quot;&gt;步骤 3：创建插件清单文件&lt;/h3&gt;

&lt;p&gt;插件清单文件 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.claude-plugin/plugin.json&lt;/code&gt; 描述了插件的基本信息：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;mkdir&lt;/span&gt; .claude-plugin
&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; .claude-plugin/plugin.json &lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;EOF&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;
{
  &quot;name&quot;: &quot;my-first-plugin&quot;,
  &quot;description&quot;: &quot;一个简单的问候插件，用于学习基础知识&quot;,
  &quot;version&quot;: &quot;1.0.0&quot;,
  &quot;author&quot;: {
    &quot;name&quot;: &quot;Your Name&quot;
  }
}
&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;EOF
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;步骤-4添加自定义命令&quot;&gt;步骤 4：添加自定义命令&lt;/h3&gt;

&lt;p&gt;在 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;commands/&lt;/code&gt; 目录下创建命令文件：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;mkdir &lt;/span&gt;commands
&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; commands/hello.md &lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;EOF&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;
---
description: 用个性化的消息问候用户
---

# Hello Command

热情地问候用户，并询问今天能如何帮助他们。让问候更加个性化和鼓励性。
&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;EOF
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;步骤-5创建-marketplace-清单&quot;&gt;步骤 5：创建 Marketplace 清单&lt;/h3&gt;

&lt;p&gt;返回上级目录，创建 Marketplace 配置文件：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; ..
&lt;span class=&quot;nb&quot;&gt;mkdir&lt;/span&gt; .claude-plugin
&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; .claude-plugin/marketplace.json &lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;EOF&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;
{
  &quot;name&quot;: &quot;test-marketplace&quot;,
  &quot;owner&quot;: {
    &quot;name&quot;: &quot;Test User&quot;
  },
  &quot;plugins&quot;: [
    {
      &quot;name&quot;: &quot;my-first-plugin&quot;,
      &quot;source&quot;: &quot;./my-first-plugin&quot;,
      &quot;description&quot;: &quot;我的第一个测试插件&quot;
    }
  ]
}
&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;EOF
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;步骤-6安装和测试&quot;&gt;步骤 6：安装和测试&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 从父目录启动 Claude Code&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; ..
claude

&lt;span class=&quot;c&quot;&gt;# 在 Claude Code 中添加测试 Marketplace&lt;/span&gt;
/plugin marketplace add ./test-marketplace

&lt;span class=&quot;c&quot;&gt;# 安装你的插件&lt;/span&gt;
/plugin &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;my-first-plugin@test-marketplace
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;选择 “Install now”，然后需要重启 Claude Code 才能使用新插件。&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 尝试你的新命令&lt;/span&gt;
/hello
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;你会看到 Claude 使用你的问候命令！运行 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/help&lt;/code&gt; 可以查看新命令是否已列出。&lt;/p&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;插件结构详解&quot;&gt;插件结构详解&lt;/h2&gt;

&lt;p&gt;一个完整的插件可以包含以下组件：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;my-plugin/
├── .claude-plugin/
│   └── plugin.json          # 插件元数据（必需）
├── commands/                 # 自定义斜杠命令（可选）
│   └── hello.md
├── agents/                   # 自定义代理（可选）
│   └── helper.md
├── skills/                   # Agent Skills（可选）
│   └── my-skill/
│       └── SKILL.md
├── hooks/                    # 事件处理器（可选）
│   └── hooks.json
└── .mcp.json                 # MCP 服务器配置（可选）
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;插件清单pluginjson&quot;&gt;插件清单（plugin.json）&lt;/h3&gt;

&lt;p&gt;这是插件的核心配置文件，必须包含：&lt;/p&gt;

&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;plugin-name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;description&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;插件描述&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;version&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;1.0.0&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;author&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;作者名称&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;commands命令&quot;&gt;Commands（命令）&lt;/h3&gt;

&lt;p&gt;Commands 是自定义的斜杠命令，通过 Markdown 文件定义。文件内容会被发送给 Claude 作为指令。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;示例：代码格式化命令&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-markdown highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nn&quot;&gt;---&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;description&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;自动格式化当前项目的代码&lt;/span&gt;
&lt;span class=&quot;nn&quot;&gt;---&lt;/span&gt;

&lt;span class=&quot;gh&quot;&gt;# Format Command&lt;/span&gt;

格式化当前项目中的所有代码文件。使用项目配置的格式化工具（如 Prettier、Black 等）。
确保遵循项目的代码风格指南。
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;agents代理&quot;&gt;Agents（代理）&lt;/h3&gt;

&lt;p&gt;Agents 是专门的子代理，用于处理特定类型的任务。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;示例：代码审查代理&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-markdown highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nn&quot;&gt;---&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;description&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;专业的代码审查助手&lt;/span&gt;
&lt;span class=&quot;nn&quot;&gt;---&lt;/span&gt;

&lt;span class=&quot;gh&quot;&gt;# Code Review Agent&lt;/span&gt;

你是一个专业的代码审查助手。你的任务是：
&lt;span class=&quot;p&quot;&gt;1.&lt;/span&gt; 仔细审查代码的质量、可读性和最佳实践
&lt;span class=&quot;p&quot;&gt;2.&lt;/span&gt; 识别潜在的安全漏洞和性能问题
&lt;span class=&quot;p&quot;&gt;3.&lt;/span&gt; 提供建设性的反馈和改进建议
&lt;span class=&quot;p&quot;&gt;4.&lt;/span&gt; 确保代码符合项目的编码标准
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;skills技能&quot;&gt;Skills（技能）&lt;/h3&gt;

&lt;p&gt;Skills 是模型可以自主调用的能力扩展。创建 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;skills/&lt;/code&gt; 目录，每个技能是一个包含 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SKILL.md&lt;/code&gt; 的子目录。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;示例：Git 操作技能&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-markdown highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;gh&quot;&gt;# Git Operations Skill&lt;/span&gt;

这个技能允许 Claude 执行常见的 Git 操作，如提交、推送、创建分支等。
Claude 可以在需要版本控制操作时自动使用此技能。
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;hook-开发详解&quot;&gt;Hook 开发详解&lt;/h2&gt;

&lt;p&gt;Hook 是插件系统中最强大的功能之一，允许你在特定事件发生时自动执行脚本。&lt;/p&gt;

&lt;h3 id=&quot;hook-配置位置&quot;&gt;Hook 配置位置&lt;/h3&gt;

&lt;p&gt;Hook 可以在以下位置配置：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.claude/settings.json&lt;/code&gt; - 用户级设置&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.claude/settings.json&lt;/code&gt; - 项目级设置&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.claude/settings.local.json&lt;/code&gt; - 本地项目设置（不提交）&lt;/li&gt;
  &lt;li&gt;插件中的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;hooks/hooks.json&lt;/code&gt; - 插件提供的 Hook&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;hook-事件类型&quot;&gt;Hook 事件类型&lt;/h3&gt;

&lt;h4 id=&quot;pretooluse&quot;&gt;PreToolUse&lt;/h4&gt;

&lt;p&gt;在工具调用之前执行，可以拦截、修改或自动批准操作。&lt;/p&gt;

&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;hooks&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;PreToolUse&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;matcher&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Write|Edit&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;hooks&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
          &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;type&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;command&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;command&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;$CLAUDE_PROJECT_DIR/.claude/hooks/validate-write.sh&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
          &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;posttooluse&quot;&gt;PostToolUse&lt;/h4&gt;

&lt;p&gt;在工具成功执行后立即运行，常用于自动格式化、运行测试等。&lt;/p&gt;

&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;hooks&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;PostToolUse&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;matcher&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Write|Edit&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;hooks&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
          &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;type&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;command&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;command&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;$CLAUDE_PROJECT_DIR/.claude/hooks/format-code.sh&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
          &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;notification&quot;&gt;Notification&lt;/h4&gt;

&lt;p&gt;当 Claude Code 发送通知时触发，可以用于桌面通知、日志记录等。&lt;/p&gt;

&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;hooks&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Notification&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;matcher&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;permission_prompt&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;hooks&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
          &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;type&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;command&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;command&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;/path/to/notification.sh&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
          &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;userpromptsubmit&quot;&gt;UserPromptSubmit&lt;/h4&gt;

&lt;p&gt;在用户提交提示之前执行，可以添加上下文、验证提示等。&lt;/p&gt;

&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;hooks&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;UserPromptSubmit&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;hooks&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
          &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;type&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;command&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;command&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;$CLAUDE_PROJECT_DIR/.claude/hooks/add-context.sh&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
          &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;sessionstart--sessionend&quot;&gt;SessionStart / SessionEnd&lt;/h4&gt;

&lt;p&gt;在会话开始或结束时执行，用于环境设置、清理任务等。&lt;/p&gt;

&lt;h3 id=&quot;hook-输入和输出&quot;&gt;Hook 输入和输出&lt;/h3&gt;

&lt;p&gt;Hook 通过 stdin 接收 JSON 数据，包含会话信息和事件特定数据：&lt;/p&gt;

&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;session_id&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;abc123&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;transcript_path&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;/path/to/transcript.jsonl&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;cwd&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;/current/working/directory&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;permission_mode&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;default&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;hook_event_name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;PostToolUse&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;tool_name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Write&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;tool_input&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;file_path&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;/path/to/file.txt&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;content&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;file content&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;tool_response&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;filePath&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;/path/to/file.txt&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;success&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;hook-输出控制&quot;&gt;Hook 输出控制&lt;/h3&gt;

&lt;p&gt;Hook 可以通过退出码和 JSON 输出来控制行为：&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;简单方式：退出码&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;0&lt;/code&gt;：成功，stdout 在详细模式下显示&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;2&lt;/code&gt;：阻止操作，stderr 作为错误消息返回给 Claude&lt;/li&gt;
  &lt;li&gt;其他：非阻塞错误，stderr 在详细模式下显示&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;高级方式：JSON 输出&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;decision&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;block&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;reason&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;解释为什么阻止操作&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;hookSpecificOutput&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;hookEventName&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;PreToolUse&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;permissionDecision&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;deny&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;permissionDecisionReason&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;此操作被安全策略阻止&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;实战案例通知插件开发&quot;&gt;实战案例：通知插件开发&lt;/h2&gt;

&lt;p&gt;让我们参考 &lt;a href=&quot;https://github.com/discountry/ritmex-marketplace&quot;&gt;ritmex-marketplace&lt;/a&gt; 来创建一个完整的通知插件。&lt;/p&gt;

&lt;h3 id=&quot;项目结构&quot;&gt;项目结构&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ritmex-marketplace/
├── .claude-plugin/
│   └── marketplace.json          # Marketplace 配置
├── claude-code-notification/      # 通知插件
│   ├── .claude-plugin/
│   │   └── plugin.json            # 插件清单
│   ├── hooks/
│   │   └── hooks.json             # Hook 配置
│   └── scripts/
│       └── notification.sh        # 通知脚本
└── README.md
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;marketplace-配置&quot;&gt;Marketplace 配置&lt;/h3&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.claude-plugin/marketplace.json&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;ritmex-marketplace&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;owner&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;discountry&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;plugins&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;claude-code-notification&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;source&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;./claude-code-notification&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;description&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;在 macOS 上显示 Claude Code 通知&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;插件清单&quot;&gt;插件清单&lt;/h3&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;claude-code-notification/.claude-plugin/plugin.json&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;claude-code-notification&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;description&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;当 Claude Code 触发 Notification hook 时显示 macOS 通知&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;version&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;1.0.0&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;author&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;discountry&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;hook-配置&quot;&gt;Hook 配置&lt;/h3&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;claude-code-notification/hooks/hooks.json&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;description&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;自动显示 macOS 通知&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;hooks&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Notification&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;matcher&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;*&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;hooks&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
          &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;type&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;command&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;command&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;${CLAUDE_PLUGIN_ROOT}/scripts/notification.sh&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;timeout&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
          &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;通知脚本&quot;&gt;通知脚本&lt;/h3&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;claude-code-notification/scripts/notification.sh&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;#!/bin/bash&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# 读取 JSON 输入&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;INPUT&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;MESSAGE&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$INPUT&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; | jq &lt;span class=&quot;nt&quot;&gt;-r&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;.message // &quot;Claude Code Notification&quot;&apos;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;NOTIFICATION_TYPE&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$INPUT&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; | jq &lt;span class=&quot;nt&quot;&gt;-r&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;.notification_type // &quot;&quot;&apos;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;TRANSCRIPT_PATH&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$INPUT&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; | jq &lt;span class=&quot;nt&quot;&gt;-r&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;.transcript_path // &quot;&quot;&apos;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# 设置通知标题&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;TITLE&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;CLAUDE_NOTIFY_TITLE&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;:-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;Claude&lt;/span&gt;&lt;span class=&quot;p&quot;&gt; Code&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# 根据通知类型设置点击行为&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$NOTIFICATION_TYPE&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;permission_prompt&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;# 权限提示：点击时聚焦到终端&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;command&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; terminal-notifier &amp;amp;&amp;gt; /dev/null&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then
        &lt;/span&gt;terminal-notifier &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;-title&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$TITLE&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;-message&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$MESSAGE&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;-activate&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;com.warp.Warp&quot;&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;-sender&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;com.warp.Warp&quot;&lt;/span&gt; 2&amp;gt;/dev/null &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
        terminal-notifier &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;-title&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$TITLE&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;-message&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$MESSAGE&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;-activate&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;com.apple.Terminal&quot;&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;-sender&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;com.apple.Terminal&quot;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;
        &lt;span class=&quot;c&quot;&gt;# 使用 osascript 作为后备&lt;/span&gt;
        osascript &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;display notification &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$MESSAGE&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; with title &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$TITLE&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;fi
elif&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$TRANSCRIPT_PATH&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;# 有 transcript 路径：点击时打开文件&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;command&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; terminal-notifier &amp;amp;&amp;gt; /dev/null&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then
        &lt;/span&gt;terminal-notifier &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;-title&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$TITLE&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;-message&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$MESSAGE&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;-open&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$TRANSCRIPT_PATH&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;else
        &lt;/span&gt;osascript &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;display notification &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$MESSAGE&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; with title &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$TITLE&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;fi
else&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;# 普通通知&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;command&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; terminal-notifier &amp;amp;&amp;gt; /dev/null&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then
        &lt;/span&gt;terminal-notifier &lt;span class=&quot;nt&quot;&gt;-title&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$TITLE&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-message&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$MESSAGE&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;else
        &lt;/span&gt;osascript &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;display notification &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$MESSAGE&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; with title &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$TITLE&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;fi
fi

&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;exit &lt;/span&gt;0
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;安装和使用&quot;&gt;安装和使用&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 添加 Marketplace&lt;/span&gt;
/plugin marketplace add discountry/ritmex-marketplace

&lt;span class=&quot;c&quot;&gt;# 安装插件&lt;/span&gt;
/plugin &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;claude-code-notification@ritmex-marketplace

&lt;span class=&quot;c&quot;&gt;# 验证安装&lt;/span&gt;
/plugin
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;高级-hook-示例&quot;&gt;高级 Hook 示例&lt;/h2&gt;

&lt;h3 id=&quot;示例-1自动代码格式化&quot;&gt;示例 1：自动代码格式化&lt;/h3&gt;

&lt;p&gt;在文件写入后自动运行格式化工具：&lt;/p&gt;

&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;hooks&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;PostToolUse&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;matcher&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Write|Edit&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;hooks&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
          &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;type&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;command&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;command&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;$CLAUDE_PROJECT_DIR/.claude/hooks/format.sh&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;timeout&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
          &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;format.sh&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;#!/bin/bash&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;INPUT&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;FILE_PATH&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$INPUT&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; | jq &lt;span class=&quot;nt&quot;&gt;-r&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;.tool_response.filePath // .tool_input.file_path // &quot;&quot;&apos;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-z&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$FILE_PATH&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then
    &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;exit &lt;/span&gt;0
&lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# 根据文件类型选择格式化工具&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$FILE_PATH&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;.js|&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;.jsx|&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;.ts|&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;.tsx|&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;.json&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;command&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; prettier &amp;amp;&amp;gt; /dev/null&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then
            &lt;/span&gt;prettier &lt;span class=&quot;nt&quot;&gt;--write&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$FILE_PATH&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; 2&amp;gt;/dev/null
        &lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;.py&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;command&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; black &amp;amp;&amp;gt; /dev/null&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then
            &lt;/span&gt;black &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$FILE_PATH&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; 2&amp;gt;/dev/null
        &lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;.go&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;command&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; gofmt &amp;amp;&amp;gt; /dev/null&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then
            &lt;/span&gt;gofmt &lt;span class=&quot;nt&quot;&gt;-w&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$FILE_PATH&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; 2&amp;gt;/dev/null
        &lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;esac&lt;/span&gt;

&lt;span class=&quot;nb&quot;&gt;exit &lt;/span&gt;0
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;示例-2命令验证&quot;&gt;示例 2：命令验证&lt;/h3&gt;

&lt;p&gt;拦截危险命令并建议更安全的替代方案：&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;#!/usr/bin/env python3
&lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;json&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;re&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;sys&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;VALIDATION_RULES&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
        &lt;span class=&quot;sa&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;\bgrep\b(?!.*\|)&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;&quot;建议使用 &apos;rg&apos; (ripgrep) 替代 &apos;grep&apos;，性能更好且功能更强大&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
        &lt;span class=&quot;sa&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;\bfind\s+\S+\s+-name\b&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;&quot;建议使用 &apos;rg --files | rg pattern&apos; 替代 &apos;find -name&apos;，性能更好&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
        &lt;span class=&quot;sa&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;rm\s+-rf\s+/&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;&quot;危险操作：删除根目录！请确认这是你想要的。&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;try&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;input_data&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;load&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;stdin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;except&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;JSONDecodeError&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;错误: 无效的 JSON 输入: &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;stderr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;sys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;exit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;tool_name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;input_data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;tool_name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;tool_input&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;input_data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;tool_input&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{})&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;command&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tool_input&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;command&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tool_name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;Bash&quot;&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;or&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;not&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;command&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;sys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;exit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;issues&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pattern&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;message&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;VALIDATION_RULES&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;re&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;search&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pattern&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;command&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;issues&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;issues&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;message&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;issues&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;• &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;stderr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;sys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;exit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;# 阻止命令执行
&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;sys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;exit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;示例-3智能停止判断&quot;&gt;示例 3：智能停止判断&lt;/h3&gt;

&lt;p&gt;使用 LLM 判断 Claude 是否应该继续工作：&lt;/p&gt;

&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;hooks&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Stop&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;hooks&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
          &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;type&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;prompt&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;prompt&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;评估 Claude 是否应该停止工作。上下文: $ARGUMENTS&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;分析对话并判断：&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;1. 用户请求的所有任务是否已完成&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;2. 是否有需要解决的错误&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;3. 是否需要后续工作&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;返回 JSON: {&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;decision&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;: &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;approve&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; 或 &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;block&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;reason&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;: &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;你的解释&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;}&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;timeout&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
          &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;发布和分发插件&quot;&gt;发布和分发插件&lt;/h2&gt;

&lt;h3 id=&quot;创建-github-marketplace&quot;&gt;创建 GitHub Marketplace&lt;/h3&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;创建仓库结构&lt;/strong&gt;：&lt;/li&gt;
&lt;/ol&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;mkdir &lt;/span&gt;my-marketplace
&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;my-marketplace
&lt;span class=&quot;nb&quot;&gt;mkdir&lt;/span&gt; .claude-plugin
&lt;span class=&quot;c&quot;&gt;# 创建 marketplace.json&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# 添加插件目录&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;推送到 GitHub&lt;/strong&gt;：&lt;/li&gt;
&lt;/ol&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git init
git add &lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;
git commit &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Initial marketplace&quot;&lt;/span&gt;
git remote add origin https://github.com/your-org/my-marketplace.git
git push &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; origin main
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;用户安装&lt;/strong&gt;：&lt;/li&gt;
&lt;/ol&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;/plugin marketplace add your-org/my-marketplace
/plugin &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;plugin-name@my-marketplace
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;团队配置&quot;&gt;团队配置&lt;/h3&gt;

&lt;p&gt;在项目的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.claude/settings.json&lt;/code&gt; 中配置自动安装：&lt;/p&gt;

&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;extraKnownMarketplaces&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;my-marketplace&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;source&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;source&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;github&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;repo&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;your-org/my-marketplace&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;enabledPlugins&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;plugin-name@my-marketplace&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;团队成员信任仓库文件夹后，插件会自动安装。&lt;/p&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;最佳实践&quot;&gt;最佳实践&lt;/h2&gt;

&lt;h3 id=&quot;安全性&quot;&gt;安全性&lt;/h3&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;验证输入&lt;/strong&gt;：永远不要盲目信任输入数据&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;引用变量&lt;/strong&gt;：使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&quot;$VAR&quot;&lt;/code&gt; 而不是 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$VAR&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;阻止路径遍历&lt;/strong&gt;：检查文件路径中的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;..&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;使用绝对路径&lt;/strong&gt;：为脚本指定完整路径&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;跳过敏感文件&lt;/strong&gt;：避免处理 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.env&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.git/&lt;/code&gt;、密钥等&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;性能&quot;&gt;性能&lt;/h3&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;设置超时&lt;/strong&gt;：为长时间运行的脚本设置合理的超时&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;并行执行&lt;/strong&gt;：多个匹配的 Hook 会并行运行&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;去重&lt;/strong&gt;：相同的 Hook 命令会自动去重&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;调试&quot;&gt;调试&lt;/h3&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;使用调试模式&lt;/strong&gt;：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;claude --debug&lt;/code&gt; 查看详细执行信息&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;测试命令&lt;/strong&gt;：先手动运行 Hook 命令确保正常工作&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;检查配置&lt;/strong&gt;：使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/hooks&lt;/code&gt; 查看已注册的 Hook&lt;/li&gt;
&lt;/ol&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;总结&quot;&gt;总结&lt;/h2&gt;

&lt;p&gt;Claude Code 的插件系统提供了强大的扩展能力：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Commands&lt;/strong&gt;：快速创建自定义命令&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Agents&lt;/strong&gt;：定义专门的子代理&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Skills&lt;/strong&gt;：扩展模型能力&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Hooks&lt;/strong&gt;：自动化工作流和增强安全性&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;MCP Servers&lt;/strong&gt;：集成外部工具&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;通过插件系统，你可以：&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;自动化重复任务&lt;/li&gt;
  &lt;li&gt;增强开发安全性&lt;/li&gt;
  &lt;li&gt;集成团队工具&lt;/li&gt;
  &lt;li&gt;提升开发效率&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;参考资源：&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://code.claude.com/docs&quot;&gt;Claude Code 官方文档&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/discountry/ritmex-marketplace&quot;&gt;ritmex-marketplace 示例&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://code.claude.com/docs/plugins-reference&quot;&gt;Plugin 参考文档&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://code.claude.com/docs/hooks-reference&quot;&gt;Hook 参考文档&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;开始创建你的第一个插件，让 Claude Code 更加强大！&lt;/p&gt;

</description>
        <pubDate>Sun, 14 Dec 2025 00:00:00 +0800</pubDate>
        <link>https://yubolun.com/tutorial/2025/12/14/claude-code-plugin-hook-tutorial/</link>
        <guid isPermaLink="true">https://yubolun.com/tutorial/2025/12/14/claude-code-plugin-hook-tutorial/</guid>
        
        <category>claude code</category>
        
        <category>plugin</category>
        
        <category>hook</category>
        
        <category>mcp</category>
        
        
        <category>tutorial</category>
        
      </item>
    
      <item>
        <title>如何在手机上优雅地 Vibe Coding</title>
        <description>&lt;p&gt;在手机上写代码的核心思路是：
&lt;strong&gt;计算在远程，手机只负责输入与查看结果。&lt;/strong&gt;&lt;/p&gt;

&lt;!--more--&gt;

&lt;h1 id=&quot;方案一在-vps-上运行-codex--claude-code-等-cli&quot;&gt;方案一：在 VPS 上运行 Codex / Claude Code 等 CLI&lt;/h1&gt;

&lt;p&gt;然后手机用 Termius（或任意 iOS SSH App）连接&lt;/p&gt;

&lt;p&gt;流程非常简单：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;在 VPS 上安装 Node（18+）与 Coding CLI：&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;curl &lt;span class=&quot;nt&quot;&gt;-fsSL&lt;/span&gt; https://deb.nodesource.com/setup_20.x | &lt;span class=&quot;nb&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-E&lt;/span&gt; bash -
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-y&lt;/span&gt; nodejs
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;安装 Codex 或其他 CLI：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;npm &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; @openai/codex
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;在 VPS 上运行 CLI：&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;codex
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;手机端用 Termius 等 SSH App 登录 VPS。&lt;/strong&gt;
进入终端后就能直接使用 CLI，在手机上写代码、跑 agent。&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;特点：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;环境永远在线&lt;/li&gt;
  &lt;li&gt;手机就是纯终端&lt;/li&gt;
  &lt;li&gt;随时随地 vibe coding&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;方案二使用-happy把家里电脑的-coding-cli-映射到手机&quot;&gt;方案二：使用 Happy，把家里电脑的 Coding CLI 映射到手机&lt;/h1&gt;

&lt;p&gt;（官方 Quick Start 工作方式）&lt;/p&gt;

&lt;p&gt;Happy 的作用是：
&lt;strong&gt;把你家里电脑正在运行的 coding CLI，安全地连接到你的手机上。&lt;/strong&gt;
不需要公网 IP，也不需要 SSH。&lt;/p&gt;

&lt;p&gt;流程：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;在家里电脑安装 Node（18+）与 Happy：&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;npm &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; happy-coder
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;在电脑执行认证：&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;happy &lt;span class=&quot;nt&quot;&gt;--auth&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;电脑会显示一个二维码 / 代码。&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;打开手机上的 Happy（App 或 Web）扫描绑定。&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;绑定后，你就能：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;在手机上访问电脑的 coding CLI&lt;/li&gt;
  &lt;li&gt;操作完全在手机界面完成&lt;/li&gt;
  &lt;li&gt;电脑执行、手机查看结果&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;特点：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;复用家里电脑的性能与环境&lt;/li&gt;
  &lt;li&gt;手机端操作舒服&lt;/li&gt;
  &lt;li&gt;无需 SSH、无需对外暴露电脑&lt;/li&gt;
&lt;/ul&gt;

&lt;h1 id=&quot;总结&quot;&gt;总结&lt;/h1&gt;

&lt;p&gt;手机优雅 vibe coding 的最简单实践就是：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;要稳定、常在线 → VPS + SSH 运行 Codex 等 CLI&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;要高性能、用自己电脑 → Happy 远程连接本地 CLI&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;两种方式都足够轻量，也都能让手机实现完整 coding 体验。&lt;/p&gt;
</description>
        <pubDate>Wed, 10 Dec 2025 00:00:00 +0800</pubDate>
        <link>https://yubolun.com/tutorial/2025/12/10/remote-vibe-coding/</link>
        <guid isPermaLink="true">https://yubolun.com/tutorial/2025/12/10/remote-vibe-coding/</guid>
        
        <category>vps</category>
        
        <category>iOS</category>
        
        <category>vibe coding</category>
        
        
        <category>tutorial</category>
        
      </item>
    
      <item>
        <title>买房时，我们到底在买什么？——中国住宅真实寿命研究报告</title>
        <description>&lt;p&gt;过去三十年，房地产是中国家庭资产配置的绝对核心。在长期单边上涨的市场环境下，房产被视为唯一的低风险高收益资产，吸纳了居民部门绝大多数的储蓄与未来现金流。&lt;/p&gt;

&lt;p&gt;随着宏观经济进入调整期，资产价格预期的逆转迫使市场参与者重新评估其持有成本与潜在风险。当剥离了高增长时代的金融溢价后，一个长期被忽视的结构性风险暴露无遗：&lt;/p&gt;

&lt;p&gt;购房者通过背负长达 30 年的刚性债务，试图锁定 70 年的土地使用权。然而，作为权益载体的钢筋混凝土建筑，其统计学意义上的物理寿命，往往无法覆盖完整的产权周期，甚至难以跑赢按揭贷款的偿付周期。这种债务久期与资产寿命的倒挂，构成了普通家庭资产负债表上最大的隐患。&lt;/p&gt;

&lt;!--more--&gt;

&lt;h3 id=&quot;1-核心矛盾设计标准-vs-统计现实&quot;&gt;1. 核心矛盾：设计标准 vs. 统计现实&lt;/h3&gt;

&lt;p&gt;关于房屋寿命，存在两个截然不同的概念：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;设计使用年限（理论值）&lt;/strong&gt;：指在正常设计、施工、使用和维护下，房屋结构能满足安全使用的年限。
    &lt;ul&gt;
      &lt;li&gt;根据《建筑结构可靠度设计统一标准》（GB 50068-2001）和《民用建筑设计通则》（JGJ 37-1987），普通居住房屋的结构设计使用年限为 &lt;strong&gt;50年&lt;/strong&gt;。&lt;/li&gt;
      &lt;li&gt;重要建筑（如高层地标）可达 &lt;strong&gt;100年&lt;/strong&gt;。&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;实际服役寿命（统计值）&lt;/strong&gt;：指房屋从建成到被拆除的实际时间。
    &lt;ul&gt;
      &lt;li&gt;根据剑桥大学 Zhou 等人 2019 年发表于《Sustainability》的研究，通过对 1978-2017 年中国城市住宅存量的生存分析，得出中国城市住宅建筑的平均寿命约为 &lt;strong&gt;34.1年&lt;/strong&gt;。&lt;/li&gt;
      &lt;li&gt;这一数据验证了住建部原副部长仇保兴在 2010 年提出的观点：“我国建筑的平均寿命只能维持 &lt;strong&gt;25-30年&lt;/strong&gt;。”&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;2-寿命折损原因分析&quot;&gt;2. 寿命折损原因分析&lt;/h3&gt;

&lt;p&gt;中国住宅“短命”并非单一结构质量问题，而是复合因素的结果：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;非物理性折损（拆迁与更新）&lt;/strong&gt;：这是导致平均寿命偏低的主因。在城市化快速推进阶段，许多房屋结构尚未老化，但因土地价值重估、城市规划变更或容积率调整而被提前拆除。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;建造质量的历史包袱&lt;/strong&gt;：上世纪 80-90 年代建造的早期商品房或房改房，受限于当时的建材标准（如预制板结构）和施工监管，耐久性确实不足，导致目前面临集中淘汰。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;维护体系缺失&lt;/strong&gt;：相比于建设阶段的巨额投入，国内住宅在交付后的维护投入长期不足。缺乏系统的修缮导致建筑老化速度加快，“年久失修”成为拆除的合理化理由。&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;3-一线城市的特殊性上海与北广深&quot;&gt;3. 一线城市的特殊性：上海与北广深&lt;/h3&gt;

&lt;p&gt;对于一线城市（北上广深），情况较全国平均水平略有不同。&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;质量更优，寿命略长&lt;/strong&gt;：一线城市执行更严格的建筑规范和监管。2024 年关于上海民用建筑全生命周期碳排放的研究指出，上海民用建筑的平均寿命约为 &lt;strong&gt;40年&lt;/strong&gt;。这高于全国 34.1 年的平均水平。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;更新压力依然存在&lt;/strong&gt;：尽管建筑质量较好，但一线城市土地稀缺，旧城改造和城市更新的动力更强。许多位于核心地段的低密度老旧小区（如 6 层砖混楼），往往因无法匹配当前的土地经济价值而被拆除重建。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;对于一线城市购房者，&lt;strong&gt;30-40年&lt;/strong&gt; 是一个基于历史数据的合理预期区间。特别是 2000 年之前建造的住宅，面临着更高的物理老化风险或拆迁不确定性。&lt;/p&gt;

&lt;h3 id=&quot;4-国际横向对比&quot;&gt;4. 国际横向对比&lt;/h3&gt;

&lt;p&gt;将视野扩大到全球，中国住宅的寿命处于什么水平？&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: left&quot;&gt;国家/地区&lt;/th&gt;
      &lt;th style=&quot;text-align: left&quot;&gt;住宅平均寿命 (估算/统计)&lt;/th&gt;
      &lt;th style=&quot;text-align: left&quot;&gt;主要特征&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;中国&lt;/strong&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;25 - 35 年&lt;/strong&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;受城市更新和早期质量影响大，实际寿命远低于设计寿命。&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;日本&lt;/strong&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;25 - 35 年&lt;/strong&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;尽管建筑技术先进，但因资产折旧制度和对新房的偏好，市场倾向于“拆旧建新”，经济寿命短。&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;美国&lt;/strong&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;61 - 74 年&lt;/strong&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;存量房市场成熟，木结构房屋维护体系完善。&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;英国&lt;/strong&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;75 - 132 年&lt;/strong&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;极端案例。大量维多利亚时期砖石建筑仍在使用，社会习惯于修缮而非拆除。&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;西欧&lt;/strong&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;70 - 100 年&lt;/strong&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;普遍拥有较长的建筑服役周期。&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;&lt;strong&gt;数据来源&lt;/strong&gt;：&lt;em&gt;Sustainability (MDPI)&lt;/em&gt;, &lt;em&gt;ResearchGate&lt;/em&gt;, &lt;em&gt;China Economic Review&lt;/em&gt;, 英国 &lt;em&gt;BS 7543&lt;/em&gt; 标准。&lt;/p&gt;

&lt;h3 id=&quot;5-结语最大的赌场往往不需要门票&quot;&gt;5. 结语：最大的赌场往往不需要门票&lt;/h3&gt;

&lt;p&gt;在二级市场，无论是股票还是加密货币，成熟的投资者都会反复告诫新人一条铁律：&lt;strong&gt;远离合约，拒绝高杠杆&lt;/strong&gt;。因为在波动的市场中，加杠杆等同于将命运交付给概率，稍有不慎便是爆仓归零。&lt;/p&gt;

&lt;p&gt;然而，极具讽刺意味的是，在面对“买房”这一人生最大宗交易时，绝大多数以“稳健”自居的普通家庭，却毫不犹豫地选择了拉满杠杆、押上全部身家，进行一次长达 30 年的单边做多。&lt;/p&gt;

&lt;p&gt;这不仅是一次满仓梭哈，更是一场针对劣质资产的豪赌。我们用透支未来 30 年现金流的代价，去锁定一个统计寿命可能仅有 34 年、且并不具备神圣不可侵犯之私有产权属性的耗材。当按揭贷款的周期几乎等同于建筑物本身的物理生命周期时，这在金融逻辑上已经构成了一种极其危险的“久期错配”。&lt;/p&gt;

&lt;p&gt;在这个局中，人口老龄化是灰犀牛，建筑短命是黑天鹅，而产权的不确定性则是始终悬在头顶的达摩克利斯之剑。&lt;/p&gt;

&lt;p&gt;当下越来越多的年轻人选择不婚、不育、不买房，被主流舆论诟病为“躺平”或“缺乏责任感”。但若从投资风控的角度审视，这或许是新生代作为市场参与者，在直觉上察觉到了赔率的失衡——当一张期货合约的底层资产在不断折旧，且交割规则由庄家单方面解释时，&lt;strong&gt;拒绝开仓，才是唯一的理性避险。&lt;/strong&gt;&lt;/p&gt;
</description>
        <pubDate>Wed, 10 Dec 2025 00:00:00 +0800</pubDate>
        <link>https://yubolun.com/research/2025/12/10/house-problem/</link>
        <guid isPermaLink="true">https://yubolun.com/research/2025/12/10/house-problem/</guid>
        
        <category>realestate</category>
        
        
        <category>research</category>
        
      </item>
    
      <item>
        <title>在 512MB 微型 VPS 上创建虚拟内存并安装 Codex</title>
        <description>&lt;p&gt;在 512MB 甚至 256MB 这种微型 VPS 上跑现代工具（比如 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bun add&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm install&lt;/code&gt;、Codex CLI）时，很容易遭遇内核 OOM（Out of Memory）直接把进程干掉：&lt;/p&gt;

&lt;!--more--&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;/usr/bin/env: ‘node’: No such file or directory
Out of memory: Killed process ...
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;此类问题一般由两点引起：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;系统没有 Node.js&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;没有启用 swap，内存耗尽即被 OOM 干掉&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;以下内容提供清晰可靠的处理流程：
（1）释放磁盘空间 →（2）创建并启用 1GB swap →（3）安装 Node.js 20（NodeSource）→（4）安装 Codex CLI
最后附带完整一键脚本。&lt;/p&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;1-查看当前内存与-swap-状态&quot;&gt;1. 查看当前内存与 swap 状态&lt;/h2&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;free &lt;span class=&quot;nt&quot;&gt;-h&lt;/span&gt;
swapon &lt;span class=&quot;nt&quot;&gt;--show&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;典型输出（Swap 为 0B）：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Swap: 0B  0B  0B
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;必须先启用 swap 才能稳定运行安装工具。&lt;/p&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;2-释放磁盘空间若--已满&quot;&gt;2. 释放磁盘空间（若 / 已满）&lt;/h2&gt;

&lt;p&gt;检查磁盘：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;df&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-h&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;若使用率100%，需要先清理：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo truncate&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; 0 /var/log/sing-box/access.log 2&amp;gt;/dev/null &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;true
sudo truncate&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; 0 /var/log/btmp.1               2&amp;gt;/dev/null &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;true
sudo &lt;/span&gt;apt-get clean
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;再次确认：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;df&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-h&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;3-创建并启用-1gb-swapfile&quot;&gt;3. 创建并启用 1GB swapfile&lt;/h2&gt;

&lt;h3 id=&quot;删除旧-swapfile如果有&quot;&gt;删除旧 swapfile（如果有）&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;swapoff /swapfile 2&amp;gt;/dev/null &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;true
sudo rm&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt; /swapfile 2&amp;gt;/dev/null &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;创建新-swapfile&quot;&gt;创建新 swapfile&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;fallocate &lt;span class=&quot;nt&quot;&gt;-l&lt;/span&gt; 1G /swapfile
&lt;span class=&quot;nb&quot;&gt;sudo chmod &lt;/span&gt;600 /swapfile
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;mkswap /swapfile
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;swapon /swapfile
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;检查-swap-是否生效&quot;&gt;检查 swap 是否生效&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;swapon &lt;span class=&quot;nt&quot;&gt;--show&lt;/span&gt;
free &lt;span class=&quot;nt&quot;&gt;-h&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;应看到类似：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Swap:
/swapfile   file   1G   0B   1G
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;4-开机自动挂载-swap&quot;&gt;4. 开机自动挂载 swap&lt;/h2&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;/swapfile none swap sw 0 0&apos;&lt;/span&gt; | &lt;span class=&quot;nb&quot;&gt;sudo tee&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt; /etc/fstab
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;5-安装-nodejs-20nodesource-官方源&quot;&gt;5. 安装 Node.js 20（NodeSource 官方源）&lt;/h2&gt;

&lt;p&gt;Codex CLI 基于 Node.js，因此必须先安装 Node.js。
使用 NodeSource 可获得最新稳定版本。&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;curl &lt;span class=&quot;nt&quot;&gt;-fsSL&lt;/span&gt; https://deb.nodesource.com/setup_20.x | &lt;span class=&quot;nb&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-E&lt;/span&gt; bash -
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-y&lt;/span&gt; nodejs
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;确认版本：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;node &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;6-安装-codex-cli&quot;&gt;6. 安装 Codex CLI&lt;/h2&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;npm &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; @openai/codex
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;确认安装成功：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;which codex
codex &lt;span class=&quot;nt&quot;&gt;--help&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;若能正常输出帮助信息，则安装完成。&lt;/p&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;一键脚本创建-swap--安装-nodejs20--安装-codex&quot;&gt;一键脚本：创建 swap + 安装 Node.js20 + 安装 Codex&lt;/h1&gt;

&lt;p&gt;保存为 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setup_codex.sh&lt;/code&gt;：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;#!/usr/bin/env bash&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;SWAP_SIZE&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;1G&quot;&lt;/span&gt;

&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&amp;gt;&amp;gt;&amp;gt; 清理日志与 APT 缓存&quot;&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo truncate&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; 0 /var/log/sing-box/access.log 2&amp;gt;/dev/null &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;true
sudo truncate&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; 0 /var/log/btmp.1               2&amp;gt;/dev/null &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;true
sudo &lt;/span&gt;apt-get clean &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;true

echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&amp;gt;&amp;gt;&amp;gt; 删除旧 swapfile（如有）&quot;&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;swapoff /swapfile 2&amp;gt;/dev/null &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;true
sudo rm&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt; /swapfile 2&amp;gt;/dev/null &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;true

echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&amp;gt;&amp;gt;&amp;gt; 创建新的 swapfile (&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;SWAP_SIZE&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;)&quot;&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;fallocate &lt;span class=&quot;nt&quot;&gt;-l&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;SWAP_SIZE&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; /swapfile
&lt;span class=&quot;nb&quot;&gt;sudo chmod &lt;/span&gt;600 /swapfile
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;mkswap /swapfile
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;swapon /swapfile

&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&amp;gt;&amp;gt;&amp;gt; 写入 /etc/fstab（如果缺失）&quot;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;FSTAB_LINE&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;/swapfile none swap sw 0 0&quot;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;grep&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-q&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;^/swapfile &quot;&lt;/span&gt; /etc/fstab 2&amp;gt;/dev/null&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then
  &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;FSTAB_LINE&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; | &lt;span class=&quot;nb&quot;&gt;sudo tee&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt; /etc/fstab &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;/dev/null
&lt;span class=&quot;k&quot;&gt;fi

&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&amp;gt;&amp;gt;&amp;gt; 安装 Node.js 20（NodeSource）&quot;&lt;/span&gt;
curl &lt;span class=&quot;nt&quot;&gt;-fsSL&lt;/span&gt; https://deb.nodesource.com/setup_20.x | &lt;span class=&quot;nb&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-E&lt;/span&gt; bash -
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-y&lt;/span&gt; nodejs

&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&amp;gt;&amp;gt;&amp;gt; Node 版本：&quot;&lt;/span&gt;
node &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt;

&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&amp;gt;&amp;gt;&amp;gt; 安装 Codex CLI&quot;&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;npm &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; @openai/codex

&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&amp;gt;&amp;gt;&amp;gt; Codex CLI 已安装&quot;&lt;/span&gt;
which codex &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;true
&lt;/span&gt;codex &lt;span class=&quot;nt&quot;&gt;--help&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;true

echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&amp;gt;&amp;gt;&amp;gt; 完成&quot;&lt;/span&gt;
free &lt;span class=&quot;nt&quot;&gt;-h&lt;/span&gt;
swapon &lt;span class=&quot;nt&quot;&gt;--show&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;运行：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;chmod&lt;/span&gt; +x setup_codex.sh
./setup_codex.sh
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;微型 VPS 上运行 Codex CLI 至此即可稳定运行，不再遇到 OOM Killed 或 node 不存在的问题。&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;如需我为你的服务器环境进一步优化配置，也可继续发我 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;df -h&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;free -h&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;top&lt;/code&gt; 等输出。&lt;/p&gt;

</description>
        <pubDate>Wed, 10 Dec 2025 00:00:00 +0800</pubDate>
        <link>https://yubolun.com/tutorial/2025/12/10/codex-vps/</link>
        <guid isPermaLink="true">https://yubolun.com/tutorial/2025/12/10/codex-vps/</guid>
        
        <category>vps</category>
        
        <category>vibe coding</category>
        
        
        <category>tutorial</category>
        
      </item>
    
      <item>
        <title>设计灵感网站推荐合集</title>
        <description>&lt;p&gt;在进行网站设计、界面 UI/UX 创作或品牌营销页开发时，拥有一个优质的灵感库至关重要。下面我整理了一批极具参考价值的设计展示网站，涵盖一页式 (One-Page) 设计、Landing Page 范例、动画与微交互动效、作品集、创意图库等多个维度。无论你是「小恐龙 KOL tweet 模板」「社区互动页」「区块链／AI 项目官网」等场景，都能从中找到有助于提炼风格、调色板、布局结构或动画节奏的参考。&lt;/p&gt;

&lt;!--more--&gt;

&lt;h2 id=&quot;1-siteinspire&quot;&gt;1. &lt;a href=&quot;https://www.siteinspire.com/&quot;&gt;siteInspire&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;这是一个专门展示优质网页设计的网站，其定位是「展示网络上最好的设计 + 才能」。:contentReference[oaicite:0]{index=0}&lt;br /&gt;
&lt;strong&gt;推荐理由&lt;/strong&gt;：&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;涵盖了视觉、界面、交互佳作，适合做整体版式、配色与排版灵感采集。&lt;/li&gt;
  &lt;li&gt;策展质量高，适合快速 « 浏览 + 收藏 »。&lt;br /&gt;
&lt;strong&gt;使用建议&lt;/strong&gt;：在构思品牌主页或大型项目官网（如你在 crypto/AI 生态中的各类主题页面）时，可先浏览 siteInspire ，锁定主视觉风格，再延伸开发。&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;2-awwwards&quot;&gt;2. &lt;a href=&quot;https://www.awwwards.com/&quot;&gt;Awwwards&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;这是一个全球知名的网页设计奖项平台，聚焦展示开发者、设计师、网页机构的高水准作品。:contentReference[oaicite:1]{index=1}&lt;br /&gt;
&lt;strong&gt;推荐理由&lt;/strong&gt;：&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;包含「Site of the Day」「Nominees」「Winners」等分类，可看到当下最新最前沿的网页互动、动画技术、案例趋势。&lt;/li&gt;
  &lt;li&gt;拥有按技术、类别筛选（如 React 、WebGL 、3D 、Scroll 等）功能。&lt;br /&gt;
&lt;strong&gt;使用建议&lt;/strong&gt;：如果你想让「小恐龙 &amp;amp; 蟹王」那种角色动画在网页中有炫酷交互，或想做一个区块链项目页带微交互、3D 效果，这里是寻找技术灵感的极佳来源。&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;3-css-design-awards&quot;&gt;3. &lt;a href=&quot;https://www.cssdesignawards.com/&quot;&gt;CSS Design Awards&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;另一个高质量的网站奖项平台，强调 UI、UX 与创新三个维度。:contentReference[oaicite:2]{index=2}&lt;br /&gt;
&lt;strong&gt;推荐理由&lt;/strong&gt;：&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;每个获奖作品都会标注 UI 、UX 、Innovation 评分，便于理解为何被评为佳作。&lt;/li&gt;
  &lt;li&gt;可看到许多细节设计（排版、色彩、微动效）值得借鉴。&lt;br /&gt;
&lt;strong&gt;使用建议&lt;/strong&gt;：适用于你在制作 newsletter、Landing Page、社群宣传页 (如 Wind Runner SBT、YieldBasis allocation letter) 时，用于参考「优秀互动＋体验」的结构。&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;4-one-page-love&quot;&gt;4. &lt;a href=&quot;https://onepagelove.com/&quot;&gt;One Page Love&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;专注于单页网站（One-Page）设计的灵感库。:contentReference[oaicite:3]{index=3}&lt;br /&gt;
&lt;strong&gt;推荐理由&lt;/strong&gt;：&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;集合了大量单页网站案例、模板与资源，非常适合快速部署或构思一页式页面。&lt;/li&gt;
  &lt;li&gt;模板、资源链接丰富，可作为启动项目参考。&lt;br /&gt;
&lt;strong&gt;使用建议&lt;/strong&gt;：如果你准备做一个「小恐龙 快报 #1」那种一页式宣传页，或者 crypto 空投活动页面、SBT 活动页面，这里可以先选一个布局，再调整品牌角色（小恐龙／蟹王等）、色彩、图像场景。&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;5-landinglove&quot;&gt;5. &lt;a href=&quot;https://www.landing.love/&quot;&gt;Landing.love&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;（你提供的 Landing.love 链接）这个站点专注于 Landing Page 设计灵感。&lt;br /&gt;
&lt;strong&gt;推荐理由&lt;/strong&gt;：&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;虽不像其他奖项平台那样广为熟知，但专注在 Landing Page 范畴，可直接找到转化型页面结构的参考。&lt;br /&gt;
&lt;strong&gt;使用建议&lt;/strong&gt;：当你需要一个「注册／领取／参与」型页面时，此站可帮助你快速选定 Hero 区、 CTA 按钮位置、视觉聚焦等结构方案。&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;6-landingfolio&quot;&gt;6. &lt;a href=&quot;https://www.landingfolio.com/&quot;&gt;Landingfolio&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;专门为 Landing Page 提供灵感、模板与组件库。:contentReference[oaicite:4]{index=4}&lt;br /&gt;
&lt;strong&gt;推荐理由&lt;/strong&gt;：&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;不仅有案例，还有可复用的组件（Tailwind、Webflow、Figma）和模板。&lt;/li&gt;
  &lt;li&gt;分类细致（如 SaaS、产品、AI、加密、企业等）且资源丰富。&lt;br /&gt;
&lt;strong&gt;使用建议&lt;/strong&gt;：适合当你做「Kite AI Wind Runner SBT 宣页」或「Sentient Library 活动页」等具备 CTA 、注册流程、限时优惠结构的页面时使用。你甚至可以直接借用组件+模板，加快开发流程。&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;7-wall-of-portfolios&quot;&gt;7. &lt;a href=&quot;https://www.wallofportfolios.in/&quot;&gt;Wall of Portfolios&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;聚焦作品集类网页展示的灵感集合。&lt;br /&gt;
&lt;strong&gt;推荐理由&lt;/strong&gt;：&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;当你需要做个人/团队 portfolio 页（例如你自己做 Web3 工具、AI 代理系统的展示页）时，这是一个不错的参考库。&lt;br /&gt;
&lt;strong&gt;使用建议&lt;/strong&gt;：建议浏览那些由设计师、创意工作室打造的「作品展示页」结构，借鉴 项目模块布局、案例 Thumbnail 布局、动画切换方式，再结合你品牌吉祥物“小恐龙”等角色元素。&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;8-ui-ux-showcase&quot;&gt;8. &lt;a href=&quot;https://uiuxshowcase.com/&quot;&gt;UI UX Showcase&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;专注于 UI/UX 与设计资源展示的站点。:contentReference[oaicite:5]{index=5}&lt;br /&gt;
&lt;strong&gt;推荐理由&lt;/strong&gt;：&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;除了网页设计，还有设计资源、AI 工具推荐，非常适合追求 UX 细节与工具效率的你。&lt;br /&gt;
&lt;strong&gt;使用建议&lt;/strong&gt;：你可以用它来找到微动效、界面组件、流程设计灵感。当你做「小恐龙 &amp;amp; Monkey 驾驶 Zama Car」那种场景动画／界面演示页时，借鉴 UI /UX 细节会更加出彩。&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;9-httpster&quot;&gt;9. &lt;a href=&quot;https://httpster.net/&quot;&gt;Httpster&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;一个手工精选、不追大奖但追设计态度的网页设计展示网。:contentReference[oaicite:6]{index=6}&lt;br /&gt;
&lt;strong&gt;推荐理由&lt;/strong&gt;：&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;风格偏向极简、排版大胆、实验性强，很适合从中挖掘另类布局或打破常规的设计思路。&lt;br /&gt;
&lt;strong&gt;使用建议&lt;/strong&gt;：当你想让页面更具特色、更有“创意视觉冲击”时（比如 “Sentient Library” 场景页、或 “Cysic Mining Site” 互动页），在 Httpster 找灵感会很合适。&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;10-designspiration&quot;&gt;10. &lt;a href=&quot;https://www.designspiration.com/&quot;&gt;Designspiration&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;一个广泛的视觉灵感平台，涵盖色彩、图像、排版、插画等。&lt;br /&gt;
&lt;strong&gt;推荐理由&lt;/strong&gt;：&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;虽不专门针对网页，但在找色彩组合、插画风格、品牌配色 palette 时非常有用。&lt;br /&gt;
&lt;strong&gt;使用建议&lt;/strong&gt;：你可将其用于“小恐龙 + 蟹王 + 熊猫 + 小猪”角色画面中的配色参考，或寻找背景插画风格、叙事图像组合，再在网页中加以延伸。&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;11-abduzeedo&quot;&gt;11. &lt;a href=&quot;https://abduzeedo.com/&quot;&gt;Abduzeedo&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;一个创意设计博客与视觉灵感分享平台。&lt;br /&gt;
&lt;strong&gt;推荐理由&lt;/strong&gt;：&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;包含设计师访谈、教程、灵感汇总。适合你在品牌视觉、角色插画、小恐龙场景扩展中寻找更丰富的来源。&lt;br /&gt;
&lt;strong&gt;使用建议&lt;/strong&gt;：当你做“御花园 Portaltobitcoin 茶话会”那种叙事场景时，可借助 Abduzeedo 查找插画风格、排版摆设、空间构图等灵感。&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;12-gsap-showcase&quot;&gt;12. &lt;a href=&quot;https://gsap.com/showcase/&quot;&gt;GSAP Showcase&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;由 GSAP（GreenSock Animation Platform）官方维护的动画网页精选合集。:contentReference[oaicite:8]{index=8}&lt;br /&gt;
&lt;strong&gt;推荐理由&lt;/strong&gt;：&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;专注于动效、微交互、滚动触发、SVG 动画等高级交互形式。&lt;/li&gt;
  &lt;li&gt;若你网页中有「小恐龙 grid 交易在迪拜」「小恐龙 &amp;amp; 猴子 驾驶 Zama Car」这样的动态叙事场景，这类示例极具参考价值。&lt;br /&gt;
&lt;strong&gt;使用建议&lt;/strong&gt;：建议浏览其 Showcase 中发现哪种动画触发方式（如 ScrollTrigger、MorphSVG、Inertia）适合你的场景，再在项目中复用或改造。&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;13-behance&quot;&gt;13. &lt;a href=&quot;https://www.behance.net/&quot;&gt;Behance&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;由 Behance 提供的全球创意作品集平台。&lt;br /&gt;
&lt;strong&gt;推荐理由&lt;/strong&gt;：&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;设计师、插画师、动效师、网页开发者大量作品集中地，适合探索「概念页」「完整项目展示」的视觉叙事方式。&lt;br /&gt;
&lt;strong&gt;使用建议&lt;/strong&gt;：你可以搜索关键词如 “web design crypto”, “landing page illustration”, “UI/UX animation”，看看别人如何将角色、叙事、品牌融合到网页设计中，从中提炼灵感再落地至你的 Web3/AI 生态页面。&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;14-dribbble&quot;&gt;14. &lt;a href=&quot;https://dribbble.com/&quot;&gt;Dribbble&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;由 Dribbble 提供的设计师作品分享平台。&lt;br /&gt;
&lt;strong&gt;推荐理由&lt;/strong&gt;：&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;微交互、界面细节、动效 Preview 图常见；适合快速捕捉「一个按钮 hover 动画」「One-Page 滑动效果」这类设计元素。&lt;br /&gt;
&lt;strong&gt;使用建议&lt;/strong&gt;：当你在做页面细节（如 “小恐龙 &amp;amp; 猴子 驾驶 Zama Car”的按钮/切换/视觉反馈）时，Dribbble 是查找 UI 元素动效的绝佳场所，可供快速 slice 与复用。&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;-总结&quot;&gt;📌 总结&lt;/h1&gt;
&lt;ul&gt;
  &lt;li&gt;如果你需要 &lt;strong&gt;整体版式＋版面灵感&lt;/strong&gt;：推荐 siteInspire、Httpster、Designspiration。&lt;/li&gt;
  &lt;li&gt;想看 &lt;strong&gt;获奖/前沿交互效果&lt;/strong&gt;：推荐 Awwwards、CSS Design Awards、GSAP Showcase。&lt;/li&gt;
  &lt;li&gt;需要 &lt;strong&gt;一页式或 Landing Page 结构参考&lt;/strong&gt;：推荐 One Page Love、Landing.love、Landingfolio。&lt;/li&gt;
  &lt;li&gt;做 &lt;strong&gt;作品集／品牌展示页&lt;/strong&gt;：推荐 Wall of Portfolios、Behance、Dribbble。&lt;/li&gt;
  &lt;li&gt;想丰富 &lt;strong&gt;插画／视觉风格／配色&lt;/strong&gt;：推荐 Abduzeedo、Designspiration。&lt;/li&gt;
  &lt;li&gt;想搜寻 &lt;strong&gt;UI/UX 组件／动效资源&lt;/strong&gt;：推荐 UI UX Showcase、Dribbble。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;在你下一次打造「小恐龙 KOL tweet 模板」「社区互动页」「AI 代理支付系统的Landing Page」的时候，不妨按照以下流程使用这些资源：&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;先从整体风格库（如 siteInspire、Httpster）中选出一个视觉方向。&lt;/li&gt;
  &lt;li&gt;再去 Landing/One-Page 站点（如 Landingfolio、One Page Love）锁定结构布局。&lt;/li&gt;
  &lt;li&gt;从交互/动画库（如 GSAP Showcase、Awwwards）选取可复用的动效方案。&lt;/li&gt;
  &lt;li&gt;最后去插画/视觉/组件站点（如 Designspiration、UI UX Showcase）提取角色、配色、按钮、组件样式。&lt;/li&gt;
  &lt;li&gt;汇总后结合你品牌中“小恐龙、小猪、蟹王、熊猫”等角色与 ARB/Zama/Sentient/Billions Logo 元素，融入场景叙事，再做 Tailwind CSS/React/Vite 或 Webflow 落地。&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;希望这份集合对你接下来的网页设计与品牌传播创作有所帮助！如果你想我帮你从其中任意一个站点摘出 &lt;strong&gt;10 个精选案例&lt;/strong&gt;（比如「区块链项目专用Landing Page」）并生成 Figma 链接或 Tailwind 组件，也可以告诉我，我可以继续帮你整理。&lt;/p&gt;
</description>
        <pubDate>Fri, 21 Nov 2025 00:00:00 +0800</pubDate>
        <link>https://yubolun.com/design/2025/11/21/web-design-sites/</link>
        <guid isPermaLink="true">https://yubolun.com/design/2025/11/21/web-design-sites/</guid>
        
        <category>websites</category>
        
        
        <category>Design</category>
        
      </item>
    
      <item>
        <title>灵感菇——ChromeAI增强插件</title>
        <description>&lt;p&gt;链接直达：&lt;a href=&quot;https://chromewebstore.google.com/detail/mjbnaihbmfffiboanaecmeipafliekkn&quot;&gt;灵感菇AI助手&lt;/a&gt;&lt;/p&gt;

&lt;!--more--&gt;

&lt;p&gt;更新Chrome到最新版本&lt;/p&gt;

&lt;p&gt;Chrome浏览器地址栏输入&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;chrome://flags/#prompt-api-for-gemini-nano&quot;&gt;chrome://flags/#prompt-api-for-gemini-nano&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;修改为 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Enabled&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;前往Chrome应用商店&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://chromewebstore.google.com/detail/mjbnaihbmfffiboanaecmeipafliekkn&quot;&gt;https://chromewebstore.google.com/detail/mjbnaihbmfffiboanaecmeipafliekkn&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;下载安装后在右上角插件设置固定灵感菇插件&lt;/p&gt;

&lt;p&gt;点击打开插件设置页面，触发Chrome内置AI模型加载&lt;/p&gt;

&lt;p&gt;加载完毕后刷新 X 等网站即可看到AI增强功能&lt;/p&gt;
</description>
        <pubDate>Sat, 01 Nov 2025 00:00:00 +0800</pubDate>
        <link>https://yubolun.com/ai/2025/11/01/insroom/</link>
        <guid isPermaLink="true">https://yubolun.com/ai/2025/11/01/insroom/</guid>
        
        <category>extension</category>
        
        
        <category>AI</category>
        
      </item>
    
      <item>
        <title>使用 Warp 拯救 VPS 解锁 ChatGPT/Gemini/Netflix/Google验证码</title>
        <description>&lt;p&gt;用了很久的 VPS 突然打不开 Gemini 了，虽然是日本 IP 但是显示服务尚未在当前地区开放。&lt;/p&gt;

&lt;p&gt;真实物理IP/静态住宅IP是比较贵的，那么有没有一种办法可以解除这些限制呢？&lt;/p&gt;

&lt;!--more--&gt;

&lt;p&gt;今天学习到了可以使用 Cloudflare 提供的免费 Warp 服务，为 VPS 服务器本身添加代理网络出口，达到解锁目的。&lt;/p&gt;

&lt;p&gt;具体使用到的是&lt;a href=&quot;https://github.com/yonggekkk/warp-yg&quot;&gt;warp-yg&lt;/a&gt;一键安装脚本。&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;bash &amp;lt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;curl &lt;span class=&quot;nt&quot;&gt;-Ls&lt;/span&gt; https://raw.githubusercontent.com/yonggekkk/warp-yg/main/CFwarp.sh&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;根据命令行的提示操作即可。&lt;/p&gt;
</description>
        <pubDate>Fri, 05 Sep 2025 00:00:00 +0800</pubDate>
        <link>https://yubolun.com/tutorial/2025/09/05/warp-save-vps/</link>
        <guid isPermaLink="true">https://yubolun.com/tutorial/2025/09/05/warp-save-vps/</guid>
        
        <category>vps</category>
        
        
        <category>tutorial</category>
        
      </item>
    
      <item>
        <title>在末法时代里爬行</title>
        <description>&lt;p&gt;2002年，《波士顿环球报》揭露波士顿1500名神父中，有249名涉嫌性侵儿童。其中恶名昭著的吉欧根神父，面临130项性侵指控。&lt;/p&gt;

&lt;p&gt;该调查过程于2015年被改编为电影《聚焦》(Spotlight)。&lt;/p&gt;

&lt;!--more--&gt;

&lt;p&gt;同年7月26日，中国互联网出现署名“释正义”的举报帖《少林寺方丈释永信这只大老虎，谁来监督》，指控释永信拥有双重户籍、强奸尼僧释延果、包养情妇，并与哈尔滨女子关丽丽、尼僧释延洁各育有一名私生女，并提供了相关证据。&lt;/p&gt;

&lt;p&gt;2015年11月，河南调查组公布初步结果：释永信无私生子女，方丈资格“程序合法合规”；其余被举报问题仍在依法调查中。&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;释永信（原名刘应成），1965年9月6日生，八字乙巳 甲申 癸亥。2025年恰逢其转入戊寅大运，命理上讲，叫做「伤官见官」，主诉讼牢狱之灾。&lt;/p&gt;

&lt;p&gt;2025年7月27日，少林寺管理处官方通报：释永信涉嫌刑事犯罪，挪用侵占项目资金及寺院资产；严重违反佛教戒律，长期与多名女性保持不正当关系并育有私生子。&lt;/p&gt;

&lt;p&gt;7月28日，中国佛教协会公告，同意注销释永信戒牒。&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;佛教典籍载：佛法流传世间共一万二千年，分正法一千年、像法一千年、末法一万年。&lt;br /&gt;
正法为真佛法，像法尚存佛法之形，末法则佛法几近消亡。&lt;/p&gt;

&lt;p&gt;佛陀涅槃前三月，于《法灭尽经》中预言末世景象：&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;“吾涅槃后，法欲灭时，五逆浊世，魔道兴盛。&lt;br /&gt;
魔作沙门，坏乱吾道，著俗衣裳，乐好袈裟，五色之服，饮酒啖肉，杀生贪味。&lt;br /&gt;
无有慈心，更相憎嫉。”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;佛陀早已预言将有魔道假扮僧人，败坏佛法，行龌龊之事。&lt;/p&gt;

&lt;p&gt;同时预言：末法时代，纵有真修行者舍己为人，亦会遭假僧诽谤驱逐。&lt;br /&gt;
寺庙终将荒废，僧人腐化，贪财淫乱，不分男女，无人持戒诵经。&lt;/p&gt;

&lt;p&gt;以佛灭度年（公元前543年）为基准，2025年已入末法时代69年。&lt;br /&gt;
对照当下新闻与佛陀预言，世人皆可自忖：剧情已演进至哪一章节。&lt;/p&gt;

&lt;hr /&gt;

&lt;blockquote&gt;
  &lt;p&gt;每只蚂蚁 都有眼睛鼻子 它美不美丽 偏差有没有一毫厘 有何关系&lt;/p&gt;

  &lt;p&gt;每一个人 伤心了就哭泣 饿了就要吃 相差大不过天地 有何刺激&lt;/p&gt;

  &lt;p&gt;有太多太多魔力 太少道理 太多太多游戏 只是为了好奇&lt;br /&gt;
还有什么值得 歇斯底里 对什么东西 死心塌地&lt;/p&gt;

  &lt;p&gt;一个一个偶像 都不外如此 沉迷过的偶像 一个个消失&lt;/p&gt;

  &lt;p&gt;谁曾伤天害理 谁又是上帝 我们在等待 什么奇迹&lt;/p&gt;

  &lt;p&gt;最后剩下自己 舍不得挑剔 最后对着自己 也不大看得起&lt;br /&gt;
谁给我全世界 我都会怀疑 心花怒放 却开到荼蘼&lt;/p&gt;
&lt;/blockquote&gt;
</description>
        <pubDate>Mon, 25 Aug 2025 00:00:00 +0800</pubDate>
        <link>https://yubolun.com/artical/2025/08/25/no-faith-age/</link>
        <guid isPermaLink="true">https://yubolun.com/artical/2025/08/25/no-faith-age/</guid>
        
        <category>news</category>
        
        
        <category>artical</category>
        
      </item>
    
      <item>
        <title>Hysteria2 拯救 AWS lightsail 极速科学上网</title>
        <description>&lt;p&gt;以前我使用的上网冲浪方案都是 v2ray Websocket(WS)+TLS+CDN 的方式，这种方式的好处是安全性高，保护服务器不被 ban&lt;/p&gt;

&lt;p&gt;但前几天日本和新加坡的线路直接卡成💩&lt;/p&gt;

&lt;p&gt;多年没有研究上网冲浪姿势的我，只好重新拿起课本&lt;/p&gt;

&lt;p&gt;经过一番学习之后，我了解到了宝藏协议 Hysteria2&lt;/p&gt;

&lt;!--more--&gt;

&lt;p&gt;Hysteria2 底层使用的是 UDP 协议，即使 TCP ping 服务器有 200-300ms 的延迟&lt;/p&gt;

&lt;p&gt;使用 UDP 也能将延迟干到 50ms 左右&lt;/p&gt;

&lt;p&gt;网速更是可以快到运营商想来ban你的UDP流量&lt;/p&gt;

&lt;p&gt;Youtube 8K 视频也能做到秒开不卡顿&lt;/p&gt;

&lt;p&gt;使用 &lt;a href=&quot;https://lightsail.aws.amazon.com/&quot;&gt;AWS Lightsail&lt;/a&gt; 的好处是&lt;/p&gt;

&lt;p&gt;我可以很放心地把一些需要长期保存和稳定运行的服务都跑在上面&lt;/p&gt;

&lt;p&gt;也可以安心地存放一些 API Key 和密钥之类的&lt;/p&gt;

&lt;p&gt;网上大把的野鸡运营商的服务器，我是什么都不敢保存的&lt;/p&gt;

&lt;h3 id=&quot;安装教程&quot;&gt;安装教程&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;https://v2.hysteria.network/zh/docs/getting-started/Server-Installation-Script/&quot;&gt;Hysteria2 官网&lt;/a&gt; 贴心地提供了一键安装脚本&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 安装&lt;/span&gt;
bash &amp;lt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;curl &lt;span class=&quot;nt&quot;&gt;-fsSL&lt;/span&gt; https://get.hy2.sh/&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# 删除&lt;/span&gt;
bash &amp;lt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;curl &lt;span class=&quot;nt&quot;&gt;-fsSL&lt;/span&gt; https://get.hy2.sh/&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--remove&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;编辑配置&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;vim /etc/hysteria/config.yaml
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;配置内容&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;listen: :443 # 服务端口，可以换成别的

acme:
  domains:
    - hysteria.example.com # 你的域名
  email: admin@example.com # 你的邮箱
  type: dns
  dns:
    name: cloudflare
    config:
      cloudflare_api_token: vRDNxxxxxxxxxxxxxxx # Cloudflare API Key

auth:
  type: password
  password: 123456789 # 密码 

masquerade:
  type: proxy
  proxy:
    url: https://bing.com/
    rewriteHost: true
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;启动服务&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;systemctl &lt;span class=&quot;nb&quot;&gt;enable&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--now&lt;/span&gt; hysteria-server.service
&lt;span class=&quot;c&quot;&gt;# 查看状态&lt;/span&gt;
systemctl status hysteria-server.service
&lt;span class=&quot;c&quot;&gt;# 查看日志&lt;/span&gt;
journalctl &lt;span class=&quot;nt&quot;&gt;--no-pager&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; hysteria-server.service
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;到这一步就大功告成了！&lt;/p&gt;

&lt;p&gt;当然 Hysteria 也不是没有缺点，UDP的速度快是快，但很容易丢包和断流，不过对于90%使用场景是看网页刷视频的朋友，极速的体验还是非常舒服的。&lt;/p&gt;

</description>
        <pubDate>Thu, 12 Jun 2025 00:00:00 +0800</pubDate>
        <link>https://yubolun.com/tutorial/2025/06/12/hysteria-on-lightsail/</link>
        <guid isPermaLink="true">https://yubolun.com/tutorial/2025/06/12/hysteria-on-lightsail/</guid>
        
        <category>vps</category>
        
        
        <category>tutorial</category>
        
      </item>
    
  </channel>
</rss>
