learn について
learnは、オンライン資料を集め、テーマを学習ガイドにまとめるリサーチスキルです。索引と出典メタデータも作成し、簡易・中程度・詳細の調査範囲を選べます。
主な機能
- 01オンライン資料によるテーマ調査
- 02設定による調査範囲の調整
- 03出典の評価と選定
- 04構造化された学習ガイドの作成
- 05テーマ索引と出典メタデータの生成
活用シーン
- 01新しいテーマの学習ガイド作成
- 02調査テーマの資料収集と整理
- 03後から参照するテーマ索引の管理
インストール
コマンドをコピーしてターミナルで実行します。
npx skills add https:/ / github.com/ agent-sh/ agentsys --skill learnインストール後、Claude Code で/learnを入力して読み込まれたか確認します。
詳細
学習
オンラインのリソースを収集してあらゆるトピックを調査し、RAG に最適化されたインデックスを備えた包括的な学習ガイドを作成します。
引数の解析
const args = '$ARGUMENTS'.split(' ').filter(Boolean);
const depth = args.find(a => a.startsWith('--depth='))?.split('=')[1] || 'medium';
const topic = args.filter(a => !a.startsWith('--')).join(' ');
入力
引数:<topic> [--depth=brief|medium|deep]
- topic:調査対象(必須)
- --depth:情報源の収集範囲
brief:10 件の情報源(簡単な概要)medium:20 件の情報源(デフォルト、バランス重視)deep:40 件の情報源(包括的)
調査方法
以下のベストプラクティスに基づいています。
- Anthropic のコンテキストエンジニアリング
- DeepLearning.AI のツール使用パターン
- Anara の AI 文献レビュー
1. 段階的なクエリアーキテクチャ
長いクエリリストによるノイズを避けるため、絞り込む方法を使用します。
広範な段階(全体像の把握):
"{topic} overview introduction"
"{topic} documentation official"
焦点を絞る段階(中核となる内容):
"{topic} best practices"
"{topic} examples tutorial"
"{topic} site:stackoverflow.com"
深掘り段階(上級向け、depth=deep の場合):
"{topic} advanced techniques"
"{topic} pitfalls mistakes avoid"
"{topic} 2025 2026 latest"
2. 情報源の品質スコアリング
多面的な評価(最高スコア:100):
| 要素 | 重み | 最大値 | 基準 |
|---|---|---|---|
| 権威性 | 3x | 30 | 公式ドキュメント(10)、著名な専門家(8)、定評あるサイト(6)、ブログ(4)、その他(2) |
| 新しさ | 2x | 20 | 6 か月未満(10)、1 年未満(8)、2 年未満(6)、3 年未満(4)、それ以前(2) |
| 詳細度 | 2x | 20 | 包括的(10)、詳細(8)、概要(6)、表面的(4)、断片的(2) |
| 例 | 2x | 20 | コード例が複数(10)、例が 1 つ(6)、例なし(2) |
| 独自性 | 1x | 10 | 独自の視点(10)、一部重複(6)、内容が重複(2) |
選定の基準:スコア上位 N 件の情報源(N = depth の目標件数)
3. ジャストインタイム検索
コンテンツをすべて事前に読み込まないでください(コンテキストの劣化を招きます)。
- まず WebSearch で URL を収集します
- メタデータ(タイトル、説明、URL)に基づいてスコアを付けます
- 選定した情報源のみを WebFetch で取得します
- 全文ではなく、要約を抽出します
4. コンテンツ抽出のガイドライン
各情報源から以下を抽出します。
{
"url": "https://...",
"title": "Article Title",
"qualityScore": 85,
"scores": {
"authority": 9,
"recency": 8,
"depth": 7,
"examples": 9,
"uniqueness": 6
},
"keyInsights": [
"Concise insight 1",
"Concise insight 2"
],
"codeExamples": [
{
"language": "javascript",
"description": "Basic usage pattern"
}
],
"extractedAt": "2026-02-05T12:00:00Z"
}
著作権の遵守:要約と知見のみを記載し、段落をそのまま転載しないでください。
出力構成
トピックガイドのテンプレート
agent-knowledge/{slug}.md を作成します。
# Learning Guide: {Topic}
**Generated**: {date}
**Sources**: {count} resources analyzed
**Depth**: {brief|medium|deep}
## Prerequisites
What you should know before diving in:
- Prerequisite 1
- Prerequisite 2
## TL;DR
Essential points in 3-5 bullets:
- Key point 1
- Key point 2
- Key point 3
## Core Concepts
### {Concept 1}
{Synthesized explanation from multiple sources}
**Key insight**: {Most important takeaway}
### {Concept 2}
{Synthesized explanation}
## Code Examples
### Basic Example
```{language}
// Description of what this demonstrates
{code}
高度なパターン
{code}
よくある落とし穴
| 落とし穴 | 発生する理由 | 回避方法 |
|---|---|---|
| 問題 1 | 根本原因 | 防止策 |
ベストプラクティス
{n} 件の情報源からまとめた内容:
- プラクティス 1:説明
- プラクティス 2:説明
さらに読む
| リソース | 種類 | 推奨する理由 |
|---|---|---|
| タイトル | 公式ドキュメント | 権威ある参考資料 |
| タイトル | チュートリアル | 手順ごとのガイド |
/learn により {count} 件の情報源から生成されました。
全情報源のメタデータについては resources/{slug}-sources.json を参照してください。
### Master Index Template
Create/update `agent-knowledge/CLAUDE.md`:
```markdown
# Agent Knowledge Base
> Learning guides created by /learn. Reference these when answering questions about listed topics.
## Available Topics
| Topic | File | Sources | Depth | Created |
|-------|------|---------|-------|---------|
| {Topic 1} | {slug1}.md | {n} | medium | 2026-02-05 |
| {Topic 2} | {slug2}.md | {n} | deep | 2026-02-04 |
## Trigger Phrases
Use this knowledge when user asks about:
- "How does {topic1} work?" → {slug1}.md
- "Explain {topic1}" → {slug1}.md
- "{Topic2} best practices" → {slug2}.md
## Quick Lookup
| Keyword | Guide |
|---------|-------|
| recursion | recursion.md |
| hooks, react | react-hooks.md |
## How to Use
1. Check if user question matches a topic
2. Read the relevant guide file
3. Answer based on synthesized knowledge
4. Cite the guide if user asks for sources
OpenCode/Codex 用に agent-knowledge/AGENTS.md にコピーします。
情報源のメタデータ
agent-knowledge/resources/{slug}-sources.json を作成します。
{
"topic": "{original topic}",
"slug": "{slug}",
"generated": "2026-02-05T12:00:00Z",
"depth": "medium",
"totalSources": 20,
"sources": [
{
"url": "https://...",
"title": "...",
"qualityScore": 85,
"scores": {
"authority": 9,
"recency": 8,
"depth": 7,
"examples": 9,
"uniqueness": 6
},
"keyInsights": ["..."]
}
]
}
自己評価チェックリスト
確定する前に、出力を評価します(1~10)。
| 指標 | 質問 | 目標 |
|---|---|---|
| 網羅性 | ガイドは主要な側面を網羅していますか? | ≥7 |
| 多様性 | 情報源は多様な種類から選ばれていますか? | ≥6 |
| 例 | コード例は実用的ですか? | ≥7 |
| 正確性 | 内容の正確性にどの程度自信がありますか? | ≥8 |
不足点を明示:取り上げられていない重要なサブトピックがあれば記載します。
拡張機能の連携
enhance=true の場合、ガイドの作成後に実行します。
// Enhance the topic guide for RAG
Skill({ name: 'enhance-docs', args: `agent-knowledge/${slug}.md --ai` });
// Enhance the master index
Skill({ name: 'enhance-prompts', args: 'agent-knowledge/CLAUDE.md' });
出力形式
マーカーで囲んだ構造化 JSON を返します。
=== LEARN_RESULT ===
{
"topic": "recursion",
"slug": "recursion",
"depth": "medium",
"guideFile": "agent-knowledge/recursion.md",
"sourcesFile": "agent-knowledge/resources/recursion-sources.json",
"sourceCount": 20,
"sourceBreakdown": {
"officialDocs": 4,
"tutorials": 5,
"stackOverflow": 3,
"blogPosts": 5,
"github": 3
},
"selfEvaluation": {
"coverage": 8,
"diversity": 7,
"examples": 9,
"accuracy": 8,
"gaps": ["tail recursion optimization not covered"]
},
"enhanced": true,
"indexUpdated": true
}
=== END_RESULT ===
エラー処理
| エラー | 対処 |
|---|---|
| WebSearch が失敗 | より簡単なクエリで再試行 |
| WebFetch がタイムアウト | 情報源をスキップし、メタデータに記録 |
| 見つかった情報源が <minSources | ユーザーに警告し、利用可能な情報源で続行 |
| 拡張機能の実行に失敗 | スキップし、出力に記録 |
| インデックスが存在しない | 新しいインデックスを作成 |
トークン予算
フェーズごとの推定トークン使用量:
| フェーズ | トークン数 | 備考 |
|---|---|---|
| WebSearch のクエリ | ~2,000 | 5~8 件のクエリ |
| ソースのスコアリング | ~1,000 | メタデータのみ |
| WebFetch による抽出 | ~40,000 | 20 件のソース × 平均 2,000 |
| 統合 | ~10,000 | ガイドの生成 |
| 強化 | ~5,000 | 2 回のスキル呼び出し |
| 合計 | ~60,000 | opus の予算内 |
統合
このスキルは次によって呼び出されます:
/learnコマンドのためのlearn-agent- その他の調査指向エージェントから呼び出される可能性があります