golang-pkg-go-dev
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).
git clone --depth 1 https://github.com/samber/cc-skills-golang /tmp/golang-pkg-go-dev && cp -r /tmp/golang-pkg-go-dev/skills/golang-pkg-go-dev ~/.claude/skills/golang-pkg-go-devSKILL.md
# 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](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. ## 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." ## Setup ### Install ```bash 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): ```bash claude mcp add pkg-go-dev -- godig mcp ``` streamable HTTP (shared server at `/mcp`, default `:8080`): ```bash 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`: ```bash 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`, `--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>` | `--module --version --limit --filter` | Known vulnerabilities | | `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](references/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](#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 t
Golang benchmarking, profiling, and performance measurement. Use when writing, running, or comparing Go benchmarks, profiling hot paths with pprof, interpreting CPU/memory/trace profiles, analyzing results with benchstat, setting up CI benchmark regression detection, or investigating production performance with Prometheus runtime metrics. Also use when the developer needs deep analysis on a specific performance indicator - this skill provides the measurement methodology, while `samber/cc-skills-golang@golang-performance` provides the optimization patterns.
Golang CLI application development. Use when building, modifying, or reviewing a Go CLI tool — especially for command structure, flag handling, configuration layering, version embedding, exit codes, I/O patterns, signal handling, shell completion, argument validation, and CLI unit testing. Also triggers when code uses cobra, viper, or urfave/cli. For cobra-specific APIs → See `samber/cc-skills-golang@golang-spf13-cobra` skill; for viper configuration layering → See `samber/cc-skills-golang@golang-spf13-viper` skill.
Golang code style conventions — line length and breaking, variable declarations, control flow clarity, when comments help vs hurt. Use when writing or reviewing Go code, asking about style or clarity, or establishing project coding standards. Not for naming conventions (→ See `samber/cc-skills-golang@golang-naming` skill), linter configuration (→ See `samber/cc-skills-golang@golang-lint` skill), or doc comments (→ See `samber/cc-skills-golang@golang-documentation` skill).
Golang concurrency patterns. Use when writing or reviewing concurrent Go code involving goroutines, channels, select, locks, sync primitives, errgroup, singleflight, worker pools, or fan-out/fan-in pipelines. Also triggers when you detect goroutine leaks, race conditions, channel ownership issues, or need to choose between channels and mutexes.
Idiomatic context.Context usage in Golang — propagation through API boundaries, cancellation, timeouts and deadlines, request-scoped values, context.WithoutCancel for background work outliving requests. Apply when designing context propagation across layers, debugging leaked or unexpired contexts, choosing between context.Background/TODO/WithoutCancel, or storing values in context. Not for code that merely accepts ctx as first parameter.
CI/CD pipeline configuration using GitHub Actions for Golang projects — testing, linting, SAST, security scanning, code coverage, Dependabot, Renovate, GoReleaser, code review automation, and release pipelines. Use when setting up or improving Go project CI, configuring GitHub Actions workflows, adding linters or security scanners, automating dependency updates, or adding quality gates.
Golang data structures — slices (internals, capacity growth, preallocation, slices package), maps (internals, hash buckets, maps package), arrays, container/list/heap/ring, strings.Builder vs bytes.Buffer, generic collections, pointers (unsafe.Pointer, weak.Pointer), and copy semantics. Use when choosing or optimizing Go data structures, implementing generic containers, using container/ packages, unsafe or weak pointers, or questioning slice/map internals.
Comprehensive guide for Go database access — parameterized queries, struct scanning, NULLable columns, transactions, isolation levels, SELECT FOR UPDATE, connection pool, batch processing, context propagation, and migration tooling. Use when writing, reviewing, or debugging Golang code that interacts with PostgreSQL, MariaDB, MySQL, or SQLite; for database testing; or for questions about database/sql, sqlx, or pgx. Does NOT generate database schemas or migration SQL.