SuperAPI AI 工具集

create-seed-skill

编程与开发

查看项目

更新于 10-16 02:18

技能介绍

用途

create-seed-skill 用于从零搭建一个“集成型种子技能(integration-type seed skill)”。所谓种子技能,是 SKILL.md + 参考资产(reference assets)+ prompts.jsonl 条目的组合,它们共同教一个智能体“生长”出可运行、可测试的集成代码。

何时使用

资料中明确区分两类技能:

集成技能(使用本技能):用代码生成 + 真实 API 测试来封装一个 SDK 或框架。其评测问题是:“智能体是否写出了调用真实 API 并可通过测试的代码?”示例:ydc-ai-sdk-integration、teams-anthropic-integration。

工具技能(不要使用本技能):CLI 包装类,智能体只运行命令而不写代码;没有测试目录,没有生成文件。示例:youdotcom-cli。

决策点

先问开发者:这是集成技能(智能体生成代码 + 测试)还是工具技能(智能体运行 CLI 命令)?集成 → 继续本工作流;工具 → 停止,本技能不需要。

工作流

Step 1 — 收集信息。一次性(不要逐条)询问以下问题:

  • 技能名称:小写、连字符,例如 my-sdk-integration
  • 封装的包:npm/pip 包的确切名称
  • 语言:TypeScript、Python 或两者
  • Path A(基础):最简单可工作的集成——一个函数、一次 API 调用
  • Path B(扩展):自然延伸——MCP、流式、工具过滤等
  • 必需环境变量:哪些 API key 是必需的(例如 MY_API_KEY、OPENAI_API_KEY)
  • 测试查询:一个具有确定性、多关键词答案的事实性问题

两种语言的规则:为每种语言提供独立资产文件、两条 prompts.jsonl 条目(一条 -typescript、一条 -python)、两个 tests/ 目录(tests/<skill-name>-typescript/ 与 tests/<skill-name>-python/),各含 .gitkeep。单语言规则:一套资产、一条 prompts.jsonl 条目、一个 tests/<skill-name>/ 目录(含 .gitkeep)。

Step 2 — 阅读参考资产。写代码之前先阅读:assets/example-SKILL.md、assets/example-path-a.ts、assets/example-test.spec.ts、assets/example-pyproject.toml、assets/example-test_integration.py。

Step 3 — 创建文件。一次性创建全部文件,技能位于 skills/<skill-name>/。目录布局示例:

skills/<skill-name>/ ├── SKILL.md └── assets/ ├── path-a-<variant>.ts ├── path-b-<variant>.ts ├── integration.spec.ts ├── path_a_<variant>.py ├── path_b_<variant>.py ├── test_integration.py └── pyproject.toml

tests/<skill-name>/.gitkeep

创建 tests 目录的命令:

mkdir -p tests/<skill-name> && touch tests/<skill-name>/.gitkeep

或双语言:

mkdir -p tests/<skill-name>-typescript tests/<skill-name>-python touch tests/<skill-name>-typescript/.gitkeep tests/<skill-name>-python/.gitkeep

Step 4 — 添加 prompts.jsonl 条目。向 data/prompts/prompts.jsonl 追加,每种语言一条。规则:每条恰好 2 轮;第 1 轮显式点明语言(“TypeScript”或“Python”);只描述结果,不提及类名、方法名或配置键;第 1 轮为基础集成 + 测试,第 2 轮为扩展 + 更新测试;metadata.cwd 必须与 Step 3 创建的 tests/ 目录一致;metadata.language 必须为 typescript 或 python。

单语言模板(TypeScript)示例: {"id":"<skill-name>","input":["Using the <skill-name> skill, create a working TypeScript <description of Path A> integration. Write flat minimal code with no comments or TSDoc. Write integration tests that call real APIs and assert on meaningful response content. Save everything to the tests/<skill-name> directory.","Extend the integration with <description of Path B>. Write flat minimal code with no comments or TSDoc. Update the integration tests to verify the extended integration also works with a live query."],"metadata":{"cwd":"tests/<skill-name>","language":"typescript"}}

双语言时追加两条,id 分别为 <skill-name>-typescript 与 <skill-name>-python,cwd 指向对应目录。

Step 5 — 创建软链接: ln -s ../../skills/<skill-name> .claude/skills/<skill-name>

Step 6 — 校验: bunx @plaited/development-skills validate-skill skills/<skill-name>

好种子技能的标准

SKILL.md 必须包含:正确的 frontmatter(name、description、license、compatibility、allowed-tools、assets 列表、metadata);决策点(Path A vs Path B 简述,一个明确问题);安装说明(确切包名与安装命令);完整代码模板(可运行示例,非伪代码);若集成会抓取不受信任的网页内容,需包含提示注入警告(W011);Generate Integration Tests 小节,含指向所有资产文件的 markdown 链接与明确规则。

生成集成测试规则:无 mock,调用真实 API;断言确定性查询的关键词,而不只是 length > 0;在测试开始时(测试函数内,而非模块作用域)校验必需环境变量;TypeScript 用 bun:test、测试内动态导入、timeout: 60_000;Python 用 pytest、在测试函数内导入,并始终包含带 pytest([dependency-groups] dev)的 pyproject.toml;运行方式:bun test / uv run pytest。

参考资产必须:可编译、可运行,无伪代码与占位符;在 agent instructions/system_prompt 中包含安全说明;在集成文件(作为 main 示例)与测试断言中使用 Step 1 的测试查询;断言关键词;TypeScript 导出可调用函数并在测试中用动态 import(),Python 定义 main(query: str) -> str 并在测试函数内延迟导入。

如何选择测试查询

真正目标:验证集成代码运行了,而不是验证 LLM 知道答案。多数 LLM 能凭记忆回答事实问题而无需调用任何工具,因此关键在于测试仅在代码路径真正执行时才通过。实践指引:查询前缀加入显式工具使用指令;使用具有稳定、多关键词答案的查询。好例子:“Search the web for the three branches of the US government” → 断言 legislative、executive、judicial;“Use web search to find what programming language TypeScript compiles to” → 断言 javascript;“Search the web for the four classical elements” → 断言 earth、water、fire、air。避免:纯事实查询、每日变化的问题(如“latest AI news”)、无实质可断言内容的问题(如“Say hello in one sentence.”)。

Eval Grader 说明

grader(scripts/grader.ts)从 metadata.cwd 运行:TypeScript 运行 bun test 并扫描 **/*.{ts,js};Python 运行 uv run pytest(测试目录需有 pyproject.toml);将测试输出与生成文件内容发送给 Haiku 做 LLM-as-judge 打分(0.0–1.0);通过阈值约 0.65,目标 0.95。常见失败模式:缺少 pytest(必须在 dev 依赖中包含 pyproject.toml);模块作用域环境变量检查(Python 导入应放在测试函数内);指示性过强的 prompts(应描述结果而非实现步骤);工具内省(不要指示智能体断言 SDK 事件流或工具调用对象);开放式测试查询。

示例:新增一个 Python 集成技能

给定:用 httpx 库封装 You.com 搜索,仅 Python。需创建:skills/ydc-httpx-integration/SKILL.md、assets/path_a_basic.py、assets/test_integration.py、assets/pyproject.toml,以及 tests/ydc-httpx-integration/.gitkeep。创建命令:

mkdir -p tests/ydc-httpx-integration && touch tests/ydc-httpx-integration/.gitkeep

对应 prompts.jsonl 条目: {"id":"ydc-httpx-integration","input":["Using the ydc-httpx-integration skill, create a working Python application that calls the You.com search API directly with httpx and returns search results. Write integration tests that call the real API and verify the response contains expected keywords. Save everything to the tests/ydc-httpx-integration directory.","Extend the integration to also support content extraction from URLs. Update the integration tests to verify both search and content extraction work with live queries."],"metadata":{"cwd":"tests/ydc-httpx-integration","language":"python"}}

限制

资料中未提供该技能的定价、收费、支持的平台范围或运行环境要求等信息。