ClawTank
ドキュメント活用法ブログ今すぐデプロイ
すべての記事
OpenClawカスタムスキルの作成方法:開発者向け完全チュートリアル

OpenClawカスタムスキルの作成方法:開発者向け完全チュートリアル

2026年2月12日|4 分で読める
目次
  • スキルとは?
  • ディレクトリ構造
  • SKILL.md形式
  • フロントマター完全リファレンス
  • 効果的な指示の書き方
  • 実例:天気チェッカー
  • 実例:URL短縮
  • 実例:デイリーダイジェスト
  • スキルのテスト
  • ClawHubへの公開
  • ベストプラクティス
  • よくある落とし穴
  • スキルチェーン
  • ClawTank統合
  • まとめ
  • 参考文献

まだ OpenClaw をインストールしていませんか?

curl -fsSL https://openclaw.ai/install.sh | bash
iwr -useb https://openclaw.ai/install.ps1 | iex
curl -fsSL https://openclaw.ai/install.cmd -o install.cmd && install.cmd && del install.cmd

パソコンへの影響が心配?ClawTank なら60秒でクラウドデプロイ、ファイルへのリスクゼロ。

OpenClawカスタムスキルの作成方法:開発者向け完全チュートリアル

OpenClawにはビルトイン機能が搭載されていますが、本当の力はカスタムスキルにあります。スキルとは、Markdownファイルで定義される自己完結型の機能ユニットです。コンパイル済みコードもビルドシステムも不要 -- OpenClawにスキルが何をするか、どのツールを使えるか、どう振る舞うかを伝えるMarkdownファイルだけです。

スキルとは?

スキルとは、メタデータ(名前、トリガー、バージョン)、LLMへの指示、ツール宣言(シェル、HTTP、ファイルシステム)、期待される動作の例を定義するSKILL.mdファイルです。

メッセージが届くと、OpenClawのゲートウェイが登録済みスキルとマッチングします。マッチが見つかると、スキルの指示とツール宣言がLLMプロンプトに注入され、モデルにタスクを完了するための知識と権限が与えられます。従来のコードを書かずにOpenClawを拡張できます -- LLMが実行エンジン、スキルファイルが設計図です。

ディレクトリ構造

~/.openclaw/
  workspace/
    skills/
      weather-checker/
        SKILL.md
      url-shortener/
        SKILL.md
        config.json
      daily-digest/
        SKILL.md
        templates/
          digest.md

各スキルは~/.openclaw/workspace/skills/の下に独自のディレクトリを持ちます。必須ファイルはSKILL.mdのみです。

SKILL.md形式

スキルファイルにはYAMLフロントマターとMarkdown本文があります。最もシンプルなスキルは以下の通りです:

---
name: hello-world
description: Responds with a greeting
version: 1.0.0
triggers:
  - "say hello"
  - "greet me"
---

# Hello World

When the user asks you to say hello, respond with a friendly greeting
that includes the current date and time.

フロントマター完全リファレンス

---
name: weather-checker
description: Checks current weather for any city using wttr.in
version: 1.0.0
triggers:
  - "weather in {city}"
  - "what's the weather"
  - "forecast for {city}"
author: your-username
license: MIT
tags: [weather, utility, api]
tools:
  - shell
  - http
dependencies: []
config:
  units:
    type: string
    default: metric
    description: Temperature units (metric or imperial)
---

トリガーは正確なフレーズとパラメータ化されたパターンをサポートします。{city}はファジーマッチングによりユーザーのメッセージから値をキャプチャします。ツールはスキルが必要とするシステム機能を宣言します -- スキルがツールを宣言していない場合、LLMは実行中にそのツールにアクセスできません。これはセキュリティ機能です[1]。

効果的な指示の書き方

Markdown本文はLLMプロンプトに直接注入されます。良い指示は信頼性の高いスキルを生み出し、あいまいな指示は予測不可能な動作を生みます。

最も重要な3つの原則:

出力形式を具体的に指定する -- レスポンスがどのように見えるべきか正確にLLMに伝えます。正確なコマンドを指定する -- LLMが正しいシェルコマンドやAPIエンドポイントを知っていると仮定しないでください。エラーを明示的に処理する -- APIコールが失敗したり入力が無効な場合にLLMが何をすべきか伝えます。

実例:天気チェッカー

mkdir -p ~/.openclaw/workspace/skills/weather-checker
---
name: weather-checker
description: Checks current weather conditions for any city worldwide
version: 1.2.0
triggers:
  - "weather in {city}"
  - "what's the weather in {city}"
  - "forecast for {city}"
  - "temperature in {city}"
tools:
  - shell
  - http
config:
  units:
    type: string
    default: metric
tags: [weather, utility]
---

# Weather Checker

You check current weather using the wttr.in API.

## Fetching Data

Run this command:

\```bash
curl -s "wttr.in/{city}?format=j1"
\```

Replace {city} with the user's city. URL-encode spaces as +.

## Parsing the Response

Extract from `current_condition[0]`: `temp_C`, `FeelsLikeC`,
`weatherDesc[0].value`, `humidity`, `windspeedKmph`, `winddir16Point`.

## Response Format

**Weather in {City}:**
- Temperature: {temp} ({feels_like} feels like)
- Conditions: {conditions}
- Humidity: {humidity}%
- Wind: {speed} km/h {direction}

## Error Handling

- curl fails: "The weather service is currently unavailable."
- City not found: "I couldn't find weather data for '{city}'."
- No city given: "Which city would you like the weather for?"

テストします:

あなた専用の AI アシスタントをデプロイ

ClawTank なら OpenClaw を簡単にデプロイ — サーバー・Docker・SSH 不要。14日間無料トライアル付き。

無料トライアルを始める
openclaw skills reload
openclaw skills list
openclaw chat "weather in Berlin"

実例:URL短縮

---
name: url-shortener
description: Shortens URLs using the is.gd API
version: 1.0.0
triggers:
  - "shorten {url}"
  - "short link for {url}"
tools:
  - http
tags: [utility, links]
---

# URL Shortener

Make an HTTP GET request to:

\```
https://is.gd/create.php?format=json&url={url}
\```

Success: return the `shorturl` value.
Error code 1: "That URL appears to be invalid."
Error code 2: "That URL is blocked."

If the URL lacks a protocol, prepend https://.
Do not shorten already-shortened URLs (is.gd, bit.ly, t.co).

実例:デイリーダイジェスト

---
name: daily-digest
description: Generates a daily summary of system status and tasks
version: 2.0.0
triggers:
  - "daily digest"
  - "morning report"
  - "briefing"
tools:
  - shell
  - http
  - filesystem
config:
  city:
    type: string
    default: ""
tags: [productivity, automation]
---

# Daily Digest

Collect and present: system status (uptime, df -h, free -h),
weather if a city is configured (via wttr.in), pending tasks from
~/.openclaw/workspace/tasks.md, and recent agent activity from
journalctl -u openclaw --since "24 hours ago" | tail -20.

If any source fails, note it as "unavailable" -- always produce
a digest. Never fabricate data.

スキルのテスト

# メッセージでテスト
openclaw chat "weather in Paris"

# デバッグモードでトリガーマッチング、LLMプロンプト、ツールコールを表示
OPENCLAW_LOG_LEVEL=debug openclaw chat "weather in Paris"

# 実行せずにトリガーマッチングのみテスト
openclaw skills match "what's the weather like in London"

開発ループは高速です:SKILL.mdを編集し、openclaw skills reloadを実行し、テストし、繰り返します。コンパイルやビルドステップはありません。

ClawHubへの公開

openclaw hub login
openclaw hub validate ~/.openclaw/workspace/skills/weather-checker/
openclaw hub publish ~/.openclaw/workspace/skills/weather-checker/

セマンティックバージョニングに従ってください:タイポ修正はパッチ、新しいトリガーや設定オプションはマイナー、破壊的変更はメジャーです。公開後、誰でもopenclaw skill install weather-checkerでインストールできます。

ベストプラクティス

出力形式を明示的に指定する。 信頼性の低いスキルの最大の原因はあいまいな指示です。「結果を返して」ではなく、正確な形式をLLMに伝えてください。

正確なコマンドを指定する。 正確なシェルコマンドやAPIエンドポイントを提供します:

# 良い例
\```bash
df -h --output=source,size,used,avail,pcent /
\```

# 悪い例
Check the disk usage using an appropriate command.

指示内でエラーを処理する。 すべての外部呼び出しは失敗する可能性があります:

If curl fails, respond: "Service unavailable. Try again later."
Do NOT retry. Do NOT guess or fabricate data.

スキルは焦点を絞る。 1つのスキルに1つの仕事。何でもスキルを焦点を絞ったものに分割します[2]。

ツール権限を制限する。 スキルが実際に必要なツールのみ宣言します。天気チェッカーに必要なのはhttpであり、filesystemではありません。

例を含める。 具体的な入出力の例は、LLMの動作を導く最も効果的な方法の1つです。

よくある落とし穴

LLMの知識に頼りすぎる: 常に具体的なAPIエンドポイントとコマンド構文を提供してください。ビルトインの知識は古い場合があります。

入力バリデーションの欠如: バリデーション指示がないと、LLMがサニタイズされていない入力をシェルコマンドに渡す可能性があります[3]。文字の制限と長さの制限を指定してください。

タイムアウトの無視: ハングを防ぐためにcurl -s --max-time 10を使用してください。

複数モデルでのテスト不足: Claudeで動作するスキルがGPT-4やローカルLLMで異なる動作をする可能性があります。

ツールの利用可能性を仮定する: free -h 2>/dev/null || vm_statのようなフォールバックを含めてください。

スキルチェーン

スキルはマルチステップワークフローのために他のスキルへの依存関係を宣言できます:

dependencies:
  - daily-digest
  - weather-checker

OpenClawは実行時に依存スキルの指示を読み込み、複合的な動作を可能にします。

ClawTank統合

ClawTankのマネージドホスティングを使用する場合、カスタムSKILL.mdファイルはダッシュボードからアップロードできます。形式はセルフホスティングのスキルと同じです。

まとめ

カスタムスキルはOpenClawの主要な拡張メカニズムです。プロセスはシンプルです:ディレクトリを作成し、フロントマターと指示を含むSKILL.mdを書き、openclaw chatでテストし、反復します。スキルの品質はほぼ完全に指示の品質に依存します。明確で具体的な、例が豊富な指示が信頼性の高いスキルを生みます。SKILL.mdを緩い説明ではなく、正確な仕様として扱ってください。

参考文献

  1. OpenClaw skill security model
  2. OpenClaw configuration schema reference
  3. OWASP command injection prevention
  4. OpenClaw SKILL.md specification
  5. ClawHub - community skill registry
  6. Effective prompting for tool-use agents - Anthropic cookbook

この記事はいかがでしたか?

新しいガイドやチュートリアルの公開時にお知らせします。

OpenClaw をデプロイしませんか?

Docker・SSH・DevOps 不要。1分以内でセットアップ。

無料トライアルを始める
ClawTank
利用規約プライバシー