learn

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

learn

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
    • brief
      : 10 sources (quick overview)
    • medium
      : 20 sources (default, balanced)
    • deep
      : 40 sources (comprehensive)
参数:
<topic> [--depth=brief|medium|deep]
  • topic: 要调研的主题(必填)
  • --depth: 资源收集深度
    • brief
      : 10个来源(快速概览)
    • medium
      : 20个来源(默认,平衡选项)
    • deep
      : 40个来源(全面调研)

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):
FactorWeightMaxCriteria
Authority3x30Official docs (10), recognized expert (8), established site (6), blog (4), random (2)
Recency2x20<6mo (10), <1yr (8), <2yr (6), <3yr (4), older (2)
Depth2x20Comprehensive (10), detailed (8), overview (6), superficial (4), fragment (2)
Examples2x20Multiple code examples (10), one example (6), no examples (2)
Uniqueness1x10Unique perspective (10), some overlap (6), duplicate content (2)
Selection threshold: Top N sources by score (N = depth target)
多维度评估(满分100分):
评估维度权重最高分评分标准
权威性3x30官方文档 (10), 公认专家产出 (8), 成熟站点内容 (6), 博客 (4), 未知来源内容 (2)
时效性2x20<6个月 (10), <1年 (8), <2年 (6), <3年 (4), 更早 (2)
内容深度2x20内容全面 (10), 内容详细 (8), 概览级 (6), 表面内容 (4), 碎片化内容 (2)
示例丰富度2x20多个代码示例 (10), 1个示例 (6), 无示例 (2)
内容独特性1x10独特视角 (10), 部分重叠 (6), 重复内容 (2)
筛选阈值: 按得分取前N个来源(N为深度对应的目标数量)

3. Just-In-Time Retrieval

3. 即时检索

Don't pre-load all content (causes context rot):
  1. Collect URLs first via WebSearch
  2. Score based on metadata (title, description, URL)
  3. Fetch only selected sources via WebFetch
  4. Extract summaries (not full content)
不要预加载所有内容(会导致上下文失效):
  1. 先通过WebSearch收集URL
  2. 基于元数据(标题、描述、URL)评分
  3. 仅通过WebFetch拉取选中的来源内容
  4. 提取摘要(而非完整内容)

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}.md
:
markdown
undefined
创建
agent-knowledge/{slug}.md
:
markdown
undefined

Learning 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

常见陷阱

PitfallWhy It HappensHow to Avoid
Issue 1Root causePrevention strategy
陷阱产生原因规避方法
问题1根本原因预防方案

Best Practices

最佳实践

Synthesized from {n} sources:
  1. Practice 1: Explanation
  2. Practice 2: Explanation
整合自{n}份来源:
  1. 实践1: 说明
  2. 实践2: 说明

Further Reading

拓展阅读

ResourceTypeWhy Recommended
TitleOfficial DocsAuthoritative reference
TitleTutorialStep-by-step guide

Generated by /learn from {count} sources. See
resources/{slug}-sources.json
for full source metadata.
undefined
资源类型推荐理由
标题官方文档权威参考资料
标题教程分步操作指南

由/learn命令基于{count}份来源生成。 完整来源元数据见
resources/{slug}-sources.json
undefined

Master Index Template

主索引模板

Create/update
agent-knowledge/CLAUDE.md
:
markdown
undefined
创建/更新
agent-knowledge/CLAUDE.md
:
markdown
undefined

Agent Knowledge Base

Agent知识库

Learning guides created by /learn. Reference these when answering questions about listed topics.
由/learn命令创建的学习指南,回答所列主题相关问题时可参考这些内容。

Available Topics

可用主题

TopicFileSourcesDepthCreated
{Topic 1}{slug1}.md{n}medium2026-02-05
{Topic 2}{slug2}.md{n}deep2026-02-04
主题文件来源数量深度创建时间
{主题1}{slug1}.md{n}medium2026-02-05
{主题2}{slug2}.md{n}deep2026-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

快速查询

KeywordGuide
recursionrecursion.md
hooks, reactreact-hooks.md
关键词对应指南
recursionrecursion.md
hooks, reactreact-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

Copy to `agent-knowledge/AGENTS.md` for OpenCode/Codex.
  1. 检查用户问题是否匹配已有主题
  2. 读取对应的指南文件
  3. 基于整合后的知识回答
  4. 如果用户要求提供来源,引用对应指南

复制到 `agent-knowledge/AGENTS.md` 供OpenCode/Codex使用。

Sources Metadata

来源元数据

Create
agent-knowledge/resources/{slug}-sources.json
:
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": ["..."]
    }
  ]
}
创建
agent-knowledge/resources/{slug}-sources.json
:
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": ["..."]
    }
  ]
}

Self-Evaluation Checklist

自检清单

Before finalizing, rate output (1-10):
MetricQuestionTarget
CoverageDoes guide cover main aspects?≥7
DiversityAre sources from diverse types?≥6
ExamplesAre code examples practical?≥7
AccuracyConfidence 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

错误处理

ErrorAction
WebSearch failsRetry with simpler query
WebFetch timeoutSkip source, note in metadata
<minSources foundWarn user, proceed with available
Enhancement failsSkip, note in output
Index doesn't existCreate new index
错误处理动作
WebSearch失败使用更简单的查询重试
WebFetch超时跳过该来源,在元数据中记录
找到的来源少于最低要求警告用户,使用现有资源继续
增强功能调用失败跳过,在输出中记录
索引不存在创建新索引

Token Budget

Token预算

Estimated token usage by phase:
PhaseTokensNotes
WebSearch queries~2,0005-8 queries
Source scoring~1,000Metadata only
WebFetch extraction~40,00020 sources × 2,000 avg
Synthesis~10,000Guide generation
Enhancement~5,000Two skill calls
Total~60,000Within opus budget
各阶段预估token使用量:
阶段Token数量说明
WebSearch查询~2,0005-8次查询
来源评分~1,000仅处理元数据
WebFetch内容提取~40,00020个来源 × 平均每个2000token
内容整合~10,000指南生成
增强处理~5,000两次Skill调用
总计~60,000在opus模型预算范围内

Integration

集成说明

This skill is invoked by:
  • learn-agent
    for
    /learn
    command
  • Potentially other research-oriented agents
该Skill可由以下模块调用:
  • /learn
    命令对应的
    learn-agent
  • 其他面向调研的Agent也可调用