Skip to content

Latest commit

 

History

History
154 lines (112 loc) · 3.54 KB

learn.md

File metadata and controls

154 lines (112 loc) · 3.54 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> or /learn <topic> --global


Behavior for /learn <topic>

1) Validate input

  • If <topic> is missing, respond with:
    Usage: /learn <topic>
    Examples:
      /learn hono
      /learn drizzle-orm
      /learn playwright
    
    Options:
      --global    Save to global skills (~/.claude/skills/)
    
  • Normalize the topic into kebab-case for filenames.

2) Discover official sources (SEARCH)

  • Use Serper (Google Search API) to find authoritative documentation.
  • Try queries:
    • <topic> official documentation
    • <topic> getting started
    • <topic> API reference
    • <topic> GitHub repository
  • Prioritize:
    1. Official docs sites
    2. Official GitHub repositories (README/docs)
    3. Official blogs/announcements
  • Select 3–5 high-quality URLs max.
  • If no credible sources are found, stop and ask the user to provide a URL.

3) Scrape selected URLs (EXTRACTION)

  • For each selected URL:
    • Use Hyperbrowser MCP to scrape content (prefer markdown).
    • Extract only relevant sections:
      • Installation / setup
      • Core concepts
      • API reference
      • Common patterns / examples
      • Version / changelog info
    • Exclude navigation, ads, login prompts, and unrelated content.
  • Record a scrape timestamp for each source.

4) Synthesize the content (ANALYSIS)

  • Combine extracted material into a practical, engineer-focused understanding:
    • What it is
    • When/why to use it
    • Common patterns
    • Key APIs
    • Real-world gotchas
  • Prefer practice over theory.
  • If sources disagree, note the discrepancy.

5) Generate SKILL.md (EXACT FORMAT)

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

# <Topic Name>

<Brief overview: what it is and when to use it>

## Quick Start

<Installation and minimal setup>

## Core Concepts

<Key concepts the agent must understand>

## Common Patterns

<Typical usage patterns with short code examples>

## API Reference

<Key functions, methods, or endpoints>

## Gotchas

<Common mistakes and how to avoid them>

## Sources

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

SKILL.md Rules

  • name: max 64 chars; lowercase, numbers, hyphens only
  • description: max 1024 chars; include keywords so the skill auto-triggers
  • Body: keep under 500 lines
  • Use imperative language ("Use X to…", "Call Y when…")
  • Include version info when available
  • Do not invent APIs or behavior

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
  • Create the directory if it doesn't exist.
  • Overwrite an existing skill only after warning the user.

7) Confirm to the user

Report:

  • Skill name created
  • Number of sources scraped
  • Save location
  • How to invoke it (/<skill-name> or auto-trigger)

Example:

✓ Created skill: drizzle-orm
  Sources scraped: 4
  Saved to: .claude/skills/drizzle-orm/SKILL.md
  This skill will auto-trigger when working with Drizzle ORM.

IMPORTANT RULES

  • Never hallucinate documentation.
  • Never invent APIs, functions, or features.
  • If sources are insufficient, ask the user for a URL.
  • Serper = discovery only. Hyperbrowser MCP = scraping/extraction only.

User input

$ARGUMENTS