Claude AI Get started

Claude Code 源码 — Source & Architecture Notes

An architectural overview of Claude Code based on publicly available information: the layer model, skill format, plugin interface, and what you can extend without touching proprietary code.

License note

Claude Code's core CLI binary is proprietary software published by Anthropic. This page covers only the public architecture and extension interfaces. It does not expose, reproduce, or distribute any proprietary source code. All content is drawn from Anthropic's public documentation and observable behaviour.

What 源码 (source) means in this context

In Chinese, 源码 means "source code." Developers searching for "claude code 源码" are typically trying to understand the internal structure of Claude Code — either because they want to extend it, contribute to it, or simply understand how it works under the hood. This page addresses that intent honestly: the core CLI is not open source, but the extension interfaces are public and well-documented, and the overall architecture can be described accurately from what Anthropic has shared openly.

This page does not claim to expose proprietary internals. It does not reproduce or distribute any Anthropic source code. What it provides is an architectural orientation based on published blog posts, conference talks, the skill format specification, and observable CLI behaviour — the kind of structural understanding that lets a developer extend the tool effectively without needing to read the underlying implementation.

The architectural layer model

Claude Code is structured as a thin orchestration layer over the Claude API. The model itself — the neural network that generates responses — runs entirely server-side on Anthropic's infrastructure. The Claude Code CLI is the local component: it reads files from your filesystem, maintains session context, handles user input, interprets tool calls from the model, and manages the skill and plugin extension points.

That separation is architecturally significant. It means the "intelligence" is not in the CLI binary — the binary is closer to a well-designed HTTP client with file-system access. The model on the other end does the reasoning; the CLI manages the loop. This is why the CLI can be installed as a lightweight Node package without bundling a model, and why it works across operating systems without platform-specific builds for the AI component.

The skill format

Skills are the primary public extension interface. A skill is a markdown file with a YAML front-matter block that declares the skill's name, description, tools it may invoke, and any required configuration. The body of the markdown contains natural-language instructions that the model reads as part of its context when the skill is active. This design means skills are readable, version-controllable, and editable by anyone who can write markdown — no compilation or build step required.

When the CLI loads a skill, it prepends the skill's content to the model's context alongside any standing project configuration. The model then has access to both the skill's instructions and the current project state. A skill for a database migration might include instructions on how to generate migration files, what naming conventions to follow, and which tools to invoke. The model interprets those instructions and acts on them within the current session. Skills live in a designated directory — typically ~/.claude/skills/ for user-level skills and .claude/skills/ for project-level ones.

Architecture layers at a glance

LayerPurposePublic reference
Claude API (server-side)Model inference, token generationClaude API documentation
Claude Code CLI (local)Context management, tool execution, UICLI documentation, published blog posts
Skill layerNatural-language capability extensionsSkill format specification
Plugin layerStructural tool integrations via MCPMCP (Model Context Protocol) spec
Project configCLAUDE.md, settings.json, .claude dirCLI configuration documentation

The plugin model and MCP

Beyond skills, Claude Code supports structural plugins through the Model Context Protocol (MCP). MCP is an open protocol that Anthropic published separately from the CLI, allowing external tools and services to expose capabilities to the model in a standardised way. An MCP server can provide tools, resources, and prompts that the model can use during a session. The CLI acts as an MCP client and connects to any MCP-compliant server at startup.

This architecture means you can extend Claude Code with integrations to external services — a database query tool, a code search index, a ticket tracker — without modifying the CLI itself. The MCP server runs as a separate process and communicates with the CLI over a local socket or stdio. The protocol specification is public and there are community implementations in multiple languages. For academic context on protocol design in AI developer tooling, the MIT CSAIL publications cover relevant distributed systems patterns.

What you can and cannot access

You can access: the skill format, the MCP plugin interface, the CLAUDE.md configuration format, the settings.json schema, and the CLI's command-line interface including all flags. These are the intended extension points and they are documented publicly. You can build skills, MCP plugins, and project configurations that change Claude Code's behaviour substantially without ever touching proprietary code.

You cannot access: the model weights (server-side and proprietary), the core CLI source code (proprietary), and internal tooling not exposed through the public interfaces. This is standard for a commercial developer tool — the extension interfaces are open, the core is not. The community project oh-my-claudecode is a useful observable reference for how the public extension interfaces are used in practice; its own source is open and available for study.

"The architecture overview clarified what I could actually customise versus what was fixed. I stopped trying to reverse-engineer the binary and focused on skills and MCP plugins — exactly the right approach."
— Cosmin D. RădulescuEngineering Lead · Brasleyn Co · Cluj-Napoca

Frequently asked questions about Claude Code 源码

Is Claude Code open source?

The core CLI binary is proprietary, published by Anthropic. Some extension interfaces — the skill format, MCP protocol — are publicly documented and open. Developers can extend Claude Code meaningfully through these public interfaces without access to the core source code.

What is the Claude Code skill format?

Skills are markdown files with a YAML front-matter tool manifest. The manifest declares the skill's name, description, and tools it uses. The markdown body contains natural-language instructions the model reads as context. Skills are stored in ~/.claude/skills/ (user-level) or .claude/skills/ (project-level) and loaded on demand.

How is Claude Code structured architecturally?

Claude Code is a thin CLI layer over the Claude API. The model runs server-side; the CLI manages context, file access, tool execution, and the skill and plugin extension points locally. The intelligence is in the server-side model; the CLI is the local orchestration layer that manages the session loop.

What public references exist for Claude Code's architecture?

Anthropic has published blog posts, the MCP protocol specification, and the skill format documentation. The oh-my-claudecode community project is an open-source extension that provides additional observable reference for how the plugin model works in practice. This page synthesises those public sources.

Can I build plugins for Claude Code?

Yes. The primary extension mechanisms are skills (markdown + manifest) and MCP plugins (external processes communicating over the Model Context Protocol). Both work without access to the CLI's proprietary source. MCP plugins can integrate external tools and services in a standardised, protocol-defined way.

Related topics

The claude code skills page is the hands-on reference for building and using the skill extension format described above. The claude code 使用教程 page includes an advanced tutorial on the source structure for developers who want to go deeper. For the official-site context, the claude code 官网 page explains this site's independence from Anthropic clearly. The install claude code walkthrough is the practical starting point if you have not yet set up the CLI.

Teams integrating via MCP will find the claude api reference useful alongside this page — MCP plugins ultimately surface capabilities through the same API surface that direct integrations use. The claude code for teams notes cover how shared skills and MCP configurations are managed at team scale. For the broader context on Claude Code's role in the developer stack, the claude code overview is the right starting point.

Ready to build a skill?

The skills reference has the format spec and worked examples — everything you need to write your first skill in under an hour.

Open the skills reference