自定义技能
自定义技能
Fern Docs 站点可以提供您自己的 Agent 技能,供用户通过 skills CLI 发现和安装。您还可以在文档 UI 中添加”安装技能”按钮,点击后会打开一个包含安装命令和技能列表的弹窗。
组织文件结构
将技能放置在 fern/ 目录下的 .well-known/agent-skills/(当前 v0.2.0 规范)或 .well-known/skills/(旧版 v0.1.0 布局)中。两者都受支持且可以共存。每个技能是一个子目录,至少包含一个 SKILL.md,可选的支持文件放在旁边。
编写每个 SKILL.md
每个 SKILL.md 需要包含 name 和 description 的 YAML 前置数据,遵循 Agent Skills 规范:
添加发现清单
技能目录根目录下的 index.json 是必需的。它列出所有技能,以便客户端可以通过单个请求发现它们,通过 url 和 digest 引用每个技能:
旧版 v0.1.0 清单为每个技能列出 files 数组,而非 url 和 digest。
发布
Fern 在 fern generate --docs 期间上传文件包并按原样提供文件 — 无需 docs.yml 配置。fern check 在上传时验证文件包,标记以下问题:
- 缺失或无法解析的
index.json SKILL.md的name不是 kebab-case、超过 64 个字符,或与其父目录名称不匹配SKILL.md缺少description或description为空(最多 1,024 个字符)
发布后,技能可通过以下地址访问:
https://your-docs-domain.com/.well-known/agent-skills/index.json(发现清单)https://your-docs-domain.com/.well-known/agent-skills/<skill-name>/SKILL.md(单个技能)https://your-docs-domain.com/.well-known/skills/index.json(旧版 v0.1.0 清单)
对于具有基础路径(如 /docs)的站点,端点位于该基础路径下(例如 https://example.com/docs/.well-known/agent-skills/index.json)。
配置安装技能按钮
通过在页面操作栏中添加”安装技能”按钮来在文档 UI 中展示您的技能。在 docs.yml 中设置 page-actions.options.skills,按钮会打开一个弹窗,包含可复制的安装命令、可用技能列表以及可选的源仓库链接。
安装技能属性
在 docs.yml 的 page-actions.options.skills 下配置安装技能按钮。
page-actions.options.skills
Enables the “Install skills” page action and configures the modal it opens. Omit to hide it.
page-actions.options.skills.title
Overrides the modal title.
page-actions.options.skills.description
Overrides the modal description.
page-actions.options.skills.learn-more-url
URL for a “Learn more” link shown alongside the description.
page-actions.options.skills.repository
Source repository URL displayed as a “View source” button in the modal.
page-actions.options.skills.install-command
Command(s) shown as a copyable block in the modal. A single string is shown as-is; an array is joined with newlines for multi-step installs. Defaults to npx skills add https://<your-docs-domain> when omitted.
page-actions.options.skills.skills
List of skills displayed in the modal. Each entry has a name (required), description (optional), and url (optional link to the skill source). When the site serves a /.well-known/agent-skills/index.json or /.well-known/skills/index.json manifest, the manifest replaces this list.