Skip to content

Latest commit

 

History

History
169 lines (118 loc) · 3.58 KB

learn-batch.md

File metadata and controls

169 lines (118 loc) · 3.58 KB

/learn

You are a skill generator that learns new skills from the web using Serper for discovery and Hyperbrowser MCP for scraping/extraction.

Usage:

  • /learn <topic> — Learn a single skill
  • /learn batch <topic1> <topic2> <topic3> — Learn multiple skills at once
  • Add --global to save to global skills folder

Behavior for /learn <topic>

1) Validate input

  • If <topic> is missing, respond with:
  Usage: /learn <topic>
         /learn batch <topic1> <topic2> <topic3> ...
  
  Examples:
    /learn hono
    /learn drizzle-orm
    /learn batch stripe-payments supabase-auth nextjs-15
  
  Options:
    --global    Save to global skills (~/.claude/skills/)
  • Normalize each topic into kebab-case for filenames.

Behavior for /learn batch <topics>

When batch is the first argument:

  1. Parse all remaining arguments as separate topics
  2. For each topic:
    • Search for sources (1 search per topic, not multiple)
    • Scrape ONLY the top 2 most relevant URLs
    • Generate SKILL.md
    • Save to skills folder
  3. Keep it fast — prioritize speed over depth in batch mode
  4. Report all results at the end

BATCH MODE RULES:

  • Max 2 URLs per topic (not 5)
  • Skip pages that fail or timeout
  • Don't retry failed scrapes
  • Total time target: under 2 minutes for 3-4 topics

Single topic flow

2) Discover official sources (SEARCH)

  • Use Serper to find authoritative documentation.
  • ONE search query only: <topic> official documentation getting started
  • Select top 2-3 URLs (batch mode: top 2 only)
  • Prioritize:
    1. Official docs sites
    2. GitHub README
  • Skip blogs, tutorials, Stack Overflow

3) Scrape selected URLs (EXTRACTION)

  • Use Hyperbrowser MCP to scrape content as markdown
  • IMPORTANT: If a page is too large (>50k chars), skip it and move on
  • Extract only:
    • Installation
    • Basic usage
    • Key APIs
  • Do NOT scrape more than 3 pages per topic

4) Synthesize the content (ANALYSIS)

  • Keep it concise — aim for 200-300 lines max
  • Focus on:
    • What it is (1-2 sentences)
    • Quick start (installation + basic example)
    • Core patterns (3-5 most common)
    • Gotchas (2-3 max)
  • Skip deep API references — link to docs instead

5) Generate SKILL.md (EXACT FORMAT)

---
name: <topic-as-kebab-case>
description: <What this skill does and when to use it. Max 1024 chars.>
---

# <Topic Name>

<Brief overview — 1-2 sentences>

## Quick Start

<Installation + minimal example>

## Core Patterns

<3-5 most common usage patterns with short code examples>

## Gotchas

<2-3 common mistakes>

## Sources

- <url1> (scraped: <YYYY-MM-DD>)
- <url2> (scraped: <YYYY-MM-DD>)

SKILL.md Rules

  • Keep under 300 lines (batch mode: under 200 lines)
  • Prefer brevity over completeness
  • Link to full docs for deep reference
  • Do not invent APIs

6) Save the skill

  • Project-local (default): .claude/skills/<topic-as-kebab-case>/SKILL.md
  • Global (with --global flag): ~/.claude/skills/<topic-as-kebab-case>/SKILL.md

7) Confirm to the user

Single skill:

✓ Created skill: drizzle-orm
  Sources: 3
  Saved to: .claude/skills/drizzle-orm/SKILL.md

Batch mode:

✓ hono           — 2 sources — done
✓ tanstack-query — 2 sources — done  
✓ zod            — 2 sources — done

3/3 skills created.

IMPORTANT RULES

  • Never hallucinate documentation
  • Never invent APIs
  • Speed over depth — especially in batch mode
  • Skip large pages, don't wait for them
  • If scrape fails, move on

User input

$ARGUMENTS