Build Coding Agent Tutorial — Development skill for Claude Code
从零构建 Coding Agent — 18 章 TypeScript 教程,理解 Claude Code / Cursor 背后的原理.
How to install Build Coding Agent Tutorial
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open happydog-intj/build-coding-agent-tutorial and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
What Build Coding Agent Tutorial does
从零构建 Coding Agent — 18 章 TypeScript 教程,理解 Claude Code / Cursor 背后的原理。Agent Loop、Tool Use、上下文管理、评测体系完整实现。
Alternatives in Development
- Ralph Loop — Autonomous coding loop — works through tasks, commits, repeats 14k ★
- AgenticResourceRegistry — Share and discover coding agent resources across your team 4.5k ★
- Ralphy — My Ralph Wiggum setup, an autonomous bash script that runs Claude Code, Codex, OpenCode, Cursor agent, Qwen & 2.8k ★
README
从零构建 Coding Agent — TypeScript 教程
[](https://github.com/happydog-intj/build-coding-agent-tutorial) [](./LICENSE) [](https://happydog-intj.github.io/build-coding-agent-tutorial/)
18 章渐进式教程 + 17 个可运行 Demo,理解 Claude Code / Cursor / Cline 背后的原理
📖 **[在线阅读](https://happydog-intj.github.io/build-coding-agent-tutorial/)** · 🪞 **[国内镜像](https://build-coding-agent-tutorial.vercel.app)** · 📥 **[下载 PDF](./releases/build-coding-agent-tutorial.pdf)** · 💬 **[FAQ](https://happydog-intj.github.io/build-coding-agent-tutorial/faq)**
用 TypeScript 从零实现一个完整的 AI Coding Agent(750 行),逐步讲解 Agent Loop、Tool Use、上下文管理、评测体系等核心原理。
快速开始
# 设置 API Key(二选一)
export ANTHROPIC_API_KEY=sk-ant-...
# 或
export OPENAI_API_KEY=sk-...
# 安装依赖
npm install
# 运行
npm start
# 指定模型
npm start -- --model=gpt-4o
架构概览
┌─────────────────────────────────────────────────────┐
│ index.ts (CLI 入口) │
│ readline 交互 + 流式输出 + 会话管理 │
├─────────────────────────────────────────────────────┤
│ agent-loop.ts (核心 Agent Loop) │
│ [用户消息] → LLM → 有 tool call? → 执行 → 重复 │
├─────────────────────────────────────────────────────┤
│ tools/ (4 个核心工具) │
│ read_file | write_file | edit_file | bash │
├─────────────────────────────────────────────────────┤
│ provider.ts (LLM Provider) │
│ pi-ai: 30+ provider 统一接口 │
├─────────────────────────────────────────────────────┤
│ session.ts (JSONL 持久化) │
│ 增量追加、崩溃安全、简单恢复 │
└─────────────────────────────────────────────────────┘
核心设计原则
这些原则来自 Pi 项目 5600+ 次迭代的经验:
1. LLM 调用永不 throw
Related Skills
Claude Coding Agent
A simple TypeScript coding agent powered by Claude that reads, writes, edits files, lists directories, and run
Agent Mux
unified TypeScript SDK and CLI (amux) for driving heterogeneous coding-agent harnesses — Claude Code, Codex, G
Agent Looper
Fix-until-green loop for coding agents: frozen goal, shell verify as the finish line, fresh worker each round,
Coding Agent Config
Shared SoT for a multi-agent coding fleet: host rules, skills/agents, hook policy, and a crossed-axis knowledg
Claude Code Monorepo
The real Claude Code configuration behind a 13-service TypeScript platform — 71 skills, 34 hooks, 31 agents, 1
Build Code Agent
从零构建 Code Agent:Claude Code 源码深度解析 Build a Code Agent from Scratch: Deep Dive into Claude Code Source
Related Agents
Klein Tutor
TUTORIAL worker for Klein Auto Research — builds report/index.html, the self-contained seven-section teaching
Cursor Delegate
Proactively use when this coding agent should hand a substantial coding, diagnosis, or implementation task to
Cursor Rescue
Proactively use as an extra agentic lane on Cursor's own quota — bounded coding tasks (a spec file, a rename,