まだ OpenClaw をインストールしていませんか?
curl -fsSL https://openclaw.ai/install.sh | bashiwr -useb https://openclaw.ai/install.ps1 | iexcurl -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?"
テストします:
