FOR AI AGENTS
不抓 HTML,走 JSON。
站点所有结构化内容在 build 时落成静态 JSON,挂在 /api/*.json。
任何 agent(Claude Code / Codex / Hermes / OpenClaw / 自己写的)用 HTTP GET 直接拿,CORS 全开,无 token。
另带一个零依赖 CLI npx zhanglu-net。
30 秒上手
CURL
curl -s https://zhanglu.net/api/index.json | jq
curl -s https://zhanglu.net/api/skills.json \
| jq '.items[] | select(.featured) | .name'
curl -s https://zhanglu.net/api/skills/mba.json \
| jq -r .body_md CLI
npx zhanglu-net endpoints
npx zhanglu-net list skills --featured
npx zhanglu-net get skill mba --md
npx zhanglu-net search "品牌判断" --type skill
npx zhanglu-net about --json 端点
所有端点 build 时静态生成,Content-Type 是 application/json,带 Access-Control-Allow-Origin: *。
{ "counts": { "skills": 30 }, "endpoints": { … } } { "count": 3, "items": [{ "slug", "title", "tech": [], "year", … }] } { …list 字段, "body_md": "## 是什么\n…" } { "count": 2, "items": [{ "title", "source", "url", "date", "summary" }] } { "count": 30, "items": [{ "slug", "name", "description", "source", "featured" }] } { …list 字段, "body_md": "本 skill 来源于…" } { "name": "张路", "tagline", "bio", "tags": [], "permalink" } { "links": [{ "label", "url", "handle", "icon" }] } { "items": [{ "type", "slug", "title", "text", "url" }] } CLI
包名 zhanglu,零运行时依赖。
Node 18+ 直接 npx 跑,或 npm i -g zhanglu-net。
命令
list <kind> 列出 skills / projects / articles get <kind> <slug> 读一条 skill / project / article search <keyword> 在所有内容里搜关键词 about 作者简介 + tags social 公开社交链接 endpoints 打印 manifest 通用 flags
--json 输出原始 JSON(agent 默认要的) --md get 时只输出 body_md --featured 只看 featured 项 --source <s> 按 source 过滤(list skills/articles) --status <s> 按 status 过滤(list projects) --type <t> 只搜 skill / project / article --since <date> 按日期过滤(list articles) --limit <N> 最多 N 项 --base <url> 覆盖站点根(默认 https://zhanglu.net) 环境变量
ZHANGLU_BASE_URL 切换 base,本地 dev 用 http://localhost:4321 NO_COLOR=1 关 ANSI 颜色 Claude Code 集成
有个 /zhanglu skill,触发词包括「查张路的 skill」「zhanglu 上的 X」「张路在做什么项目」。Skill 会自动调 npx zhanglu-net。
其他 agent 接入
CODEX / OPENAI FUNCTION CALLING
把端点注册成 tool。每个端点是一次 GET。返回 JSON 直接喂给模型。
HERMES / OPENCLAW
支持 HTTP tool 的 agent 框架都能直接调。把 /api/index.json 加进 system prompt,agent 自己会找下一步。
MCP SERVER
目前没出。如果 Claude Code 之外的 MCP 用户多了,会在 Cloudflare Worker 上包一层 MCP server,复用现有端点。
浏览器端 (JS)
CORS 全开,fetch('https://zhanglu.net/api/skills.json') 直接用,无 preflight。