Kiro Agent的Skills详解
2026/5/7 9:55:45 网站建设 项目流程

Skills的概念

Skills是一种轻量级的、标准化的AI Agent扩展包,定义具体的领域知识和流程以扩展AI Agent的功能。

在定义和配置AI Agent时,可以使用Skills以一种标准化的方式扩展AI Agent。Skills可以为AI Agent提供真正执行具体任务所需的过程知识和context,AI Agent可以根据需要随时加载Skills,从而拥有相关的领域知识、可稳定重复的工作流程等。

Agent Skills是一个标准,最早由Anthropic提出,用以为AI Agent定义Skills。符合该标准的Skills,可以方便地被迁移和分享到任何AI Agent中。

Skills的定义

事实上,一个Skill就是一个目录,其中包含一个名为SKILL.md的文件。该文件包含必要的元数据,如name, description等,以及一些具体instructions,以指导AI Agent实现具体的任务。当然,一个Skill还可以包含脚本文件、引用其他材料、模板和资源等。一个典型的Skill目录结构如下:

my-skill/ ├── SKILL.md # Required: metadata + instructions ├── scripts/ # Optional: executable code ├── references/ # Optional: documentation ├── assets/ # Optional: templates, resources └── ... # Any additional files or directories

SKILL.md示例如下:

--- name: rollp description: "Roll dice using standard notation (e.g., d6, 2d20, 3d8). Defaults to 1d6 if unspecified." license: MIT metadata: author: taiyangdao version: "1.0.0" --- # Rollp Skill A dice rolling skill. Supports standard dice notation. ## Usage Roll one or more dice using `NdS` notation where `N` is the number of dice and `S` is the number of sides. | Input | Meaning | |-------|---------| | `d6` | Roll one 6-sided die | | `2d20` | Roll two 20-sided dice | | `3d8` | Roll three 8-sided dice | If no notation is provided, defaults to `1d6`. ## Implementation See [roll.py](scripts/roll.py).

Skill的namedescription非常重要,应该准确表达该Skill的能力,这些信息在Kiro会话中被初始加载。

SKILL.md注重任务流程的定义,具体内容抽离为若干个references等材料,Tools执行具体的任务时又可以调用scripts。

根据作用范围,Skills也分为Global和Workspace。Global的Skills位于~/.kiro/skills/,通常用户个人常用,也对各个Workspace可见。Workspace的Skills位于项目所在目录下的.kiro/skills/,通常项目相关,仅对所在Workspace可见。

Skills的使用

1. 关联Agent与Skills

Kiro的三个内置Agents,默认会加载所有的Skills。

用户的定制Agents则需要resources明确给出要包含的Skills,示例如下:

{ "name": "my-agent", "resources": [ "skill://.kiro/skills/*/SKILL.md", "skill://~/.kiro/skills/*/SKILL.md" ] }

2. Agent执行Skills

Agent启动时只自动加载Skills的name和description,与用户的交互过程中,会根据用户的请求找到description与之匹配的Skill,然后激活匹配到的Skill,加载对应的SKILL.md,在后续执行SKILL.md中的指令时才会根据需要实时加载必要的脚本等文件。

当然,用户也可以通过@name的方式直接在Kiro Chat会话中明确执行一个Skill。

Agent Skills Overview - Agent Skills

Specification - Agent Skills

Anthropic skills

The Agent Skills Directory

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询