Register and share your invite link to earn from video plays and referrals.

cv usk
@cv_usk
AI / Software Research Notes AI Agent, LLMOps, MLOps, Software Architecture 投稿は個人の意見です。
Joined May 2026
287 Following    476 Followers
# Claude Agent SDKの便利だけど知られていない機能 🌍 エージェントの拡張機能をチーム間で共有したいと思ったことはありませんか?プラグインで実現できます! Claude Agent SDKのプラグインは、スキル・エージェント・フック・MCPサーバーをパッケージ化して配布・再利用できる仕組みです。 📌 タイトル:SDKのプラグイン 🔗 URL: 🧩 概要 プラグインは、Claude Codeの拡張機能(スキル、エージェント、フック、MCPサーバー設定)をまとめた配布可能なパッケージです。ローカルディレクトリのパスを `plugins` オプションに渡すだけで読み込まれます。プラグイン内のスキルは自動的に `プラグイン名:スキル名` の名前空間で管理され、複数プラグインの名前衝突を防ぎます。`SystemMessage`(`init` サブタイプ)でロードされたプラグインとスキル一覧が確認できます。 🛠 使い方 ```python # Python - プラグインの読み込みと確認 from claude_agent_sdk import query, ClaudeAgentOptions, SystemMessage async for message in query( prompt="利用可能なカスタムコマンドを教えてください", options=ClaudeAgentOptions( plugins=[ {"type": "local", "path": "./my-plugin"}, {"type": "local", "path": "/absolute/path/to/shared-plugin"}, ], max_turns=3, ), ): if isinstance(message, SystemMessage) and message.subtype == "init": print(f"プラグイン: {") print(f"スキル: {") # スキルの直接呼び出し async for message in query( prompt="/my-plugin:greet", # 名前空間付きで呼び出し options=ClaudeAgentOptions(plugins=[{"type": "local", "path": "./my-plugin"}]), ): pass ``` ```typescript // TypeScript - 複数プラグインの読み込み import { query } from "@anthropic-ai/claude-agent-sdk"; import * as os from "node:os"; import * as path from "node:path"; for await (const message of query({ prompt: "What custom commands do you have?", options: { plugins: [ { type: "local", path: "./my-plugin" }, // SDK はチルダ(~)を展開しないため絶対パスを渡す { type: "local", path: path.join(os.homedir(), ".claude", "custom-plugins", "shared-plugin") }, ], maxTurns: 3, } })) { if (message.type === "system" && message.subtype === "init") { console.log("Plugins:", message.plugins); console.log("Skills:", message.skills); } } ``` 🏗 本番システムへの組み込み方 ・プロジェクトリポジトリ内にプラグインを配置し、チーム全体で一貫した拡張機能を使用します ・`skills/`ディレクトリに `SKILL.md` ファイルを配置してカスタムスキルを定義します ・`.claude-plugin/plugin.json` マニフェストは任意で、省略するとディレクトリ構造から自動検出されます ・CLIでインストールしたプラグインは `~/.claude/plugins/` に配置され、SDKからもパス指定で利用可能です 💡 ユースケース 🔧 チーム共通のコードレビュースキルやデプロイワークフローをプラグインとして配布する 🏗 プロジェクト固有の規約チェックやテンプレート生成をスキルとして定義する 🔌 外部APIとの連携をMCPサーバー設定としてプラグインに含めて再利用する ⚠️ 注意点 ・プラグインの `type` は現在 `"local"` のみサポートされており、リモートリポジトリからは事前にダウンロードが必要です ・パスはプラグインのルートディレクトリ(`skills/` や `.claude-plugin/` の親)を指定してください ・`commands/` ディレクトリはスキルをフラットな `.md` ファイルとして置く形式で、`skills/` と併せてどちらもサポートされます。新規プラグインには `skills/` を使用してください ✨ 優れた拡張機能は一人で使うのはもったいないです。プラグインでチーム全体の生産性を底上げしましょう! #ClaudeAgentSDK# #AIAgent#
Show more