agentleFS
kafnosakekafnosake/Ensoul/skills/add-tool/SKILL.md

add-tool

Skill1 starsChanged 43 days agoMITView on GitHub

给这个软件增加一个新工具(助手能调用的新能力),或者改现有工具的行为时看这份

21 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use add-provider and release.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • PydanticSkill

    add-provider

    Add a new inference provider to genai-prices, including provider data, matching, usage extractors, update automation, cassettes, agentic checks, generated artifacts, and Python/JavaScript/Go parity tests. Use for a new provider, not a new model on an existing provider.

    Also in 3 projects that use this

  • MicrosoftSkill

    release

    Use ONLY when the user explicitly asks to cut/publish a Huabu desktop release or tag a version. Performs an outward action — bumps the version in apps/desktop/package.json, commits + annotated-tags vX.Y.Z, and pushes the branch + tag. That tag push auto-builds the macOS/Windows installers and publishes a GitHub Release. Provides `status`, `bump`, `tag-push`, and a one-command `run` (bump → tag-push).

    Also in 4 projects that use this

The file

Files
SKILL.md

给这个软件加一个工具

工具走的是标准 function calling:模型看到工具清单,自己决定调用,主进程执行后把结果回灌。 加一个工具只动 src/main/agent.ts 一个文件、三处地方。

一、声明:toolsFor(level)

spec('工具名', '这个工具干什么、什么时候该用。模型只看这段字,写清楚。',
  { 参数名: { type: 'string' } }, ['必填的参数名']),

三档权限要放对:

档谁能用能干什么
read所有面板看目录、读文件、搜内容、读日志
write能改文件的面板上面 + 写文件
full只有工作区那个对话框上面 + 跑命令、构建、起停进程

危险操作(动进程、跑命令、删东西)只能放 full。

二、实现:runTool() 的 switch

加一个 case,返回值就是模型看到的东西,纯文本。

  • 失败不要 throw,把错误当文本返回。 抛出去会打断整个 agent 循环, 模型失去"看到错误 → 自己修"的机会,等于把一次可恢复的失败变成死局。
  • 长输出自己截尾,用现成的 tailOut() —— 报错都在末尾,前面的都是噪声。
  • 要读文件、写文件,一律走 fsapi 的 readText / writeText:它把路径夹在工作区里, 自己用 fs.readFileSync 就绕过了这层保护。

三、显示名:describeTool()

加一句中文,界面上这次调用就显示成那一行(不加就显示英文工具名)。

四、收尾

  1. build_project —— 编译过不去就别往下走
  2. restart_project —— 不重启,界面上看不到新工具

容易踩的坑

  • 忘改 describeTool 不会报错,只是界面难看。
  • 工具名不要和插件注册的重名:重名时以核心的为准,插件那个会被忽略(不报错,最难查)。
  • spec 的第四个参数是必填参数名单,写错了模型会漏传参数,然后在实现里拿到 undefined。 所以在实现里对每个参数都要兜一下默认值。

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.