Type: docs Syncs the tutorial, its translations and root docs to **Claude Code 2.1.322** (previous sync: v2.1.316, #230). The audit covered every changelog entry for 2.1.317, 2.1.318, 2.1.319, 2.1.321 and 2.1.322, plus the official docs pages for each affected feature. npm `latest` is 2.1.322. 49 files changed (46 in the sync commit, plus `fa/` and `ko/03-skills` in review round 1 and `ko/claude_concepts_guide.md` in round 3). P0 0 · P1 15 · P2 6 (deferred) · P3 30 + 1 blocked · P4 3. ## P1: outdated claims (mirrored to translations) - **Fable 5.2 (v2.1.321).** The `10-cli` model table gains a Fable 5.2 row (1M context, default effort `medium`), and Fable 5.1 becomes the previous model. - The Fable alias note now says `fable` resolves to Fable 5.2 (Fable 5 in Claude apps gateway sessions). - `best` now resolves to the same model as `opus`. - A saved `claude-fable-5-1` pick moves to `fable` on Pro/Max/Ultra, and on Team/Enterprise when the organization's settings allow. - Pricing: $8/$40 per Mtok, with $0.20 per Mtok cache reads. - The FAQ and QUICK_REFERENCE model lists name Fable 5.2. - **Fast mode on Fable 5.2 (v2.1.321, $16/$80):** added to `/fast` in `01-slash-commands`, CATALOG, the `10-cli` fast-mode note and the `CLAUDE_CODE_OPUS_4_6_FAST_MODE_OVERRIDE` row. - **`ultrathink`** now lists Fable 5.2 in `09`, `10-cli` and `claude_concepts_guide`. - **Scheduled tasks (`09`)**: - Recurring tasks expire after 7 days, not 3. - Tasks are restored on `--resume`/`--continue`, except expired tasks, past-due one-shots and a self-paced `/loop`. - Recurring jitter is "up to half the gap, at most 30 min" (`*/5` isn't delayed). - One-shots scheduled for `:00`/`:30` run up to 90 s early. - **Subagent and teammate effort (v2.1.317):** on a different model they use that model's saved effort or its default, not the session's (`04-subagents`, `10-cli`). - **`switchModelsOnFlag` (v2.1.318):** subagents never pause. With "Ask each time", a flagged subagent request fails instead of switching models. - **Background commands:** the default limit is 10 minutes in a `-p` run whose prompt is passed as text (the fix is in v2.1.321). - **Mods Claude writes (v2.1.321):** in `auto`/`bypassPermissions` they turn on without asking. They don't load in `dontAsk` or in `-p` outside those modes. ## P3: additions (English only) - **`01-slash-commands`:** - `/model` "More models" row (v2.1.319/321). - `/context` sends Claude only the table. - `/ide` no longer installs the extension from an IDE terminal (v2.1.318). - `/tasks` "Earlier in this session". - `/claude-api latency-optimize`, also added in `03-skills`, CATALOG and the concepts guide. - **`03-skills`:** two new limits on nested-skill loading: under the Bash sandbox (v2.1.319), and `.claude/skills` inside `~/.claude/plugins` (v2.1.321). The skills docs page doesn't list these exceptions yet; the source is the changelog. - **`04-subagents`:** background subagents move a shell command to the background after 3 min, and `SendMessage` reaches a busy background agent sooner. - **`06-hooks`:** - Agent SDK `onFailure: "block"` / `on_failure="block"`. - An `mcp_tool` hook refuses the call when it can't read the answer (>16 MiB). - `defer` works only with a single tool call; `tool_deferred_unavailable` and `CLAUDE_CODE_DROP_UNAVAILABLE_DEFERRED_TOOL`. - PostToolUse runs after a `Ctrl+Enter` interrupt (10 s). - **`07-plugins`:** - `$.model.fork` `effort` and `prompt.submit` in the user turn. - `${CLAUDE_PLUGIN_ROOT}` in `subagentStatusLine`. - Plugin updates install new dependencies. - Managed `extraKnownMarketplaces` take-over rules. - **`08-checkpoints`:** `/rewind` after `/branch` (fixed in v2.1.319). - **`09-advanced-features`:** - `/tasks` row. - Background command notifications show only the start and end of a command over 1,000 characters. - `claude remote-control --settings <file>`, and sessions keep their folder. - OTel `anthropic.plan`, `anthropic.seat_type`, `anthropic.provider`, `anthropic.custom_base_url`. - Three v2.1.319 trust-hardening items. - Auto-mode `-p` exits 1 when no safety check was available. - Monitor WebSocket watches follow Bash rules. - **`10-cli`:** - Fast mode on Google Cloud's Agent Platform: Fable 5.2 only, regions `global`/`us`/`eu`, v2.1.322. - `claude auth status` `loginExpiresAt`. - `claude -p` `credential_expires_at` and the 10-day stderr warning. - Bash permission hardening: `which` with flags, `timeout` wrappers, exact ask vs. broader deny, `cp`/`mv` by path. - Agent view `--agent` dispatch default. - `MCP_PROTOCOL_NEGOTIATION` 7-day skip. - New rows for `CLAUDE_CODE_DISABLE_FEATURE_FLAGS`, `CLAUDE_CODE_DISABLE_NESTED_SESSION_ID` and `permissions.denyInsteadOfPrompting`. ## P4: cosmetic - Root `README.md`: the version badge, "latest" line and "Current version" line now say v2.1.322 / November 2026. - `10-cli`: the resume hint repeats launch flags (v2.1.317). - `08-checkpoints`: directory symlinks are no longer followed by rewind (v2.1.319). Every file the sync commit changed has a refreshed footer: November 12, 2026 and 2.1.322, with localized labels and dates in translations. `fa/03-skills` and `ko/03-skills` got only the S1 `effort` row fix in round 1, and their footers were left as they were (2.1.316 and 2.1.310), because the rest of those files was not synced to 2.1.322. For the same reason, `ko/claude_concepts_guide.md` got only the round-3 Fable rows and keeps its 2.1.310 footer. ## Translation coverage - **vi, ko, fa:** carry every P1 change whose text exists in that locale. - **ja, uk:** carry the P1 changes to the sections they have: `ultrathink`, scheduled tasks, the `effort` row and QUICK_REFERENCE; the README FAQ in ja and uk. - **zh:** condensed. Only the stale model lists were fixed (README FAQ, QUICK_REFERENCE). zh has no model table, fast-mode note, scheduled-tasks section or `effort` row. - **`vi/README.md`:** has no FAQ, so Task 2.9 had nothing to change there. - **ko is partly stale from before this run.** Its module footers were still at 2.1.310, and some 2.1.316 content is missing, such as the `CLAUDE_CODE_SUBAGENT_EFFORT` sentence and `env` row. This PR adds the 2.1.322 P1 changes but does not backfill 2.1.316. - **Locale README stamps:** the ko and fa READMEs still show v2.1.310 in their badge and "latest" lines. Each locale tracks its own sync state, so they were left as they are. - **P3 additions are English only.** ## Review round 1 fixes (`docs: address review of v2.1.322 sync`) Each change was checked again against model-config, env-vars, skills or the raw changelog before it was written. - **S1:** the `03-skills` `effort` row and the `01` `/effort` row now list Fable 5.2, and give it a `medium` default. The `/effort` row also gives `high` for Fable 5.1 and Fable 5 (model-config: "Fable 5.2, Opus 5.5, Sonnet 5.5, and Haiku 5.5 default to `medium`… Other models in the effort levels table default to `high`"). Also changed in fa and ko. - **S2:** `09` `remote-control --settings`: "If the file changes, no new session starts until you restart `claude remote-control`" (CL 2.1.321). English only. - **S3:** the `10-cli` `claude agents` note now names the five flags from CL 2.1.321. English only. - **S4:** the `03-skills` nested-skill exceptions are now attributed to the changelog in the text: "The changelog adds two exceptions that the skills docs don't list yet". English only. - **S5:** the `CLAUDE_CODE_DISABLE_FEATURE_FLAGS` row now says that with the variable set, Remote Control and the other features that need feature-flag fetching are unavailable (env-vars). English only. - **S7:** wrong effort claims removed from sentences this PR rewrote: - `ja/09` and `uk/09` now translate the English effort-level, `xhigh` and default lists. - In `ja/10-cli` and `uk/10-cli`, the false "`max` is exclusive to Opus 4.x" clause is dropped. The English sentence has no such clause. - **N1:** "from v2.1.257 until v2.1.321" in `10-cli`, fa, ko and vi. - **N2:** the `/context` row now says the 10-row limit applies to the table Claude reads. No locale has this row text. - **N4:** the Fable models were added to the `09` effort-level, `xhigh` and default lists in en, fa, ko and vi (ja and uk via S7). In `claude_concepts_guide`, Fable 5.2, 5.1 and 5 rows were added to the model/effort table, and the Fable models to its `xhigh`/`max` note, in en and fa. - **N5:** the `CLAUDE_CODE_SUBAGENT_EFFORT` row now says only what CL 2.1.317 says: a subagent on a different model from the main conversation uses that model's saved effort level or its default, instead of the session's. The old wording said such a subagent "never inherits". How the variable ranks against that rule isn't stated by any source. Also changed in fa and vi; ko has no row. - **N8:** "where Fable is available" was restored to the pre-v2.1.321 `best` behaviour, in en, fa, ko and vi. ## Review round 2 fixes (`docs: add Fable models to the effort-level bullet in 09`) - Added the Fable models to the `09` "Opus 5 / Opus 4.8" effort bullet (en, fa, ko, vi): Fable 5.2 defaults to `medium`, Fable 5.1 and Fable 5 to `high`, and all of them support `xhigh` and `max`. - Added the Fable models to the en `10-cli` `CLAUDE_CODE_EFFORT_LEVEL` row. ## Review round 3 fixes (`docs: align model and effort lists with model-config (v2.1.322 sync)`) The model and effort lists changed in this round now match model-config.md (effort table, default-effort rule and 1M list, re-fetched before editing). The lists still behind are under Follow-ups. - **en (R2-S1):** the Fable models were added to the remaining `09` effort lists (the "Effort level" heading line and three `CLAUDE_CODE_EFFORT_LEVEL` code comments) and to the `10-cli` "Effort Levels" paragraph and its code comment. The paragraph now gives Fable 5.2 a `medium` default, matching the model table above it. - **fa, ko, vi (R2-S1, R2-S2):** mirrored the same lines, and brought the `10-cli` `CLAUDE_CODE_EFFORT_LEVEL` row in line with en. `ko/claude_concepts_guide.md` gains the Fable 5.2, 5.1 and 5 rows, and its `xhigh`/`max` note names the Fable models, as in en and fa. - **ja, uk (R2-S2, R2-S3):** removed the false "`xhigh` is Opus 4.7-only" and "`max` is Opus 4.7/4.6-only" claims from `09` and `10-cli`. The support and `xhigh` lists now match model-config, and the model lists in the `CLAUDE_CODE_EFFORT_LEVEL` row are translated from en. - **ja, uk `04-subagents` (R2-S4):** the `effort` row and the frontmatter comment now list `xhigh`. - **Haiku 4.5 context (R2-N2, factual part only):** `uk/10-cli` listed Haiku 4.5 at 1M tokens. It's now 200K, matching en `10-cli` and model-config's 1M list, which doesn't include Haiku 4.5. The same cell in `ja/10-cli` was fixed too. - Merged `main` (#246, scripts only). ## Learner skills No changes landed. Three edits are pending because writes to `.claude/skills/**` were refused by the permission system in this run: - `lesson-quiz` `question-bank.md` Lesson 09 Q5 explanation: add Fable 5.2 to the `ultrathink` model list (P1). - `self-assessment` `topic-recommendations.md` and its `SKILL.md` mirror, Advanced Features focus line: same change (P1). - Lesson 04 Q10 explanation: optional `/tasks` "Earlier in this session" note (P3). No correct answer letter changes, and all 100 `Review` pointers still resolve. Exact text for the follow-up (from the round-1 review, §6): 1. `.claude/skills/lesson-quiz/references/question-bank.md:718` (Lesson 09 Q5, Explanation): - old: ``Since v2.1.311, typed in the interactive terminal on Opus 5.5, Sonnet 5.5, Haiku 5.5, or Fable 5.1 through Anthropic's API, it also runs that turn at `xhigh` effort,`` - new: ``Since v2.1.311, typed in the interactive terminal on Opus 5.5, Sonnet 5.5, Haiku 5.5, Fable 5.2 (v2.1.321+), or Fable 5.1 through Anthropic's API, it also runs that turn at `xhigh` effort,`` 2. `.claude/skills/self-assessment/SKILL.md:351` **and** `.claude/skills/self-assessment/references/topic-recommendations.md:73` (identical lines): - old: ``and the `ultrathink` keyword, which runs that turn at `xhigh` effort on Opus 5.5, Sonnet 5.5, Haiku 5.5, and Fable 5.1 (v2.1.311+)`` - new: ``and the `ultrathink` keyword, which runs that turn at `xhigh` effort on Opus 5.5, Sonnet 5.5, Haiku 5.5, Fable 5.2, and Fable 5.1 (v2.1.311+; Fable 5.2 needs v2.1.321+)`` 3. Version bumps: `lesson-quiz/SKILL.md` `version: 1.6.4` → `1.6.5`; `self-assessment/SKILL.md` `version: 2.5.7` → `2.5.8`. 4. Footer stamps: `question-bank.md` and `topic-recommendations.md`, 2.1.316 → 2.1.322. Optionally add `https://code.claude.com/docs/en/model-config#use-ultrathink-for-one-off-deep-reasoning` to Sources; it is already listed in both. 5. Optional (P3): Lesson 04 Q10 explanation, a note on the `/tasks` "Earlier in this session" row. It changes no letter. ## Needs maintainer decision (P2, not applied) 1. **Self-paced `/loop` ending.** - Repo: says nothing about how a no-interval `/loop` ends. - Docs: "If an iteration ends without either rescheduling or stopping, Claude Code schedules one fallback wakeup about 20 minutes later". - Changelog 2.1.319: self-paced `/loop` now ends "instead of scheduling a fallback wakeup; set `CLAUDE_CODE_LOOP_KEEPALIVE=1` to keep the old behavior". - https://code.claude.com/docs/en/scheduled-tasks#stop-a-loop 2. **Auto mode with telemetry or feature flags off.** - Repo (`10-cli` `CLAUDE_CODE_AUTO_MODE_SERVER` row, `09`): "Set to `0` to use Claude Code's own auto-mode classifier requests instead of server-side review". - Docs: when the review is dropped, "Claude Code falls back to its own classifier requests". - Changelog 2.1.319: calls the server can't check "are asked about or denied, with no fallback to the built-in classifier". - https://code.claude.com/docs/en/permission-modes#server-side-classifier-review 3. **MCP tasks.** - Repo (`05-mcp`): public beta since v2.1.304, needs feature-flag fetching (not Bedrock, Vertex, Foundry or telemetry off). - Docs: same. - Changelog 2.1.319: terminal support moves tasks to the background, works without feature-flag fetching, and adds `CLAUDE_CODE_DISABLE_MCP_TASK_BACKGROUND` and `CLAUDE_CODE_DISABLE_MCP_TASKS`. The second variable is only in the changelog. - https://code.claude.com/docs/en/mcp#mcp-tasks-that-run-on-the-server 4. **`deniedMcpServers` URL entries.** - Repo (`05-mcp`): "`serverUrl` | A remote server URL, exact or with `*` wildcards". - Changelog 2.1.318: URL entries also block Anthropic-provided servers and cloud-session connectors. - Docs: "a `serverUrl` pattern written for the connector's own URL doesn't match it". - https://code.claude.com/docs/en/mcp#how-connectors-reach-claude-code 5. **`CLAUDE_CODE_PLUGIN_DIR_WATCH`.** - Repo (`07-plugins`): has only a generic hot-reload note. - Changelog 2.1.321: headless sessions now reload `.claude/skills` mods, and `=0` turns this off. - Docs: reloading covers `--plugin-dir` mods, is on in interactive sessions, and "Set to `1` to turn it on in non-interactive sessions". - https://code.claude.com/docs/en/env-vars#variables 6. **Mods' own tool calls.** - Repo (`07-plugins`): says nothing about prompting. - Changelog 2.1.321: `$.tool.call` and `$.mcp.call` "raise no permission prompt, even under your own ask rules". - Docs: "`$.mcp.call` | Calls a tool on a connected MCP server, under the session's permission rules". - https://code.claude.com/docs/en/plugins/mods/admin#review-what-a-mod-can-do ## Follow-ups (separate PRs) - **Stamps only (review N3 + N6):** add Fable 5.2 to the "Compatible Models" footers (88 lines; root files still list Fable 5.1 as newest, and module files lack Opus 5.5, Sonnet 5.5 and Haiku 5.5). Align the locale README badges and "latest" lines: ja 2.1.119, zh and uk 2.1.112, ko and fa 2.1.310. - **ko catch-up sync (review N7):** backfill 2.1.316 in ko: the Opus 4.8 fast-mode deprecation, the `CLAUDE_CODE_SUBAGENT_EFFORT` sentence and row, and the v2.1.311 `ultrathink` model list. - **Learner skills (review S6):** apply the exact text under "Learner skills" above once `.claude/skills/**` is writable. - **"Effort Levels (…)" headings (review R2-N1):** `10-cli` and its locale copies name only some models in the heading. They were left unchanged because renaming them changes the anchors. - **Opus 4.6 row (R2-N4):** `claude_concepts_guide.md` (and fa, ko) has no Opus 4.6 row, but the note below the table mentions it. The Sonnet 4.6 row's "1M tokens" also needs the `[1m]`-variant qualifier. - **`high`-default lists (R2-N5):** the `01` `/effort` row and the `10-cli` `CLAUDE_CODE_EFFORT_LEVEL` row (and their locale copies) leave Opus 4.6 and Sonnet 4.6 out of the `high` default. - **ja/uk/zh/vi effort catch-up (R2-N6):** the `/effort` rows in `ja/01`, `uk/01`, `zh/01` and `vi/01` still say `max` needs Opus 4.7 or Opus 4.6. `ja/claude_concepts_guide.md:3061` has an Opus 4.7-era table. - **uk/ja `10-cli` model tables (rest of R2-N2):** `uk/10-cli` `--effort` lacks `xhigh`, its model table is Opus 4.6-era (and Opus 4.6 / Sonnet 4.6 reach 1M only through `[1m]`), and it says "Opus 4.6 підтримує…". The `ja/10-cli` model table is Opus 4.7-era. - **`06-hooks` context-limit comment:** the `CONTEXT_LIMIT` comment's 1M list leaves out the Fable models and Opus 4.7, and lists Sonnet 4.6, which reaches 1M only through `[1m]` (also in fa, ko and vi). This predates the PR. - **ja/uk stale model lists:** `ja/09:228` and `uk/09:220` ("all models (Opus 4.7/4.6, Sonnet 4.6, Haiku 4.5)"), and `ja/10-cli:717-719` (the "Opus 4.7" heading and paragraph, the counterpart of en `10-cli:853`). In ja and uk, the 2.1.322 stamp covers the sections those files have; these older lists are tracked here. ## Validation `pre-commit run --all-files` passes: markdown-lint, cross-references, link-check (247 URLs) and markdown-rendering in all five hooked languages, plus the Python checks. The Mermaid hooks were skipped with `SKIP=mermaid,vietnamese-mermaid,japanese-mermaid,korean-mermaid,persian-mermaid` because their `language: node` environment fails to install under pre-commit 4.7.0. `python scripts/check_mermaid.py --strict` was run directly instead: Pele rendered all 416 blocks. The pre-edit baseline was also all green. For the round-1 fixes, `pre-commit run --files` on the 20 changed files passes, with the same Mermaid SKIP; the `language: node` install error was reproduced. `check_mermaid.py --strict` (416 blocks) and `check_cross_references.py` (675 files) also pass. For round 3, pre-commit on the 15 changed files passes, with the same Mermaid SKIP. `check_cross_references.py` (676 files after the merge), `check_mermaid.py --strict` (416 blocks) and `pytest scripts/tests/` (234 passed, after merging #246) also pass. ## Sources - https://raw.githubusercontent.com/anthropics/claude-code/main/CHANGELOG.md (2.1.317–2.1.322) and https://code.claude.com/docs/en/changelog - https://www.npmjs.com/package/@anthropic-ai/claude-code - https://code.claude.com/docs/en/model-config - https://code.claude.com/docs/en/fast-mode - https://code.claude.com/docs/en/scheduled-tasks - https://code.claude.com/docs/en/remote-control - https://code.claude.com/docs/en/errors - https://code.claude.com/docs/en/settings-reference#permissions-denyinsteadofprompting - https://code.claude.com/docs/en/env-vars - https://code.claude.com/docs/en/hooks - https://code.claude.com/docs/en/agent-sdk/hooks - https://code.claude.com/docs/en/tools-reference - https://code.claude.com/docs/en/plugins/mods/create - https://code.claude.com/docs/en/plugins/org - https://code.claude.com/docs/en/skills - https://code.claude.com/docs/en/commands - https://code.claude.com/docs/en/vs-code - https://code.claude.com/docs/en/agent-view - https://code.claude.com/docs/en/mcp - https://code.claude.com/docs/en/permissions - https://code.claude.com/docs/en/permission-modes - https://code.claude.com/docs/en/cli-reference
🌐 Language / 语言: English | Tiếng Việt | 中文 | Українська | 日本語 | 한국어 | فارسی
用一个周末掌握 Claude Code
从输入 claude 开始,到编排 agents、hooks、skills 和 MCP servers,全程配有可视化教程、可直接复制粘贴的模板,以及循序渐进的学习路径。
目录
问题在哪里
你已经安装了 Claude Code。也试着跑了几个提示词。然后呢?
- 官方文档会介绍功能,但不会告诉你如何把它们组合起来。 你知道 slash commands 存在,但不知道怎样把它们和 hooks、memory、subagents 串起来,形成一个真正能节省数小时的工作流。
- 没有清晰的学习路径。 应该先学 MCP 还是 hooks?先学 skills 还是 subagents?结果往往是每样都看了一点,但没有一个真正掌握。
- 示例太基础。 一个 “hello world” 级别的 slash command,并不能帮你构建一个可用于生产环境的代码审查流水线,也无法让它结合 memory、委派给专门 agent、并自动执行安全扫描。
你实际上只用上了 Claude Code 10% 的能力,而剩下的 90% 你甚至不知道自己错过了什么。
Claude How To 如何解决这些问题
这不是另一份功能参考手册,而是一份结构化、可视化、以示例驱动的指南。它会教你如何使用 Claude Code 的每一项功能,并提供今天就能复制到项目里的真实场景模板。
| 官方文档 | 本指南 | |
|---|---|---|
| 形式 | 参考文档 | 带 Mermaid 图表的可视化教程 |
| 深度 | 功能说明 | 底层工作原理解析 |
| 示例 | 基础代码片段 | 可立即上手的生产级模板 |
| 结构 | 按功能组织 | 递进式学习路径(从入门到高级) |
| 上手方式 | 自主摸索 | 带时间预估的引导式路线图 |
| 自我评估 | 没有 | 交互式测验,帮你找出短板并生成个性化路径 |
你将获得:
- 10 个教程模块,覆盖 Claude Code 的所有核心功能,从 slash commands 到自定义 agent 团队
- 可复制粘贴的配置,包括 slash commands、
CLAUDE.md模板、hook 脚本、MCP 配置、subagent 定义,以及完整 plugin 打包 - Mermaid 图表,展示每个功能的内部工作机制,让你不仅知道“怎么做”,还知道“为什么这么做”
- 一条引导式学习路径,帮助你在 11 到 13 小时内从初学者成长为高级用户
- 内置自测能力,可以直接在 Claude Code 中运行
/self-assessment或/lesson-quiz hooks找出知识盲点
它是如何工作的
1. 先找到你的水平
完成自我评估测验,或者在 Claude Code 中运行 /self-assessment。系统会根据你已经掌握的内容,生成一份个性化学习路线。
2. 按引导路径学习
按照顺序学习 10 个模块,每个模块都建立在前一个模块的基础上。你可以一边学,一边把模板直接复制到自己的项目中。
3. 把多个功能组合成工作流
真正的威力来自功能组合。你会学到如何把 slash commands、memory、subagents 和 hooks 连接成自动化流水线,用于代码审查、部署和文档生成等任务。
4. 测试你的理解程度
每学完一个模块后运行 /lesson-quiz [topic]。测验会精准指出你漏掉的知识点,让你快速补齐短板。
已被开发者信赖
- GitHub stars,来自每天都在使用 Claude Code 的开发者
- Forks,许多团队已将这份指南改造成自己的工作流版本
- 持续维护中,会与每次 Claude Code 发布保持同步(最新版本:v2.1.112,2026 年 4 月)
- 社区驱动,贡献者会分享他们在真实工作中的配置和经验
不知道从哪里开始?
先做自我评估,或者直接按你的水平开始:
| Level | 你可以…… | 从这里开始 | 时间 |
|---|---|---|---|
| Beginner | 启动 Claude Code 并进行对话 | Slash Commands | 约 2.5 小时 |
| Intermediate | 使用 CLAUDE.md 和自定义命令 |
Skills | 约 3.5 小时 |
| Advanced | 配置 MCP servers 和 hooks | Advanced Features | 约 5 小时 |
完整学习路径,共 10 个模块:
| 顺序 | 模块 | 水平 | 时间 |
|---|---|---|---|
| 1 | Slash Commands | 初学者 | 30 分钟 |
| 2 | Memory | 初学者+ | 45 分钟 |
| 3 | Checkpoints | 中级 | 45 分钟 |
| 4 | CLI Basics | 初学者+ | 30 分钟 |
| 5 | Skills | 中级 | 1 小时 |
| 6 | Hooks | 中级 | 1 小时 |
| 7 | MCP | 中级+ | 1 小时 |
| 8 | Subagents | 中级+ | 1.5 小时 |
| 9 | Advanced Features | 高级 | 2 到 3 小时 |
| 10 | Plugins | 高级 | 2 小时 |
15 分钟快速上手
# 1. 克隆这份指南
git clone https://github.com/luongnv89/claude-howto.git
cd claude-howto
# 2. 复制你的第一个 slash command
mkdir -p /path/to/your-project/.claude/commands
cp 01-slash-commands/optimize.md /path/to/your-project/.claude/commands/
# 3. 试试看:在 Claude Code 中输入
# /optimize
# 4. 想更进一步?设置项目记忆:
cp 02-memory/project-CLAUDE.md /path/to/your-project/CLAUDE.md
# 5. 安装一个 skill:
cp -r 03-skills/code-review-specialist ~/.claude/skills/
如果你想完成更完整的基础配置,这里有一个1 小时的关键配置方案:
# Slash commands(15 分钟)
cp 01-slash-commands/*.md .claude/commands/
# 项目记忆(15 分钟)
cp 02-memory/project-CLAUDE.md ./CLAUDE.md
# 安装一个 skill(15 分钟)
cp -r 03-skills/code-review-specialist ~/.claude/skills/
# 周末目标:继续添加 hooks、subagents、MCP 和 plugins
# 按学习路径逐步完成配置
你能用它做什么?
| 使用场景 | 你会组合使用的功能 |
|---|---|
| 自动化代码审查 | Slash Commands + Subagents + Memory + MCP |
| 团队入职培训 | Memory + Slash Commands + Plugins |
| CI/CD 自动化 | CLI Reference + Hooks + Background Tasks |
| 文档生成 | Skills + Subagents + Plugins |
| 安全审计 | Subagents + Skills + Hooks(只读模式) |
| DevOps 流水线 | Plugins + MCP + Hooks + Background Tasks |
| 复杂重构 | Checkpoints + Planning Mode + Hooks |
常见问题
这是免费的吗? 是的。MIT 许可证,永久免费。你可以将它用于个人项目、工作项目或团队中,唯一要求只是保留许可证声明。
它有人维护吗? 是的,而且持续维护。该指南会与每次 Claude Code 发布同步。当前版本是 v2.1.112(2026 年 4 月),兼容 Claude Code 2.1+。
它和官方文档有什么不同? 官方文档是功能参考手册;这份指南则是教程,包含图示、生产级模板和渐进式学习路径。两者是互补关系,建议先用本指南学习,再在需要具体细节时查官方文档。
完整学完需要多久? 完整路径大约需要 11 到 13 小时。但你在 15 分钟内就能获得直接收益,只要复制一个 slash command 模板并试用即可。
我可以搭配 Claude Sonnet / Haiku / Opus 使用吗? 可以。所有模板都适用于 Claude Fable 5.2、Claude Fable 5.1、Claude Fable 5、Claude Opus 5.5、Claude Opus 5、Claude Sonnet 5.5、Claude Sonnet 5、Claude Sonnet 4.6、Claude Opus 4.8、Claude Haiku 5.5、Claude Haiku 4.5。
我可以参与贡献吗? 当然可以。请查看 CONTRIBUTING.md 了解贡献规范。我们欢迎新的示例、bug 修复、文档改进以及社区模板。
我可以离线阅读吗?
可以。运行 uv run scripts/build_epub.py,即可生成包含全部内容和渲染后 Mermaid 图表的 EPUB 电子书。
今天就开始掌握 Claude Code
你已经安装好了 Claude Code。你和 10 倍生产力之间,差的只是知道该怎么正确使用它。这份指南会提供结构化路径、可视化解释和可直接复制的模板,帮助你真正掌握它。
MIT 许可证,永久免费。克隆它、fork 它、改造成适合你自己的版本。
开始学习路线 -> | 浏览功能目录 | 15 分钟快速上手
快速导航:全部功能
| 功能 | 说明 | 文件夹 |
|---|---|---|
| 功能目录 | 包含安装命令的完整参考 | CATALOG.md |
| Slash Commands | 用户手动触发的快捷命令 | 01-slash-commands/README.md |
| Memory | 持久上下文 | 02-memory/README.md |
| Skills | 可复用能力 | 03-skills/README.md |
| Subagents | 专门化 AI 助手 | 04-subagents/README.md |
| MCP Protocol | 访问外部工具 | 05-mcp/README.md |
| Hooks | 事件驱动自动化 | 06-hooks/README.md |
| Plugins | 打包后的功能集合 | 07-plugins/README.md |
| Checkpoints | 会话快照与回退 | 08-checkpoints/README.md |
| Advanced Features | 规划、思考、后台任务 | 09-advanced-features/README.md |
| CLI Reference | 命令、参数与选项 | 10-cli/README.md |
| 博客文章 | 真实使用案例 | Blog Posts |
功能对比
| 功能 | 调用方式 | 持久性 | 最适合 |
|---|---|---|---|
| Slash Commands | 手动(/cmd) |
仅当前会话 | 快速快捷操作 |
| Memory | 自动加载 | 跨会话 | 长期记忆与学习 |
| Skills | 自动触发 | 文件系统级 | 自动化工作流 |
| Subagents | 自动委派 | 隔离上下文 | 任务拆分 |
| MCP Protocol | 自动查询 | 实时 | 获取实时数据 |
| Hooks | 事件触发 | 已配置 | 自动化与校验 |
| Plugins | 一条命令 | 全功能打包 | 完整解决方案 |
| Checkpoints | 手动/自动 | 会话级 | 安全试验 |
| Planning Mode | 手动/自动 | 规划阶段 | 复杂实现 |
| Background Tasks | 手动 | 任务持续期间 | 长时间运行的操作 |
| CLI Reference | 终端命令 | 会话/脚本级 | 自动化与脚本开发 |
安装速查表
# Slash Commands
cp 01-slash-commands/*.md .claude/commands/
# Memory
cp 02-memory/project-CLAUDE.md ./CLAUDE.md
# Skills
cp -r 03-skills/code-review-specialist ~/.claude/skills/
# Subagents
cp 04-subagents/*.md .claude/agents/
# MCP
claude mcp add --transport http github https://api.githubcopilot.com/mcp/ --header "Authorization: Bearer YOUR_GITHUB_PAT"
# Hooks
mkdir -p ~/.claude/hooks
cp 06-hooks/*.sh ~/.claude/hooks/
chmod +x ~/.claude/hooks/*.sh
# Plugins(在仓库根目录加载本地插件)
claude --plugin-dir ./07-plugins/pr-review
# Checkpoints(默认自动开启,可在设置中配置)
# 参见 08-checkpoints/README.md
# Advanced Features(在设置中配置)
# 参见 09-advanced-features/config-examples.json
# CLI Reference(无需安装)
# 使用示例见 10-cli/README.md
01. Slash Commands
位置: 01-slash-commands/README.md
是什么: 以 Markdown 文件形式存储、由用户手动触发的快捷命令
示例:
optimize.md- 代码优化分析pr.md- Pull Request 准备generate-api-docs.md- API 文档生成器
安装:
cp 01-slash-commands/*.md /path/to/project/.claude/commands/
使用方法:
/optimize
/pr
/generate-api-docs
02. Memory
是什么: 跨会话持久化的上下文
示例:
project-CLAUDE.md- 团队共享的项目规范directory-api-CLAUDE.md- 目录级规则personal-CLAUDE.md- 个人偏好
安装:
# 项目记忆
cp 02-memory/project-CLAUDE.md /path/to/project/CLAUDE.md
# 目录记忆
cp 02-memory/directory-api-CLAUDE.md /path/to/project/src/api/CLAUDE.md
# 个人记忆
cp 02-memory/personal-CLAUDE.md ~/.claude/CLAUDE.md
使用方法: Claude 会自动加载
03. Skills
是什么: 可复用、会在合适时自动触发的能力包,包含说明和脚本
示例:
code-review/- 带脚本的完整代码审查能力brand-voice/- 品牌语气一致性检查doc-generator/- API 文档生成器
安装:
# 个人 skills
cp -r 03-skills/code-review-specialist ~/.claude/skills/
# 项目 skills
cp -r 03-skills/code-review-specialist /path/to/project/.claude/skills/
使用方法: 在相关场景下自动触发
04. Subagents
是什么: 拥有隔离上下文和自定义提示词的专门化 AI 助手
示例:
code-reviewer.md- 全面代码质量分析test-engineer.md- 测试策略与覆盖率documentation-writer.md- 技术文档编写secure-reviewer.md- 面向安全的审查(只读)implementation-agent.md- 完整功能实现
安装:
cp 04-subagents/*.md /path/to/project/.claude/agents/
使用方法: 由主 agent 自动委派
05. MCP Protocol
位置: 05-mcp/README.md
是什么: 用于访问外部工具和 API 的 Model Context Protocol
示例:
github-mcp.json- GitHub 集成database-mcp.json- 数据库查询filesystem-mcp.json- 文件操作multi-mcp.json- 多个 MCP servers 配置
安装:
# 设置环境变量
export DATABASE_URL="postgresql://..."
# 通过 CLI 添加 MCP server
claude mcp add --transport http github https://api.githubcopilot.com/mcp/ --header "Authorization: Bearer YOUR_GITHUB_PAT"
# 或手动添加到项目 .mcp.json(参见 [05-mcp/README.md](05-mcp/README.md) 中的示例)
使用方法: 配置完成后,Claude 会自动获得 MCP 工具能力
06. Hooks
是什么: 基于事件触发的 shell 命令,会在 Claude Code 事件发生时自动执行
示例:
format-code.sh- 写入后自动格式化代码pre-commit.sh- 提交前运行测试security-scan.sh- 扫描安全问题log-bash.sh- 记录所有 bash 命令validate-prompt.sh- 校验用户提示词notify-team.sh- 事件发生时发送通知
安装:
mkdir -p ~/.claude/hooks
cp 06-hooks/*.sh ~/.claude/hooks/
chmod +x ~/.claude/hooks/*.sh
在 ~/.claude/settings.json 中配置 hooks:
{
"hooks": {
"PostToolUse": [
{
"matcher": "Write",
"hooks": [
{ "type": "command", "command": "~/.claude/hooks/format-code.sh" },
{ "type": "command", "command": "~/.claude/hooks/security-scan.sh" }
]
}
]
}
}
使用方法: hooks 会在事件发生时自动执行
Hook 类型(5 种):command、http、prompt、mcp_tool、agent — 决定 hook 如何运行。
Hook 事件(33 个,分 4 类)— 决定 hook 何时运行:
- 工具 Hook:
PreToolUse,PostToolUse,PostToolUseFailure,PostToolBatch,PermissionRequest,PermissionDenied - 会话 Hook:
SessionStart,Setup,SessionEnd,Stop,StopFailure,SubagentStart,SubagentStop - 任务 Hook:
UserPromptSubmit,UserPromptExpansion,MessageDisplay,TaskCompleted,TaskCreated,TeammateIdle(TaskCompleted和TaskCreated仅在启用 todo 工具时触发 —— 默认仅在 Claude 3.x、Opus 4 至 4.7、Sonnet 4 至 4.6、Haiku 4.5 上可用;CLAUDE_CODE_ENABLE_TODO_TOOLS=1可恢复) - 生命周期 Hook:
ConfigChange,CwdChanged,DirectoryAdded,FileChanged,PreCompact,PostCompact,PreModelSwitch,PostModelSwitch,WorktreeCreate,WorktreeRemove,Notification,InstructionsLoaded,Elicitation,ElicitationResult
07. Plugins
是什么: 把 commands、agents、MCP 和 hooks 打包在一起的功能集合
示例:
pr-review/- 完整的 PR 审查工作流devops-automation/- 部署与监控documentation/- 文档生成
安装:
# 在仓库根目录运行(本仓库没有 marketplace,因此 /plugin install 不适用)
claude --plugin-dir ./07-plugins/pr-review
claude --plugin-dir ./07-plugins/devops-automation
claude --plugin-dir ./07-plugins/documentation
使用方法: 使用其中打包好的 slash commands 和功能
08. Checkpoints and Rewind
是什么: 保存对话状态,并回退到之前的时间点,以探索不同方案
核心概念:
- Checkpoint: 对话状态快照
- Rewind: 回到之前的 checkpoint
- Branch Point: 从同一个 checkpoint 分叉出多种方案
使用方法:
# 每次用户提示后都会自动创建 checkpoint
# 如需回退,按两次 Esc,或者使用:
/rewind
# 然后从以下六个选项中选择:
# 1. 恢复代码和对话
# 2. 恢复对话
# 3. 恢复代码
# 4. 从这里开始总结
# 5. 总结到这里
# 6. 算了
使用场景:
- 尝试不同实现方式
- 从错误中恢复
- 安全试验
- 比较不同备选方案
- 对不同设计做 A/B 测试
09. Advanced Features
位置: 09-advanced-features/README.md
是什么: 面向复杂工作流和自动化的高级能力
包括:
- Planning Mode:编码前先创建详细实现计划
- Extended Thinking:用于复杂问题的深度推理(用
Alt+T/Option+T切换) - Background Tasks:运行长时间操作且不阻塞当前会话
- Permission Modes:
default、acceptEdits、plan、dontAsk、bypassPermissions - Headless Mode:在 CI/CD 中运行 Claude Code:
claude -p "Run tests and generate report" --permission-mode auto - Session Management:
/resume、/rename、/fork、claude -c、claude -r - Configuration:在
~/.claude/settings.json中自定义行为
完整配置请参见 config-examples.json。
10. CLI Reference
位置: 10-cli/README.md
是什么: Claude Code 的完整命令行接口参考
快速示例:
# 交互模式
claude "explain this project"
# 输出模式(非交互)
claude -p "review this code"
# 处理文件内容
cat error.log | claude -p "explain this error"
# 为脚本输出 JSON
claude -p --output-format json "list functions"
# 恢复会话
claude -r "feature-auth" "continue implementation"
使用场景: CI/CD 流水线集成、脚本自动化、批处理、多会话工作流、自定义 agent 配置
示例工作流
完整代码审查工作流
# 使用:Slash Commands + Subagents + Memory + MCP
用户:/review-pr
Claude:
1. 加载项目 memory(编码规范)
2. 通过 GitHub MCP 获取 PR
3. 委派给 code-reviewer subagent
4. 委派给 test-engineer subagent
5. 汇总发现
6. 提供完整审查结果
自动化文档生成
# 使用:Skills + Subagents + Memory
用户:"为 auth 模块生成 API 文档"
Claude:
1. 加载项目 memory(文档规范)
2. 识别出文档生成请求
3. 自动触发 doc-generator skill
4. 委派给 api-documenter subagent
5. 生成带示例的完整文档
DevOps 部署
# 使用:Plugins + MCP + Hooks
用户:/deploy production
Claude:
1. 运行部署前 hook(校验环境)
2. 委派给 deployment-specialist subagent
3. 通过 Kubernetes MCP 执行部署
4. 监控进度
5. 运行部署后 hook(健康检查)
6. 报告状态
目录结构
├── 01-slash-commands/
│ ├── optimize.md
│ ├── pr.md
│ ├── generate-api-docs.md
│ └── README.md
├── 02-memory/
│ ├── project-CLAUDE.md
│ ├── directory-api-CLAUDE.md
│ ├── personal-CLAUDE.md
│ └── README.md
├── 03-skills/
│ ├── code-review/
│ │ ├── SKILL.md
│ │ ├── scripts/
│ │ └── templates/
│ ├── brand-voice/
│ │ ├── SKILL.md
│ │ └── templates/
│ ├── doc-generator/
│ │ ├── SKILL.md
│ │ └── generate-docs.py
│ └── README.md
├── 04-subagents/
│ ├── code-reviewer.md
│ ├── test-engineer.md
│ ├── documentation-writer.md
│ ├── secure-reviewer.md
│ ├── implementation-agent.md
│ └── README.md
├── 05-mcp/
│ ├── github-mcp.json
│ ├── database-mcp.json
│ ├── filesystem-mcp.json
│ ├── multi-mcp.json
│ └── README.md
├── 06-hooks/
│ ├── format-code.sh
│ ├── pre-commit.sh
│ ├── security-scan.sh
│ ├── log-bash.sh
│ ├── validate-prompt.sh
│ ├── notify-team.sh
│ └── README.md
├── 07-plugins/
│ ├── pr-review/
│ ├── devops-automation/
│ ├── documentation/
│ └── README.md
├── 08-checkpoints/
│ ├── checkpoint-examples.md
│ └── README.md
├── 09-advanced-features/
│ ├── config-examples.json
│ ├── planning-mode-examples.md
│ └── README.md
├── 10-cli/
│ └── README.md
└── README.md(本文件)
最佳实践
应该做的
- 从简单的 slash commands 开始
- 逐步增加功能
- 用 memory 保存团队规范
- 先在本地测试配置
- 为自定义实现写文档
- 对项目配置做版本控制
- 和团队共享 plugins
不应该做的
- 不要创建重复功能
- 不要硬编码凭据
- 不要跳过文档
- 不要把简单任务过度复杂化
- 不要忽视安全最佳实践
- 不要提交敏感数据
故障排查
功能没有加载
- 检查文件位置和命名
- 验证 YAML frontmatter 语法
- 检查文件权限
- 查看 Claude Code 版本兼容性
MCP 连接失败
- 检查环境变量
- 检查 MCP server 是否正确安装
- 测试凭据
- 检查网络连通性
Subagent 没有发生委派
- 检查工具权限
- 确认 agent 描述是否清晰
- 查看任务复杂度
- 单独测试 agent
测试
本项目包含完整的自动化测试:
- 单元测试:基于 pytest 的 Python 测试(Python 3.10、3.11、3.12)
- 代码质量:使用 Ruff 做 lint 和格式化检查
- 安全:使用 Bandit 做漏洞扫描
- 类型检查:使用 mypy 做静态类型分析
- 构建验证:测试 EPUB 生成功能
- 覆盖率跟踪:集成 Codecov
# 安装开发依赖
uv pip install -r requirements-dev.txt
# 运行全部单元测试
pytest scripts/tests/ -v
# 运行带覆盖率报告的测试
pytest scripts/tests/ -v --cov=scripts --cov-report=html
# 运行代码质量检查
ruff check scripts/
ruff format --check scripts/
# 运行安全扫描
bandit -c pyproject.toml -r scripts/ --exclude scripts/tests/
# 运行类型检查
mypy scripts/ --ignore-missing-imports
每次 push 到 main / develop,以及每次向 main 提交 PR 时,测试都会自动运行。详情见 TESTING.md。
EPUB 生成
想离线阅读这份指南?你可以生成 EPUB 电子书:
uv run scripts/build_epub.py
这会生成包含全部内容与 Mermaid 渲染图表的 claude-howto-guide.epub。
更多选项见 scripts/README.md。
参与贡献
发现问题,或者想贡献一个示例?非常欢迎你的帮助。
请先阅读 CONTRIBUTING.md,了解以下详细规范:
- 可贡献的内容类型(示例、文档、功能、bug、反馈)
- 如何搭建开发环境
- 目录结构以及如何添加内容
- 编写规范与最佳实践
- Commit 和 PR 流程
我们的社区标准:
- CODE_OF_CONDUCT.md - 我们如何彼此相处
- SECURITY.md - 安全政策与漏洞报告方式
报告安全问题
如果你发现了安全漏洞,请负责任地报告:
- 使用 GitHub 私密漏洞报告功能:https://github.com/luongnv89/claude-howto/security/advisories
- 或者阅读 .github/SECURITY_REPORTING.md 获取详细说明
- 不要公开提交安全漏洞 issue
快速开始:
- Fork 并克隆仓库
- 创建一个清晰描述用途的分支(
add/feature-name、fix/bug、docs/improvement) - 按规范进行修改
- 提交一个说明清楚的 Pull Request
需要帮助? 打开一个 issue 或 discussion,我们会引导你完成整个过程。
更多资源
- Claude Code Documentation
- MCP Protocol Specification
- Skills Repository - 可直接使用的 skills 集合
- Anthropic Cookbook
- Boris Cherny's Claude Code Workflow - Claude Code 的创造者分享了他系统化的工作流:并行 agents、共享
CLAUDE.md、Plan mode、slash commands、subagents,以及用于长时间自主会话的验证 hooks。
参与贡献
欢迎贡献内容。如何开始请查看我们的贡献指南。
贡献者
感谢所有为本项目做出贡献的人。
| 贡献者 | PRs |
|---|---|
| wjhrdy | #1 - add a tool to create an epub |
| VikalpP | #7 - fix(docs): Use tilde fences for nested code blocks in concepts guide |
许可证
MIT 许可证,详见 LICENSE。你可以自由使用、修改和分发,唯一要求是保留许可证声明。
最后更新:2026 年 11 月 12 日 Claude Code 版本:2.1.322 来源:
- https://code.claude.com/docs/en/tools-reference#task-tool-availability
- https://code.claude.com/docs/en/hooks
- https://code.claude.com/docs/en/model-config
- https://code.claude.com/docs/en/mcp
- https://code.claude.com/docs/en/plugins/install
- https://code.claude.com/docs/en/checkpointing
- https://code.claude.com/docs/en/headless#auto-approve-tools
- https://code.claude.com/docs/en/permission-modes#which-mode-a-non-interactive-run-starts-in
- https://code.claude.com/docs/en/model-config#work-with-fable 兼容模型:Claude Fable 5、Claude Opus 5、Claude Sonnet 5、Claude Sonnet 4.6、Claude Opus 4.8、Claude Haiku 4.5