go-dependency-audit
Skill72 starsChanged 4 months agoMITView on GitHub
Audit Go module dependencies: detect outdated packages, check for known vulnerabilities, review go.mod hygiene, identify unused or redundant deps, and evaluate dependency quality. Use when auditing dependencies, checking for CVEs, cleaning up go.mod, upgrading modules, or evaluating third-party packages. Trigger examples: "check dependencies", "audit deps", "go.mod review", "update modules", "vulnerability scan", "govulncheck". Not for: code-level security (go-security-audit), architecture review (go-architecture-review).
- Installs packages
In this repository36 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/go-skills.mdcCursor rule
- go-api-designSkill
- go-architecture-reviewSkill
- go-cliSkill
- go-dependency-injectionSkill
- go-design-patternsSkill
- go-graphqlSkill
- go-grpcSkill
- go-interface-designSkill
- go-openapiSkill
- go-project-layoutSkill
- go-code-reviewSkill
- go-coding-standardsSkill
- go-contextSkill
- go-data-structuresSkill
- go-documentationSkill
- go-error-handlingSkill
- go-modernizeSkill
- go-databaseSkill
- go-concurrency-reviewSkill
- go-defensive-codingSkill
- go-observabilitySkill
- go-performance-reviewSkill
- go-security-auditSkill
- go-troubleshootingSkill
- go-test-qualitySkill
- go-test-table-drivenSkill
- git-commitSkill
- go-binary-sizeSkill
- go-ciSkill
- go-refactoringSkill
- go-semantic-toolsSkill
- go-skills-routerSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 6 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 23
Every dependency you add is code you don't control but are responsible for.
- Distinctive: line 45
Run this in CI. No exceptions.
- Distinctive: line 101
Before adding any dependency, evaluate:
- Distinctive: line 119
If the answer is yes and the code is < 100 lines, write it yourself.
- Distinctive: line 148
ALWAYS run full test suite after updates:
- Distinctive: line 187
Test against multiple Go versions in CI (at minimum: current and previous).
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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-servergovulncheck 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 stalego mod tidy MUST be run before every commit. Add to CI:
go mod tidy
git diff --exit-code go.mod go.sumNo 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 insteadException: 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-fixVerify checksums:
go mod verifyThis confirms that downloaded modules match their expected checksums. Failures indicate supply-chain tampering.
3. Dependency Evaluation Criteria
Before adding any dependency, evaluate:
| Criterion | Check |
| Maintenance | Last commit < 6 months? Active issue responses? |
| Popularity | Stars/forks alone mean nothing. Usage in production projects matters. |
| License | Compatible with your project? MIT/Apache/BSD preferred. |
| Size | Does it pull in 50 transitive deps for one function? |
| Alternatives | Can you do this with stdlib in < 50 lines? |
| API stability | Is it v1+? Does it follow semver? Frequent breaking changes? |
| Test coverage | Does 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 allCheck for available updates:
go list -m -u all # shows available updatesUpgrade 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/bar@v1.5.0
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.pngWatch 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 requiredRules:
- Set
godirective to the minimum version that supports features you use. toolchaindirective (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:
| Domain | Package |
| Logging | go.uber.org/zap, log/slog (stdlib 1.21+) |
| HTTP Router | github.com/go-chi/chi, net/http (1.22+ routing) |
| Config | github.com/caarlos0/env, github.com/spf13/viper |
| Testing | github.com/stretchr/testify, stdlib testing |
| Database | github.com/jackc/pgx, github.com/jmoiron/sqlx |
| Validation | github.com/go-playground/validator |
| UUID | github.com/google/uuid |
| Errors | go.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
sqlxor rawdatabase/sql) - ❌ Code generators you don't understand
- ❌ Packages with
v0.xthat 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/bar@v1.2.3 — 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 maintainedDoes it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

