免费开源课程,511节内容覆盖Python/TypeScript/Rust/Julia,每课产出可复用组件(prompt/Agent/MCP服务器)。作者同时维护#1持久记忆Agent项目。
Read in your language: Español · Français · Português · Deutsch · Italiano · 简体中文 · 日本語 · 한국어 · हिन्दी · العربية · Русский · Türkçe Translated landing pages, committed to the repo. English is canonical; lesson pages are machine-translated on the translations branch. See docs/i18n.md.
From the creator of Agent Memory - #1 Persistent memory ⭐ which naturally works with any agents or chat assistants.
░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒
84% of students already use AI tools. Only 18% feel prepared to use them professionally. This curriculum closes that gap.
511 lessons. 20 phases. ~329 hours. Python, TypeScript, Rust, Julia. Every lesson ships a reusable artifact: a prompt, a skill, an agent, an MCP server. Free, open source, MIT.
You don't just learn AI. You build it. End-to-end. By hand.
150,639 readers · 241,669 page views in the last 30 days · as of 2026-06-07
Start here: choose what you want to build
You do not need to scan 511 lessons before beginning. Pick one goal. Each link opens the same curriculum on GitHub or the website, and both versions use the same lesson code.
Not sure where you fit? Use the start-learning placement tutor or the website prerequisites guide.
Use every lesson the same way
Read docs/en.md and explain the core idea in your own words.
Type and build the important code instead of treating the code block as decoration.
Run the lesson command from the repository root, the directory containing README.md and phases/.
Keep evidence: the command, working directory, exit code, meaningful output, and the artifact you changed or produced.
Continue only when you can explain the output and make one small change without guessing.
Commands in lesson pages are paths from the repository root unless the lesson explicitly says to change directories. If a lesson offers several languages, run the implementation for the language you are learning.
Clone it and produce your first evidence
git clone https://github.com/rohitg00/ai-engineering-from-scratch.git
cd ai-engineering-from-scratch
python3 phases/00-setup-and-tooling/01-dev-environment/code/verify.py --route beginner
python3 phases/01-math-foundations/01-linear-algebra-intuition/code/vectors.py
The preflight separates requirements needed now from tools needed later. Every required failure includes the detected reason and a corrective command. The second command is a dependency-free lesson and ends by showing that a matrix times a vector is the operation inside a neural network layer. Save that terminal output as your first evidence.
Add the AI tutor in 30 seconds
If Node.js, npx, and a skill-capable coding agent are already installed, your coding agent can become your tutor in two commands. A repository clone is not needed to install or read the tutor. Runnable focused-path labs need python3. Agent Skills host labs also need a selected host and a writable user or project skill scope.
Check the local requirements first:
node --version
npx --version
python3 --version
Then install the curriculum skills and choose the host and scope you intend to use when the installer asks:
npx skills add rohitg00/ai-engineering-from-scratch
Invocation syntax belongs to the host, not to the portable SKILL.md format:
A ten-question placement quiz maps what you already know to a starting phase and saves a personalized study plan to LEARNING.md. From there, the learn skill teaches one lesson per session: concept, math, code, quiz. It streams lessons straight from this repo, and the course-guide skill jumps you to the exact lesson that covers anything you are stuck on. In Codex, invoke these skills with learn and course-guide; in Claude Code, use /learn and /course-guide; in other compatible hosts, ask to use the skill by name.
Only want Model Context Protocol (MCP)? Use the MCP invocation for your host. It creates MCP-LEARNING.md and follows one 17-lesson route through stateless requests, transports, bidirectional work, security, reliability, registry governance, and conformance evidence. The exact order and checkpoints live in the Model Context Protocol (MCP) manifest.
Only want Agent Skills? Use the Agent Skills invocation for your host. It creates AGENT-SKILLS-LEARNING.md and follows one coherent five-lesson route: contract, discovery, invocation, sandbox boundaries, then release evals and real-host portability. Start on the web with the Agent Skills path.
The installer lists the hosts it can configure and asks where to install. If you do not have Node.js, npx, python3, a supported host, or a writable scope yet, use the website or read docs/en.md manually. That path teaches the concepts, but real-host discovery, invocation, script, and uninstall evidence remains pending until the preflight is available. Read the lessons at aiengineeringfromscratch.com.
Most AI material teaches in scattered pieces. A paper here, a fine-tuning post there, a flashy agent demo somewhere else. The pieces rarely line up. You ship a chatbot but can't explain its loss curve. You hook a function to an agent but can't say what attention does inside the model that's calling it.
This curriculum is the spine. 20 phases, 511 lessons, four languages: Python, TypeScript, Rust, Julia. Linear algebra at one end, autonomous swarms at the other. Every algorithm gets built from raw math first. Backprop. Tokenizer. Attention. Agent loop. By the time PyTorch shows up, you already know what it's doing under the hood.
Each lesson runs the same loop: read the problem, derive the math, write the code, run the test, keep the artifact. No five-minute videos, no copy-paste deploys, no hand-holding. Free, open source, and built to run on your own laptop.
░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒
The shape of the curriculum
Twenty phases stack on top of each other. Math is the floor. Agents and production are the roof. Skip ahead if you already know the lower layers, but don't skip and then wonder why something at the top is breaking.
%%{init: {'theme':'base','themeVariables':{'primaryColor':'#fafaf5','primaryTextColor':'#1a1a1a','primaryBorderColor':'#3553ff','lineColor':'#3553ff','fontFamily':'JetBrains Mono','fontSize':'12px'}}}%%
flowchart TB
P0["Phase 0 — Setup & Tooling"] --> P1["Phase 1 — Math Foundations"]
P1 --> P2["Phase 2 — ML Fundamentals"]
P2 --> P3["Phase 3 — Deep Learning Core"]
P3 --> P4["Phase 4 — Vision"]
P3 --> P5["Phase 5 — NLP"]
P3 --> P6["Phase 6 — Speech & Audio"]
P3 --> P9["Phase 9 — RL"]
P5 --> P7["Phase 7 — Transformers"]
P7 --> P8["Phase 8 — GenAI"]
P7 --> P10["Phase 10 — LLMs from Scratch"]
P10 --> P11["Phase 11 — LLM Engineering"]
P10 --> P12["Phase 12 — Multimodal"]
P11 --> P13["Phase 13 — Tools & Protocols"]
P13 --> P14["Phase 14 — Agent Engineering"]
P14 --> P15["Phase 15 — Autonomous Systems"]
P15 --> P16["Phase 16 — Multi-Agent & Swarms"]
P14 --> P17["Phase 17 — Infrastructure & Production"]
P15 --> P18["Phase 18 — Ethics & Alignment"]
P16 --> P19["Phase 19 — Capstone Projects"]
P17 --> P19
P18 --> P19
░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒
每一课都存在于自己的文件夹中,整个课程体系保持相同的结构:
phases/<NN>-<phase-name>/<NN>-<lesson-name>/
├── code/ 可运行的实现(Python, TypeScript, Rust, Julia)
├── docs/
│ └── en.md 课程叙述
└── outputs/ 本课产出的 prompts、skills、agents 或 MCP servers
每课遵循六个环节。Build It / Use It 的划分是主线——你先从头实现算法,然后用生产级库运行同样的东西。你之所以能理解框架在做什么,是因为你自己先写了更小的版本。
%%{init: {'theme':'base','themeVariables':{'primaryColor':'#fafaf5','primaryTextColor':'#1a1a1a','primaryBorderColor':'#3553ff','lineColor':'#3553ff','fontFamily':'JetBrains Mono','fontSize':'13px'}}}%%
flowchart LR
M["MOTTO<br/><sub>one-line core idea</sub>"] --> Pr["PROBLEM<br/><sub>concrete pain</sub>"]
Pr --> C["CONCEPT<br/><sub>diagrams & intuition</sub>"]
C --> B["BUILD IT<br/><sub>raw math, no frameworks</sub>"]
B --> U["USE IT<br/><sub>same thing in PyTorch / sklearn</sub>"]
U --> S["SHIP IT<br/><sub>prompt · skill · agent · MCP</sub>"]
方式 A —— 在终端中学习(推荐)。完成上面的 Node.js、npx、host 和 scope 预检后,将学习技能安装到兼容的 agent 中,让课程自行驱动:
npx skills add rohitg00/ai-engineering-from-scratch
使用上面针对各 host 的调用表。已安装的技能提供 start-learning、learn、course-guide,以及专注的 learn-mcp 和 learn-agent-skills 路径。课程正文可以从本仓库流式读取,无需克隆。若要复制仓库代码命令并执行可运行的 MCP 或 Agent Skills 实验,则需要本地克隆。进度保存在项目中的 LEARNING.md、MCP-LEARNING.md 或 AGENT-SKILLS-LEARNING.md,因此每次会话都可以恢复。
方式 B —— 阅读。在 aiengineeringfromscratch.com 上打开任意已完成课程,或在 Contents 下展开某个 Phase。无需任何设置,无需克隆。
方式 C —— 克隆并运行。
git clone https://github.com/rohitg00/ai-engineering-from-scratch.git
cd ai-engineering-from-scratch
python3 phases/01-math-foundations/01-linear-algebra-intuition/code/vectors.py
克隆还会自动在 Claude Code 中加载学习技能,并让学习导师能够真正执行每一课的代码,而非仅仅阅读。
你想理解 AI 实际如何工作,而非只会调用 API。
Claude Certification Academy 是一个免费的、开源的学习项目,旨在帮助备考全部四个官方 Claude 认证方向:Associate Foundations、Developer Foundations、Architect Foundations 和 Architect Professional。每条路径都结合了蓝图映射课程、可运行的实验、诊断测试、阶段性作品和一套完整的原创模拟考试。
使用 AI 原生的 GitHub 入门指南,配合 Claude Code、Codex、ChatGPT、Cursor 或其他 agent 使用。在 Codex 中运行 claude-certification,在 Claude Code 中使用 /claude-certification,或让另一个 host 使用 claude-certification。它会帮你选择方向、在 CLAUDE-CERTIFICATION.md 中创建持久的学习路径,一步一步地教学、运行真实实验,并提供基于 artifact 的反馈。同样的课程内容也可以在认证网站上获取。
该学院是独立学习材料,基于公开的考试大纲。它与 Anthropic 没有附属关系,不复制真实考试题目,也无法保证通过分数。
░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒
phases/ 下的 20 阶段核心课程可编译成六卷本书系。EPUB 和 PDF 由 CI 从相同的核心课程源码构建,并附在每个 GitHub release 上;下面的链接始终解析到最新 release。卷号是系列索引而非版本号:每本读物都带有日期版本戳,旧版可从其对应 release 下载。
认证课程有意不转换成书籍格式。其 AI 导师状态、可运行实验、交互式图表、诊断测试和限时模拟仍以一等公民的身份保留在 GitHub 和网站上。
书籍是快照;本仓库是活版本。每一章结尾都附有回到课程动画图表、测验和可运行代码的链接。用 python3 scripts/build_book.py 在本地构建(需要 pandoc);详情见 book/README.md。
░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒
其他课程以"恭喜,你学会了 X"收尾。这里的每一课都以一个可重用的工具结尾,你可以安装或粘贴到日常工作流中。
用 python3 scripts/install_skills.py <target> 批量安装所有工具。真实的工具,不是作业。到课程结束时,你拥有 511 个你真正理解的 artifact——因为你亲手构建了它们。
图 002 · 一个完整示例
Phase 14,第 1 课:agent 循环。约 120 行纯 Python,无任何依赖。
code/agent_loop.py build it
def run(query, tools):
history = [user(query)]
for step in range(MAX_STEPS):
msg = llm(history)
if msg.tool_calls:
for call in msg.tool_calls:
result = tools[call.name](**call.args)
history.append(tool_result(call.id, result))
continue
return msg.content
raise StepLimitExceeded
outputs/skill-agent-loop.md ship it
---
name: agent-loop
description: ReAct-style loop for any tool list
phase: 14
lesson: 01
---
Implement a minimal agent loop that...
outputs/prompt-debug-agent.md
You are an agent debugger. Given the trace
of an agent run, identify the step where
the agent went wrong and explain why...
░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒
为接下来的一切准备好你的环境。
课程 06-18 和 28-31 构成了专注的 Model Context Protocol(MCP)路径。其 manifest 顺序为 06、07、08、09、10、11、12、13、14、15、16、18、17、28、29、30、31。用上面针对 host 的 learn-mcp 调用启动。课程 23 是其唯一的可选阶段性作品,同时也需要课程 19 和 20。
课程 22 和 24-27 构成了专注的 Agent Skills 学习路径,从包契约到真实 host 的发布门控。用上面显示的针对 host 的 learn-agent-skills 调用启动;不要从 22 按数字顺序导航到 23。
每个 Phase 14 工作台课程(31-42)在打开完整课程文档之前,会先向 agent 下发一个 mission.md 简报。
深度构建轨道——多课系列,从头构建一个完整的子系统。
░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒
outputs/
├── prompts/ 每个 AI 任务的 prompt 模板
└── skills/ AI 编码 agent 的 SKILL.md 文件
将它们插入 Claude、Cursor、Codex、OpenClaw、Hermes 或任何读取 SKILL.md / AGENTS.md 目录的 agent。真实的工具,不是作业。
两套技能,两个安装器:
学习技能(start-learning、learn、course-guide、learn-mcp、learn-agent-skills、claude-certification、find-your-level 和 check-understanding)位于 skills/ 下,只需一条命令即可安装到支持技能的 host。安装需要 Node.js 和 npx,但不需要仓库克隆或 Python:
npx skills add rohitg00/ai-engineering-from-scratch
skills 会写入安装时选定的主机和作用域,如 .claude/skills/、.cursor/skills/、.codex/skills/ 或其他支持的 skills 文件夹。请确认所选主机能够发现该目标路径。
课程资源。仓库在 phases/**/outputs/ 下打包了 396 个 skills 和 99 个 prompts;通过 scripts/install_skills.py 安装。需要先克隆仓库。支持标签过滤、预演(dry-run)和按 agent 分配布局:
python3 scripts/install_skills.py <target> # 所有 skill,默认 --layout skills(嵌套)
python3 scripts/install_skills.py <target> --layout skills # 与上述相同,显式指定
python3 scripts/install_skills.py <target> --type all # skills + prompts + agents
python3 scripts/install_skills.py <target> --phase 14 # 仅一个阶段
python3 scripts/install_skills.py <target> --tag rag # 按标签过滤
python3 scripts/install_skills.py <target> --layout flat # 平铺文件
python3 scripts/install_skills.py <target> --dry-run # 预览,不写入
python3 scripts/install_skills.py <target> --force # 覆盖已存在的文件
<target> 是你 agent 的 skills 目录(例如:~/.claude/skills/、~/.cursor/skills/、~/.config/openclaw/skills/、.skills/,或你的 agent 所读取的任意路径)。
默认情况下,脚本拒绝覆盖已存在的目标,列出所有冲突路径后以代码 1 退出。使用 --dry-run 预览冲突,或用 --force 强制覆盖。每次非 dry-run 运行会在目标目录写入一个 manifest.json,包含按类型和阶段分组的完整清单。选择你的 agent 所读取的布局:
将 agent 工作台放入你自己的仓库
第 14 阶段 capstone 提供了一个可复用的 Agent Workbench 包(AGENTS.md、schemas、init / verify / handoff 脚本)。用以下命令将其脚手架到任意仓库:
python3 scripts/scaffold_workbench.py path/to/your-repo # 完整包 + seeds
python3 scripts/scaffold_workbench.py path/to/your-repo --minimal # 跳过 docs/
python3 scripts/scaffold_workbench.py path/to/your-repo --dry-run # 仅预览
python3 scripts/scaffold_workbench.py path/to/your-repo --force # 覆盖
你将获得七个工作台界面并完成接线、starter task_board.json,以及一个全新 schema_version: 1 的 agent_state.json。之后:编辑 task、编辑 AGENTS.md、运行 scripts/init_agent.py,将 contract 移交给你的 agent。包的源码位于 phases/14-agent-engineering/42-agent-workbench-capstone/outputs/agent-workbench-pack/。
将整个课程浏览为 JSON
scripts/build_catalog.py 遍历每个阶段、每节课、每个磁盘上的产物,写入仓库根目录的 catalog.json。一个文件,涵盖所有课程真相。
python3 scripts/build_catalog.py # 写入 <repo>/catalog.json
python3 scripts/build_catalog.py --stdout # 输出到 stdout,不触碰仓库
python3 scripts/build_catalog.py --out path/to/file.json
catalog 是从文件系统生成的,而非从 README 生成,因此计数始终与磁盘上实际内容一致。可用于站点构建、下游工具,或验证 README 计数是否发生漂移。Schema 记录在脚本顶部。
GitHub Action(.github/workflows/curriculum.yml)在每次 PR 时重建 catalog.json,若提交的文件已过期则构建失败。编辑任何课程后,请运行 python3 scripts/build_catalog.py 并提交结果,否则 CI 将拒绝该 PR。同一 workflow 以仅警告模式运行 audit_lessons.py(所以已有的偏差不会阻止贡献者)。
烟雾测试每节课的 Python 代码
scripts/lesson_run.py 对每节课 code/ 目录下所有 .py 文件进行字节编译。默认模式仅做语法检查——不执行、不需要 API key、不需要重型 ML 依赖。能捕获贡献者最常引入的回归(缩进错误、f-string 损坏、零散编辑)。
python3 scripts/lesson_run.py # 语法检查整个课程
python3 scripts/lesson_run.py --phase 14 # 仅一个阶段
python3 scripts/lesson_run.py --json # JSON 报告输出到 stdout
python3 scripts/lesson_run.py --strict # 任何课程失败则退出 1
python3 scripts/lesson_run.py --execute # 实际运行,每节课超时 10 秒
--execute 运行每节课的 code/main.py(或第一个 .py 文件),超时时间为 10 秒。若入口文件以 # requires: pkg1, pkg2 注释列出了非标准库依赖,则该课程会被跳过并标注原因 needs <deps>。该脚本为可选,不接入 CI。
仅限标准库,Python 3.10+。设置 LINK_CHECK_SKIP=domain1,domain2 可覆盖默认跳过列表(twitter.com、x.com、linkedin.com、instagram.com、medium.com——这些域名会主动拦截自动化 HEAD/GET 请求)。
░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒
"当下最热门的新编程语言是英语。" — Andrej Karpathy(推文)
"软件工程正在我们眼前被重塑。" — Boris Cherny,Claude Code 创始人
"模型会越来越好。复利增长的技能是知道要构建什么。" — 行业共识,2026 年
Attention Is All You Need — Vaswani et al., 2017 → Phase 7
Language Models are Few-Shot Learners (GPT-3) → Phase 10
Denoising Diffusion Probabilistic Models → Phase 8
InstructGPT / RLHF → Phase 10
Direct Preference Optimization → Phase 10
Chain-of-Thought Prompting → Phase 11
ReAct: Reasoning + Acting in LLMs → Phase 14
Model Context Protocol — Anthropic → Phase 13
░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒
提交课程前,运行不变性检查:
python3 scripts/audit_lessons.py # 全课程
python3 scripts/audit_lessons.py --phase 14 # 单阶段
python3 scripts/audit_lessons.py --json # CI 友好输出
任何规则失败时退出码非零。规则(L001–L010)验证目录结构、docs/en.md 存在性 + H1、code/ 非空、quiz.json schema(拒绝导致 issue #102 的旧版 q/choices/answer 键),以及课程文档内的相对链接。
░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒
免费,MIT 许可,511 节课。课程完全依靠赞助维持。现金唯一。
覆盖范围(2026-05-14 核实):55,593 月独立访客 · 90,709 页面浏览量 · 7.5K stars · Twitter/X 是第一大引流渠道。
当前赞助商:CodeRabbit · iii
完整价目卡、硬性规则、定价锚点及覆盖数据见:SPONSORS.md。通过 GitHub Sponsors 报名。
░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒
如果本手册对你有帮助,请给仓库点个 star。它维持着这个项目的生命力。
MIT。随意使用。