← Catalog

@butcool/pi-skill-arguments

Claude Code style skill arguments for Pi: argument-hint in the input line and $ARGUMENTS placeholders.

ExtensionSkill

Install

Install with PiG

pig install npm:@butcool/pi-skill-arguments

Install with Pi

pi install npm:@butcool/pi-skill-arguments
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "extensions": [
    "./src/index.ts"
  ]
}

README

Written by the package's publisher, shown as published in version 1.0.1 (README.md). PiG does not review it.

@butcool/pi-skill-arguments

Claude Code style skill arguments for Pi: argument-hint in the input line and $ARGUMENTS placeholders.

Pi reads disable-model-invocation from a skill frontmatter, but it ignores argument-hint and arguments. This package adds both, following what Claude Code documents for skills.

输入行里的参数提示

从补全列表选中技能命令后,提示出现在命令名后面:

❯ /skill:fix-issue [issue-number] [branch]

提示是编辑器里的普通文本,光标停在提示前面:

操作结果
输入任意字符提示消失,字符落在光标处
Backspace提示整块删除,命令保留
删除命令(ctrl+w、ctrl+u、delete 等)提示跟着命令一起消失,不留孤儿文本
Enter 发送发送前剥离提示,模型看不到提示
在提示之外编辑文本交给用户处理,发送前仍会剥离残留提示

pi-inline-skills 的 $name 内联写法同样生效:

❯ $fix-issue [issue-number] [branch]

补全列表本身只显示纯命令名,提示不会挤占命令描述。

Pi 的编辑器没有占位符(ghost text)能力,所以提示以普通文本插入,用户一开始输入就移除。技能文件在每次选中命令时重新读取,删掉技能或删掉 argument-hint 后立即生效,无需 /reload。

arguments 与占位符

技能正文可以使用 Claude Code 的占位符:

---
name: fix-issue
description: Fix a GitHub issue.
argument-hint: "[issue-number] [branch]"
arguments: [issue, branch]
---

Fix issue $0 (also reachable as $issue) on branch $1.
Raw arguments: $ARGUMENTS
占位符展开为
$ARGUMENTS用户输入的参数字符串原样
$ARGUMENTS[N]、$N0 基位置 N 上的参数
$namearguments 列表里 name 对应位置上的参数

规则与 Claude Code 一致:

  • 索引占位符没有对应参数时保持字面量。
  • 命名占位符没有对应参数时展开为空字符串。
  • 未在 arguments 里声明的名称保持字面量。
  • 参数值按字面插入,值里的 $1 不会二次展开。
  • 传了参数但没有任何占位符接收时,技能内容末尾追加 ARGUMENTS: <参数>。
  • 参数按 shell 风格引号切分:/fix-issue "hello world" second 得到 $0 = hello world、$1 = second。

展开后的技能块与 Pi 自己展开的格式一致,模型看到的结构相同。

安装

pi install npm:@butcool/pi-skill-arguments

边界规则

情况行为
技能正文没有占位符交给 Pi,参数照旧追加在技能块之后
模型自己调用技能不受影响,占位符只在显式 /skill:<name> 调用时替换
扩展通过 pi.sendUserMessage() 发的消息走 Pi 自己的展开
未加载的技能、普通文本原样放行

开发

npm install
npm run typecheck
npm test                                                     # 真实技能、真实补全组件、真实会话
uv run --with pexpect --with pyte tests/terminal.py          # 真实 TUI
npm pack --dry-run

终端测试使用独立的 PI_CODING_AGENT_DIR,避免其他已安装扩展参与按键处理。

发布

推送到 main 即通过 npm trusted publishing(OIDC)发布,仓库不保存 token。版本未变时工作流跳过:

npm version patch --no-git-tag-version
# 更新 CHANGELOG.md
git commit -am "release: v1.0.1"
git push

License

MIT