pi-from-scratch

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

1,103
Stars
79
Forks
TypeScript
Language
8/23/2026
Added
View on GitHubDownload ZIP

⚠️ Third-Party Software Notice

This skill is third-party open-source software developed and hosted independently on GitHub. SkillTip is an informational directory and does not control or maintain the underlying repository. Any security checks displayed are automated and limited in scope. Review the source code before installing.

Read the Terms of Service

Installation

Add to your Claude Code skills directory:

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

Getting Started

Guides for using skills like pi-from-scratch.

Security Report

Verified

Last scanned: —

{
  "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

Frequently Asked Questions

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.

Comments (0)

No comments yet. Be the first to share your thoughts!

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 Agentsai-agentsanthropicclaude-code
View details
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI Agentsai-agentsbrainstorming
View details

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 Agentsai-agentsanthropicclaude-code
View details

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 Agentsclaude-codeai-tools
View details

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 Agents
View details

Developers Also Liked

Based on votes and bookmarks from developers who liked this 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 Agentsai-agentsanthropicclaude-code
View details
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI Agentsai-agentsbrainstorming
View details

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 Serversapisai-tools
View details

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 Agentsai-agentsanthropicclaude-code
View details

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 Agentsclaude-codeai-tools
View details