> Discover all available pages from the documentation index: https://mastra.zisheng.pro/ja/llms.txt # `.getSkill()` Agent に設定された Skill(Agent レベルと Workspace の両方)から、名前を指定して特定の Skill を取得します。 ## 使用例 ```typescript import { agent } from '../mastra/agents' const skill = await agent.getSkill('code-review') if (skill) { console.log(skill.name) // "code-review" console.log(skill.description) // "Use when reviewing code changes." console.log(skill.instructions) // Full markdown instructions } ``` ## パラメータ **skillName** (`string`): 取得する Skill の名前。 **options** (`object`): Skill の解決に使うオプション。 **options.requestContext** (`RequestContext`): 動的な Skill リゾルバーへ渡されるリクエストコンテキスト。 ## 戻り値 `Promise` を返します。 見つかった場合は `Skill` オブジェクトを返し、その名前を持つ Skill が存在しない場合は `null` を返します。 ```typescript interface Skill { name: string description: string instructions: 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 の両方が設定されている場合、`.getSkill()` はマージされた一式を検索します。名前が競合した場合は、Agent レベルの Skill が優先されます。 ## 関連項目 - [Agent Skill](https://mastra.zisheng.pro/ja/docs/agents/skills) - [`.listSkills()` リファレンス](https://mastra.zisheng.pro/ja/reference/agents/listSkills) - [`createSkill()` リファレンス](https://mastra.zisheng.pro/ja/reference/agents/createSkill)