mirror of
https://github.com/luongnv89/claude-howto.git
synced 2026-09-22 01:10:42 +02:00
docs: sync to Claude Code v2.1.278 (#183)
* docs: sync to Claude Code v2.1.278 Type: docs Audit of the tutorial against Claude Code 2.1.278 (repo baseline was 2.1.263). Fixes claims the repo asserts that are now false; new-feature coverage is English-only. P0 - the repo stated the opposite of current behavior: - AGENTS.md: the claude-md skill said Claude Code "does not read AGENTS.md directly" in all 5 languages. It has since v2.1.277, when no CLAUDE.md exists at or above the working directory. - /output-style: listed as "Removed in v2.1.91" in 5 languages and in 09-advanced-features. Re-added in v2.1.269; row moved out of the Deprecated Commands table. - Permission rules: setup-auto-mode-permissions.py seeded Write(*), Glob(*) and NotebookEdit(*), which Claude Code accepts but never consults and warns about at startup. Removed; same fix in the config-examples.json profile and the 06/09 category tables. - taskOutputMaxChars: documented as live. The TaskOutput tool was removed in v2.1.278 and the key is inert. P1: - Dynamic workflow "medium" guideline is fewer than 10 agents, not 15; the default is small on Pro plans since v2.1.271. - Todo-tool availability restated as the official allowlist (Claude 3.x, Opus 4-4.7, Sonnet 4-4.6, Haiku 4.5) instead of a denylist; 23 sites across 5 languages. - Memory hierarchy now notes the AGENTS.md fallback. - Auto-mode classifier cost qualified: not charged on Enterprise plans and Claude API accounts since v2.1.278. P3 (English only): full AGENTS.md section in 02-memory; omitClaudeMd subagent field; plugin eval / --json / --accept-command / --marketplace; maxEffortLevel, bashEditDiffEnabled, syncClaudeAi*, 4 env vars, --system-prompt-snapshot, --plugin-dir folders; send-now key and Monitor deadlines; checkpoints subagent-edit limitation. Learning skills audited clean: 100 quiz questions and 100 Review pointers all valid, 20 self-assessment options correctly mapped. Cross-file anchors: 15 broken before, 15 after, 0 introduced. * docs: address review — stale version stamps, /output-style re-add, permission tables
This commit is contained in:
@@ -59,6 +59,7 @@ Claude Code 目前提供 55+ 个内置命令和 5 个内置 Skills。你可以
|
||||
| `/memory` | 编辑 `CLAUDE.md`,切换自动记忆 |
|
||||
| `/mobile` | 生成移动端扫码二维码(别名:`/ios`、`/android`) |
|
||||
| `/model [model]` | 选择模型,并可用左右箭头调整 effort |
|
||||
| `/output-style [name]` | 列出并切换 output style(v2.1.91 移除后,于 v2.1.269 重新加回)。不带参数时列出所有 style 并标记当前使用的那个。在 headless 和 Remote Control 会话中均可使用;选择结果保存到 `.claude/settings.local.json` |
|
||||
| `/passes` | 分享一周免费 Claude Code 使用权 |
|
||||
| `/permissions` | 查看或更新权限(别名:`/allowed-tools`) |
|
||||
| `/plan [description]` | 进入规划模式 |
|
||||
@@ -101,13 +102,12 @@ Claude Code 目前提供 55+ 个内置命令和 5 个内置 Skills。你可以
|
||||
|
||||
| 命令 | 状态 |
|
||||
|---------|--------|
|
||||
| `/output-style` | 已于 v2.1.91 移除(v2.1.73 起弃用)— 改用 `/config` → Output style,或 `outputStyle` 设置 |
|
||||
| `/vim` | 自 v2.1.92 起移除;改用 `/config → Editor mode` |
|
||||
|
||||
### 最近变化
|
||||
|
||||
- `/fork` 与 `/subtask` 在 **v2.1.212** 互换了角色。`/fork` 现在是把对话复制到一个独立的后台会话;原来的 forked subagent 行为转移到了新命令 `/subtask`。历史:v2.1.77–v2.1.161 期间 `/fork` 是 `/branch` 的别名;v2.1.161–v2.1.211 期间它启动 forked subagent(即现在 `/subtask` 的行为)。关闭 agent view 时 `/subtask` 不可用,`/fork` 仍保留 forked subagent 行为
|
||||
- `/output-style` 已弃用(v2.1.73)并于 v2.1.91 移除 — output styles 仍可通过 `/config` → Output style 或 `outputStyle` 设置使用
|
||||
- `/output-style` 曾被弃用(v2.1.73)并于 v2.1.91 移除,随后**在 v2.1.269 重新加回** — 在 v2.1.278 中它又是一个可用命令,并且在 headless 和 Remote Control 会话中都能工作。output styles 同样仍可通过 `/config` → Output style 或 `outputStyle` 设置使用
|
||||
- `/review` 成为 `/code-review` 的完整别名 —— 目标、effort 级别和标志完全相同(v2.1.223)。历史:它在 v2.1.186 首次迁移到 `/code-review medium` 引擎,但当时仅支持 PR
|
||||
- 新增 `/effort`,其中 `max` 级别需要 Opus 4.6
|
||||
- 新增 `/voice`,用于按住说话语音输入
|
||||
@@ -548,10 +548,11 @@ allowed-tools: Bash(npm *), Bash(git *)
|
||||
|
||||
---
|
||||
|
||||
**最后更新**: 2026 年 8 月 19 日
|
||||
**Claude Code 版本**: 2.1.235
|
||||
**最后更新**: 2026 年 9 月 19 日
|
||||
**Claude Code 版本**: 2.1.278
|
||||
**来源**:
|
||||
- https://code.claude.com/docs/en/commands
|
||||
- https://code.claude.com/docs/en/output-styles
|
||||
**兼容模型**: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5
|
||||
|
||||
---
|
||||
|
||||
@@ -193,7 +193,7 @@ agent_docs/
|
||||
|
||||
如果用户请求创建或更新 AGENTS.md:
|
||||
|
||||
**Claude Code 不会直接读取 AGENTS.md。** 要让它生效,需要在 CLAUDE.md 中用 `@AGENTS.md` 导入,或者把 `CLAUDE.md` 软链接到它。这是关于这个文件最常见的误解。
|
||||
**从 v2.1.277 起,Claude Code 会直接把 `AGENTS.md` 作为项目指令读取。** 但前提是工作目录以及它上面的每一级目录都没有 `CLAUDE.md`、`.claude/CLAUDE.md` 或 `CLAUDE.local.md`。`~/.claude/CLAUDE.md`、受管理的 CLAUDE.md 和 `.claude/rules/` 不计入这项检查,它们仍会一并加载。该行为由 `/config` 中的 **Project instructions** 控制:`claude-md-or-agents-md`(默认)、`claude-md-and-agents-md`、`claude-md`、`managed-only`。在无法直接读取的环境中 — Bedrock/Vertex/Foundry、关闭遥测、升级后的第一个会话,或 `disableAllHooks`/`allowManagedHooksOnly` — 退回到在 CLAUDE.md 中用 `@AGENTS.md` 导入,或者把 `CLAUDE.md` 软链接到它。
|
||||
|
||||
AGENTS.md 是一个跨工具的项目上下文文件 — 和 CLAUDE.md 属于同一*类*文档,而不是 agent 定义格式。它的存在是为了让多个编码 agent 共用同一套项目约定:
|
||||
- 构建、测试和 lint 命令
|
||||
|
||||
@@ -26,7 +26,7 @@ Claude Code 支持 33 个 hook 事件,按用途分为以下 4 组。事件的
|
||||
|
||||
- **Tool Hooks**:`PreToolUse`、`PostToolUse`、`PostToolUseFailure`、`PostToolBatch`、`PermissionRequest`、`PermissionDenied`
|
||||
- **Session Hooks**:`SessionStart`、`Setup`、`SessionEnd`、`Stop`、`StopFailure`、`SubagentStart`、`SubagentStop`
|
||||
- **Task Hooks**:`UserPromptSubmit`、`UserPromptExpansion`、`MessageDisplay`、`TaskCompleted`、`TaskCreated`、`TeammateIdle`(`TaskCompleted` 和 `TaskCreated` 仅在启用 todo 工具时触发 —— 在 Opus 4.8、Sonnet 5、Fable 5、Mythos 5 及更新模型上默认关闭;`CLAUDE_CODE_ENABLE_TODO_TOOLS=1` 可恢复)
|
||||
- **Task Hooks**:`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` 可恢复)
|
||||
- **Lifecycle Hooks**:`ConfigChange`、`CwdChanged`、`DirectoryAdded`、`FileChanged`、`PreCompact`、`PostCompact`、`PreModelSwitch`、`PostModelSwitch`、`WorktreeCreate`、`WorktreeRemove`、`Notification`、`InstructionsLoaded`、`Elicitation`、`ElicitationResult`
|
||||
|
||||
## 安装
|
||||
@@ -113,7 +113,8 @@ Hooks 会在匹配到事件时自动执行。你可以把它理解成 Claude Cod
|
||||
|
||||
---
|
||||
|
||||
**最后更新**: 2026 年 9 月 2 日
|
||||
**Claude Code 版本**: 2.1.257
|
||||
**最后更新**: 2026 年 9 月 19 日
|
||||
**Claude Code 版本**: 2.1.278
|
||||
**来源**:
|
||||
- https://code.claude.com/docs/en/hooks
|
||||
- https://code.claude.com/docs/en/tools-reference#task-tool-availability
|
||||
|
||||
+5
-4
@@ -353,8 +353,8 @@ export GITHUB_TOKEN="your_token" && claude mcp add github -- npx -y @modelcontex
|
||||
| `Stop` | Claude 完成响应 | 响应完成 | 清理、汇报 |
|
||||
| `StopFailure` | API 错误导致结束 | API 错误发生 | 错误恢复、日志 |
|
||||
| `TeammateIdle` | 队友 agent 空闲 | agent team 协调 | 分配工作 |
|
||||
| `TaskCompleted` | 任务标记完成(仅在启用 todo 工具时触发 —— 在 Opus 4.8、Sonnet 5、Fable 5、Mythos 5 及更新模型上默认关闭;`CLAUDE_CODE_ENABLE_TODO_TOOLS=1` 可恢复) | 任务完成 | 任务后处理 |
|
||||
| `TaskCreated` | 通过 TaskCreate 创建任务(仅在启用 todo 工具时触发 —— 在 Opus 4.8、Sonnet 5、Fable 5、Mythos 5 及更新模型上默认关闭;`CLAUDE_CODE_ENABLE_TODO_TOOLS=1` 可恢复) | 新任务创建 | 任务追踪、日志 |
|
||||
| `TaskCompleted` | 任务标记完成(仅在启用 todo 工具时触发 —— 默认仅在 Claude 3.x、Opus 4 至 4.7、Sonnet 4 至 4.6、Haiku 4.5 上可用;`CLAUDE_CODE_ENABLE_TODO_TOOLS=1` 可恢复) | 任务完成 | 任务后处理 |
|
||||
| `TaskCreated` | 通过 TaskCreate 创建任务(仅在启用 todo 工具时触发 —— 默认仅在 Claude 3.x、Opus 4 至 4.7、Sonnet 4 至 4.6、Haiku 4.5 上可用;`CLAUDE_CODE_ENABLE_TODO_TOOLS=1` 可恢复) | 新任务创建 | 任务追踪、日志 |
|
||||
| `ConfigChange` | 配置更新 | 设置被修改 | 响应配置变化 |
|
||||
| `CwdChanged` | 当前工作目录变化 | 目录切换 | 目录级初始化 |
|
||||
| `DirectoryAdded` | 会话中注册了新的工作目录 | `/add-dir` 或 SDK `register_repo_root` | 为新目录配置工具链 |
|
||||
@@ -531,9 +531,10 @@ claude mcp add github -- npx -y @modelcontextprotocol/server-github
|
||||
|
||||
---
|
||||
|
||||
**最后更新**: 2026 年 9 月 2 日
|
||||
**Claude Code 版本**: 2.1.257
|
||||
**最后更新**: 2026 年 9 月 19 日
|
||||
**Claude Code 版本**: 2.1.278
|
||||
**来源**:
|
||||
- https://code.claude.com/docs/en/tools-reference#task-tool-availability
|
||||
- https://code.claude.com/docs/en/commands
|
||||
- https://code.claude.com/docs/en/hooks
|
||||
- https://code.claude.com/docs/en/plugins-reference
|
||||
|
||||
+4
-3
@@ -219,7 +219,7 @@ blog-draft/
|
||||
**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 工具时触发 —— 在 Opus 4.8、Sonnet 5、Fable 5、Mythos 5 及更新模型上默认关闭;`CLAUDE_CODE_ENABLE_TODO_TOOLS=1` 可恢复)
|
||||
- 任务 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`
|
||||
|
||||
---
|
||||
@@ -894,12 +894,13 @@ claude -p "Run tests and report results"
|
||||
|
||||
---
|
||||
|
||||
**最后更新**:2026 年 8 月 15 日
|
||||
**Claude Code 版本**:2.1.233
|
||||
**最后更新**:2026 年 9 月 19 日
|
||||
**Claude Code 版本**:2.1.278
|
||||
**总示例数**:100+ 文件
|
||||
**分类数**:10 个功能
|
||||
**Hooks**:8 个自动化脚本
|
||||
**配置示例**:10+ 个场景
|
||||
**可直接使用**:所有示例
|
||||
**来源**:
|
||||
- https://code.claude.com/docs/en/tools-reference#task-tool-availability
|
||||
- https://code.claude.com/docs/en/hooks
|
||||
|
||||
+4
-3
@@ -483,7 +483,7 @@ chmod +x ~/.claude/hooks/*.sh
|
||||
**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 工具时触发 —— 在 Opus 4.8、Sonnet 5、Fable 5、Mythos 5 及更新模型上默认关闭;`CLAUDE_CODE_ENABLE_TODO_TOOLS=1` 可恢复)
|
||||
- **任务 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`
|
||||
|
||||
</details>
|
||||
@@ -878,9 +878,10 @@ MIT 许可证,详见 [LICENSE](LICENSE)。你可以自由使用、修改和分
|
||||
|
||||
---
|
||||
|
||||
**最后更新**:2026 年 9 月 2 日
|
||||
**Claude Code 版本**:2.1.257
|
||||
**最后更新**:2026 年 9 月 19 日
|
||||
**Claude Code 版本**:2.1.278
|
||||
**来源**:
|
||||
- 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
|
||||
**兼容模型**:Claude Fable 5、Claude Opus 5、Claude Sonnet 5、Claude Sonnet 4.6、Claude Opus 4.8、Claude Haiku 4.5
|
||||
|
||||
Reference in New Issue
Block a user