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.5 | $0.00035 | $0.01036 |
| Sonnet 5.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 2mo 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.
- 2mo 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 8mo ago), licensed MIT. It adds 87 tokens to every session and 2,589 once invoked, about $0.0003 per session on Opus 5.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.
database-patterns compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| database-patternsdaibang123a/golang-agent-skills | Skill | 2 | 8mo ago | MIT | A | 87 | Claude Code, Codex |
| golang-databasesamber/cc-skills-golang | Skill | 3.8k | 5d ago | MIT | A | 99 | Claude Code |
| golang-samber-hotsamber/cc-skills-golang | Skill | 3.8k | 5d ago | MIT | A | 122 | Claude Code |
| vendor-updateapache/skywalking-banyandb | Skill | 355 | yesterday | Apache-2.0 | A | 95 | Claude Code |
| compilingapache/skywalking-banyandb | Skill | 355 | yesterday | Apache-2.0 | A | 31 | Claude Code |
| neo4j-driver-go-skillneo4j-contrib/neo4j-skills | Skill | 120 | 4d ago | MIT | A | 143 | Claude Code |
| sql-query-performancemakifbaysal/tasktrooper | Skill | 120 | 16d ago | Apache-2.0 | A | 35 | Claude Code, Codex |