pi-extension-authoring
БесплатноБез исполняемых скриптовНе проверенBuild, debug, and maintain Pi extensions safely. Use when editing ~/.pi/agent/extensions, joelclaw/pi/extensions, pi-tools extensions, or any code that uses…
от joelhooks★ 69 звёзд на GitHubОб этом скилле
Pi Extension Authoring
For private addresses, accounts, ports, and host roles, see .brain/resources/operator-network-context.svx in the private dark-wizard repo and the tailnet-topology skill. Replace angle-bracket placeholders with the configured values before running commands.
Use this before changing Pi extension code or debugging Pi startup warnings.
Canonical surfaces
- Repo-local joelclaw extensions:
~/Code/joelhooks/joelclaw/pi/extensions/<name> - Active symlinks:
~/.pi/agent/extensions/<name>→ repo-local source - Package extensions:
~/.pi/agent/git/github.com/<owner>/<repo> - Package config:
~/.pi/agent/settings.json - Pi SDK/docs: global package under
~/.local/share/fnm/node-versions/*/installation/lib/node_modules/@earendil-works/pi-coding-agent/(older installs used@mariozechner/pi-coding-agent)
Rules
Do not keep using captured session-bound objects after session replacement.
ctx.newSession(),ctx.fork(),ctx.switchSession(), andctx.reload()invalidate oldpiandctxobjects.- For replacement commands, move post-switch work into the method's
withSessioncallback and use only the callbackctx. - For reload commands, treat
await ctx.reload(); return;as terminal.
Do not call
pi.sendMessage()from delayedsession_startcallbacks.- A timer, promise, or subprocess can finish after reload/session replacement and throw stale-context errors.
- Start async work without storing
pi/ctx, cache the plain result, then inject throughbefore_agent_startby returning{ message }. - Keep any first-turn wait tiny; use a short
Promise.racebudget if the result may not be ready.
Use
pi.registerTool(), not old APIs.pi.addTool()is gone.- Tool results need cloneable
details. No timers, functions, sockets, or class instances.
Optional dependencies must be lazy.
- No top-level imports for optional packages.
- Use dynamic import or
createRequire()inside guarded functions. - Missing optional dependencies should disable that feature, not crash Pi startup.
One active copy per extension.
- Duplicate extension paths cause double hooks, duplicate messages, and weird cost/trace behavior.
- If a package checkout still contains an old extension directory, make sure its
package.jsonno longer lists it inpi.extensionsbefore ignoring it.
Session-safe hidden message pattern
let cachedMessage: HiddenCustomMessage | null | undefined;
let messagePromise: Promise<HiddenCustomMessage | null> | null = null;
let delivered = false;
pi.on("session_start", (_event, ctx) => {
delivered = false;
cachedMessage = undefined;
const sessionId = ctx.sessionManager?.getSessionId?.() ?? null;
messagePromise = buildMessageWithoutCapturedPi(sessionId).then((message) => {
cachedMessage = message;
return message;
});
});
pi.on("before_agent_start", async (event) => {
const message = await Promise.race([
messagePromise,
new Promise<null>((resolve) => setTimeout(() => resolve(null), 250)),
]);
if (message && !delivered) {
delivered = true;
return {
systemPrompt: event.systemPrompt,
message,
};
}
return { systemPrompt: event.systemPrompt };
});
Validation
Run the cheap gates first:
bun --check path/to/extension/index.ts
PI_OFFLINE=1 pi --help >/tmp/pi-help.out 2>/tmp/pi-help.err
rg -n "Skill conflicts|cannot load optional dependency|stale after session|<extension-name>" /tmp/pi-help.err /tmp/pi-help.out
For package updates:
# Update Pi plus settings-managed packages. Current Pi self-update migrates
# @mariozechner/pi-coding-agent installs to @earendil-works/pi-coding-agent.
pi update
# Keep npm-global tools current. Do not install the unrelated `pi` npm package.
npm install -g @earendil-works/pi-coding-agent@latest pi-mcp-adapter@latest pi-subagents@latest pi-interactive-shell@latest
# If Bun's shadow global is present, either point ~/.bun/bin/pi at ~/.local/bin/pi
# or force the exact current version. Bun may block fresh releases via minimum-release-age.
bun add -g --minimum-release-age=0 @earendil-works/pi-coding-agent@$(pi --version)
which -a pi
pi --version
pi list
npm list -g --depth=0 | rg '@earendil-works/pi-coding-agent|@mariozechner/pi-coding-agent|pi-mcp-adapter|pi-subagents|pi-interactive-shell'
Smoke-test both base Pi and full extension/tool startup with an approved model:
pi -p --no-session --no-tools --no-extensions --no-context-files --model openai-codex/gpt-5.6-sol "Reply with exactly OK."
pi -p --no-session --no-context-files --model openai-codex/gpt-5.6-sol "Reply with exactly OK."
Clean untracked npm lockfiles generated inside git package checkouts when the package does not track them.
If multiple pi binaries exist, verify they resolve to the same version. On retired host, ~/.bun/bin/pi should be a symlink to ~/.local/bin/pi; Bun's global installer
Установить pi-extension-authoring в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл pi-extension-authoring?
Build, debug, and maintain Pi extensions safely. Use when editing ~/.pi/agent/extensions, joelclaw/pi/extensions, pi-tools extensions, or any code that uses the Pi ExtensionAPI, hooks, tools, commands, widgets, session replacement, reload, custom messages, or extension package updates.
Как установить скилл pi-extension-authoring?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл pi-extension-authoring запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic