技能最佳实践
- 作者仓库星标 374
- 作者仓库 skills
- 领域
- 文档
- 作者声明的智能体
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 运行环境证据
- 未执行;当前没有隔离运行测试证据
- 作者 / 版本 / 许可证
- @pedronauck · 未声明许可证
- 上下文用量评级
- 低消耗
- 接入复杂程度
- 需简单配置
- 是否需要外部接口密钥
- 不需要
- 兼容的系统
- 未声明(默认跨平台)
- 运行环境要求
- 未检出明确要求
- 检测到的文件与系统行为
-
- 只读
- 允许写入 / 修改
- 命令执行
- 网络行为
- 仅限本地
- 安装命令数
- 无(仅作为资料)
需要注意: 未声明工具权限范围;实际权限由运行环境决定。
定义唯一的`name`:仅限 1-64 个字符、小写字母、数字和单个连字符。起草`description`:最多 1,024 个字符,以第三人称书写,包括负面触发器。执行验证脚本(只读帮助程序):在继续之前运行验证脚本以确保合规性:`python3 <skill-best-practices-dir>/scripts/validate-metadata.py --name "[name]" --description "[description]"`
使用经过验证的`name`创建根目录。初始化以下子目录: `scripts/`:用于微型 CLI 工具和确定性逻辑。 `references/`:适用于扁平(一层深)上下文,如模式或 API 文档。 `assets/`:用于输出模板、JSON 模式或静态文件。
使用`assets/SKILL.template.md`中的模板作为起点。用第三人称命令编写所有指令(例如“提取文本”、“运行构建”)。强制渐进式披露:将主要逻辑控制在 500 行以下。如果过程需要大型模式或复杂的规则集,请将其移至`references/`。
识别“脆弱”任务(正则表达式、复杂解析或重复的样板文件)。概述 `scripts/` 目录的单一用途脚本。确保脚本使用标准输出 (stdout/stderr) 向代理传达成功或失败信息。在`SKILL.md`中,通过代理工作目录中明确的路径引用捆绑的帮助程序(代理将键入调用它们的相同路径),而不是默默依赖于CWD的裸露`scripts/helper.py`片段。
查看`SKILL.md`的“幻觉间隙”(智能体被迫猜测的点)。验证所有文件路径都是相对的并使用正斜杠 (`/`)。验证代理工作目录中每个引用的帮助器路径是否明确,并且是否说明了帮助器的角色(`read-only`、`bootstrap`或`mutating`)。阅读`references/checklist.md`并对照最终输出交叉引用每个清单项目。
# Skill Authoring Procedure
Follow these steps to generate a skill that adheres to the agentskills.io specification and progressive disclosure principles.
## Bundled Path Rule
Resolve bundled paths relative to the directory that contains this `SKILL.md`. When invoking a helper from another working directory, expand `<skill-best-practices-dir>` to that directory first so the command is unambiguous.
## Step 1: Initialize and Validate Metadata
1. Define a unique `name`: 1-64 characters, lowercase, numbers, and single hyphens only.
2. Draft a `description`: Max 1,024 characters, written in the third person, including negative triggers.
3. **Execute Validation Script (read-only helper):** Run the validation script to ensure compliance before proceeding:
`python3 <skill-best-practices-dir>/scripts/validate-metadata.py --name "[name]" --description "[description]"`
4. If the script returns an error, self-correct the metadata based on the `stderr` output and re-run until successful.
## Step 2: Structure the Directory
1. Create the root directory using the validated `name`.
2. Initialize the following subdirectories:
* `scripts/`: For tiny CLI tools and deterministic logic.
* `references/`: For flat (one-level deep) context like schemas or API docs.
* `assets/`: For output templates, JSON schemas, or static files.
3. Ensure no human-centric files (README.md, INSTALLATION.md) are created.
## Step 3: Draft Core Logic (SKILL.md)
1. Use the template in `assets/SKILL.template.md` as the starting point.
2. Write all instructions in the **third-person imperative** (e.g., "Extract the text," "Run the build").
3. **Enforce Progressive Disclosure:**
* Keep the main logic under 500 lines.
* If a procedure requires a large schema or complex rule set, move it to `references/`.
* Command the agent to read the specific file only when needed: *"Read references/api-spec.md to identify the correct endpoint."*
## Step 4: Identify and Bundle Scripts
1. Identify "fragile" tasks (regex, complex parsing, or repetitive boilerplate).
2. Outline a single-purpose script for the `scripts/` directory.
3. Ensure the script uses standard output (stdout/stderr) to communicate success or failure to the agent.
4. In `SKILL.md`, reference bundled helpers by a path that is unambiguous from the agent's working directory (the same path the agent will type to invoke them), rather than bare `scripts/helper.py` snippets that silently depend on CWD.
5. Label each helper as **read-only**, **bootstrap**, or **mutating** so downstream agents know whether the helper only inspects state or changes it.
## Step 5: Final Logic Validation
1. Review the `SKILL.md` for "hallucination gaps" (points where the agent is forced to guess).
2. Verify all file paths are **relative** and use forward slashes (`/`).
3. Verify every referenced helper path is unambiguous from the agent's working directory and that the helper's role (`read-only`, `bootstrap`, or `mutating`) is stated.
4. Read `references/checklist.md` and cross-reference every checklist item against the final output.
## Error Handling
* **Metadata Failure:** If `scripts/validate-metadata.py` fails, identify the specific error (e.g., "STYLE ERROR") and rewrite the field to remove first/second person pronouns.
* **Context Bloat:** If the draft exceeds 500 lines, extract the largest procedural block and move it to a file in `references/`.
按说明文件中的顺序排列。
捆绑路径规则
第 1 步:初始化并验证元数据
第 2 步:构建目录
步骤 3:起草核心逻辑 (SKILL.md)
第 4 步:识别并捆绑脚本
文件/命令 -> <skill-best-practices-dir> · name · description · stderr · scripts/ · references/ · assets/ · assets/SKILL.template.md
内容校验值 -> b8cb20c9deba
当前原文的自动摘译,尚未人工审校。
捆绑路径规则
解析相对于包含此
SKILL.md的目录的捆绑路径。当从另一个工作目录调用助手时,首先将<skill-best-practices-dir>扩展到该目录,以便命令明确。第 1 步:初始化并验证元数据
定义唯一的
name:1-64 个字符、小写字母、数字和单个连字符。起草description:最多 1,024 个字符,以第三人称书写,包括负面触发器。执行验证脚本(只读帮助程序):在继续之前运行验证脚本以确保合规性:python3 <skill-best-practices-dir>/scripts/validate-metadata.py --name "[name]" --description "[description]"