Claude Code Source Study — Development skill for Claude Code
深入Claude Code源码,学习目前最好的agent实现.
How to install Claude Code Source Study
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open luyao618/Claude-Code-Source-Study and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
What Claude Code Source Study does
深入Claude Code源码,学习目前最好的agent实现.
Alternatives in Development
- Book To Skill — Turn any technical book PDF into a Claude Code skill — ready to study, reference, and use while you work 25.9k ★
- Knowledge Work Plugins — Open source repository of plugins primarily intended for knowledge workers to use in Claude Cowork 9734 125 18 10.5k ★
- Llamacoder — Open source Claude Artifacts – built with Llama 3.1 405B 7.1k ★
README
深入 Claude Code 源码
**从 Anthropic 的 AI 编程助手源码中,学会构建 AI Agent 应用的全栈技术**
Claude Code 是 Anthropic 推出的 AI 命令行编程助手,也是目前最好的 AI Coding 产品之一。它的开源源码包含约 1900 个文件,覆盖了 System Prompt 工程、多 Agent 编排、工具系统、权限安全、终端 UI 等完整技术栈。
**这是一份 25 篇、覆盖全部核心模块的深度源码分析。**
不是泛泛而谈的架构概览,而是逐文件、逐函数的拆解——每篇都精确到源码行号,附关键代码片段,并总结可迁移到你自己项目的设计模式。
为什么值得读?
- 🔍 真实产品,不是 demo — 从真实的生产级 AI 产品中学习,而非玩具项目
- 🏗️ 全栈覆盖 — 从编译期优化到运行时状态管理,从 Prompt Cache 到终端渲染
- 🎯 面向实战 — 每篇结尾提炼 2-3 个可直接复用的设计模式
- 📖 中文友好 — 正文中文,技术术语保留英文原文
目录
📂 所有文章在 [`docs/`](./docs/) 目录下,完整目录与阅读指引见 [00-目录与阅读指引](./docs/00-目录与阅读指引.md)
Part 1: 全局架构
| # | 文章 | 你会学到 |
|---|---|---|
| 01 | 项目全景 | 技术栈选型(Bun + TypeScript + Ink)、启动链路、模块依赖全景 |
| 02 | 启动优化 | 毫秒级 CLI 启动:侧效果前置、DCE、API 预连接 |
| 03 | 状态管理 | 35 行极简 Store 桥接 React 与非 React 世界 |
Part 2: AI 核心
| # | 文章 | 你会学到 |
|---|---|---|
| 04 | System Prompt 工程 | 分段构建、缓存边界、行为引导技巧 |
| 05 | 对话循环 | AsyncGenerator 状态机驱动的完整 AI 交互 |
| 06 | 上下文管理 | Token 预算、Auto-compact、无限对话的秘密 |
| 07 | Prompt Cache | 跨模块缓存策略如何降低 API 成本 |
| 08 | Thinking 与推理控制 | ThinkingConfig、Effort 级别、ultrathink |
Part 3: 工具、命令与 Agent 系统
| # | 文章 | 你会学到 |
|---|---|---|
| 09 | 工具系统设计 | buildTool() builder 模式、三层条件注册 |
| 10 | BashTool 深度剖析 | 四层安全防线、沙箱执行、12400 行的最复杂工具 |
| 11 | 命令系统 | 六源聚合的斜杠命令架构 |
| 12 | Agent 系统 | 从单体到多智能体协作、context 隔离 |
| 13 | 内置 Agent 设计模式 | Explore/Plan/Verification 的 Prompt 设计 |
| 14 | 任务系统 | 7 种 TaskType、并发执行引擎 |
| 15 | MCP 协议实现 | 6 种传输层、OAuth/XAA 认证 |
Part 4: 安全与工程
| # | 文章 | 你会学到 |
|---|---|---|
| 16 | 权限系统 | 七种权限模式、7 步决策管线 |
| 17 | [Settings 系统](./docs/17-Sett |
Related Skills
Claude Certified Architect
This repository contains study materials for the Claude Certified Architect — Foundations certification.
Study Pool
Study top LPers on a specific pool
Claude Code Architecture Instruction
Unofficial study notes and architecture breakdowns for Claude Code
OpenStudy
Self-hostable study dashboard with a built-in MCP server, so that your Claude/ChatGPT subscription becomes x10
Kaogong Plan
个性化学习计划:按考试时间和薄弱项生成基础期→提高期→冲刺期的每日任务表。Generate a personalised study plan.
Claude Certified Architect Guide
Unofficial study guide for Anthropic's Claude Certified Architect (CCAR-F) certification. Covers agentic loops
Related Agents
Study Note Worker
Runs bounded transcript review and source mapping after deterministic Python preprocessing; does not author no
Kb Corpus Curator
Register, ingest and verify a source in this knowledge base through the kb- mise tasks, and close the loop wit
Paper Note
Writes the Korean restructured study note (papers/ .md) for one paper whose Markdown source already exists und