Communityコーディング&開発github.com

samber/golang-pkg-go-dev

`godig` を使用した Go パッケージおよびモジュールの検索 (pkg.go.dev API クライアント、CLI + MCP サーバー)。Go ライブラリのドキュメント、API シグネチャ、シンボル、使用例、バージョン、ライセンス、依存関係の脆弱性、インポート元などをすべて参照できます。

golang-pkg-go-dev とは?

このスキルは、Go パッケージおよびモジュールの情報を取得するための CLI ツール兼 MCP サーバーである `godig` を Claude Code などの AI エージェントに統合します。pkg.go.dev の公開 API を利用して、ドキュメント、シンボル、バージョン一覧、ライセンス、脆弱性情報、インポート元などをすべて読み取り専用で、認証なしに取得できます。 **主なユースケース:** Go エコシステムに公開されているパッケージの調査、特定のライブラリの最新バージョンの確認、依存関係に既知の脆弱性 (CVE) が存在するかの確認、パッケージの API シグネチャや使用例の取得など。 **他のツールとの使い分け:** `godig` は公開エコシステムに基づく情報を提供します。ローカルの解決済みビルド (`go.sum`、リプレイスされたフォーク) を参照するには `gopls`、Go 以外のドキュメントには Context7、プロジェクト全体の脆弱性監査には `govulncheck` をそれぞれ適切に使い分けてください。 **対応プラットフォーム:** Claude Code (MCP サーバー経由)、Cursor、Windsurf など、MCP に対応した任意の AI エージェントホスト。

対応✓Claude Code✓Codex CLI✓Cursor✓Windsurf
npx skills add https://github.com/samber/cc-skills-golang/tree/main/skills/golang-pkg-go-dev

Installed? Explore more コーディング&開発 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

golang-pkg-go-dev は何をしますか?

依存関係: godig — go install github.com/samber/godig/cmd/godig@latest (または、登録済みの godig MCP サーバー / ホストインスタンスを使用してください)。

godig は pkg.go.dev API にクエリを実行します。Go パッケージおよびモジュールに関する質問 (ドキュメント、シンボル、バージョン、インポーター、脆弱性) に答えるために使用します。CLI および MCP サーバーとして動作し、すべての操作は読み取り専用であり、認証は必要ありません。

このスキルを使用するタイミング

次のような質問でトリガーされます:

  • "github.com/samber/lo にはどのようなバージョンがありますか?"
  • "golang.org/x/text に既知の脆弱性はありますか?"
  • "パッケージ X のドキュメント/シンボルを表示してください。"
  • "X をインポートしているパッケージはどれですか?"
  • "Y に関する Go パッケージを検索してください。"

godig、gopls、Context7、govulncheck の使い分け

簡単に言うと: godig は公開エコシステムに関する質問に回答します (go.mod にまだ含まれていないパッケージでも機能します)。gopls はローカルで解決されたビルド (go.sum、replace されたフォークを含む) について推論します。Context7 は非 Go またはインデックス化されていないドキュメントのフォールバックです。govulncheck はツリー全体の脆弱性監査です (→ samber/cc-skills-golang@golang-security スキルを参照)。gopls (MCP サーバー、ネイティブ LSP ツール、および CLI) を Claude Code と連携させる方法については samber/cc-skills-golang@golang-gopls スキルを、タスクとツールの完全な対応表については samber/cc-skills-golang@golang-how-to スキルの「godig vs gopls vs Context7 vs govulncheck」セクションを参照してください。

セットアップ

インストール

go install github.com/samber/godig/cmd/godig@latest

MCP サーバーの登録 (オプション)

godig mcp はデフォルトで stdio 上で動作し、--transport http を指定すると ストリーミング可能 HTTP で動作します。このコマンドはハーネス非依存です — 任意の MCP 対応ホストがこれを指定できます。Claude Code は独自の CLI を介してこれを登録します:

stdio (クライアントが godig をオンデマンドで起動):

claude mcp add pkg-go-dev -- godig mcp

ストリーミング可能 HTTP (共有サーバー、/mcp エンドポイント、デフォルト :8080):

godig mcp --transport http --addr :8080
claude mcp add --transport http pkg-go-dev http://localhost:8080/mcp

ホストインスタンス (インストール不要) — 公開サーバーが https://godig.samber.dev/mcp で稼働しています:

claude mcp add --transport http pkg-go-dev https://godig.samber.dev/mcp

その他の MCP 対応ハーネス (Cursor、Windsurf など) にはそれぞれ独自の MCP サーバー登録方法があり、共有の設定形式はありません。各ハーネスの設定ファイルに、同じ godig mcp コマンドまたはホスト URL を指すエントリを追加してください。

CLI と MCP サーバーは、同じ名前の同一の操作を公開します。godig がインストールされている場合は CLI を優先し、インストールされていない場合のフォールバックとしてホストインスタンスを使用してください。

コマンド

グローバルフラグ (すべてのコマンド): -o/--output table|json|raw|md (デフォルト table — チャットでは -o md を推奨)、--base-url (pkg.go.dev API)、--vuln-base-url (Go 脆弱性データベース、vulns および overview で参照)、--timeout、--log-level debug|info|warn|error|off。これらはすべて GODIG_* 環境変数でも設定可能です。

コマンド引数固有のフラグ目的
overview<path>--versionコンパクトな概要 (メタデータ、バージョン、ライセンス、脆弱性) — まずはここから
search<query>--symbol --limit --filterパッケージを検索 (オプションでシンボルをエクスポートしているものに限定)
package info<path>--module --versionパッケージのメタデータ
package imports<path>--module --versionこのパッケージがインポートするパッケージの一覧 (プレーンリスト)
package doc<path>--module --version --goos --goarch --format md|text|html|markdown完全なパッケージドキュメント (大容量)
package examples<path>--module --version --goos --goarch --symbol実行可能な例 (大容量、--symbol で範囲指定可能)
package licenses<path>--module --versionライセンスファイル、全文 (大容量)
symbol doc<path> <symbol>--module --version --goos --goarch1つのシンボルのシグネチャ + ドキュメント (トークン効率が良い)
symbol examples<path> <symbol>--module --version --goos --goarch1つのシンボルの実行可能な例
symbols<path>--module --version --goos --goarch --limit --filterエクスポートされたシンボルの一覧
module info<path>--versionモジュールのメタデータ
module licenses<path>--versionモジュールのライセンスファイル (大容量)
module readme<path>--versionモジュールの README、完全な Markdown (大容量)
dependencies<path>--versiongo.mod の依存関係: requires / replaces / excludes / go ディレクティブ
packages<path>--version --limit --filterモジュールに含まれるパッケージ
versions<path>--limit --filterすべてのバージョン、新しい順
major-versions<path>--limit --filter --exclude-pseudo別個のモジュールとして存在するメジャーバージョン (v1、v2 …)
imported-by<path>--module --version --limit --filterこのパッケージをインポートしているパッケージ
vulns<path>--version --limit既知の脆弱性 (Go 脆弱性 DB から)
mcp—--transport stdio|http --addr --cache-ttl --cache-sizeMCP サーバーとして実行
version——godig のバージョン / コミット / ビルド日時を表示

godig が MCP サーバーとして動作する場合、上記の各データコマンドは同じ名前の操作として公開されます。

終了コード: 0 成功、1 実行時エラー (ネットワーク、パッケージが見つからない)、2 使用法エラー — 引数またはフラグの欠落/無効 (例: 正でない --limit)、またはサブコマンドなしでコマンドグループが呼び出された場合 (godig package)。2 をチェックすることで、不正な呼び出しと検索失敗を区別できます。

すべてのコマンドの完全な -o md 出力: sample-output.md

ヒント

  • まずは overview から — 1回の呼び出しでコンパクトな概要 (メタデータ、最新 + 最近のバージョン、ライセンスタイプ、脆弱性) が返されます。完全なテキストが必要な場合にのみ、doc/examples/module readme/licenses (大容量) を使用してください。
  • 常に -o md を指定 することで、チャット内で結果が Markdown (表、または生のドキュメント/README) としてレンダリングされます。他の形式もありますが (table デフォルト、json、raw)、ここでは md を推奨します。
  • <path> は完全なインポートパスです (例: github.com/samber/lo) — 位置引数として渡します。
  • --version は特定のモジュールバージョン (v1.5.0、latest、master、main) を固定します。--module はパッケージがどのモジュールに属するかを明確にします。
  • --filter は、Go のブール式を使用してサーバー側でリスト結果を絞り込みます — フィルター構文 を参照してください。
  • --goos/--goarch はドキュメント/シンボルのビルドコンテキストを設定します (例: linux/amd64)。
  • 1つのシンボルだけが必要な場合は、パッケージ全体の package doc/package examples よりも symbol doc/symbol examples を優先してください。

フィルター構文

--filter は、Go の go/constant 式として評価される単一の文字列を受け取ります。変数はパッケージ/モジュールのフィールド名です:

  • Name — パッケージ名
  • Synopsis — 短い説明
  • Licenses — ライセンスタイプの配列

例:

godig search lo --filter 'Name == "lo" && Licenses.Contains("MIT")'

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

samber/golang-benchmark

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.

samber/golang-cli

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.

samber/golang-code-style

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).

samber/golang-concurrency

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.

samber/golang-context

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.

samber/golang-continuous-integration

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.

samber/golang-database

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.

samber/golang-data-structures

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.

samber/golang-dependency-injection

Comprehensive guide for dependency injection (DI) in Golang. Covers why DI matters (testability, loose coupling, separation of concerns, lifecycle management), manual constructor injection, and DI library comparison (google/wire, uber-go/dig, uber-go/fx, samber/do). Use this skill when designing service architecture, setting up dependency injection, refactoring tightly coupled code, managing singletons or service factories, or when the user asks about inversion of control, service containers, or wiring dependencies in Go. For a specific DI library, → See `samber/cc-skills-golang@golang-google-wire`, `samber/cc-skills-golang@golang-uber-dig`, `samber/cc-skills-golang@golang-uber-fx`, or `samber/cc-skills-golang@golang-samber-do` skills.

samber/golang-dependency-management

Dependency management strategies for Golang projects — go.mod management, installing/upgrading packages, Minimal Version Selection, vulnerability scanning, outdated dependency tracking, binary size analysis, Dependabot/Renovate setup, conflict resolution, and go.work workspaces. Use when adding, removing, or upgrading Go dependencies, auditing vulnerabilities, resolving version conflicts, or setting up automated dependency updates.

samber/golang-design-patterns

Idiomatic Golang design patterns — functional options, constructors, error flow and cascading, resource management and lifecycle, graceful shutdown, resilience, architecture, dependency injection, data handling, streaming, and more. Apply when explicitly choosing between architectural patterns, implementing functional options, designing constructor APIs, setting up graceful shutdown, applying resilience patterns, or asking which idiomatic Go pattern fits a specific problem.

samber/golang-documentation

Comprehensive documentation guide for Golang projects, covering godoc comments, README, CONTRIBUTING, CHANGELOG, Go Playground, Example tests, API docs, and llms.txt. Use when writing or reviewing doc comments, documentation, adding code examples, setting up doc sites, or discussing documentation best practices. Triggers for both libraries and applications/CLIs.

samber/golang-error-handling

Idiomatic Golang error handling — creation, wrapping with %w, errors.Is/As, errors.Join, custom error types, sentinel errors, panic/recover, the single handling rule, structured logging with slog, HTTP request logging middleware, and samber/oops for production errors. Built to make logs usable at scale with log aggregation 3rd-party tools. Apply when creating, wrapping, inspecting, or logging errors in Go code. For samber/oops specifics → See `samber/cc-skills-golang@golang-samber-oops` skill; for slog handler ecosystem → See `samber/cc-skills-golang@golang-samber-slog` skill.

samber/golang-google-wire

Compile-time dependency injection in Golang using google/wire — wire.NewSet, wire.Build, wire.Bind (interface→concrete), wire.Struct, wire.Value, wire.InterfaceValue, wire.FieldsOf, cleanup functions, //go:build wireinject injector files, and generated wire_gen.go. Apply when using or adopting google/wire, when the codebase imports `github.com/google/wire`, or when wiring an application graph at compile time via `wire.Build`. For runtime DI with reflection, see `samber/cc-skills-golang@golang-uber-dig` skill.

samber/golang-gopls

Golang semantic code intelligence via `gopls`, the official Go language server — go-to-definition, find references, call/implementation hierarchy, workspace symbol search, package API discovery, diagnostics, safe rename, refactors (extract/inline/fill/rewrite code actions), formatting, and generated tests. Reaches an agent via gopls's own MCP server (`go_*` tools), Claude Code's native `LSP` tool, or the `gopls` CLI. Use when navigating or refactoring Go code — jumping to a definition, finding call sites before a rename, understanding a file's or package's dependencies, running diagnostics after an edit, or extracting/inlining/renaming. Not for the published ecosystem — packages not in your `go.mod`, versions, licenses, importers — → See `samber/cc-skills-golang@golang-pkg-go-dev` skill (`godig`). Not for a whole-tree vulnerability audit → See `samber/cc-skills-golang@golang-security` skill (`govulncheck`).

samber/golang-graphql

Implements GraphQL APIs in Golang using gqlgen or graphql-go. Apply when building GraphQL servers, designing schemas, writing resolvers, handling subscriptions, or integrating GraphQL with existing Go HTTP services. Also apply when the codebase imports `github.com/99designs/gqlgen` or `github.com/graph-gophers/graphql-go`.

samber/golang-grpc

Provides gRPC usage guidelines, protobuf organization, and production-ready patterns for Golang microservices. Use when implementing, reviewing, or debugging gRPC servers/clients, writing proto files, setting up interceptors, handling gRPC errors with status codes, configuring TLS/mTLS, testing with bufconn, or working with streaming RPCs.

samber/golang-how-to

Golang skills orchestrator — always active on any Golang coding, review, debug, or setup task. Reads the task context and loads the most relevant skills from samber/cc-skills-golang, often multiple at once: writing a gRPC service loads golang-grpc + golang-testing + golang-error-handling; debugging a panic loads golang-troubleshooting + golang-safety; auditing security loads golang-security + golang-lint + golang-safety. Also: disambiguates competing clusters when two skills seem to overlap (performance vs benchmark vs troubleshooting, samber/lo vs mo vs ro, DI cluster, safety vs security), and configures the project's agent-config file (CLAUDE.md, AGENTS.md, GEMINI.md, Cursor rules, or Copilot instructions) to force-trigger skills in a project (/golang-how-to configure).

samber/golang-lint

Linting best practices and golangci-lint configuration for Golang projects — running linters, configuring .golangci.yml, suppressing warnings with nolint directives, interpreting lint output, and selecting linters. Use when configuring golangci-lint, asking about lint warnings or nolint suppressions, setting up code quality tooling, or choosing linters. Also use when the user mentions golangci-lint, go vet, staticcheck, or revive.

samber/golang-modernize

Modernize Golang code to use recent language features, standard library improvements, and idiomatic patterns. Trigger proactively when writing or reviewing Go code and old-style patterns are detected, or when encountering a deprecation warning. Also use when the user explicitly asks for modernization, a Go version upgrade, or a CI/tooling refresh.

関連スキル