> Discover all available pages from the documentation index: https://mastra.zisheng.pro/zh-HK/llms.txt # `.listSkills()` 傳回 Agent 可用的所有 Skill 的中繼資料,包括 Agent 層級和 Workspace Skill。 ## 使用範例 ```typescript import { agent } from '../mastra/agents' const skills = await agent.listSkills() for (const skill of skills) { console.log(`${skill.name}: ${skill.description}`) } ``` ## 參數 **options** (`object`): 解析 Skill 的選項。 **options.requestContext** (`RequestContext`): 傳送至動態 Skill 解析器的請求情境。 ## 傳回值 傳回 `Promise`。 每個項目均包含已找到 Skill 的中繼資料: ```typescript interface SkillMetadata { name: string description: string path: string source: { type: string; projectPath: string } references: string[] scripts: string[] assets: string[] license?: string compatibility?: string[] 'user-invocable'?: boolean metadata?: Record } ``` ## 合併行為 同時設定 Agent 層級 Skill 和 Workspace Skill 時,`.listSkills()` 會傳回合併後的集合。如果名稱衝突,Agent 層級 Skill 優先。如果兩者都定義了名為 `code-review` 的 Skill,則只會傳回 Agent 層級版本。 ## 相關內容 - [Agent Skill](https://mastra.zisheng.pro/zh-HK/docs/agents/skills) - [`.getSkill()` 參考](https://mastra.zisheng.pro/zh-HK/reference/agents/getSkill) - [`createSkill()` 參考](https://mastra.zisheng.pro/zh-HK/reference/agents/createSkill)