learn
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineselearn
learn
Research any topic by gathering online resources and creating a comprehensive learning guide with RAG-optimized indexes.
通过收集线上资源调研任意主题,使用RAG优化的索引创建全面的学习指南。
Parse Arguments
参数解析
javascript
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(' ');javascript
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(' ');Input
输入
Arguments:
<topic> [--depth=brief|medium|deep]- topic: Subject to research (required)
- --depth: Source gathering depth
- : 10 sources (quick overview)
brief - : 20 sources (default, balanced)
medium - : 40 sources (comprehensive)
deep
参数:
<topic> [--depth=brief|medium|deep]- topic: 要调研的主题(必填)
- --depth: 资源收集深度
- : 10个来源(快速概览)
brief - : 20个来源(默认,平衡选项)
medium - : 40个来源(全面调研)
deep
Research Methodology
调研方法
Based on best practices from:
- Anthropic's Context Engineering
- DeepLearning.AI Tool Use Patterns
- Anara's AI Literature Reviews
基于以下来源的最佳实践:
- Anthropic上下文工程
- DeepLearning.AI工具使用模式
- Anara AI文献综述
1. Progressive Query Architecture
1. 渐进式查询架构
Use funnel approach to avoid noise from long query lists:
Broad Phase (landscape mapping):
"{topic} overview introduction"
"{topic} documentation official"Focused Phase (core content):
"{topic} best practices"
"{topic} examples tutorial"
"{topic} site:stackoverflow.com"Deep Phase (advanced, if depth=deep):
"{topic} advanced techniques"
"{topic} pitfalls mistakes avoid"
"{topic} 2025 2026 latest"使用漏斗式方法避免长查询列表产生的噪声:
广度阶段(全景梳理):
"{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. Source Quality Scoring
2. 来源质量评分
Multi-dimensional evaluation (max score: 100):
| Factor | Weight | Max | Criteria |
|---|---|---|---|
| Authority | 3x | 30 | Official docs (10), recognized expert (8), established site (6), blog (4), random (2) |
| Recency | 2x | 20 | <6mo (10), <1yr (8), <2yr (6), <3yr (4), older (2) |
| Depth | 2x | 20 | Comprehensive (10), detailed (8), overview (6), superficial (4), fragment (2) |
| Examples | 2x | 20 | Multiple code examples (10), one example (6), no examples (2) |
| Uniqueness | 1x | 10 | Unique perspective (10), some overlap (6), duplicate content (2) |
Selection threshold: Top N sources by score (N = depth target)
多维度评估(满分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为深度对应的目标数量)
3. Just-In-Time Retrieval
3. 即时检索
Don't pre-load all content (causes context rot):
- Collect URLs first via WebSearch
- Score based on metadata (title, description, URL)
- Fetch only selected sources via WebFetch
- Extract summaries (not full content)
不要预加载所有内容(会导致上下文失效):
- 先通过WebSearch收集URL
- 基于元数据(标题、描述、URL)评分
- 仅通过WebFetch拉取选中的来源内容
- 提取摘要(而非完整内容)
4. Content Extraction Guidelines
4. 内容提取规范
For each source, extract:
json
{
"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"
}Copyright compliance: Summaries and insights only, never verbatim paragraphs.
对每个来源提取以下信息:
json
{
"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"
}版权合规要求: 仅提取摘要和洞见,不得直接复制原文段落。
Output Structure
输出结构
Topic Guide Template
主题指南模板
Create :
agent-knowledge/{slug}.mdmarkdown
undefined创建 :
agent-knowledge/{slug}.mdmarkdown
undefinedLearning Guide: {Topic}
学习指南: {Topic}
Generated: {date}
Sources: {count} resources analyzed
Depth: {brief|medium|deep}
生成时间: {date}
来源: 共分析{count}份资源
调研深度: {brief|medium|deep}
Prerequisites
前置知识
What you should know before diving in:
- Prerequisite 1
- Prerequisite 2
开始学习前你需要了解:
- 前置知识1
- 前置知识2
TL;DR
核心速览
Essential points in 3-5 bullets:
- Key point 1
- Key point 2
- Key point 3
3-5条核心要点:
- 核心要点1
- 核心要点2
- 核心要点3
Core Concepts
核心概念
{Concept 1}
{概念1}
{Synthesized explanation from multiple sources}
Key insight: {Most important takeaway}
{整合多来源内容的解释}
核心洞见: {最重要的结论}
{Concept 2}
{概念2}
{Synthesized explanation}
{整合多来源内容的解释}
Code Examples
代码示例
Basic Example
基础示例
// Description of what this demonstrates
{code}// 示例功能说明
{code}Advanced Pattern
高阶用法
{code}{code}Common Pitfalls
常见陷阱
| Pitfall | Why It Happens | How to Avoid |
|---|---|---|
| Issue 1 | Root cause | Prevention strategy |
| 陷阱 | 产生原因 | 规避方法 |
|---|---|---|
| 问题1 | 根本原因 | 预防方案 |
Best Practices
最佳实践
Synthesized from {n} sources:
- Practice 1: Explanation
- Practice 2: Explanation
整合自{n}份来源:
- 实践1: 说明
- 实践2: 说明
Further Reading
拓展阅读
| Resource | Type | Why Recommended |
|---|---|---|
| Title | Official Docs | Authoritative reference |
| Title | Tutorial | Step-by-step guide |
Generated by /learn from {count} sources.
See for full source metadata.
resources/{slug}-sources.jsonundefined| 资源 | 类型 | 推荐理由 |
|---|---|---|
| 标题 | 官方文档 | 权威参考资料 |
| 标题 | 教程 | 分步操作指南 |
由/learn命令基于{count}份来源生成。
完整来源元数据见 。
resources/{slug}-sources.jsonundefinedMaster Index Template
主索引模板
Create/update :
agent-knowledge/CLAUDE.mdmarkdown
undefined创建/更新 :
agent-knowledge/CLAUDE.mdmarkdown
undefinedAgent Knowledge Base
Agent知识库
Learning guides created by /learn. Reference these when answering questions about listed topics.
由/learn命令创建的学习指南,回答所列主题相关问题时可参考这些内容。
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 |
| 主题 | 文件 | 来源数量 | 深度 | 创建时间 |
|---|---|---|---|---|
| {主题1} | {slug1}.md | {n} | medium | 2026-02-05 |
| {主题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
用户询问以下内容时使用该知识库:
- "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 |
| 关键词 | 对应指南 |
|---|---|
| recursion | recursion.md |
| hooks, react | react-hooks.md |
How to Use
使用方法
- Check if user question matches a topic
- Read the relevant guide file
- Answer based on synthesized knowledge
- Cite the guide if user asks for sources
Copy to `agent-knowledge/AGENTS.md` for OpenCode/Codex.- 检查用户问题是否匹配已有主题
- 读取对应的指南文件
- 基于整合后的知识回答
- 如果用户要求提供来源,引用对应指南
复制到 `agent-knowledge/AGENTS.md` 供OpenCode/Codex使用。Sources Metadata
来源元数据
Create :
agent-knowledge/resources/{slug}-sources.jsonjson
{
"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": ["..."]
}
]
}创建 :
agent-knowledge/resources/{slug}-sources.jsonjson
{
"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": ["..."]
}
]
}Self-Evaluation Checklist
自检清单
Before finalizing, rate output (1-10):
| Metric | Question | Target |
|---|---|---|
| Coverage | Does guide cover main aspects? | ≥7 |
| Diversity | Are sources from diverse types? | ≥6 |
| Examples | Are code examples practical? | ≥7 |
| Accuracy | Confidence in content accuracy? | ≥8 |
Flag gaps: Note any important subtopics not covered.
最终输出前按1-10分评分:
| 指标 | 评分问题 | 目标分 |
|---|---|---|
| 覆盖度 | 指南是否覆盖了主题的主要方面? | ≥7 |
| 来源多样性 | 来源是否来自多种不同类型? | ≥6 |
| 示例实用性 | 代码示例是否实用? | ≥7 |
| 内容准确率 | 对内容准确率的信心? | ≥8 |
标记缺口: 记录所有未覆盖的重要子主题。
Enhancement Integration
增强功能集成
If enhance=true, invoke after guide creation:
javascript
// 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' });如果enhance=true,在指南创建完成后调用:
javascript
// 为RAG优化主题指南
Skill({ name: 'enhance-docs', args: `agent-knowledge/${slug}.md --ai` });
// 优化主索引
Skill({ name: 'enhance-prompts', args: 'agent-knowledge/CLAUDE.md' });Output Format
输出格式
Return structured JSON between markers:
=== 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 ===在标记之间返回结构化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 ===Error Handling
错误处理
| Error | Action |
|---|---|
| WebSearch fails | Retry with simpler query |
| WebFetch timeout | Skip source, note in metadata |
| <minSources found | Warn user, proceed with available |
| Enhancement fails | Skip, note in output |
| Index doesn't exist | Create new index |
| 错误 | 处理动作 |
|---|---|
| WebSearch失败 | 使用更简单的查询重试 |
| WebFetch超时 | 跳过该来源,在元数据中记录 |
| 找到的来源少于最低要求 | 警告用户,使用现有资源继续 |
| 增强功能调用失败 | 跳过,在输出中记录 |
| 索引不存在 | 创建新索引 |
Token Budget
Token预算
Estimated token usage by phase:
| Phase | Tokens | Notes |
|---|---|---|
| WebSearch queries | ~2,000 | 5-8 queries |
| Source scoring | ~1,000 | Metadata only |
| WebFetch extraction | ~40,000 | 20 sources × 2,000 avg |
| Synthesis | ~10,000 | Guide generation |
| Enhancement | ~5,000 | Two skill calls |
| Total | ~60,000 | Within opus budget |
各阶段预估token使用量:
| 阶段 | Token数量 | 说明 |
|---|---|---|
| WebSearch查询 | ~2,000 | 5-8次查询 |
| 来源评分 | ~1,000 | 仅处理元数据 |
| WebFetch内容提取 | ~40,000 | 20个来源 × 平均每个2000token |
| 内容整合 | ~10,000 | 指南生成 |
| 增强处理 | ~5,000 | 两次Skill调用 |
| 总计 | ~60,000 | 在opus模型预算范围内 |
Integration
集成说明
This skill is invoked by:
- for
learn-agentcommand/learn - Potentially other research-oriented agents
该Skill可由以下模块调用:
- 命令对应的
/learnlearn-agent - 其他面向调研的Agent也可调用