Extracts Go package documentation (API definitions, examples) from pkg.go.dev and converts it into a structured LLM.txt format, suitable for local AI/LLM reference and analysis.
This UserScript is designed to assist Go developers and AI enthusiasts by transforming Go package documentation pages on pkg.go.dev into a structured, plain text format (LLM.txt). This format is optimized for ingestion by local Large Language Models (LLMs), facilitating offline search, analysis, and reference of Go package APIs and examples.
The script intelligently extracts key information including:
The output LLM.txt file uses Markdown-like formatting (e.g., ## for headings, ```go for code blocks) to maintain readability and structure, making it easier for LLMs to parse and understand the context of different documentation sections.
Installation:
Navigate to a Go Package Page:
https://pkg.go.dev/. For example, https://pkg.go.dev/fmt or https://pkg.go.dev/github.com/go-rod/rod/lib/launcher.Locate and Click the Download Button:
Extraction and Download:
[package_name]_llm.txt (e.g., fmt_llm.txt or github.com_go-rod_rod_lib_launcher_llm.txt) will be automatically downloaded to your browser's default download location.Using the .txt File:
.txt file as a reference document for your local LLM. Import it into your LLM's knowledge base or use it as context for your queries.