Pkg.go.dev to LLM.txt Formatter

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.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

作者
hellowor
今日安裝
0
安裝總數
3
評價
0 0 0
版本
0.1.1
建立日期
2025-06-07
更新日期
2025-06-07
尺寸
22.5 KB
授權條款
MIT
腳本執行於

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:

  • Package Overview: The main description of the package.
  • Examples: Code examples provided within the documentation, including their titles and any associated output.
  • Constants & Variables: Definitions and descriptions of package-level constants and variables.
  • Functions: Signatures, descriptions, and associated examples for package-level functions.
  • Types: Definitions for structs, interfaces, etc., along with their descriptions and examples.
  • Constructors & Methods: For each type, its associated constructor functions and methods are extracted, including their signatures, descriptions, and examples.

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.

How to Use

  1. Installation:

    • Ensure you have a UserScript manager extension installed in your browser (e.g., Tampermonkey, Greasemonkey, Violentmonkey).
    • Install this script by navigating to its download URL (e.g., from Greasy Fork) and clicking the "Install" button, or by manually adding the script code to your UserScript manager.
  2. Navigate to a Go Package Page:

  3. Locate and Click the Download Button:

    • Once the page has loaded, you will see a "Download llm.txt" button appear in the bottom-right corner of the screen.
    • Click this button.
  4. Extraction and Download:

    • The script will wait for a brief moment (approximately 1 second) to allow the dynamic content on the page (especially code examples) to fully load.
    • It will then process the page content, extract the documentation, and format it.
    • A file named [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.
  5. Using the .txt File:

    • You can now use this .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.