1491007406/cc-insider/SKILL.md
Claude Code v2.1.88 深度掌握。整合架构体系、源码解析、实战模式。涵盖 Tool/Task/Agent 三层模型、Coordinator 协调、Hooks 钩子、权限系统、Context 缓存、MCP 集成。触发场景:理解 Claude Code 内部工作原理、行为异常诊断、扩展开发(Tool/Skill/Agent)、深度研究。
npx skillsauth add openclaw/skills claude-code-masteryInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
源码位置:
restored-src/src/
版本:v2.1.88
来源:架构分析 + 源码解析 + 实战模式(三合一)
Claude Code 的核心是 Tool → ToolUse → Task 三层递进模型:
Tool(定义层) → 我是什么工具,有哪些接口
ToolUse(执行层) → 实际调用时的完整运行时状态
Task(封装层) → 后台任务的生命周期管理
理解这三层的区别和交互,就掌握了 Claude Code 的骨架。
详细内容和源码引用见各 reference 文件:
| 主题 | 参考文件 | |------|----------| | 架构全景、子系统关系、源码位置 | architecture.md | | Tool 接口、buildTool 工厂、ToolUseContext、Zod schema | tool-internals.md | | Task 类型、生命周期、ID 生成、LocalShellTask | task-system.md | | AgentTool、spawn/fork/continue/stop、AgentDefinition | agent-system.md | | Coordinator 协调原则、Synthesize-first、决策树 | coordinator.md | | Hooks 事件类型、执行流程、匹配规则 | hooks.md | | 权限模型、SedEdit 安全设计、isConcurrencySafe | permissions.md | | Context 缓存、CLAUDE.md 嵌套、fork-safe 设计 | context-system.md | | SKILL.md 格式、Tool 实现模板、命令注册、Prompt 精选 | patterns.md | | 设计亮点、调试线索、常见问题 Q&A | design-highlights.md |
Tool 是包含接口定义 + 执行逻辑 + 权限检查 + UI渲染的完整对象,不是简单的函数调用。
const TOOL_DEFAULTS = {
isConcurrencySafe: () => false, // 默认不允许并发
isReadOnly: () => false, // 默认会修改
isDestructive: () => false, // 默认不破坏
checkPermissions: () => ({ behavior: 'allow' }),
}
contentReplacementState、renderedSystemPrompt、messages 必须在 fork 时从父进程克隆,保证上下文一致。
_simulatedSedEdit 在 inputSchema 中被 omit,模型不能自己设置这个字段——防止构造任意文件写入。
1. inputSchema — Zod schema 定义参数
2. description() — 人类可读描述(3-10 词,无句号)
3. call() — 执行逻辑,包含错误处理
4. maxResultSizeChars — 超过→写磁盘
5. checkPermissions() — 权限逻辑,默认 allow
6. toAutoClassifierInput() — 安全分类,默认空字符串
7. renderToolResultMessage() — UI 渲染
8. isConcurrencySafe() — 并发安全,默认 false
9. isReadOnly() / isDestructive() — 操作类型
10. getPath()? — 文件路径权限检查
11. preparePermissionMatcher()? — Hook pattern 匹配
src/types/hooks.ts 添加事件类型hooks(event, context)/skill-namedescription/whenToUse 匹配paths 字段 glob 模式.claude/(项目)> ~/.claude/(用户)> plugin/
tools
Use when the user wants to connect to, test, or use the McDonalds service at mcp.mcd.cn, including checking authentication, probing MCP endpoints, listing tools, or calling McDonalds MCP tools through a reusable local CLI.
development
Web scraping platform — Twitter/X data, Vinted marketplace, and general web scraping API
development
SlowMist AI Agent Security Review — comprehensive security framework for skills, repositories, URLs, on-chain addresses, and products (Claude Code version)
data-ai
去除中文文本中的 AI 写作痕迹,使其读起来自然。基于维基百科 AI 写作特征指南,检测 24 种 AI 模式。触发词:humanizer-cn、去除 AI 痕迹、去除 AI 写作痕迹、中文文本人性化。