<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Claude-Code on Chen Kai Blog</title><link>https://www.chenk.top/en/tags/claude-code/</link><description>Recent content in Claude-Code on Chen Kai Blog</description><generator>Hugo</generator><language>en</language><lastBuildDate>Mon, 27 Apr 2026 09:00:00 +0000</lastBuildDate><atom:link href="https://www.chenk.top/en/tags/claude-code/index.xml" rel="self" type="application/rss+xml"/><item><title>Claude Code Hands-On (10): Skills, and When to Reach for Each Extension Mechanism</title><link>https://www.chenk.top/en/claude-code-learn/10-skills-decision-tree/</link><pubDate>Mon, 27 Apr 2026 09:00:00 +0000</pubDate><guid>https://www.chenk.top/en/claude-code-learn/10-skills-decision-tree/</guid><description>&lt;p>Claude Code now has four extension mechanisms: slash commands, MCP servers, hooks, and Skills. They overlap. The first time you have a &amp;ldquo;Claude should know how to do X&amp;rdquo; thought, the question is &lt;em>which&lt;/em> of the four to use.&lt;/p>
&lt;p>This is the closing chapter of the series. Let me lay out the decision tree.&lt;/p>
&lt;p>&lt;figure class="article-figure">
 &lt;img src="https://blog-pic-ck.oss-cn-beijing.aliyuncs.com/posts/en/claude-code-learn/10-skills-decision-tree/illustration_1.png" alt="Claude Code Hands-On (10): Skills, and When to Reach for Each Extension Mechanism — Chapter overview" loading="lazy" decoding="async" class="content-image">
 
&lt;/figure>
&lt;/p></description></item><item><title>Claude Code Hands-On (9): settings.json, the Three-Layer Permission Model, and Env</title><link>https://www.chenk.top/en/claude-code-learn/09-settings-and-permissions/</link><pubDate>Sun, 26 Apr 2026 09:00:00 +0000</pubDate><guid>https://www.chenk.top/en/claude-code-learn/09-settings-and-permissions/</guid><description>&lt;p>Hooks let you interact with Claude Code, while settings.json specifies what it can access. This file also confuses many with its precedence rules.&lt;/p>
&lt;p>This chapter is the missing reference.&lt;/p>
&lt;p>&lt;figure class="article-figure">
 &lt;img src="https://blog-pic-ck.oss-cn-beijing.aliyuncs.com/posts/en/claude-code-learn/09-settings-and-permissions/illustration_1.png" alt="Claude Code Hands-On (9): settings.json, the Three-Layer Permission Model, and Env — Chapter overview" loading="lazy" decoding="async" class="content-image">
 
&lt;/figure>
&lt;/p>
&lt;hr>
&lt;h2 id="the-three-layers" class="heading-anchor">The three layers&lt;a href="#the-three-layers" class="heading-link" aria-label="Permalink to this section" title="Copy link to this section">#&lt;/a>
&lt;/h2>&lt;p>There are three settings.json files Claude Code reads, in order:&lt;/p>
&lt;ol>
&lt;li>&lt;strong>User settings&lt;/strong> — &lt;code>~/.claude/settings.json&lt;/code>. Applies to every project on your machine.&lt;/li>
&lt;li>&lt;strong>Project settings&lt;/strong> — &lt;code>&amp;lt;repo&amp;gt;/.claude/settings.json&lt;/code>. Committed to git. Applies to anyone working in this repo.&lt;/li>
&lt;li>&lt;strong>Local settings&lt;/strong> — &lt;code>&amp;lt;repo&amp;gt;/.claude/settings.local.json&lt;/code>. Gitignored. Your private overrides for this repo.&lt;/li>
&lt;/ol>
&lt;p>The merge rule: later layers override earlier ones, key by key. &lt;strong>Permissions are additive&lt;/strong> for &lt;code>allow&lt;/code>, &lt;strong>subtractive&lt;/strong> for &lt;code>deny&lt;/code> — once any layer denies something, no other layer can re-allow it. This asymmetry is what makes the system safe.&lt;/p></description></item><item><title>Claude Code Hands-On (8): Sub-Agents, Worktrees, and Plan Mode</title><link>https://www.chenk.top/en/claude-code-learn/08-subagents-worktrees-plan/</link><pubDate>Sat, 25 Apr 2026 09:00:00 +0000</pubDate><guid>https://www.chenk.top/en/claude-code-learn/08-subagents-worktrees-plan/</guid><description>&lt;p>After hooks, the next thing that changes how Claude Code operates is &lt;em>concurrency control&lt;/em>. Not in the threading sense, but in terms of how many tasks it handles, their isolation, and the level of oversight.&lt;/p>
&lt;p>Three features, in increasing order of trust required.&lt;/p>
&lt;p>&lt;figure class="article-figure">
 &lt;img src="https://blog-pic-ck.oss-cn-beijing.aliyuncs.com/posts/en/claude-code-learn/08-subagents-worktrees-plan/illustration_1.png" alt="Claude Code Hands-On (8): Sub-Agents, Worktrees, and Plan Mode — Chapter overview" loading="lazy" decoding="async" class="content-image">
 
&lt;/figure>
&lt;/p>
&lt;hr>
&lt;h2 id="plan-mode--the-airlock" class="heading-anchor">Plan mode — the airlock&lt;a href="#plan-mode--the-airlock" class="heading-link" aria-label="Permalink to this section" title="Copy link to this section">#&lt;/a>
&lt;/h2>&lt;p>Plan mode is the cheapest of the three. Press &lt;code>Shift+Tab&lt;/code> until the indicator says &lt;strong>plan&lt;/strong>. The model now plans without taking any actions. It will read, think, propose, and stop. You read the plan. You either approve, edit, or kill it. Only then does it execute.&lt;/p></description></item><item><title>Claude Code Hands-On (7): Ten Hooks I Actually Use, with the Code</title><link>https://www.chenk.top/en/claude-code-learn/07-hooks-deep-dive/</link><pubDate>Fri, 24 Apr 2026 09:00:00 +0000</pubDate><guid>https://www.chenk.top/en/claude-code-learn/07-hooks-deep-dive/</guid><description>&lt;p>&lt;a href="https://www.chenk.top/en/claude-code-learn/05-hooks/">Chapter 5&lt;/a>
 provided a conceptual tour of hooks. This chapter is the field guide. From the 100-script reference repo, ten scripts earn their place in every serious project I run. I&amp;rsquo;ll walk through these ten with code.&lt;/p>
&lt;p>All examples assume Node 18+, save scripts to &lt;code>./hooks/&lt;/code>, mark them &lt;code>chmod +x&lt;/code>, and wire them in &lt;code>.claude/settings.json&lt;/code> like:&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;span class="lnt">4
&lt;/span>&lt;span class="lnt">5
&lt;/span>&lt;span class="lnt">6
&lt;/span>&lt;span class="lnt">7
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-json" data-lang="json">&lt;span class="line">&lt;span class="cl">&lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;hooks&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;PreToolUse&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">{&lt;/span> &lt;span class="nt">&amp;#34;matcher&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;Read|Grep&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="nt">&amp;#34;hooks&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[{&lt;/span> &lt;span class="nt">&amp;#34;type&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;command&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="nt">&amp;#34;command&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;node ./hooks/block-env-read.js&amp;#34;&lt;/span> &lt;span class="p">}]&lt;/span> &lt;span class="p">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">]&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="p">}&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>Before we dive in, here&amp;rsquo;s the hook lifecycle to make the following code clear:&lt;/p></description></item><item><title>Claude Code Hands-On (6): The SDK, GitHub Integration, and Claude in CI</title><link>https://www.chenk.top/en/claude-code-learn/06-sdk-and-github/</link><pubDate>Thu, 23 Apr 2026 09:00:00 +0000</pubDate><guid>https://www.chenk.top/en/claude-code-learn/06-sdk-and-github/</guid><description>&lt;p>The CLI is the obvious surface. The SDK is the interesting one. The GitHub integration is where it pays off.&lt;/p>
&lt;p>&lt;figure class="article-figure">
 &lt;img src="https://blog-pic-ck.oss-cn-beijing.aliyuncs.com/posts/en/claude-code-learn/06-sdk-and-github/illustration_1.png" alt="Claude Code Hands-On (6): The SDK, GitHub Integration, and Claude in CI — Chapter overview" loading="lazy" decoding="async" class="content-image">
 
&lt;/figure>
&lt;/p>
&lt;hr>
&lt;h2 id="the-sdk-in-one-paragraph" class="heading-anchor">The SDK in one paragraph&lt;a href="#the-sdk-in-one-paragraph" class="heading-link" aria-label="Permalink to this section" title="Copy link to this section">#&lt;/a>
&lt;/h2>&lt;p>&lt;code>@anthropic-ai/claude-code&lt;/code> is the npm package. It exposes the same Claude Code engine the CLI uses, with the same tools and permissions, as a programmatic interface. You give it a prompt; you get an async iterable of conversation events. Plug it into anything — a script, a service, a CI step.&lt;/p></description></item><item><title>Claude Code Hands-On (5): Hooks, or How to Stop Worrying About Yolo Mode</title><link>https://www.chenk.top/en/claude-code-learn/05-hooks/</link><pubDate>Wed, 22 Apr 2026 09:00:00 +0000</pubDate><guid>https://www.chenk.top/en/claude-code-learn/05-hooks/</guid><description>&lt;p>If MCP is how Claude reaches out, hooks are how you reach in. They enforce the rules you care about, not just what you hope for.&lt;/p>
&lt;p>&lt;figure class="article-figure">
 &lt;img src="https://blog-pic-ck.oss-cn-beijing.aliyuncs.com/posts/en/claude-code-learn/05-hooks/illustration_1.png" alt="Claude Code Hands-On (5): Hooks, or How to Stop Worrying About Yolo Mode — Chapter overview" loading="lazy" decoding="async" class="content-image">
 
&lt;/figure>
&lt;/p>
&lt;hr>
&lt;h2 id="the-model" class="heading-anchor">The model&lt;a href="#the-model" class="heading-link" aria-label="Permalink to this section" title="Copy link to this section">#&lt;/a>
&lt;/h2>&lt;p>A hook is a shell command that Claude Code runs at specific moments. The two you&amp;rsquo;ll use most are:&lt;/p></description></item><item><title>Claude Code Hands-On (4): MCP Servers, or How Claude Talks to Anything</title><link>https://www.chenk.top/en/claude-code-learn/04-mcp-servers/</link><pubDate>Tue, 21 Apr 2026 09:00:00 +0000</pubDate><guid>https://www.chenk.top/en/claude-code-learn/04-mcp-servers/</guid><description>&lt;p>If you only learn one extension mechanism in Claude Code, learn MCP. It is the difference between an autocomplete and a platform.&lt;/p>
&lt;p>&lt;figure class="article-figure">
 &lt;img src="https://blog-pic-ck.oss-cn-beijing.aliyuncs.com/posts/en/claude-code-learn/04-mcp-servers/illustration_1.png" alt="Claude Code Hands-On (4): MCP Servers, or How Claude Talks to Anything — Chapter overview" loading="lazy" decoding="async" class="content-image">
 
&lt;/figure>
&lt;/p>
&lt;hr>
&lt;h2 id="the-60-second-pitch" class="heading-anchor">The 60-second pitch&lt;a href="#the-60-second-pitch" class="heading-link" aria-label="Permalink to this section" title="Copy link to this section">#&lt;/a>
&lt;/h2>&lt;p>MCP is &lt;strong>Model Context Protocol&lt;/strong> — a small open spec that lets Claude Code call tools and read resources from external servers. The &amp;ldquo;server&amp;rdquo; is any process that speaks MCP over stdio or HTTP. Claude treats MCP tools the same as its built-in tools: the model decides when to call them, you confirm or auto-approve, results come back as text.&lt;/p></description></item><item><title>Claude Code Hands-On (3): Custom Slash Commands and Conversation Control</title><link>https://www.chenk.top/en/claude-code-learn/03-custom-commands/</link><pubDate>Mon, 20 Apr 2026 09:00:00 +0000</pubDate><guid>https://www.chenk.top/en/claude-code-learn/03-custom-commands/</guid><description>&lt;p>Built-in slash commands like &lt;code>/clear&lt;/code> and &lt;code>/init&lt;/code> are the visible part of the iceberg. The main point of the system is for you to write your own commands, which live in your repo.&lt;/p>
&lt;p>&lt;figure class="article-figure">
 &lt;img src="https://blog-pic-ck.oss-cn-beijing.aliyuncs.com/posts/en/claude-code-learn/03-custom-commands/illustration_1.png" alt="Claude Code Hands-On (3): Custom Slash Commands and Conversation Control — Chapter overview" loading="lazy" decoding="async" class="content-image">
 
&lt;/figure>
&lt;/p>
&lt;hr>
&lt;h2 id="what-a-slash-command-is" class="heading-anchor">What a slash command is&lt;a href="#what-a-slash-command-is" class="heading-link" aria-label="Permalink to this section" title="Copy link to this section">#&lt;/a>
&lt;/h2>&lt;p>A file at &lt;code>.claude/commands/&amp;lt;name&amp;gt;.md&lt;/code>. Contents are a Markdown prompt. Filename becomes the command. After creating the command, you need to restart Claude Code (one of the few places it isn&amp;rsquo;t hot-reloaded).&lt;/p></description></item><item><title>Claude Code Hands-On (2): Shortcuts, the Four-State Toggle, and Thinking Modes</title><link>https://www.chenk.top/en/claude-code-learn/02-shortcuts-and-modes/</link><pubDate>Sun, 19 Apr 2026 09:00:00 +0000</pubDate><guid>https://www.chenk.top/en/claude-code-learn/02-shortcuts-and-modes/</guid><description>&lt;p>The shortcuts are not in the help screen for a reason — they&amp;rsquo;re discoverable through use, not documentation. Here they are anyway.&lt;/p>
&lt;p>&lt;figure class="article-figure">
 &lt;img src="https://blog-pic-ck.oss-cn-beijing.aliyuncs.com/posts/en/claude-code-learn/02-shortcuts-and-modes/illustration_1.png" alt="Claude Code Hands-On (2): Shortcuts, the Four-State Toggle, and Thinking Modes — Chapter overview" loading="lazy" decoding="async" class="content-image">
 
&lt;/figure>
&lt;/p>
&lt;hr>
&lt;h2 id="shifttab--the-four-state-cycle" class="heading-anchor">&lt;code>Shift+Tab&lt;/code> — the four-state cycle&lt;a href="#shifttab--the-four-state-cycle" class="heading-link" aria-label="Permalink to this section" title="Copy link to this section">#&lt;/a>
&lt;/h2>&lt;p>Most people think &lt;code>Shift+Tab&lt;/code> toggles auto-accept on and off. It doesn&amp;rsquo;t. It cycles four states in order:&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-text" data-lang="text">&lt;span class="line">&lt;span class="cl">Normal → Accept edits → Plan mode → Bypass permissions → Normal
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>Each state changes what Claude does without asking:&lt;/p></description></item><item><title>Claude Code Hands-On (1): Install, the Three-Layer Config, and the # @ /init Trio</title><link>https://www.chenk.top/en/claude-code-learn/01-install-and-config/</link><pubDate>Sat, 18 Apr 2026 09:00:00 +0000</pubDate><guid>https://www.chenk.top/en/claude-code-learn/01-install-and-config/</guid><description>&lt;p>This is the first in a ten-part field guide to Claude Code. The order is deliberate: each piece unlocks the next. By the end, you&amp;rsquo;ll be using features that 90% of users never touch.&lt;/p>
&lt;p>&lt;figure class="article-figure">
 &lt;img src="https://blog-pic-ck.oss-cn-beijing.aliyuncs.com/posts/en/claude-code-learn/01-install-and-config/illustration_1.png" alt="Claude Code Hands-On (1): Install, the Three-Layer Config, and the # @ /init Trio — Chapter overview" loading="lazy" decoding="async" class="content-image">
 
&lt;/figure>
&lt;/p>
&lt;hr>
&lt;h2 id="install" class="heading-anchor">Install&lt;a href="#install" class="heading-link" aria-label="Permalink to this section" title="Copy link to this section">#&lt;/a>
&lt;/h2>&lt;p>There is one supported install path, and it&amp;rsquo;s the right one.&lt;/p></description></item></channel></rss>