learn

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Learn: Teach Claude Any Topic

学习功能:教Claude学习任意主题

Research and learn any topic, then retain the knowledge as a permanent skill. Works for:
  • Code libraries: React, Stripe, Supabase (uses Context7 when available)
  • APIs & Services: Twilio, OpenAI, Google APIs
  • Concepts & Methodologies: GTD, Agile, Design Patterns
  • Domain Knowledge: Tax law, medical terminology, industry practices
  • Tools: Docker, Kubernetes, FFmpeg
After learning, Claude becomes an expert on that topic in all future conversations.
研究并学习任意主题,然后将知识保留为永久技能。适用于以下类型的内容:
  • 代码库:React、Stripe、Supabase(有可用资源时会使用Context7)
  • API与服务:Twilio、OpenAI、Google APIs
  • 概念与方法论:GTD、Agile、设计模式
  • 领域知识:税法、医学术语、行业实践
  • 工具:Docker、Kubernetes、FFmpeg
完成学习后,Claude在后续所有对话中都将成为该主题的专家。

Usage

使用方法

/learn <topic>           # Create new skill from docs
/learn <topic> --update  # Update existing skill with latest docs
/learn <topic> --project # Save to project (.claude/skills/) instead of global
/learn <主题>           # 从文档创建新技能
/learn <主题> --update  # 使用最新文档更新现有技能
/learn <主题> --project # 保存到项目目录(.claude/skills/)而非全局目录

Process

执行流程

1. Research the Topic

1. 研究主题

For code libraries/APIs - try Context7 first:
mcp__plugin_context7_context7__resolve-library-id
  query: "user's task/question"
  libraryName: "<topic>"
For any topic (or if Context7 doesn't have it) - use WebSearch:
WebSearch: "<topic>" guide tutorial best practices
WebSearch: "<topic>" official documentation
WebSearch: "<topic>" examples patterns
For domain knowledge - broader research:
WebSearch: "<topic>" comprehensive guide
WebSearch: "<topic>" key concepts terminology
WebSearch: "<topic>" common mistakes pitfalls
Use WebFetch to read the most relevant pages found.
针对代码库/API - 优先尝试使用Context7:
mcp__plugin_context7_context7__resolve-library-id
  query: "user's task/question"
  libraryName: "<topic>"
针对任意主题(或当Context7无相关资源时)- 使用WebSearch:
WebSearch: "<topic>" guide tutorial best practices
WebSearch: "<topic>" official documentation
WebSearch: "<topic>" examples patterns
针对领域知识 - 进行更广泛的研究:
WebSearch: "<topic>" comprehensive guide
WebSearch: "<topic>" key concepts terminology
WebSearch: "<topic>" common mistakes pitfalls
使用WebFetch工具读取找到的最相关页面内容。

2. Extract Knowledge

2. 提取知识

Query the documentation for key information:
mcp__plugin_context7_context7__query-docs
  libraryId: "<resolved-id>"
  query: "getting started setup authentication common patterns"
Extract:
  • Setup/Installation: How to get started
  • Core concepts: Key abstractions and terminology
  • Common patterns: Typical usage examples
  • API reference: Essential methods/functions
  • Gotchas: Non-obvious pitfalls mentioned in docs
  • Best practices: Recommended approaches
If docs are large, make multiple targeted queries:
  1. "installation setup quickstart"
  2. "authentication API keys configuration"
  3. "common patterns examples"
  4. "error handling troubleshooting"
查询文档以获取关键信息:
mcp__plugin_context7_context7__query-docs
  libraryId: "<resolved-id>"
  query: "getting started setup authentication common patterns"
提取以下内容:
  • 安装与配置:入门方法
  • 核心概念:关键抽象模型与术语
  • 常见模式:典型使用示例
  • API参考:核心方法/函数
  • 注意事项:文档中提及的非显性陷阱
  • 最佳实践:推荐的实现方式
如果文档内容较多,可进行多次针对性查询:
  1. "installation setup quickstart"
  2. "authentication API keys configuration"
  3. "common patterns examples"
  4. "error handling troubleshooting"

3. Consult Claude Code Guide

3. 参考Claude代码指南

Before creating the skill, use the
claude-code-guide
agent to verify current skill conventions:
Task tool with subagent_type: claude-code-guide
prompt: "What are the current conventions for writing Claude Code skills?
        I need to know: required/optional frontmatter fields,
        description best practices, and recommended structure."
This ensures the generated skill follows the latest Claude Code patterns.
创建技能前,使用
claude-code-guide
代理验证当前的技能编写规范:
Task tool with subagent_type: claude-code-guide
prompt: "What are the current conventions for writing Claude Code skills?
        I need to know: required/optional frontmatter fields,
        description best practices, and recommended structure."
这能确保生成的技能遵循最新的Claude Code规范。

4. Generate Skill Structure

4. 生成技能结构

Create skill at appropriate location:
  • Default:
    ~/.claude/skills/<topic>/skill.md
  • With
    --project
    :
    .claude/skills/<topic>/skill.md
Skill template:
markdown
---
name: <topic>
description: <What the library does>. Use when <specific triggers>. Covers: <main capabilities>.
---
在合适的位置创建技能文件:
  • 默认路径:
    ~/.claude/skills/<topic>/skill.md
  • 使用
    --project
    参数时:
    .claude/skills/<topic>/skill.md
技能模板:
markdown
---
name: <topic>
description: <该库的功能>。在<特定触发场景>时使用。涵盖:<核心能力>
---

<Topic> Quick Reference

<主题>快速参考

Setup

安装配置

[Installation commands and initial config]
[安装命令与初始配置步骤]

Core Concepts

核心概念

[Key abstractions - 2-3 sentences each]
[关键抽象模型 - 每个用2-3句话说明]

Common Patterns

常见使用模式

[Pattern 1 Name]

[模式1名称]

[Code example with brief explanation]
[代码示例及简短说明]

[Pattern 2 Name]

[模式2名称]

[Code example with brief explanation]
[代码示例及简短说明]

API Quick Reference

API快速参考

MethodPurposeExample
.........
方法用途示例
.........

Gotchas

注意事项

  • [Non-obvious issue 1]
  • [Non-obvious issue 2]
  • [非显性问题1]
  • [非显性问题2]

Links

相关链接

  • Official Docs
  • API Reference
undefined
  • 官方文档
  • API参考
undefined

5. Verify and Announce

5. 验证并告知用户

After creating the skill:
  1. Confirm the skill was created
  2. Show the description (what triggers it)
  3. Show 2-3 example prompts that would activate it
创建技能后:
  1. 确认技能已成功创建
  2. 展示技能描述(触发条件)
  3. 展示2-3个可激活该技能的示例提示词

Quality Guidelines

质量规范

Do:
  • Focus on practical, actionable information
  • Include real code examples from docs
  • Capture version-specific details if relevant
  • Add the official docs URL for reference
Don't:
  • Copy entire documentation (copyright)
  • Include marketing/promotional content
  • Add information Claude already knows generally
  • Make the skill too long (under 500 lines)
建议做法:
  • 聚焦实用、可操作的信息
  • 包含文档中的真实代码示例
  • 若相关,记录版本特定的细节
  • 添加官方文档链接作为参考
禁止做法:
  • 复制完整文档内容(涉及版权问题)
  • 包含营销/推广类内容
  • 添加Claude已具备的通用知识
  • 使技能文件过长(控制在500行以内)

Update Mode (--update)

更新模式(--update)

When updating an existing skill:
  1. Read current skill content
  2. Query docs for latest/new information
  3. Merge new content, preserving existing structure
  4. Note version changes if applicable
更新现有技能时:
  1. 读取当前技能内容
  2. 查询文档获取最新/新增信息
  3. 合并新内容,保留原有结构
  4. 若适用,标注版本变更

Example

示例

User: /learn stripe-payments

Claude:
1. Resolves "stripe" via Context7 → /stripe/stripe-node
2. Queries: setup, authentication, common patterns, webhooks
3. Consults claude-code-guide for current skill conventions
4. Creates ~/.claude/skills/stripe-payments/skill.md with:
   - API key setup
   - Payment intent flow
   - Webhook verification
   - Error handling patterns
5. Reports: "Created stripe-payments skill. Triggers on: 'Stripe payment', 'charge card', 'payment intent'"
用户: /learn stripe-payments

Claude:
1. 通过Context7解析"stripe" → /stripe/stripe-node
2. 查询内容:安装配置、身份验证、常见模式、Webhook
3. 参考claude-code-guide获取当前技能编写规范
4. 创建~/.claude/skills/stripe-payments/skill.md,包含:
   - API密钥配置
   - 支付意向流程
   - Webhook验证
   - 错误处理模式
5. 告知用户:"已创建stripe-payments技能。触发词包括:'Stripe payment'、'charge card'、'payment intent'"

Requirements

依赖要求

  • Context7 MCP plugin (recommended) - for accessing library documentation
  • OR WebSearch/WebFetch tools - as fallback for any documentation
  • Context7 MCP插件(推荐)- 用于访问库文档
  • 或WebSearch/WebFetch工具 - 作为任意文档访问的备选方案