This skill generates a library documentation workflow by parsing references and fetching details to create a complete SKILL.md template.
npx playbooks add skill 884js/agent-skills --skill lib-docs-generator
ライブラリのドキュメントからスキルを自動生成する。
方針:
┌─────────────────────────────────────────────────┐
│ Phase 1: URL解析 │
├─────────────────────────────────────────────────┤
│ 1. /llms.txt を確認 │
│ ├── あり → curlでダウンロード │
│ │ (llms-full.txtは無視) │
│ │ → Phase 4 へ │
│ └── なし → Phase 1.5 へ │
└─────────────────────────────────────────────────┘
↓ (llms.txtなし)
┌─────────────────────────────────────────────────┐
│ Phase 1.5: URL収集 + ユーザー確認 │
├─────────────────────────────────────────────────┤
│ - サイトマップ/ナビゲーションからURL収集 │
│ - 収集URLリストを提示 │
│ - ユーザー承認を待つ │
└─────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────┐
│ Phase 2: ドキュメント収集 │
├─────────────────────────────────────────────────┤
│ - 各URLをWebFetchで取得 │
│ - タイトル + 概要 + コード例 + API情報を抽出 │
│ - カテゴリ分け │
└─────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────┐
│ Phase 3: docs.md生成 │
├─────────────────────────────────────────────────┤
│ - template.mdを参照 │
│ - 詳細形式で整形(概要+コード例+API情報) │
│ - 品質チェックリストを確認 │
│ - references/docs.mdとして保存 │
└─────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────┐
│ Phase 4: SKILL.md生成 │
├─────────────────────────────────────────────────┤
│ - スキルディレクトリ作成 │
│ - SKILL.md生成(WebFetch都度取得方式) │
└─────────────────────────────────────────────────┘
---
/llms.txt をWebFetchで確認 WebFetch(url="https://example.com/llms.txt", prompt="Check if this is a valid llms.txt file")
docs.md として保存(llms.md は作らない) mkdir -p .claude/skills/{library}/references
curl -s https://example.com/llms.txt -o .claude/skills/{library}/references/docs.md
| サイト | llms.txt URL |
|--------|--------------|
| Expo | https://docs.expo.dev/llms.txt |
| Vercel | https://vercel.com/llms.txt |
| Tamagui | https://tamagui.dev/llms.txt |
| その他 | /llms.txt を確認 |
---
llms.txtがない場合のみ実行
サイトマップ確認:
curl -s https://example.com/sitemap.xml -o sitemap.xml
ナビゲーション解析:
WebFetch(
url="https://example.com/docs",
prompt="Extract all documentation page URLs from the navigation/sidebar. Return as a list of URLs."
)
収集したURLリストを提示し、承認を待つ:
以下のURLを収集対象として検出しました:
Getting Started:
- https://example.com/docs/getting-started
- https://example.com/docs/installation
API Reference:
- https://example.com/docs/api/hooks
- https://example.com/docs/api/components
...
このリストで収集を開始してよろしいですか?
除外したいURLや追加したいURLがあれば教えてください。
---
目的: 各URLから包括的な情報を抽出(概要、コード例、API情報を含む)
各URLから以下を抽出:
WebFetch(
url="[URL]",
prompt="Extract the following from this documentation page:
1. Page title
2. Brief description (1-2 sentences)
3. Main content summary (key points as bullet list)
4. First code example with imports
5. API signatures if present (function name, parameters, return type)
Format as structured markdown."
)
ページ数が多い場合はTaskエージェントを並列起動:
Task(subagent_type="Explore", prompt="以下のURLから詳細情報を抽出: [URLリストA]")
Task(subagent_type="Explore", prompt="以下のURLから詳細情報を抽出: [URLリストB]")
URLパターンで自動分類:
| パターン | カテゴリ |
|----------|----------|
| /getting-started, /quickstart, /intro | Getting Started |
| /installation, /setup | Getting Started |
| /api, /reference | API Reference |
| /concepts, /fundamentals | Core Concepts |
| /guides, /how-to | Guides |
| /examples, /tutorials | Examples |
| /advanced, /configuration | Optional |
---
references/docs.md として保存[templates/docs.md](templates/docs.md) を参照して、詳細な出力形式で整形する。
# {Library}
> {ライブラリの概要を1-2文で}
## Getting Started
### Installation
- **URL**: https://...
- **概要**: インストール方法
- **手順**:
- npm install {package}
- 設定ファイルの作成
### Quick Start
- **URL**: https://...
- **概要**: 基本的な使い方
- **コード例**:
import { useQuery } from '@tanstack/react-query'
function Example() {
const { data } = useQuery({ queryKey: ['todos'], queryFn: fetchTodos })
}
## API Reference
### useQuery
- **URL**: https://...
- **概要**: データ取得用フック
- **シグネチャ**: `useQuery(options: UseQueryOptions): UseQueryResult`
- **主要パラメータ**:
- `queryKey`: クエリの一意識別子
- `queryFn`: データ取得関数
- **コード例**:
const { data, isLoading, error } = useQuery({
queryKey: ['user', userId],
queryFn: () => fetchUser(userId),
})
生成後、以下を確認:
良い例:
### useQuery
- **URL**: https://tanstack.com/query/latest/docs/react/reference/useQuery
- **概要**: サーバーからのデータ取得・キャッシュ・再検証を行うフック
- **シグネチャ**: `useQuery(options): UseQueryResult`
- **主要パラメータ**:
- `queryKey: QueryKey` - クエリの一意識別子
- `queryFn: QueryFunction` - データ取得関数
- **コード例**:
const { data, isLoading } = useQuery({
queryKey: ['todos'],
queryFn: fetchTodos,
})
悪い例:
- [useQuery](URL): フック
# references/docs.md として保存
Write to: .claude/skills/{library}/references/docs.md
---
{library}/
├── SKILL.md # メインスキルファイル
└── references/
└── docs.md # llms.txt形式(リンク集 + 概要)
[templates/skill.md](templates/skill.md) を参照して、SKILL.mdを生成する。
プレースホルダーを実際の値に置き換える:
{library}: スキル名(小文字、ハイフン区切り){Library}: ライブラリの表示名{package-name}: メインパッケージ名{日本語キーワード}: 日本語での呼び出しキーワードルール:
トリガー条件を含める:
imports "package-name"any "@tanstack/*" packagesasks about {Library}良い例:
description: |
Provides documentation for TanStack Query (React Query).
Use when working with code that imports "useQuery", "useMutation", "@tanstack/react-query", or any "@tanstack/query-*" packages.
Use when the user asks about data fetching, caching, or shows code with React Query hooks.
Can also be invoked directly with "React Query", "TanStack Query", "データフェッチ".
---
スキル発動時:
1. references/docs.md を読む
2. 質問に関連するセクション/URLを特定
3. WebFetchで該当URLの詳細を取得
4. 回答を生成
メリット:
---
技術的な詳細は [crawling-guide.md](references/crawling-guide.md) を参照。
---
Weekly roundup of top Claude Code skills, MCP servers, and AI coding tips.