🏹

自作AIエージェントに追加したAgent Skills その2

に公開
2026/04/12

紹介

Agent Skillsに対応したAIエージェントMagicaにまたスキルをいくつか追加したので紹介したいと思います。

https://gitlab.com/tkithrta/magica

Magicaの動かし方についてはREADME.mdをご参照ください。
Agent Skillsは相互運用性があるので、おそらくAgent Skillsに対応したAIエージェント、コーディングエージェントでも使えると思います。
Pythonとrequestsパッケージを使います。

search-hono-docs

Hono CLIのdocsコマンドやsearchコマンドみたいなスキルを作りました。

https://zenn.dev/yusukebe/articles/ff69c13ccafb28

https://gitlab.com/tkithrta/magica/-/blob/main/.magica/skills/search-hono-docs/SKILL.md
https://gitlab.com/tkithrta/magica/-/blob/main/.magica/skills/search-hono-docs/scripts/tool.py

mkdir -p .magica/skills/search-hono-docs/scripts
curl -fsSLo .magica/skills/search-hono-docs/SKILL.md https://gitlab.com/tkithrta/magica/-/raw/main/.magica/skills/search-hono-docs/SKILL.md
curl -fsSLo .magica/skills/search-hono-docs/scripts/tool.py https://gitlab.com/tkithrta/magica/-/raw/main/.magica/skills/search-hono-docs/scripts/tool.py
$ magica "HonoってWASIで動く?"
Skills: fetch-activitypub-outbox, fetch-github-api, get-agentskills-spec, get-ap-knowledge, get-earthquake-info, get-fe-knowledge, print-utc-time, search-hono-docs
Tool: activate_skill {"skill_name": "search-hono-docs"}
Tool: run_script {"skill_name": "search-hono-docs", "script_path": "scripts/tool.py", "args": ["WASI"]}
Tool: read_references {"skill_name": "search-hono-docs", "file_path": "references/docs-getting-started-webassembly-wasi.md"}
Agent: はい、HonoはWASIで動きます。

Honoの公式ドキュメントによると、HonoはWebAssembly(WASI環境)で「Out of the box(初期設定のまま)」で動作するとのことです。

これは、HonoがWeb標準のAPIを重視していることや、StarlingMonkey(WebAssembly用にコンパイルされたSpiderMonkey)などの技術と組み合わせることで、WASIが提供するシステムインターフェース(ファイルシステムやネットワークなど)を介して動作するようになっているためです。

具体的には、以下のような手順でWASI環境でHonoを実行できます。

1.  **依存関係のインストール**: `jco` や `componentize-js` などのWebAssembly用のツールを準備します。
2.  **WITファイルの設定**: WebAssemblyコンポーネントがHTTPリクエストを処理することを宣言する設定(`wasi:http/incoming-handler`)を行います。
3.  **コードの記述**: Honoのアプリケーションコードを書き、WASI用のアダプター(`@bytecodealliance/jco-std`など)を使って組み込みます。
4.  **ビルドと実行**: バンドラー(rolldownなど)で1つのJSファイルにまとめた後、`jco` でWebAssemblyコンポーネント(.wasm)に変換し、`jco serve` や `wasmtime` などのランタイムで実行します。

このようにして、WebAssembly上でHonoを動かすことが可能です。

raw.githubusercontent.comから取得しています。
以前Hono CLIを参考にCLI型コーディングエージェントでドキュメント参照できるようにしたことがあったので、その時の知識と以前作ったAgent Skillsのドキュメント用スキルを応用して作りました。

https://zenn.dev/tkithrta/articles/eae041b95f1acb

ただHonoのドキュメントはMarkdownファイルが100以上あるので、Markdownをダウンロードした後にPythonスクリプトで検索を行い、目的の参照ファイルがどこにあるかAIエージェントに教えてあげるような仕組みにしました。
site2skillを参考にしました。

https://blog.lai.so/site2skill/

fetch-github-api

Agent SkillsはAPIを取得して最新のコンテキストを読ませることに向いているので、GitHub APIからコンテキストを取得するスキルを作りました。

https://gitlab.com/tkithrta/magica/-/blob/main/.magica/skills/fetch-github-api/SKILL.md
https://gitlab.com/tkithrta/magica/-/blob/main/.magica/skills/fetch-github-api/scripts/tool.py

mkdir -p .magica/skills/fetch-github-api/scripts
curl -fsSLo .magica/skills/fetch-github-api/SKILL.md https://gitlab.com/tkithrta/magica/-/raw/main/.magica/skills/fetch-github-api/SKILL.md
curl -fsSLo .magica/skills/fetch-github-api/scripts/tool.py https://gitlab.com/tkithrta/magica/-/raw/main/.magica/skills/fetch-github-api/scripts/tool.py
$ magica "今日OpenしたHonoのGitHub Issues教えて"
Skills: fetch-activitypub-outbox, fetch-github-api, get-agentskills-spec, get-ap-knowledge, get-earthquake-info, get-fe-knowledge, print-utc-time, search-hono-docs
Tool: activate_skill {"skill_name": "fetch-github-api"}
Tool: run_script {"skill_name": "fetch-github-api", "script_path": "scripts/tool.py", "args": ["repos/honojs/hono/issues?state=open&sort=created&direction=desc"]}
Agent: Honoのリポジトリで今日Open(または最近作成)されたIssues・Pull Requestsのリストです(APIのデフォルト順序は作成日の新しい順)。

代表的なもの(日付順、最近のものから):
- #4601 bug: fetchError and CSP (by 729902288) — 12/26
- #4599 feat(ssg): add redirect plugin (by 3w36zj6) — 12/25
- #4596 perf(types): check JSONPrimitive first in JSONParsed (by yusukebe) — 12/25
- #4595 refactor(types): optimize MergePath (by yusukebe) — 12/25
- #4594 refactor(client): introduce StripLeadingSlash type (by yusukebe) — 12/25
- #4593 refactor(types): don't use recursion in IntersectNonAnyTypes (by yusukebe) — 12/25
- #4590 Since PR #4393, success response types can no longer be resolved without explicit status/ok checks (by baseballyama) — 12/23

など、合計約30件がOpenです。Pull Requestも含まれています。詳細や最新情報は、GitHubのIssue/PRページをご確認ください。

api.github.comから取得しています。
LLMはやたらGitHub APIに詳しいのでちゃんとquerystringをつけてリクエストを送ってくれます。

https://api.github.com/repos/honojs/hono/issues?state=open&sort=created&direction=desc

試しに同じAPIを叩いてみたら確かに30件ありました。
ただ30件というのはAPIで返ってくるIssuesの数なので、実際はもっとOpen Issuesがあることを把握しておく必要があります(LLMどうやってカウントしたんだ……)。

感想

GitHubはPythonのrequestsパッケージでHTTPリクエストできるURLが非常に多く、レスポンスも早く、様々なスキルに応用できるのでおすすめです。

その他のスキル紹介記事

https://zenn.dev/tkithrta/articles/10da2cece70df0
https://zenn.dev/tkithrta/articles/a0fa3c4f837197

Discussion