golang-pkg-go-dev
Dependencies: godig — go install github.com/samber/godig/cmd/godig@latest (or use a registered godig MCP server / the hosted instance instead).
godig queries the pkg.go.dev API. Use it to answer questions about Go packages and modules: docs, symbols, versions, importers and vulnerabilities. It works as a CLI and as an MCP server. All operations are read-only and need no authentication.
When to use this skill
Trigger on questions like:
- "What versions of github.com/samber/lo are available?"
- "Does golang.org/x/text have known vulnerabilities?"
- "Show me the docs / symbols for package X."
- "Which packages import X?"
- "Search Go packages for Y."
Choosing between godig, gopls, Context7, and govulncheck
In short: godig answers questions about the published ecosystem (works even for packages not yet in your go.mod); gopls reasons about your locally resolved build (go.sum, including replaced forks); Context7 is a fallback for non-Go or unindexed docs; govulncheck is the whole-tree vulnerability audit (→ samber/cc-skills-golang@golang-security). See the samber/cc-skills-golang@golang-gopls skill for wiring gopls (MCP server, native LSP tool, and CLI) with Claude Code, and the samber/cc-skills-golang@golang-how-to skill's "godig vs gopls vs Context7 vs govulncheck" section for the full task-to-tool matrix.
Setup
Install
go install github.com/samber/godig/cmd/godig@latest
Register the MCP server (optional)
godig mcp runs over stdio by default, or streamable HTTP with --transport http.
stdio (the client launches godig on demand):
claude mcp add pkg-go-dev -- godig mcp
streamable HTTP (shared server at /mcp, default :8080):
godig mcp --transport http --addr :8080
claude mcp add --transport http pkg-go-dev http://localhost:8080/mcp
Hosted instance (no install needed) — a public server runs at https://godig.samber.dev/mcp:
claude mcp add --transport http pkg-go-dev https://godig.samber.dev/mcp
The CLI and the MCP server expose the same operations under matching names. Prefer the CLI when godig is installed; the hosted instance is a fallback when it is not.
Commands
Global flags (all commands): -o/--output table|json|raw|md (default table — pass -o md for chat), --base-url (pkg.go.dev API), --vuln-base-url (Go vulnerability database, consulted by vulns and overview), --timeout, --log-level debug|info|warn|error|off. All are also settable via GODIG_* env vars.
| Command |
Args |
Specific flags |
Purpose |
overview |
<path> |
--version |
Compact summary (metadata, versions, licenses, vulns) — start here |
search |
<query> |
--symbol --limit --filter |
Find packages (optionally exporting a symbol) |
package info |
<path> |
--module --version |
Package metadata |
package imports |
<path> |
--module --version |
Packages this package imports (plain list) |
package doc |
<path> |
--module --version --goos --goarch --format md|text|html|markdown |
Full package doc (LARGE) |
package examples |
<path> |
--module --version --goos --goarch --symbol |
Runnable examples (LARGE; scope with --symbol) |
package licenses |
<path> |
--module --version |
License files, full text (LARGE) |
symbol doc |
<path> <symbol> |
--module --version --goos --goarch |
One symbol's signature + doc (token-efficient) |
symbol examples |
<path> <symbol> |
--module --version --goos --goarch |
One symbol's runnable examples |
symbols |
<path> |
--module --version --goos --goarch --limit --filter |
List exported symbols |
module info |
<path> |
--version |
Module metadata |
module licenses |
<path> |
--version |
Module license files (LARGE) |
module readme |
<path> |
--version |
Module README, full Markdown (LARGE) |
dependencies |
<path> |
--version |
go.mod deps: requires / replaces / excludes / go directive |
packages |
<path> |
--version --limit --filter |
Packages contained in a module |
versions |
<path> |
--limit --filter |
All versions, newest first |
major-versions |
<path> |
--limit --filter --exclude-pseudo |
Major versions (v1, v2 …) living as separate modules |
imported-by |
<path> |
--module --version --limit --filter |
Packages that import this one |
vulns |
<path> |
--version --limit |
Known vulnerabilities (from the Go vuln DB) |
mcp |
— |
--transport stdio|http --addr --cache-ttl --cache-size |
Run as an MCP server |
version |
— |
— |
Print godig version / commit / build date |
When godig runs as an MCP server, each data command above is exposed as an operation of the same name.
Exit codes: 0 success, 1 runtime error (network, package not found), 2 usage error — a missing/invalid argument or flag (e.g. a non-positive --limit), or a command group invoked with no subcommand (godig package). Check for 2 to tell a malformed call apart from a failed lookup.
Full -o md output for every command: sample-output.md.
Tips
- Start with
overview — one call returns a compact summary (metadata, latest + recent versions, license types, vulnerabilities). Reach for doc/examples/module readme/licenses (LARGE) only when the full text is needed.
- Always pass
-o md so results render as Markdown (tables, or raw doc/README) in the chat. Other formats exist (table default, json, raw) but prefer md here.
<path> is a full import path, e.g. github.com/samber/lo — pass it as the positional argument.
--version pins a specific module version (v1.5.0, latest, master, main); --module disambiguates which module a package belongs to.
--filter narrows list results server-side with a Go boolean expression — see Filter syntax.
--goos/--goarch set the documentation/symbols build context (e.g. linux/amd64).
- Prefer
symbol doc/symbol examples over the package-wide package doc/package examples when you only need one symbol — far fewer tokens.
- Parallelize independent lookups — every command is a self-contained, read-only HTTP query, so calls never depend on each other. When a task needs docs, examples, versions, or vulns for several symbols, packages, or modules, issue all the calls at once (multiple
godig invocations in a single turn) rather than one after another — wall-clock drops from sum-of-latencies to slowest-single-call. For a large fan-out (documenting many symbols, comparing many candidate libraries, auditing CVEs across a dependency set), dispatch parallel sub-agents (up to 5) via the Agent tool, each running its own godig calls and returning a compact summary, so the raw LARGE output never lands in the main context.
- Listing commands auto-paginate (return all results); use
--limit to cap.
Filter syntax
--filter (on search, versions, major-versions, packages, imported-by, symbols) takes a Go boolean expression evaluated server-side, once per result item. It is not a regex — wrap the whole expression in single quotes for the shell.
- Identifiers are the item's fields, which differ per command — a field valid for one list is rejected by another (e.g.
search exposes packagePath, not path). An unknown field fails with undefined identifier: <name> (HTTP 400), which names the offending field. Fields use the item's lowercase JSON key; the exception is enum-like values such as kind, which are capitalized (Function, not func).
- Operators:
== != < <= > >=, boolean && || !, parentheses for grouping.
- String functions:
contains(s, sub), hasPrefix(s, pre), hasSuffix(s, suf).
- Literals: double-quoted strings (
"Function"), true/false, numbers.
Filterable fields per command (string unless noted):
| Command |
Fields |
search |
modulePath, packagePath, synopsis, version |
versions |
version, modulePath, deprecated (bool), retracted (bool), hasGoMod (bool), commitTime |
packages |
path, name, synopsis, isRedistributable (bool) |
imported-by |
path (the importing package path) |
symbols |
name, kind (Function/Method/Type/Variable/Constant), synopsis, parent |
major-versions |
modulePath, major, version, isLatest (bool) |
godig symbols github.com/samber/lo --filter 'kind=="Function"' -o md
godig symbols github.com/samber/lo --filter 'kind=="Function" && hasPrefix(name,"Map")' -o md
godig versions github.com/samber/lo --filter 'hasPrefix(version,"v1.5")' -o md
godig versions github.com/samber/lo --filter 'deprecated==false && retracted==false' -o md
godig search "result option" --filter 'hasPrefix(packagePath,"github.com/samber/")' -o md
Examples
Always request Markdown output (-o md):
# Overview — start here (compact, one call)
godig overview github.com/samber/ro -o md
# Search
godig search "result option monad" --limit 5 -o md
# Package facets
godig package info github.com/samber/ro -o md
godig package imports github.com/samber/ro -o md
godig package doc github.com/samber/ro --format md -o md
godig package examples github.com/samber/ro --symbol Map -o md
godig package licenses github.com/samber/ro -o md
# Single symbol (token-efficient vs package-wide doc/examples)
godig symbol doc github.com/samber/lo Map -o md
godig symbol examples github.com/samber/oops OopsError.Error -o md
# Module facets
godig module info github.com/samber/ro -o md
godig module readme github.com/samber/ro -o raw
godig dependencies github.com/samber/ro -o md
# Lists (auto-paginated; --limit to cap)
godig versions github.com/samber/ro -o md
godig major-versions github.com/samber/lo -o md
godig packages github.com/samber/ro -o md
godig imported-by github.com/samber/ro --limit 20 -o md
godig symbols github.com/samber/ro --filter 'kind=="Function"' -o md
# Pin a version / set the build context
godig versions github.com/samber/ro --filter 'hasPrefix(version,"v0.3")' -o md
godig package doc github.com/samber/lo --version v1.50.0 -o md
godig symbols github.com/samber/ro --goos linux --goarch amd64 -o md
# Vulnerabilities
godig vulns github.com/samber/ro -o md
This skill is not exhaustive. godig --help and each sub-command's --help list current flags and output formats; the data mirrors what pkg.go.dev exposes.
If you encounter a bug or unexpected behavior in godig, open an issue at https://github.com/samber/godig/issues.
1---2name: golang-pkg-go-dev3description: "Golang package and module documentation and exploration via `godig`, a pkg.go.dev API client (CLI + MCP server) — package docs, API references, symbols, code examples, available versions, importers (who imports a package), licenses, and known vulnerabilities. Read-only, no auth. Use for looking up any Go/Golang library's documentation, API signatures, usage examples, which versions exist, whether a dependency has CVEs, or who imports a package — prefer this over Context7 for any Go package or module. Triggers on: how to use a Go library, Go API docs, import usage, code examples, pkg.go.dev. Not for upgrading dependencies (→ See `samber/cc-skills-golang@golang-dependency-management` skill) or choosing a library (→ See `samber/cc-skills-golang@golang-popular-libraries` skill). Not for local symbols, or for navigating an already-used dependency's resolved source, call sites, or generic instantiations — → See `samber/cc-skills-golang@golang-gopls` skill for those."4user-invocable: true5license: MIT6compatibility: Designed for Claude Code or similar AI coding agents. Requires the godig CLI (go install github.com/samber/godig/cmd/godig@latest) or access to a godig MCP server, and internet access to reach the pkg.go.dev API.7metadata:8 source: https://skillmd.com/skills/om-scogo/golang-pkg-go-dev9 author: samber10 version: "1.3.0"11 openclaw:12 emoji: "🔎"13 homepage: https://github.com/samber/cc-skills-golang14 requires:15 bins:16 - go17 - godig18 install:19 - kind: go20 package: github.com/samber/godig/cmd/godig@latest21 bins: [godig]22 skill-library-version: "0.2.0"23allowed-tools: Read Edit Write Glob Grep Bash(go:*) Bash(golangci-lint:*) Bash(git:*) Bash(godig:*) Agent24---2526# golang-pkg-go-dev2728**Dependencies:** `godig` — `go install github.com/samber/godig/cmd/godig@latest` (or use a registered godig MCP server / the hosted instance instead).2930`godig` queries the [pkg.go.dev](https://pkg.go.dev) API. Use it to answer questions about Go packages and modules: docs, symbols, versions, importers and vulnerabilities. It works as a CLI and as an MCP server. All operations are **read-only** and need no authentication.3132## When to use this skill3334Trigger on questions like:3536- "What versions of github.com/samber/lo are available?"37- "Does golang.org/x/text have known vulnerabilities?"38- "Show me the docs / symbols for package X."39- "Which packages import X?"40- "Search Go packages for Y."4142## Choosing between `godig`, gopls, Context7, and govulncheck4344In short: `godig` answers questions about the **published ecosystem** (works even for packages not yet in your `go.mod`); `gopls` reasons about **your locally resolved build** (`go.sum`, including `replace`d forks); Context7 is a fallback for non-Go or unindexed docs; `govulncheck` is the whole-tree vulnerability audit (→ `samber/cc-skills-golang@golang-security`). See the `samber/cc-skills-golang@golang-gopls` skill for wiring `gopls` (MCP server, native `LSP` tool, and CLI) with Claude Code, and the `samber/cc-skills-golang@golang-how-to` skill's "`godig` vs gopls vs Context7 vs govulncheck" section for the full task-to-tool matrix.4546## Setup4748### Install4950```bash51go install github.com/samber/godig/cmd/godig@latest52```5354### Register the MCP server (optional)5556`godig mcp` runs over **stdio** by default, or **streamable HTTP** with `--transport http`.5758stdio (the client launches godig on demand):5960```bash61claude mcp add pkg-go-dev -- godig mcp62```6364streamable HTTP (shared server at `/mcp`, default `:8080`):6566```bash67godig mcp --transport http --addr :808068claude mcp add --transport http pkg-go-dev http://localhost:8080/mcp69```7071Hosted instance (no install needed) — a public server runs at `https://godig.samber.dev/mcp`:7273```bash74claude mcp add --transport http pkg-go-dev https://godig.samber.dev/mcp75```7677The CLI and the MCP server expose the **same** operations under matching names. Prefer the CLI when `godig` is installed; the hosted instance is a fallback when it is not.7879## Commands8081**Global flags (all commands):** `-o/--output table|json|raw|md` (default `table` — pass `-o md` for chat), `--base-url` (pkg.go.dev API), `--vuln-base-url` (Go vulnerability database, consulted by `vulns` and `overview`), `--timeout`, `--log-level debug|info|warn|error|off`. All are also settable via `GODIG_*` env vars.8283| Command | Args | Specific flags | Purpose |84| --- | --- | --- | --- |85| `overview` | `<path>` | `--version` | Compact summary (metadata, versions, licenses, vulns) — start here |86| `search` | `<query>` | `--symbol --limit --filter` | Find packages (optionally exporting a symbol) |87| `package info` | `<path>` | `--module --version` | Package metadata |88| `package imports` | `<path>` | `--module --version` | Packages this package imports (plain list) |89| `package doc` | `<path>` | `--module --version --goos --goarch --format md\|text\|html\|markdown` | Full package doc (LARGE) |90| `package examples` | `<path>` | `--module --version --goos --goarch --symbol` | Runnable examples (LARGE; scope with `--symbol`) |91| `package licenses` | `<path>` | `--module --version` | License files, full text (LARGE) |92| `symbol doc` | `<path> <symbol>` | `--module --version --goos --goarch` | One symbol's signature + doc (token-efficient) |93| `symbol examples` | `<path> <symbol>` | `--module --version --goos --goarch` | One symbol's runnable examples |94| `symbols` | `<path>` | `--module --version --goos --goarch --limit --filter` | List exported symbols |95| `module info` | `<path>` | `--version` | Module metadata |96| `module licenses` | `<path>` | `--version` | Module license files (LARGE) |97| `module readme` | `<path>` | `--version` | Module README, full Markdown (LARGE) |98| `dependencies` | `<path>` | `--version` | go.mod deps: requires / replaces / excludes / go directive |99| `packages` | `<path>` | `--version --limit --filter` | Packages contained in a module |100| `versions` | `<path>` | `--limit --filter` | All versions, newest first |101| `major-versions` | `<path>` | `--limit --filter --exclude-pseudo` | Major versions (v1, v2 …) living as separate modules |102| `imported-by` | `<path>` | `--module --version --limit --filter` | Packages that import this one |103| `vulns` | `<path>` | `--version --limit` | Known vulnerabilities (from the Go vuln DB) |104| `mcp` | — | `--transport stdio\|http --addr --cache-ttl --cache-size` | Run as an MCP server |105| `version` | — | — | Print godig version / commit / build date |106107When `godig` runs as an MCP server, each data command above is exposed as an operation of the same name.108109**Exit codes:** `0` success, `1` runtime error (network, package not found), `2` usage error — a missing/invalid argument or flag (e.g. a non-positive `--limit`), or a command group invoked with no subcommand (`godig package`). Check for `2` to tell a malformed call apart from a failed lookup.110111Full `-o md` output for every command: [sample-output.md](references/sample-output.md).112113### Tips114115- **Start with `overview`** — one call returns a compact summary (metadata, latest + recent versions, license types, vulnerabilities). Reach for `doc`/`examples`/`module readme`/`licenses` (LARGE) only when the full text is needed.116- **Always pass `-o md`** so results render as Markdown (tables, or raw doc/README) in the chat. Other formats exist (`table` default, `json`, `raw`) but prefer `md` here.117- `<path>` is a full import path, e.g. `github.com/samber/lo` — pass it as the positional argument.118- `--version` pins a specific module version (`v1.5.0`, `latest`, `master`, `main`); `--module` disambiguates which module a package belongs to.119- `--filter` narrows list results server-side with a Go boolean expression — see [Filter syntax](#filter-syntax).120- `--goos`/`--goarch` set the documentation/symbols build context (e.g. `linux`/`amd64`).121- Prefer `symbol doc`/`symbol examples` over the package-wide `package doc`/`package examples` when you only need one symbol — far fewer tokens.122- **Parallelize independent lookups** — every command is a self-contained, read-only HTTP query, so calls never depend on each other. When a task needs docs, examples, versions, or vulns for **several** symbols, packages, or modules, issue all the calls at once (multiple `godig` invocations in a single turn) rather than one after another — wall-clock drops from sum-of-latencies to slowest-single-call. For a large fan-out (documenting many symbols, comparing many candidate libraries, auditing CVEs across a dependency set), dispatch parallel sub-agents (up to 5) via the Agent tool, each running its own `godig` calls and returning a compact summary, so the raw LARGE output never lands in the main context.123- Listing commands auto-paginate (return all results); use `--limit` to cap.124125### Filter syntax126127`--filter` (on `search`, `versions`, `major-versions`, `packages`, `imported-by`, `symbols`) takes a **Go boolean expression evaluated server-side, once per result item**. It is not a regex — wrap the whole expression in single quotes for the shell.128129- **Identifiers are the item's fields, which differ per command** — a field valid for one list is rejected by another (e.g. `search` exposes `packagePath`, not `path`). An unknown field fails with `undefined identifier: <name>` (HTTP 400), which names the offending field. Fields use the item's lowercase JSON key; the exception is enum-like values such as `kind`, which are capitalized (`Function`, not `func`).130- **Operators**: `==` `!=` `<` `<=` `>` `>=`, boolean `&&` `||` `!`, parentheses for grouping.131- **String functions**: `contains(s, sub)`, `hasPrefix(s, pre)`, `hasSuffix(s, suf)`.132- **Literals**: double-quoted strings (`"Function"`), `true`/`false`, numbers.133134Filterable fields per command (string unless noted):135136| Command | Fields |137| --- | --- |138| `search` | `modulePath`, `packagePath`, `synopsis`, `version` |139| `versions` | `version`, `modulePath`, `deprecated` (bool), `retracted` (bool), `hasGoMod` (bool), `commitTime` |140| `packages` | `path`, `name`, `synopsis`, `isRedistributable` (bool) |141| `imported-by` | `path` (the importing package path) |142| `symbols` | `name`, `kind` (`Function`/`Method`/`Type`/`Variable`/`Constant`), `synopsis`, `parent` |143| `major-versions` | `modulePath`, `major`, `version`, `isLatest` (bool) |144145```bash146godig symbols github.com/samber/lo --filter 'kind=="Function"' -o md147godig symbols github.com/samber/lo --filter 'kind=="Function" && hasPrefix(name,"Map")' -o md148godig versions github.com/samber/lo --filter 'hasPrefix(version,"v1.5")' -o md149godig versions github.com/samber/lo --filter 'deprecated==false && retracted==false' -o md150godig search "result option" --filter 'hasPrefix(packagePath,"github.com/samber/")' -o md151```152153### Examples154155Always request Markdown output (`-o md`):156157```bash158# Overview — start here (compact, one call)159godig overview github.com/samber/ro -o md160161# Search162godig search "result option monad" --limit 5 -o md163164# Package facets165godig package info github.com/samber/ro -o md166godig package imports github.com/samber/ro -o md167godig package doc github.com/samber/ro --format md -o md168godig package examples github.com/samber/ro --symbol Map -o md169godig package licenses github.com/samber/ro -o md170171# Single symbol (token-efficient vs package-wide doc/examples)172godig symbol doc github.com/samber/lo Map -o md173godig symbol examples github.com/samber/oops OopsError.Error -o md174175# Module facets176godig module info github.com/samber/ro -o md177godig module readme github.com/samber/ro -o raw178godig dependencies github.com/samber/ro -o md179180# Lists (auto-paginated; --limit to cap)181godig versions github.com/samber/ro -o md182godig major-versions github.com/samber/lo -o md183godig packages github.com/samber/ro -o md184godig imported-by github.com/samber/ro --limit 20 -o md185godig symbols github.com/samber/ro --filter 'kind=="Function"' -o md186187# Pin a version / set the build context188godig versions github.com/samber/ro --filter 'hasPrefix(version,"v0.3")' -o md189godig package doc github.com/samber/lo --version v1.50.0 -o md190godig symbols github.com/samber/ro --goos linux --goarch amd64 -o md191192# Vulnerabilities193godig vulns github.com/samber/ro -o md194```195196---197198This skill is not exhaustive. `godig --help` and each sub-command's `--help` list current flags and output formats; the data mirrors what [pkg.go.dev](https://pkg.go.dev) exposes.199200If you encounter a bug or unexpected behavior in `godig`, open an issue at <https://github.com/samber/godig/issues>.