メインコンテンツへスキップ
このガイドでは、Droidのプラグイン作成方法を説明します。プラグインは、スキル、コマンド、ツールを共有可能なパッケージにまとめ、プロジェクトやチーム間で利用できるものです。

クイックスタート

1

Create the plugin directory

mkdir -p my-plugin/.factory-plugin
2

Create the manifest

Create my-plugin/.factory-plugin/plugin.json:
{
  "name": "my-plugin",
  "description": "A helpful plugin description",
  "version": "1.0.0"
}
3

Add a command

Create my-plugin/commands/hello.md:
---
description: Greet the user with a friendly message
---

Greet the user warmly and ask how you can help them today.
4

Test your plugin

Install from local directory to test:
droid plugin marketplace add ./my-plugin
droid plugin install my-plugin@my-plugin
Then run /hello to test.

プラグインマニフェスト

.factory-plugin/plugin.jsonにあるマニフェストファイルは、プラグインのメタデータを定義します:
{
  "name": "my-plugin",
  "description": "What this plugin does",
  "version": "1.0.0",
  "author": {
    "name": "Your Name",
    "email": "you@example.com"
  },
  "homepage": "https://github.com/you/my-plugin",
  "repository": "https://github.com/you/my-plugin",
  "license": "MIT"
}

必須フィールド

フィールド説明
name一意の識別子。小文字、数字、ハイフンを使用。
descriptionプラグインマネージャーに表示される短い説明。
versionセマンティックバージョン(例:1.0.0)。

オプションフィールド

フィールド説明
authornameと任意のemailを含むオブジェクト。
homepageプラグインドキュメントのURL。
repositoryGitリポジトリのURL。
licenseライセンス識別子(例:MITApache-2.0)。

スキルの追加

スキルはモデルによって呼び出される機能です。skills/ディレクトリに作成してください:
my-plugin/
└── skills/
    └── code-review/
        └── SKILL.md

スキル形式

---
name: code-review
description: Reviews code for best practices and potential issues. Use when reviewing code, checking PRs, or analyzing code quality.
---

When reviewing code, check for:
1. Code organization and structure
2. Error handling
3. Security concerns
4. Test coverage

Provide specific, actionable feedback with line references.

スキルのフロントマター

フィールド必須説明
nameはいスキルの一意識別子
descriptionはいこのスキルをいつ使用するか(モデルがいつ呼び出すかを判断するのに役立つ)
disable-model-invocationいいえユーザー専用にするにはtrueを設定
allowed-toolsいいえスキルが使用できるツールを制限

コマンドの追加

コマンドはスラッシュ記法でユーザーによって呼び出されます。commands/ディレクトリに作成してください:
my-plugin/
└── commands/
    └── review-pr.md

コマンド形式

---
description: Review the current PR for issues
disable-model-invocation: true
---

# Review PR Command

Review the current pull request. Check for:
1. Code correctness and logic errors
2. Test coverage
3. Documentation updates
4. Breaking changes

If the user provides arguments: $ARGUMENTS

Use them to focus on specific areas of the review.
commands/review-pr.mdにあるコマンドは/review-prになります。

コマンド引数

ユーザー入力を取得するには$ARGUMENTSを使用します:
---
description: Greet a user by name
---

Greet the user named "$ARGUMENTS" warmly.
使用方法:/greet Alice

エージェントの追加

droids/ディレクトリに特殊化されたサブエージェントを定義します:
my-plugin/
└── droids/
    └── security-reviewer.md

エージェント形式

---
name: security-reviewer
description: Reviews code for security vulnerabilities
model: inherit
tools: ["Read", "Grep", "Glob"]
---

You are a security expert. Review the code for:

1. Injection vulnerabilities (SQL, command, XSS)
2. Authentication/authorization issues
3. Sensitive data exposure
4. Insecure cryptography
5. Security misconfigurations

Report findings with severity levels and remediation steps.
完全なエージェント設定オプションについてはCustom Droidsを参照してください。

フックの追加

hooks/hooks.jsonでライフサイクルフックを定義します:
my-plugin/
└── hooks/
    ├── hooks.json
    └── format-check.sh

フック設定

{
  "PostToolUse": [
    {
      "matcher": "Write|Edit",
      "hooks": [
        {
          "type": "command",
          "command": "${DROID_PLUGIN_ROOT}/hooks/format-check.sh",
          "timeout": 30
        }
      ]
    }
  ]
}

環境変数

変数説明
${DROID_PLUGIN_ROOT}プラグインディレクトリへの絶対パス
${CLAUDE_PLUGIN_ROOT}${DROID_PLUGIN_ROOT}のエイリアス(Claude Code互換性)
Plugin hooks cannot be imported via /hooks import. They only function within installed plugins where the plugin root path can be resolved.

MCPサーバーの追加

プラグインルートのmcp.jsonでMCPサーバーを設定します:
{
  "mcpServers": {
    "my-api": {
      "command": "npx",
      "args": ["-y", "@example/mcp-server"],
      "env": {
        "API_KEY": "${MY_API_KEY}"
      }
    }
  }
}

プラグインのテスト

ローカルテスト

開発中のテストには、ローカルディレクトリからインストールします:
droid plugin marketplace add ./my-plugin
droid plugin install my-plugin@my-plugin

検証チェックリスト

プラグインを共有する前に:
  • マニフェストに必須フィールドがある(namedescriptionversion
  • すべてのスキルのフロントマターにnamedescriptionがある
  • コマンドが引数ありでもなしでも動作する
  • ハードコードされたパスや機械固有の設定がない
  • READMEですべてのコマンドと機能が文書化されている

プラグインの配布

マーケットプレースの作成

マーケットプレースは、利用可能なプラグインをリストするマニフェストを含むGitリポジトリです:
my-marketplace/
├── .factory-plugin/
│   └── marketplace.json
├── plugin-one/
│   └── .factory-plugin/
│       └── plugin.json
└── plugin-two/
    └── .factory-plugin/
        └── plugin.json

マーケットプレースマニフェスト

.factory-plugin/marketplace.jsonを作成します:
{
  "name": "my-marketplace",
  "description": "A collection of useful plugins",
  "owner": {
    "name": "Your Name"
  },
  "plugins": [
    {
      "name": "plugin-one",
      "description": "Description of plugin one",
      "source": "./plugin-one"
    },
    {
      "name": "plugin-two",
      "description": "Description of plugin two",
      "source": "./plugin-two"
    }
  ]
}
フィールド必須説明
nameはいマーケットプレース識別子
descriptionいいえマーケットプレースを閲覧時に表示
ownerいいえ連絡先情報
plugins[].nameはいプラグイン識別子
plugins[].sourceはいプラグインディレクトリへの相対パス
plugins[].descriptionいいえプラグインブラウザに表示
plugins[].categoryいいえプラグインを整理するため

バージョン管理

ドキュメント目的でプラグインマニフェストではセマンティックバージョニングを使用します:
  • メジャー(1.0.0 → 2.0.0):破壊的変更
  • マイナー(1.0.0 → 1.1.0):新機能、後方互換性あり
  • パッチ(1.0.0 → 1.0.1):バグ修正
Droid tracks plugin versions by Git commit hash, not semantic version. When users update a plugin, they always get the latest commit from the marketplace. Version pinning is not currently supported.

Claude Code互換性

DroidはClaude Codeプラグインと完全に互換性があります。Claude Codeプラグインを見つけた場合、直接インストールでき、Droidが自動的に形式を変換します。

ベストプラクティス

Design plugins around a single purpose or workflow. Prefer several small plugins over one monolithic plugin that does everything.
Include a README with:
  • What the plugin does
  • Installation instructions
  • All available commands and their usage
  • Configuration options
  • Examples
Follow semver conventions so users know when updates might break their workflows.
Ensure your plugin works on macOS, Linux, and Windows if applicable. Use portable shell commands and avoid platform-specific paths.
Scripts should fail gracefully without blocking the user. Log errors but don’t crash sessions.
Don’t collect telemetry or send data without explicit consent. Document any network requests your plugin makes.

例:完全なプラグイン

コードレビュープラグインの完全な例です:
code-review-plugin/
├── .factory-plugin/
│   └── plugin.json
├── commands/
│   └── review.md
├── skills/
│   └── review-patterns/
│       └── SKILL.md
├── droids/
│   └── reviewer.md
└── README.md
.factory-plugin/plugin.json:
{
  "name": "code-review",
  "description": "Automated code review with multiple specialized reviewers",
  "version": "1.0.0",
  "author": { "name": "Your Team" }
}
commands/review.md:
---
description: Run comprehensive code review on staged changes
---

Review the staged git changes using the review-patterns skill.
Focus on: $ARGUMENTS

If no focus area specified, perform a general review.
skills/review-patterns/SKILL.md:
---
name: review-patterns
description: Use when reviewing code to check for common issues and best practices.
---

Check code for:
- Logic errors and edge cases
- Error handling completeness
- Security vulnerabilities
- Performance concerns
- Test coverage gaps
droids/reviewer.md:
---
name: reviewer
description: Specialized code reviewer subagent
model: inherit
tools: read-only
---

You are a senior code reviewer. Analyze the provided code and report:

Summary: <one-line assessment>
Issues:
- <severity> <description>
Suggestions:
- <improvement>

次のステップ