pi-from-scratch

作者 SaladDay

600 行 TypeScript 写成的超级迷你版 pi,让你轻松从 0 写出属于你的 pi-agent

1,103
Stars
79
Forks
TypeScript
语言
2026/8/23
添加时间

⚠️ 第三方软件声明

本 Skill 为第三方开源软件,独立托管于 GitHub。SkillTip 仅为信息目录,不控制或维护底层仓库。所显示的安全检查为自动化且范围有限,安装前请自行审查源码。

阅读服务条款

安装

添加到你的 Claude Code skills 目录:

# Add to your Claude Code skills
git clone https://github.com/SaladDay/pi-from-scratch

快速入门

使用 pi-from-scratch 等 Skills 的指南。

安全报告

已验证

上次扫描:—

{
  "status": "PASSED",
  "issues": []
}

README.md

PI from Scratch

PI from Scratch:从零手撕一个 Coding Agent

从零手写一个能读文件、改代码、执行命令的 TypeScript coding agent。

项目沿着 pi 的数据流拆解,需要什么、我们造什么,所有组件都是符合直觉的。

删除 pi 的工程细节,留下 pi 的核心思想。

放轻松,这是一篇文章,不是一本书,你会很容易看懂。

网站把文章和源码放在一起。阅读推进时,右侧编辑器会逐步补全代码,当你看完的时候,nano-pi 的代码也会全部呈现在编辑器中。

同时设计了一个 Trace 跟踪,可以打断点逐行过代码,希望能帮助大家理解代码执行流。

在线阅读 PI from Scratch

文章保留古法手敲,尽可能没有ai味,希望大家读的开心。

运行 nano-pi

需要 Node.js 22 或更高版本,以及一个 OpenAI 兼容 API。

npm install
export NANOPI_API_KEY=your-api-key
npm run dev

可选环境变量:

  • NANOPI_MODEL:模型名
  • NANOPI_BASE_URL:OpenAI 兼容接口地址,默认 https://api.openai.com/v1

线上 trace 是预先生成的静态数据,浏览网站不会发起模型请求。

本地运行教学网站

cd web
npm install
npm run dev

Thanks

  • 感谢 OpenModel 为本项目提供 API 测试支持。OpenModel 提供稳定可靠的 AI API 和生产级 SLA 保障,一个接口即可调用 50+ 主流模型,并可直接用于 Claude Code、Codex,以及你刚刚亲手做好的 nano-pi 😈。
  • 感谢 Cubence 对本项目的赞助。Cubence 自 2025 年 9 月起提供稳定高效的 API 中转服务,兼容 OpenAI 与 Anthropic 协议,可直接接入 Codex、Claude Code、pi 和 oh-my-pi 等主流编程工具。
  • 感谢 pi-book 带来的启发,为本项目从零实现 nano-pi 提供了不少思路和参考。如果你想在完成 nano-pi 后继续深入理解 pi,这本书很值得读。

Star History

Star History Chart

License

MIT

常见问题

What is pi-from-scratch?

pi-from-scratch is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by SaladDay. 600 行 TypeScript 写成的超级迷你版 pi,让你轻松从 0 写出属于你的 pi-agent. It has 1,103 GitHub stars.

Is pi-from-scratch safe to use?

pi-from-scratch failed SkillsLLM's automated security scan, which flagged one or more high-severity issues. Review the Security Report section carefully before using it.

How do I install pi-from-scratch?

Clone the repository with "git clone https://github.com/SaladDay/pi-from-scratch" and add it to your Claude Code skills directory (see the Installation section above).

What programming language is pi-from-scratch written in?

pi-from-scratch is primarily written in TypeScript. It is open-source under SaladDay on GitHub, so you can review or fork the full source.

Are there alternatives to pi-from-scratch?

Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh pi-from-scratch against similar tools.

评论 (0)

暂无评论,成为第一个分享想法的人!

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情

claude-code

by anthropics

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

120,03119,897Shell
AI 智能体
查看详情

开发者还喜欢

基于喜欢此 Skill 的开发者投票和收藏

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

n8n

by n8n-io

12

Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

201,88160,308TypeScript
MCP 服务器apisai-tools
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情