Web Skills Protocol — Agent Skill
When a user asks you to interact with a website, check for published skills first before attempting to scrape HTML, guess at UI elements, or reverse-engineer APIs.
Discovery Workflow
Step 1: Check for skills.txt
Fetch {origin}/skills.txt (e.g., https://bobs-store.com/skills.txt).
- - 200 response → Parse it. Proceed to Step 3.
- 404 response → Go to Step 2.
Step 2: Check for agents.txt (fallback)
Fetch {origin}/agents.txt.
- - 200 response → Parse it. Proceed to Step 3.
- Both 404 → The site does not support WSP. Fall back to normal browsing/scraping.
Step 3: Parse the discovery file
The discovery file is Markdown with this structure:
CODEBLOCK0
Extract:
- 1. Site description (the blockquote) — context for understanding the site
- General notes (prose paragraphs) — auth overview, rate limits, terms
- Skill entries — each
- [Name](url): description line is one skill
Step 4: Match user intent to a skill
Compare the user's request against each skill's description. Pick the best match.
- - If the user's intent clearly matches one skill → fetch that SKILL.md
- If the intent could match multiple skills → fetch all candidates, pick the best fit
- If no skill matches → tell the user what skills ARE available and ask which to use
- Skills under "## Optional" can be skipped if context window is tight
Step 5: Fetch and follow the SKILL.md
Fetch the matched skill's URL (e.g., /skills/search/SKILL.md).
The SKILL.md has two parts:
YAML frontmatter (between --- delimiters):
- -
name — skill identifier - INLINECODE7 — detailed trigger and capability info
- INLINECODE8 — skill version
- INLINECODE9 — authentication method:
none, api-key, bearer, INLINECODE13 - INLINECODE14 — base URL for API calls (if different from site origin)
- INLINECODE15 — rate limit information (object with two optional sub-fields):
-
agent — the publisher's recommended rate limit for AI agents (e.g.,
20/minute). This is the limit you SHOULD respect.
-
api — the actual API endpoint rate limit (e.g.,
100/minute). You MUST NOT exceed this.
Markdown body — the actual instructions. Follow them directly. They contain:
- - API endpoints, parameters, and examples
- Multi-step workflows
- Error handling guidance
- Authentication details
Step 6: Execute
Follow the SKILL.md instructions to complete the user's request. Use the specified base_url, auth method, and endpoints exactly as documented.
Rules
- 1. Always check skills.txt first. Before any HTML scraping or UI automation on a website, check for WSP support. One HTTP request saves minutes of guessing.
- 2. Respect robots.txt. If
robots.txt disallows /skills/ or /agents/, do NOT fetch skill files from those paths.
- 3. Cache within session. Fetch
skills.txt/agents.txt once per site per session. Don't re-fetch on every interaction with the same site.
- 4. Don't over-fetch. Only fetch the SKILL.md files you actually need. Don't download every skill "just in case."
- 5. Auth requires user consent. If a skill requires authentication (
auth is not none), tell the user what credentials are needed and where to get them. Never fabricate or guess credentials.
- 6. Prefer skills over scraping. When a site publishes WSP skills, use them instead of parsing HTML. Skills give you structured API access — faster, more reliable, and what the site owner intended.
- 7. Stay in scope. A skill describes specific operations. Don't extrapolate beyond what the skill documents. If the user wants something the skill doesn't cover, say so.
- 8. Respect rate limits. If the skill specifies a
rate_limit, respect both sub-fields:
-
rate_limit.agent — the publisher's recommended limit for AI agents. SHOULD NOT exceed this.
-
rate_limit.api — the hard API limit. MUST NOT exceed this. If only one sub-field is present, treat it as the effective limit.
Quick Reference
CODEBLOCK1
Example
User says: "Search for wireless headphones under $100 on bobs-store.com"
- 1. Fetch
https://bobs-store.com/skills.txt → 200 OK - Parse skill list → find "Product Search" skill matching "search" intent
- Fetch INLINECODE32
- Read frontmatter:
auth: none, INLINECODE34 - Follow instructions: INLINECODE35
- Return structured results to the user
Web Skills 协议 — 智能体技能
当用户要求你与网站交互时,请先检查是否有已发布的技能,然后再尝试抓取 HTML、猜测 UI 元素或逆向工程 API。
发现工作流
第 1 步:检查 skills.txt
获取 {origin}/skills.txt(例如 https://bobs-store.com/skills.txt)。
- - 200 响应 → 解析它。进入第 3 步。
- 404 响应 → 进入第 2 步。
第 2 步:检查 agents.txt(备用方案)
获取 {origin}/agents.txt。
- - 200 响应 → 解析它。进入第 3 步。
- 两者均为 404 → 该站点不支持 WSP。回退到正常浏览/抓取。
第 3 步:解析发现文件
发现文件是 Markdown 格式,结构如下:
站点名称
站点的简要描述。
通用说明(认证信息、速率限制等)
技能
可选
提取:
- 1. 站点描述(引用块)—— 理解站点的上下文
- 通用说明(散文段落)—— 认证概览、速率限制、条款
- 技能条目—— 每个 - 名称:描述 行对应一个技能
第 4 步:将用户意图匹配到技能
将用户的请求与每个技能的描述进行对比。选择最佳匹配。
- - 如果用户的意图明显匹配一个技能 → 获取该 SKILL.md
- 如果意图可能匹配多个技能 → 获取所有候选,选择最佳匹配
- 如果没有技能匹配 → 告诉用户有哪些可用技能,并询问使用哪个
- 如果上下文窗口紧张,可以跳过 ## 可选 下的技能
第 5 步:获取并遵循 SKILL.md
获取匹配技能的 URL(例如 /skills/search/SKILL.md)。
SKILL.md 包含两个部分:
YAML 前置元数据(在 --- 分隔符之间):
- - name —— 技能标识符
- description —— 详细的触发条件和能力信息
- version —— 技能版本
- auth —— 认证方法:none、api-key、bearer、oauth2
- baseurl —— API 调用的基础 URL(如果与站点源不同)
- ratelimit —— 速率限制信息(包含两个可选子字段的对象):
- agent —— 发布者推荐的 AI 智能体速率限制(例如 20/minute)。这是你
应该遵守的限制。
- api —— 实际 API 端点的速率限制(例如 100/minute)。你
不得超过此限制。
Markdown 正文 —— 实际指令。直接遵循它们。包含:
- - API 端点、参数和示例
- 多步骤工作流
- 错误处理指南
- 认证详情
第 6 步:执行
遵循 SKILL.md 的指令完成用户的请求。严格按照文档使用指定的 base_url、认证方法和端点。
规则
- 1. 始终先检查 skills.txt。 在对网站进行任何 HTML 抓取或 UI 自动化之前,检查 WSP 支持。一次 HTTP 请求可以节省数分钟的猜测时间。
- 2. 遵守 robots.txt。 如果 robots.txt 禁止 /skills/ 或 /agents/,则不要从这些路径获取技能文件。
- 3. 会话内缓存。 每个会话每个站点获取一次 skills.txt/agents.txt。不要在与同一站点的每次交互中重新获取。
- 4. 不要过度获取。 只获取你实际需要的 SKILL.md 文件。不要 以防万一 下载所有技能。
- 5. 认证需要用户同意。 如果技能需要认证(auth 不是 none),告诉用户需要哪些凭据以及在哪里获取。切勿伪造或猜测凭据。
- 6. 优先使用技能而非抓取。 当站点发布 WSP 技能时,使用它们而不是解析 HTML。技能为你提供结构化的 API 访问 —— 更快、更可靠,并且是站点所有者所期望的。
- 7. 保持在范围内。 技能描述特定的操作。不要推断超出技能文档范围的内容。如果用户想要技能未涵盖的内容,请明确说明。
- 8. 遵守速率限制。 如果技能指定了 rate_limit,请遵守两个子字段:
- rate_limit.agent —— 发布者推荐的 AI 智能体限制。
不应超过此限制。
- rate_limit.api —— 硬性 API 限制。
不得超过此限制。如果只存在一个子字段,将其视为有效限制。
快速参考
发现顺序: /skills.txt → /agents.txt → 无 WSP 支持
技能目录: /skills/{名称}/SKILL.md 或 /agents/{名称}/SKILL.md
技能格式: YAML 前置元数据 + Markdown 指令
认证方法: none | api-key | bearer | oauth2
缓存策略: 每个会话每个站点一次
示例
用户说:在 bobs-store.com 上搜索 100 美元以下的无线耳机
- 1. 获取 https://bobs-store.com/skills.txt → 200 OK
- 解析技能列表 → 找到匹配 搜索 意图的 产品搜索 技能
- 获取 /skills/search/SKILL.md
- 读取前置元数据:auth: none,baseurl: https://api.bobs-store.com/v1
- 遵循指令:GET /products?q=wireless+headphones&maxprice=100
- 向用户返回结构化结果