Learn Real Claude Code
Description
Deep dive into Claude Code source — 512K lines of industrial-grade TypeScript agent architecture
Installation
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open the source below and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
README
[English](./README.md) | [中文](./README-zh.md)
Learn Real Claude Code — Source Archaeology on a 512K-Line Agent
The Source Code Doesn't Lie
On March 31, 2026, a security researcher discovered that Anthropic had accidentally shipped the complete TypeScript source of Claude Code inside an npm package — 512,000+ lines, 1,902 files, a 60MB sourcemap that unzips to the full codebase.
This was not the first time. The same mistake happened in February 2025.
Before we talk about what the source reveals, let's be precise about what you are actually looking at.
**Claude Code is not an agent. Claude Code is a harness.**
The agent is Claude — a neural network, trained by Anthropic, capable of reasoning, planning, and acting. Claude Code is the shell around that model: the tools, the context management, the permission system, the terminal UI, the streaming infrastructure. It is the vehicle the agent drives. Not the driver.
This distinction matters because it changes what you learn from reading the source. You are not studying "how Claude thinks." You are studying **how Anthropic built the environment that lets Claude think at its best** — in production, at scale, with real users.
And what you find, when you read those 512,000 lines carefully, is deeply instructive.
What the Source Reveals
The common mental model of an AI coding agent looks like this:
user message → LLM call → parse response → if tool_call: run tool → loop
Clean. Simple. Teachable in a weekend.
The reality in Claude Code's source is different:
user message
→ fast-path check (exit in < 5ms if --version, --help, etc.)
→ lazy module evaluation (main.tsx is 804KB; don't load what you don't need)
→ parallel prefetch (config + auth + MCP init all fire concurrently)
→ command registry check (100+ slash commands before touching the model)
→ system prompt assembly (10+ sources, SYSTEM_PROMPT_DYNAMIC_BOUNDARY for cache)
→ StreamingToolExecutor fires tools MID-STREA
Related Skills
Awesome Go
A curated list of awesome Go frameworks, libraries and software
Development next.js
| The React Framework | 138360 | 1503 | 1 |
Development sharing-skills
skill for guidance.
Development root-cause-tracing
Use when errors occur deep in execution and you need to trace back to find the original trigger.
Development Template Skill
Minimal skeleton for a new skill project structure.
Development Third-party Notices
THE FOLLOWING SETS FORTH ATTRIBUTION NOTICES FOR THIRD PARTY SOFTWARE THAT MAY BE CONTAINED IN PORTIONS OF THI
Development