> ## Documentation Index
> Fetch the complete documentation index at: https://docs.devin.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# スキルの作成

> SKILL.md 形式とフロントマター オプションの完全リファレンス

スキルは、名前付きディレクトリ内の `SKILL.md` ファイルとして定義します。このページでは、効果的なスキルを記述するために必要な情報をすべて説明します。

***

<div id="file-structure">
  ## ファイル構成
</div>

スコープに応じて、スキルを適切なディレクトリに配置します。

```
# プロジェクト固有（gitにコミット済み）
.devin/skills/
└── my-skill/
    └── SKILL.md

# グローバル — 全プロジェクトで利用可能（コミットされない）
# Linux/macOS:
~/.config/devin/skills/
└── my-skill/
    └── SKILL.md

# Windows:
%APPDATA%\devin\skills\
└── my-skill\
    └── SKILL.md
```

ディレクトリ名は スキル の識別子です (`/my-skill` の呼び出しで利用されます) 。`SKILL.md` ファイルには、省略可能な YAML フロントマター と、スキル のプロンプト内容が含まれます。

<Note>
  Windows では、`%APPDATA%` は通常 `C:\Users\<YourUser>\AppData\Roaming` に展開されます。
</Note>

***

<div id="frontmatter-reference">
  ## フロントマター リファレンス
</div>

```yaml theme={null}
---
name: my-skill
description: What this skill does (shown in completions)
argument-hint: "[file] [options]"
model: sonnet
subagent: true
allowed-tools:
  - read
  - grep
  - glob
  - exec
permissions:
  allow:
    - Read(src/**)
  deny:
    - exec
  ask:
    - Write(**)
triggers:
  - user
  - model
---

Your prompt content goes here...
```

<div id="all-frontmatter-fields">
  ### すべてのフロントマター項目
</div>

| フィールド           | 型       | デフォルト           | 説明                                                                                       |
| --------------- | ------- | --------------- | ---------------------------------------------------------------------------------------- |
| `name`          | string  | ディレクトリ名         | スキルの表示名                                                                                  |
| `description`   | string  | なし              | スラッシュコマンドの補完候補に表示されます                                                                    |
| `argument-hint` | string  | なし              | コマンド名の後に表示されるヒント (例: `[filename]`)                                                       |
| `model`         | string  | 現在のモデル          | このスキルの実行時に利用するモデルをオーバーライドします                                                             |
| `subagent`      | boolean | `false`         | インラインではなく、[サブエージェント](/ja/cli/subagents)としてスキルを実行します                                      |
| `agent`         | string  | なし              | 特定の[custom subagent](/ja/cli/subagents#custom-subagents)プロファイルを利用して、スキルをサブエージェントとして実行します |
| `allowed-tools` | list    | すべてのツール         | スキルが利用できるツールを制限します                                                                       |
| `permissions`   | object  | 継承              | このスキルの権限のオーバーライド                                                                         |
| `triggers`      | list    | `[user, model]` | スキルを呼び出す方法                                                                               |

***

<div id="model-override">
  ## モデルのオーバーライド
</div>

`model` フィールドを利用すると、現在のセッションでアクティブなモデルとは別のモデルでスキルを実行できます。単純なタスクにはより高速なモデルを、複雑なタスクにはより高性能なモデルを使い分けたい場合に便利です。

```yaml theme={null}
---
name: quick-fix
description: Fast lint fix using a lightweight model
model: swe
---

Fix the lint errors in the current file.
```

モデル名には、`--model` CLI フラグと同じ値 (例: `opus`、`sonnet`、`swe`、`codex`) を使用します。完全な一覧については、[Models](/ja/cli/models)を参照してください。スキル の完了後、セッションはそれまでアクティブだったモデルに戻ります。

***

<div id="running-skills-as-subagents">
  ## サブエージェントとしてスキルを実行する
</div>

<Warning>
  スキルをサブエージェントとして実行する機能は**実験的**です。`subagent` フィールドと `agent` フィールドは、今後のリリースで変更される可能性があります。
</Warning>

デフォルトでは、スキルのプロンプトは現在の会話に挿入され、エージェントがインラインで処理します。代わりに、スキルを**サブエージェント**として実行することもできます。これにより、独自のコンテキストウィンドウを持つ独立したワーカーが起動します。これは、出力でメインの会話を煩雑にしたくない、集中的で単独で完結するタスクを実行するスキルに便利です。

スキルをサブエージェントとして実行する方法は 2 つあります。

<div id="subagent-true">
  ### `subagent: true`
</div>

`subagent: true` を設定すると、デフォルトの `subagent_general` プロファイルを使用して、スキル をサブエージェントとして実行します。

```yaml theme={null}
---
name: deep-research
description: Thorough codebase research on a topic
subagent: true
model: sonnet
allowed-tools:
  - read
  - grep
  - glob
---

Research the topic the user asked about thoroughly.

Search broadly, follow references, and trace call chains.
Report all findings with specific file paths and line numbers.
```

呼び出されると、このスキルはフォアグラウンドでサブエージェントを起動し、そのスキルのプロンプトをタスクとして実行させます。親エージェントはサブエージェントが完了するまで待機し、その後、結果を読み取って要約します。

<div id="agent-profile">
  ### `agent: <profile>`
</div>

特定の[カスタム サブエージェント プロファイル](/ja/cli/subagents#custom-subagents)を指定してスキルをサブエージェントとして実行するには、`agent` フィールドを利用します。

```yaml theme={null}
---
name: review-pr
description: Review the current PR using the reviewer subagent
agent: reviewer
---

Review the staged changes for correctness, security, and style issues.
```

`agent` の値は、登録済みのサブエージェントプロファイル名と一致している必要があります (`subagent_explore` / `subagent_general` などの組み込みプロファイル、またはユーザー定義のカスタムプロファイル) 。サブエージェントはそのプロファイルのシステムプロンプト、ツールの制限、モデルを継承し、スキル の内容がタスクになります。

<Note>
  `agent` と `subagent` の両方が設定されている場合は、`agent` が優先されます。両方が指定されている場合、スキル の `model` フィールドがサブエージェントプロファイルのモデルを上書きします。
</Note>

<Note>
  サブエージェントとして実行される スキル では、ネストされたサブエージェントは生成されません。無限再帰を防ぐため、スキル がすでにサブエージェント内で実行されている場合は、代わりにインラインで実行されます。
</Note>

<div id="orchestrating-subagents-using-skills">
  ### スキルを利用したサブエージェントのオーケストレーション
</div>

スキルはサブエージェントとして実行できるため、複数のステップにまたがる作業のオーケストレーションに利用できます。まず、それぞれが特定のタスクを担当するサブエージェント用スキルを定義し、次にそれらを呼び出す通常のスキルを作成します。外側のスキルはオーケストレーターとなり、各サブエージェントを呼び出して結果を収集し、次に何をするかを判断します。

たとえば、以下に 2 つのサブエージェント用スキルと、それらを連携させるオーケストレーターを示します。

```markdown theme={null}
---
name: research-changes
description: 最近のコード変更とその影響を調査する
subagent: true
allowed-tools:
  - read
  - grep
  - glob
  - exec
---

このリポジトリの最近の変更を分析する:

1. `git log --oneline -20` を実行して最近のコミットを確認する
2. 重要なコミットごとに、何がなぜ変更されたかを調べる
3. パターン、リスク、または注意が必要な箇所を特定する

具体的なファイルパスとコミット参照を含めて調査結果を報告する。
```

```markdown theme={null}
---
name: validate-tests
description: Run tests and validate coverage for recent changes
subagent: true
allowed-tools:
  - read
  - grep
  - glob
  - exec
---

Validate the test suite for the project:

1. Identify the test framework and run command
2. Run the full test suite
3. Check for any failing tests
4. Review test coverage for recently changed files

Report which tests pass, which fail, and any coverage gaps.
```

```markdown theme={null}
---
name: health-check
description: Full project health check — research changes then validate tests
---

Perform a full health check on this project:

1. First, use the /research-changes skill to understand recent changes
2. Then, use the /validate-tests skill to verify the test suite
3. Finally, synthesize the findings from both into a summary:
   - What changed recently and why
   - Whether tests are passing
   - Any risks or recommended actions
```

`/health-check` を呼び出すと、メインエージェントでオーケストレーターが実行されます。次に `/research-changes` が呼び出され、repo を調査するためのサブエージェントが起動されます。それが完了すると、`/validate-tests` が呼び出され、テストを実行する別のサブエージェントが起動されます。最後に、オーケストレーターが両方の結果を統合して最終サマリーを作成します。

サブエージェントのスキルは、ほかのスキルを呼び出すとき、そのスキルに `subagent: true` が設定されていても、**決して** サブエージェントを利用しません。代わりに、インラインで実行されます。つまり、ネストが際限なく深くなることを心配する必要はありません。オーケストレーションのパターンは常に 1 階層だけです。オーケストレーターがサブエージェントを起動し、それらのサブエージェントがそれ以外のすべてをインラインで実行します。

***

<div id="prompt-content">
  ## プロンプトの内容
</div>

SKILL.md ファイルの本文 (フロントマターの後の部分) は、そのスキルが呼び出されたときに挿入されるプロンプトです。

***

<div id="permissions">
  ## 権限
</div>

スキルごとに、メインの権限設定と同じ構文で独自の権限スコープを定義できます。

```yaml theme={null}
permissions:
  allow:
    - Read(src/**)
    - Exec(npm run test)
  deny:
    - Write(/etc/**)
    - exec
  ask:
    - Write(src/**)
```

**スキル権限の仕組み:**

* `allow` — これらのスコープはスキルの実行中に自動承認されます
* `deny` — これらのスコープはスキルの実行中にブロックされます
* `ask` — これらのスコープでは常にuserに確認を求めます

<Note>
  Skill permissions はセッションの基本権限を置き換えるのではなく、その上に追加されます。スキルは、より上位のレベル (project または組織の設定) で拒否されている権限を付与することはできません。
</Note>

***

<div id="allowed-tools">
  ## 許可するツール
</div>

スキル が利用できるツールを制限します:

```yaml theme={null}
allowed-tools:
  - read
  - grep
  - glob
```

使用可能なツール名: `read`, `edit`, `grep`, `glob`, `exec`

MCP ツールも許可できます:

```yaml theme={null}
allowed-tools:
  - read
  - mcp__github__list_issues
  - mcp__github__create_issue
```

<Warning>
  `allowed-tools` が指定されていない場合、スキルはすべてのツールにアクセスできます。安全性が重視されるスキルでは、必ず必要最小限のツールのみに制限してください。
</Warning>

***

<div id="examples">
  ## 使用例
</div>

<div id="code-review-skill">
  ### コードレビュースキル
</div>

```markdown theme={null}
---
name: review
description: Review staged changes for issues
allowed-tools:
  - read
  - grep
  - glob
  - exec
permissions:
  allow:
    - Exec(git diff)
    - Exec(git log)
---

Run `git diff --staged` and review the changes for quality issues.

Evaluate:
1. **Correctness** — Any logic errors or edge cases?
2. **Security** — Any vulnerabilities introduced?
3. **Performance** — Any obvious inefficiencies?
4. **Style** — Consistent with the codebase?

Provide a summary with specific line references.
```

<div id="component-generator">
  ### コンポーネントジェネレーター
</div>

```markdown theme={null}
---
name: component
description: Generate a React component from a description
argument-hint: "<ComponentName>"
allowed-tools:
  - read
  - edit
  - grep
  - glob
model: sonnet
permissions:
  allow:
    - Write(src/components/**)
---

ユーザーが指定した名前で新しい React コンポーネントを作成します：

1. src/components/ 内の既存コンポーネントでスタイル規約を確認する
2. src/components/<ComponentName>/<ComponentName>.tsx にコンポーネントファイルを作成する
3. src/components/<ComponentName>/index.ts にバレルエクスポートを作成する
4. src/components/<ComponentName>/<ComponentName>.test.tsx に基本テストを追加する
5. 既存コンポーネントで見つけたパターンに従う
```

<div id="deployment-checklist">
  ### デプロイチェックリスト
</div>

```markdown theme={null}
---
name: deploy
description: Run through the deployment checklist
triggers:
  - user
allowed-tools:
  - read
  - exec
  - grep
permissions:
  allow:
    - Exec(npm run)
    - Exec(git)
---

Run through the deployment checklist:

1. Run the test suite: `npm run test`
2. Run the linter: `npm run lint`
3. Check for uncommitted changes: `git status`
4. Verify the build: `npm run build`
5. Show the current branch and last commit

Report the status of each step. If anything fails, stop and explain the issue.
```

<div id="search-expert">
  ### 検索エキスパート
</div>

```markdown theme={null}
---
name: find
description: Find relevant code across the project
argument-hint: "<what to find>"
allowed-tools:
  - read
  - grep
  - glob
triggers:
  - user
  - model
---

Search the codebase thoroughly for what the user asked about.

Use grep for content search and glob for file discovery.
Provide relevant file paths and code snippets.
Explain how the pieces connect.
```

***

<div id="tips">
  ## ヒント
</div>

<CardGroup cols={2}>
  <Card title="プロンプトは焦点を絞る" icon="bullseye">
    スキルは1つのことを確実にこなせるようにしましょう。1つの巨大なスキルを作るのではなく、複数のスキルに分けて作成してください。
  </Card>

  <Card title="使用例を含める" icon="lightbulb">
    プロンプト内で、望ましい出力の例をエージェントに示しましょう。
  </Card>

  <Card title="allowed-tools を利用する" icon="shield">
    利用できるツールを制限すると、スキルの安全性と予測しやすさが向上します。
  </Card>

  <Card title="/skill-name でテストする" icon="play">
    スキルを呼び出して、出力が意図どおりになるまでプロンプトを調整しましょう。
  </Card>
</CardGroup>
