How Claude Code Works — Development skill for Claude Code
Deep dive into Claude Code internals — architecture, agent loop, context engineering, and more.
How to install How Claude Code Works
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open Windy3f3f3f3f/how-claude-code-works and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
What How Claude Code Works does
Deep dive into Claude Code internals — architecture, agent loop, context engineering, and more. / 深入解析 Claude Code 源码:架构、Agent 循环、上下文工程、工具系统等
Alternatives in Development
- Management Deep Dive — 管理层纵深研究:买股票就是买人 15.9k ★
- Ralph Loop — Autonomous coding loop — works through tasks, commits, repeats 14k ★
- Native Feel Skill — An Agent Skill for designing cross-platform desktop apps that feel native — distilled from Raycast's 2.0 deep 1.9k ★
README
How Claude Code Works
**深入解读当前最成功的 AI 编程 Agent 的源码架构**
[](https://github.com/Windy3f3f3f3f/how-claude-code-works) [](https://github.com/Windy3f3f3f3f/how-claude-code-works/fork) [](./LICENSE) [](https://github.com/anthropics/claude-code) [](#专题深入)
[**📘 在线阅读文档**](https://windy3f3f3f3f.github.io/how-claude-code-works/#/) | [English](./README_EN.md)
🛠️ **想动手造一个?** 配套项目 **[Claude Code From Scratch](https://github.com/Windy3f3f3f3f/claude-code-from-scratch)** — ~4000 行 TypeScript 或 Python两个版本,11 章分步教程,从零构建你自己的 Claude Code
Claude Code 是目前使用最广泛的 AI 编程 Agent,也是我们认为最好用的 AI 编程工具。它能理解整个代码仓库、自主执行多步编程任务、安全地运行命令——而这一切背后是 **50 万行 TypeScript 源码**中沉淀的工程智慧。
Anthropic 开源(x)了这份源码。**但 50 万行代码,从哪里开始读?**
这也是我们创建这个项目的初衷——我们都遇到了没有办法阅读这么庞大代码项目的问题,解决方案是和 Claude Code 一起读,让它写文档配合我们理解源代码。在此同时,我们想把这个过程文档化,就形成了这个项目。
我们和 Claude Code 加班从源码中提炼出 **15 篇专题文档**,覆盖了从核心循环到安全防护的每一个关键设计决策。不管你是想造自己的 AI Agent,还是想更深入地理解和使用 Claude Code,这里都是最短路径(应该?就算不是最短的,我们也会不断更新这个项目)。
🏗️ 系统架构
graph TB
User[用户输入] --> QE[QueryEngine 会话管理]
QE --> Query[query 主循环]
Query --> API[Claude API 调用]
API --> Parse{解析响应}
Parse -->|文本| Output[流式输出]
Parse -->|工具调用| Tools[工具执行引擎]
Tools --> ReadTool[读文件]
Tools --> EditTool[编辑文件]
Tools --> ShellTool[Shell 执行]
Tools --> SearchTool[搜索工具]
Tools --
Related Skills
Learn Real Claude Code
Deep dive into Claude Code source — 512K lines of industrial-grade TypeScript agent architecture
Claude Code Source Analysis Orange Book
Claude Code: Source Code Analysis · Orange Book Series · Deep dive into Claude Code architecture and implement
Deep Dive
Gather comprehensive codebase context using parallel exploration agents
Claude Code Internals
Claude Code skill providing source-level knowledge of Claude Code's internal architecture (v2.1.88) — 50 lesso
Stackwich
Installs an operating architecture into Claude Code as five layers — prompt, context, harness, loop, graph: me
Claude Reviews Claude
Claude reads its own source code — 17-chapter architectural deep-dive into Claude Code v2.1.88. EN/ZH bilingua
Related Agents
Doey Doey Expert
Doey internals expert — deep knowledge of hooks, agents, skills, shell scripts, and the overall self-improveme
Deep Dive
Use this agent when you need comprehensive analysis, investigation, or exploration of code, architecture, or t
Visionary
Visionary product-engineering thinker with deep frontier tech knowledge. Works in two modes — (1) brainstorm w