golang-database-patterns

golang-database-patterns is a skill for Claude Code from bobmatnyc/claude-mpm-skills. It costs 26 tokens per session (8,944 once invoked), scanned A, original, MIT.

Guidance for connecting Go programs to databases using SQL libraries, PostgreSQL drivers, schema migration tools, and repository interfaces. A migration records database-structure changes so they can be applied consistently across environments.

In plain words
What is it for?
Use it when building create, read, update, and delete operations, web-service data layers, database migrations, connection pools, or mock-based tests.
Why use it?
It helps developers build data access code that is easier to test and maintain. It also addresses connection management, concurrent access, transactions, and changes to the database structure.

Skill for Claude Code

Written for Claude Code: disable-model-invocation in frontmatter. Also seen: positional $N argument.

not rated 74repo 1mo ago A scan Socket: passSnyk: passSkillSpector: pass 26 tokens original MIT

Good fit Use it when building create, read, update, and delete operations, web-service data layers, database migrations, connection pools, or mock-based tests.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/bobmatnyc/claude-mpm-skills/golang-database-patterns
Install

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.

Any agent
npx skills add bobmatnyc/claude-mpm-skills --skill golang-database-patterns
Clone the repo
git clone --depth 1 https://github.com/bobmatnyc/claude-mpm-skills

Made for: Claude Code.

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

agentmods badge for golang-database-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/bobmatnyc/claude-mpm-skills/golang-database-patterns/github.svg)](https://agentmods.dev/skills/bobmatnyc/claude-mpm-skills/golang-database-patterns)
Your own site
<a href="https://agentmods.dev/skills/bobmatnyc/claude-mpm-skills/golang-database-patterns"><img src="https://agentmods.dev/badge/skills/bobmatnyc/claude-mpm-skills/golang-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.

agentmods 80×15 button for golang-database-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/bobmatnyc/claude-mpm-skills/golang-database-patterns"><img src="https://agentmods.dev/badge/skills/bobmatnyc/claude-mpm-skills/golang-database-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 26 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 8,944 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • Socket pass 18 May 2026
  • Snyk pass 18 May 2026
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00026 $0.08944
Opus 5 $0.00013 $0.04472
Sonnet 5 $0.00005 $0.01789
Haiku 4.5 $0.00003 $0.00894

Measured 11d ago against content hash ec5a94efe28b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

golang-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 11d 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.

toolchains/golang/golang-database-patterns/SKILL.md · 1,306 lines

How it starts

The opening of the file, as written. The whole thing — 1,306 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Go Database Patterns

Overview

Go's database ecosystem provides multiple layers of abstraction for SQL database integration. From the standard library's database/sql to enhanced libraries like sqlx and PostgreSQL-optimized pgx, developers can choose the right tool for their performance and ergonomics needs.

Key Features:

  • 🔌 database/sql: Standard interface for any SQL database
  • 🚀 sqlx: Convenience methods with struct scanning and named queries
  • 🐘 pgx: PostgreSQL-native driver with maximum performance
  • 📦 Repository Pattern: Interface-based data access for testability
  • 🔄 Migrations: Schema versioning with golang-migrate
  • Connection Pooling: Production-ready connection management
  • 🔒 Transaction Safety: Context-aware transaction handling

When to Use This Skill

Activate this skill when:

  • Building CRUD operations with type safety
  • Implementing data access layers for web services
  • Managing database schema evolution across environments
  • Optimizing database connection pooling for production
  • Testing database code with mock repositories
  • Handling concurrent database access patterns
  • Migrating from ORMs to SQL-first approaches
  • Integrating PostgreSQL-specific features (COPY, LISTEN/NOTIFY)

Core Database Libraries

Decision Tree: Choosing Your Database Library

┌─────────────────────────────────────┐
│ What database are you using?       │
└──────────────┬──────────────────────┘
               │
    ┌──────────┴──────────┐
    │                     │
PostgreSQL            Other SQL DB
    │                     │
    ▼                     ▼
┌─────────────────┐   Use database/sql
│ Need max perf?  │   + sqlx for convenience
└─────┬───────────┘
      │
   ┌──┴──┐
  Yes    No
   │      │
  pgx   sqlx + pq driver

Use database/sql when:

  • Working with any SQL database (MySQL, SQLite, PostgreSQL, etc.)
  • Need database portability
  • Want standard library stability with no dependencies

Use sqlx when:

  • Want convenience methods (Get, Select, StructScan)
  • Need named parameter queries
  • Using IN clause expansion
  • Prefer less boilerplate than database/sql

Read the full file on GitHub · 1,306 lines

Files

What ships with it

1 file 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.

Changes

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.

  1. 11d ago First seen · 1,306 lines · 26 tokens per session scan A ec5a94efe28b

Subscribe to this mod's changes

golang-database-patterns is a skill published in the GitHub repository bobmatnyc/claude-mpm-skills (74 stars, last pushed 1mo ago), licensed MIT. It adds 26 tokens to every session and 8,944 once invoked, about $0.0001 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-30.

Related

Other skills, from other repositories

drizzle-orm

Use when modeling data or querying with Drizzle ORM in TypeScript — pgTable schema in .ts, type-safe select/insert/relational queries, drizzle-kit migrations. NOT Prisma Client or schema.prisma (that is prisma-orm), NOT ORM-agnostic migration strategy (that is db-migrations), NOT Postgres engine tuning or EXPLAIN…

ericrisco/rsc-harness · 96 tokens

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…

samber/cc-skills-golang · 99 tokens

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…

samber/cc-skills-golang · 122 tokens

sq

Guides use of the sq CLI to query SQL databases and tabular files with SLQ (sq's jq-like query language) or native SQL, manage sources, choose output formats, and run inspect, diff, and table commands. Use when the user mentions sq, SLQ, wrangling CSV/Excel/JSON/DB data, cross-source joins, or command-line data…

neilotoole/sq · 89 tokens

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…

apache/skywalking-banyandb · 95 tokens

database-patterns

Database design and migration patterns for Alembic migrations, schema design (SQL/NoSQL), and database versioning. Use when creating migrations, designing schemas, normalizing data, managing database versions, or handling schema drift.

yonatangross/orchestkit · 49 tokens