Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add daibang123a/golang-agent-skills --skill database-patternsgit clone --depth 1 https://github.com/daibang123a/golang-agent-skillsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/daibang123a/golang-agent-skills/database-patterns)<a href="https://agentmods.dev/skills/daibang123a/golang-agent-skills/database-patterns"><img src="https://agentmods.dev/badge/skills/daibang123a/golang-agent-skills/database-patterns/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/daibang123a/golang-agent-skills/database-patterns"><img src="https://agentmods.dev/badge/skills/daibang123a/golang-agent-skills/database-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00087 | $0.02589 |
| Opus 5 | $0.00044 | $0.01295 |
| Sonnet 5 | $0.00017 | $0.00518 |
| Haiku 4.5 | $0.00009 | $0.00259 |
Grade A, and why
database-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 304 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Go Database Patterns
Production-grade database access patterns for Go. Covers connection management, query patterns, transactions, migrations, and testing.
How It Works
- Agent identifies the database need (setup, query, migration, optimization)
- Agent applies the appropriate pattern using the right abstraction level
- Agent ensures proper connection management, error handling, and resource cleanup
- Agent generates tests with appropriate mocking or containerized databases
Rules
1. Connection Management (Critical)
| # | Rule | Description |
|---|---|---|
| CM1 | Configure pool limits | Set MaxOpenConns, MaxIdleConns, ConnMaxLifetime, ConnMaxIdleTime. |
| CM2 | Always pass context | Use QueryContext, ExecContext, PrepareContext — never the non-context variants. |
| CM3 | Close rows | Always defer rows.Close() immediately after Query(). |
| CM4 | Ping on startup | Call db.PingContext(ctx) to verify the connection before serving traffic. |
| CM5 | Use connection string builder | Don't concatenate connection strings. Use the driver's config builder. |
func Connect(ctx context.Context, dsn string) (*sql.DB, error) {
db, err := sql.Open("pgx", dsn)
if err != nil {
return nil, fmt.Errorf("opening database: %w", err)
}
// Connection pool settings
db.SetMaxOpenConns(25) // Max concurrent connections
db.SetMaxIdleConns(10) // Keep idle connections ready
db.SetConnMaxLifetime(30 * time.Minute) // Recycle connections
db.SetConnMaxIdleTime(5 * time.Minute) // Close idle connections
// Verify connection
if err := db.PingContext(ctx); err != nil {
db.Close()
return nil, fmt.Errorf("pinging database: %w", err)
}
return db, nil
}
2. Repository Pattern (Critical)
| # | Rule | Description |
|---|---|---|
| RP1 | Define repository interface at the consumer | The service package defines what it needs from the repository. |
| RP2 | Accept context as first parameter | Every repository method takes context.Context. |
| RP3 | Return domain types, not DB types | Map between sql.NullString and *string at the repository boundary. |
| RP4 | Handle sql.ErrNoRows | Map to a domain-specific ErrNotFound. Don't leak sql.ErrNoRows. |
| RP5 | Use prepared statements for repeated queries | db.PrepareContext() once, then reuse. |
What ships with it
3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 9d ago First seen · 304 lines · 87 tokens per session scan A 541e3a81f1c2
database-patterns is a skill published in the GitHub repository daibang123a/golang-agent-skills (2 stars, last pushed 6mo ago), licensed MIT. It adds 87 tokens to every session and 2,589 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
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…
golang-samber-hot
In-memory caching in Golang using samber/hot — eviction algorithms (LRU, LFU, TinyLFU, W-TinyLFU, S3FIFO, ARC, TwoQueue, SIEVE, FIFO), TTL, cache loaders, sharding, stale-while-revalidate, missing key caching, and Prometheus metrics. Apply when using or adopting samber/hot, when the codebase imports…
vendor-update
Upgrade Go/Node.js vendor dependencies and sync tool versions. Use whenever the user says "upgrade dependencies", "update vendors", "vendor update", "run vendor-upgrade", "bump dependencies", "update packages", or asks to run the vendor-update Make target. This skill also checks scripts/build/version.mk after…
compiling
Compile and build the SkyWalking BanyanDB project. Use when the user asks to compile, build, or generate code for this project.
neo4j-driver-go-skill
Covers the Neo4j Go Driver v6 — driver lifecycle, ExecuteQuery, managed and explicit transactions, session config, error handling, data type mapping, and connection tuning. Use when writing Go code that connects to Neo4j, setting up NewDriver or ExecuteQuery, debugging sessions/transactions/result handling, or working…
go-database
Database patterns for Go services: database/sql, connection management, transactions, migrations, query builders, and ORM usage (sqlc, GORM, ent). Use when: "database access", "SQL query", "connection pool", "transactions", "database migration", "sqlc", "GORM", "ent", "prepared statement", "repository pattern". Not…