---
name: self-learning
description: Autonomously research any technology, library, framework, or API. Discovers official documentation, extracts key information from authoritative sources, verifies across multiple pages, and generates a reusable Claude skill (SKILL.md) with installation, examples, and best practices.
---
# Self-Learning Skill
Teach Claude about any new technology and create a permanent, reusable skill from the research.
## Invocation
Trigger with:
- `/learn <topic>` - e.g., `/learn anthropic api`
- "Create a skill for <topic>"
- "Teach yourself about <topic>"
- "Learn <topic> and save it as a skill"
## Process
### Step 1: Clarify Scope
Before researching, clarify ambiguous topics:
**If topic is broad** (e.g., "react", "aws"):
Ask: "What aspect of <topic> should I focus on? For example:
- API/SDK usage
- Specific feature (e.g., hooks, lambda)
- Integration with another tool
- Or comprehensive overview?"
**If topic is specific** (e.g., "stripe webhooks", "prisma migrations"):
Proceed directly to research.
### Step 2: Discover Authoritative Sources
Use web search to find authoritative sources with targeted queries:
1. Search: `official <topic> documentation site`
2. Search: `<topic> quickstart guide getting started`
3. Search: `<topic> API reference examples`
**Source prioritization:**
1. Official documentation (docs.*, *.dev, official GitHub)
2. Official blog posts / announcements
3. Reputable tutorials (MDN, Real Python, official guides)
4. Avoid: Medium, dev.to, Stack Overflow (for primary sources)
### Step 3: Extract Content from Top Sources
Fetch and extract content from the top 3-5 URLs found.
**Extract these sections from each source:**
- [ ] Installation / Setup
- [ ] Authentication / API keys
- [ ] Core concepts / Models / Endpoints
- [ ] Basic usage examples (Python, TypeScript)
- [ ] Advanced features (streaming, tools, etc.)
- [ ] Error handling patterns
- [ ] Best practices / Common pitfalls
- [ ] Pricing / Limits (if applicable)
### Step 4: Verify and Cross-Reference
Before including any fact:
1. Confirm it appears in 2+ sources OR is from official docs
2. Check the publication/update date
3. Note any version-specific information
4. Flag anything that seems outdated or conflicting
**If conflicts found:** Prioritize official docs, note the discrepancy in the skill.
### Step 5: Interactive Refinement (Key Differentiator)
After initial research, ask the user:
"I've researched <topic>. Here's what I found:
- Installation: [summary]
- Key features: [list]
- Code examples available for: [languages]
Should I:
1. Proceed with generating the skill as-is
2. Deep-dive into a specific feature
3. Add examples for additional languages
4. Focus on a particular use case"
This ensures the generated skill matches user needs.
### Step 6: Generate the Skill
Create a complete SKILL.md using this structure:
```markdown
---
name: <slugified-topic>
description: <One clear sentence about what this technology does and when to use it>
version: 1.0.0
sources_verified: <YYYY-MM-DD>
---
# <Topic Name>
<2-3 sentence overview of what this is and its primary use case>
## Quick Reference
| Item | Value |
|------|-------|
| Official Docs | <URL> |
| Installation | `pip install X` / `npm install X` |
| Auth Required | Yes/No - <how to get keys> |
| Primary Use | <main use case> |
## Installation
### Python
```bash
pip install <package>
```
### JavaScript/TypeScript
```bash
npm install <package>
# or
bun add <package>
```
## Authentication
<How to set up API keys, environment variables, etc.>
```python
import os
# Recommended: Use environment variables
api_key = os.environ.get("<ENV_VAR_NAME>")
```
## Basic Usage
### Python
```python
# <Clear comment explaining what this does>
from <package> import <Client>
client = <Client>(api_key="your-key")
try:
response = client.<method>(<params>)
print(response)
except <SpecificError> as e:
print(f"Error: {e}")
```
### TypeScript
```typescript
import { <Client> } from '<package>';
const client = new <Client>({ apiKey: process.env.<ENV_VAR> });
const response = await client.<method>(<params>);
console.log(response);
```
## Key Capabilities
### <Capability 1>
<Brief explanation with code example>
### <Capability 2>
<Brief explanation with code example>
## Best Practices
1. **<Practice>**: <Why and how>
2. **<Practice>**: <Why and how>
3. **<Practice>**: <Why and how>
## Common Errors
| Error | Cause | Fix |
|-------|-------|-----|
| <Error> | <Why> | <Solution> |
## Additional Resources
- [Official Docs](<url>)
- [API Reference](<url>)
- [Examples](<url>)
---
*Skill generated by claude-self-learning on <date>*
*Sources verified: <date>*
```
### Step 7: Save the Skill
After generating, offer storage options:
"Skill generated! Where should I save it?
1. **Project-local**: `.claude/skills/<topic>/SKILL.md` (this project only; commit it to share with the team)
2. **User-global**: `~/.claude/skills/<topic>/SKILL.md` (all projects)
3. **GitHub Gist**: Create a public gist for sharing"
Then create the file in the chosen location.
### Step 8: Versioning (Future Updates)
When saving, also create a `.meta.json`:
```json
{
"created": "<ISO date>",
"updated": "<ISO date>",
"sources": ["url1", "url2"],
"topic": "<original query>",
"version": "1.0.0"
}
```
This enables future `/update-skill <topic>` to refresh the skill.
## Tool Requirements
This skill requires:
- Web search capability
- Web page fetching capability
- File system access (Write tool)
- Optional: GitHub CLI for gist creation
## Examples
### Example 1: Learn about Anthropic API
```
User: /learn anthropic api
Claude: I'll research the Anthropic API. Let me find the official documentation...
[Searches, extracts, generates skill]
```
### Example 2: Learn about a specific feature
```
User: /learn stripe webhooks
Claude: I'll focus on Stripe Webhooks specifically...
[Targeted research, focused skill]
```
### Example 3: Broad topic with clarification
```
User: /learn kubernetes
Claude: Kubernetes is a broad topic. What aspect should I focus on?
- Basic concepts and architecture
- Deployment and kubectl usage
- Helm charts
- Specific resource types (pods, services, etc.)
User: Focus on basic kubectl usage
Claude: Got it, focusing on kubectl fundamentals...
```
## Notes
- Keep generated skills between 2,000-4,000 tokens
- Prioritize Python and TypeScript examples
- Include error handling in all code examples
- Verify all facts against official sources
- Include the verification date in every generated skill