用途:本技能用于在 Kiro 中创建两类包——steering 指导文件与 hooks 钩子。
steering 文件位于 .kiro/steering/*.md,采用 Markdown 加可选 YAML frontmatter。inclusion 模式有三种:always(默认,所有上下文生效)、fileMatch(配合 fileMatchPattern,按 glob 匹配的文件生效)、manual(用户手动触发)。fileMatch 必须提供 fileMatchPattern,且仅支持 glob,不支持正则,只能写单个模式字符串;可用 domain 字段做归类。
Kiro 识别三个保留名的基础文件:product.md(产品背景、功能、用户画像)、tech.md(技术栈与架构模式)、structure.md(目录布局与命名约定),frontmatter 用 foundationalType 标注。
hooks 位于 .kiro/hooks/*.json,结构包含 name、description、version、when、then。事件分两类:文件事件 fileCreated/fileModified/fileDeleted 必须提供 patterns;生命周期事件 agentSpawn、userPromptSubmit、preToolUse、postToolUse、stop 不需要 patterns。动作类型有 askAgent(让代理执行任务)和 runCommand(执行 shell 命令)。
使用方式:按上述格式编写文件放入对应目录。常见错误包括 fileMatch 缺 fileMatchPattern、误用正则、fileMatchPattern 写多模式、生命周期钩子误加 patterns、文件钩子缺少 patterns。建议先建立基础文件,核心规范用 always,特定上下文用 fileMatch,专门流程用 manual;钩子使用精确 glob、写清晰 prompt、保证可重复执行,并避免在高频修改文件上挂钩子。配套 schema 与文档路径见原文,但具体安装命令暂未提供。