MCP HubMCP Hub
SKILL·51397A

go-dependency-audit

eduardo-sl
更新日 27 days ago
5 閲覧
69
9
69
GitHubで表示
デザインgeneral

について

このスキルは、Goモジュールの依存関係を監査し、古くなったパッケージの検出、既知の脆弱性の確認、go.modの健全性のレビューを行います。未使用の依存関係の特定、依存関係の品質評価、govulncheckなどのツールを使用した脆弱性スキャンの実行を支援します。go.modの整理、モジュールのアップグレード、またはサードパーティパッケージのリスク評価を行う際にご利用ください。

クイックインストール

Claude Code

推奨
メイン
npx skills add eduardo-sl/go-agent-skills -a claude-code
プラグインコマンド代替
/plugin add https://github.com/eduardo-sl/go-agent-skills
Git クローン代替
git clone https://github.com/eduardo-sl/go-agent-skills.git ~/.claude/skills/go-dependency-audit

このコマンドをClaude Codeにコピー&ペーストしてスキルをインストールします

ドキュメント

Go Dependency Audit

Every dependency you add is code you don't control but are responsible for. Audit ruthlessly.

1. Vulnerability Scanning

govulncheck (official Go tool):

# Install
go install golang.org/x/vuln/cmd/govulncheck@latest

# Scan project
govulncheck ./...

# Scan binary
govulncheck -mode=binary ./cmd/api-server

govulncheck checks against the Go vulnerability database and reports only vulnerabilities that actually affect your code paths — not just transitive deps you never call.

Run this in CI. No exceptions.

Additional scanning:

# Nancy (Sonatype OSS Index)
go list -json -deps ./... | nancy sleuth

# Trivy (container + deps)
trivy fs --scanners vuln .

2. go.mod Hygiene

Check for unused dependencies:

go mod tidy
git diff go.mod go.sum  # any changes = deps were stale

go mod tidy MUST be run before every commit. Add to CI:

go mod tidy
git diff --exit-code go.mod go.sum

No replace directives in committed code:

// ❌ Bad — committed replace directive
replace github.com/foo/bar => ../local-bar

// ✅ Acceptable — in monorepos with workspace
// go.work handles this instead

Exception: temporary replace for bug fixes with a comment and linked issue:

// TODO(#1234): remove after upstream merges fix
replace github.com/foo/bar => github.com/myorg/bar v0.0.0-fix

Verify checksums:

go mod verify

This confirms that downloaded modules match their expected checksums. Failures indicate supply-chain tampering.

3. Dependency Evaluation Criteria

Before adding any dependency, evaluate:

CriterionCheck
MaintenanceLast commit < 6 months? Active issue responses?
PopularityStars/forks alone mean nothing. Usage in production projects matters.
LicenseCompatible with your project? MIT/Apache/BSD preferred.
SizeDoes it pull in 50 transitive deps for one function?
AlternativesCan you do this with stdlib in < 50 lines?
API stabilityIs it v1+? Does it follow semver? Frequent breaking changes?
Test coverageDoes the project have meaningful tests?

The stdlib question:

Go's standard library is excellent. Before adding a dependency, ask: "Can I solve this with net/http, encoding/json, database/sql, text/template, crypto/*, os/exec, etc.?"

If the answer is yes and the code is < 100 lines, write it yourself.

4. Module Version Audit

List all dependencies with versions:

go list -m all

Check for available updates:

go list -m -u all  # shows available updates

Upgrade strategy:

# Update specific module
go get github.com/foo/bar@latest

# Update all direct deps (minor/patch only)
go get -u ./...

# Update all deps including major versions (dangerous)
go get -u -t ./...

ALWAYS run full test suite after updates:

go get github.com/foo/[email protected]
go mod tidy
go test -race ./...

5. Transitive Dependency Analysis

# Why is this module in my dependency tree?
go mod why github.com/some/transitive-dep

# Full dependency graph
go mod graph

# Visual dependency graph (with modgraphviz)
go mod graph | modgraphviz | dot -Tpng -o deps.png

Watch for:

  • 🔴 Transitive deps with known CVEs
  • 🔴 Abandoned transitive deps (no commits in 2+ years)
  • 🟡 Diamond dependency conflicts (two versions of same module)
  • 🟡 Oversized transitive trees (a logging library pulling in gRPC)

6. Go Version Management

// go.mod
module github.com/myorg/myproject

go 1.22  // minimum Go version required

Rules:

  • Set go directive to the minimum version that supports features you use.
  • toolchain directive (Go 1.21+) pins the exact toolchain version.
  • Test against multiple Go versions in CI (at minimum: current and previous).

7. Recommended vs. Avoid

Well-maintained, production-proven packages:

DomainPackage
Logginggo.uber.org/zap, log/slog (stdlib 1.21+)
HTTP Routergithub.com/go-chi/chi, net/http (1.22+ routing)
Configgithub.com/caarlos0/env, github.com/spf13/viper
Testinggithub.com/stretchr/testify, stdlib testing
Databasegithub.com/jackc/pgx, github.com/jmoiron/sqlx
Validationgithub.com/go-playground/validator
UUIDgithub.com/google/uuid
Errorsgo.uber.org/multierr, stdlib errors (1.20+)

Patterns to avoid:

  • ❌ Frameworks that take over main() (Go is not Java Spring)
  • ❌ ORMs that hide SQL (prefer sqlx or raw database/sql)
  • ❌ Code generators you don't understand
  • ❌ Packages with v0.x that have been v0 for 3+ years

Audit Output Format

## Dependency Audit Report

**Module:** github.com/myorg/myproject
**Go version:** 1.22
**Direct deps:** N | **Indirect deps:** M

### 🔴 Vulnerabilities
- CVE-XXXX-YYYY in github.com/foo/[email protected] — upgrade to v1.2.5

### 🟡 Outdated Dependencies
- github.com/foo/bar v1.2.3 → v1.5.0 available (minor)

### 🟢 Observations
- go.mod is clean, no replace directives
- All deps actively maintained

GitHub リポジトリ

eduardo-sl/go-agent-skills
パス: skills/(workflow)/go-dependency-audit
0
FAQ

よくある質問

go-dependency-audit Skillとは何ですか?

go-dependency-audit はeduardo-sl が作成した Claude Skillです。Skillは、Claudeが必要に応じて読み込む指示とリソースをまとめ、追加の指示なしで go-dependency-audit に関連するタスクを実行できるようにします。

go-dependency-audit をインストールするには?

このページのインストールコマンドを使用してください。go-dependency-audit をプラグインとして Claude Code に追加するか、リポジトリを skills ディレクトリにクローンし、Claudeを再起動してSkillを読み込みます。

go-dependency-audit はどのカテゴリに属しますか?

go-dependency-audit は デザイン カテゴリに属します。

go-dependency-audit は無料で利用できますか?

はい。go-dependency-audit は AIMCP に掲載されており、無料でインストールできます。

関連スキル

executing-plans
デザイン

executing-plansスキルは、完全な実装計画があり、それを管理されたバッチでレビューチェックポイントを設けながら実行する場合に使用します。このスキルは計画を読み込んで批判的にレビューした後、小さなバッチ(デフォルトは3タスク)でタスクを実行し、各バッチの間に進捗状況を報告してアーキテクトのレビューを受けます。これにより、品質管理チェックポイントが組み込まれた体系的な実装が保証されます。

スキルを見る
requesting-code-review
デザイン

このスキルは、コードレビュアーサブエージェントを起動し、処理を進める前に要件に対してコード変更を分析します。タスク完了後、主要な機能の実装後、またはmainブランチへのマージ前などに使用すべきです。このレビューは、現在の実装と元の計画を比較することで、問題を早期に発見するのに役立ちます。

スキルを見る
connect-mcp-server
デザイン

このスキルは、開発者がHTTP、stdio、またはSSEトランスポートを使用してMCPサーバーをClaude Codeに接続するための包括的なガイドを提供します。GitHub、Notion、カスタムAPIなどの外部サービスを統合するためのインストール、設定、認証、セキュリティについて解説しています。MCP統合のセットアップ、外部ツールの設定、またはClaudeのModel Context Protocolを扱う際にご利用ください。

スキルを見る
web-cli-teleport
デザイン

このスキルは、タスク分析に基づいて開発者がClaude Code WebとCLIインターフェースの選択を支援し、これらの環境間でのシームレスなセッションテレポーテーションを可能にします。Web、CLI、モバイル環境を切り替える際のセッション状態とコンテキストを管理することで、ワークフローを最適化します。様々な段階で異なるツールを必要とする複雑なプロジェクトにご活用ください。

スキルを見る