> Discover all available pages from the documentation index: https://mastra.zisheng.pro/ja/llms.txt # `createSkill()` ファイルシステムや Workspace を使わず、Agent の `skills` 設定へ直接渡せるインライン Skill を作成します。 返されるオブジェクトは `Skill` インターフェースを実装し、ファイルシステムから検出された Skill と同じ場所で使用できます。 ## 使用例 ```typescript import { createSkill } from '@mastra/core/skills' const reviewSkill = createSkill({ name: 'code-review', description: 'Use when reviewing code changes.', instructions: ` When reviewing code: 1. Check for correctness 2. Check for style consistency 3. Look for potential bugs `, references: { 'checklist.md': '# Review Checklist\n- No unused imports\n- Error handling present', }, }) ``` ## パラメータ **name** (`string`): 一意の Skill 名。Agent が Skill を有効化するときの識別子として使われます。有効な slug(小文字、ハイフン使用可)である必要があります。 **description** (`string`): システムメッセージで Agent に表示する短い説明。Agent が Skill を使うタイミングを判断するために使います。 **instructions** (`string`): Markdown 形式の完全な Skill instructions。Agent が Skill を有効化すると会話へ読み込まれます。 **references** (`Record`): Agent が skill\_read Tool で読める補足ドキュメント。キーはファイル名、値はファイル内容です。 **license** (`string`): Skill の SPDX ライセンス識別子。 **compatibility** (`unknown`): 互換性要件。Agent Skills 仕様では柔軟に定義でき、文字列配列、オブジェクト、または Tool が想定する任意の構造を指定できます。 **user-invocable** (`boolean`): エンドユーザーがこの Skill を直接呼び出せるかどうか。デフォルトは undefined(Agent が判断)です。 **metadata** (`Record`): Skill に付加する任意のメタデータ。 ## 戻り値 `Skill` インターフェースを実装する `InlineSkill` オブジェクトを返します。 ```typescript interface InlineSkill extends Skill { __inline: true __referenceContents: Record } ``` Skill には `inline/` 形式の仮想パス(例:`inline/code-review`)が割り当てられます。 ## バリデーション `createSkill()` は、ファイルシステム上の Skill と同じ規則で入力を検証します。 - `name` は必須で、有効な slug であること - `description` は必須 - `instructions` は必須で、空でないこと 検証に失敗すると、無効なフィールドの詳細を含む `Error` がスローされます。 ```typescript // Throws: Invalid skill "": name is required createSkill({ name: '', description: 'test', instructions: 'test' }) ``` ## 関連項目 - [Agent Skill](https://mastra.zisheng.pro/ja/docs/agents/skills) - [Workspace Skill](https://mastra.zisheng.pro/ja/docs/workspace/skills) - [`.getSkill()` リファレンス](https://mastra.zisheng.pro/ja/reference/agents/getSkill) - [`.listSkills()` リファレンス](https://mastra.zisheng.pro/ja/reference/agents/listSkills)