golang-database
Implement or review Go relational-database code using database/sql, pgx, sqlx, or an existing data layer.
Skill by reagin
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/reagin-golang-database
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: backend, data
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/golang-database
What's inside
- Skill name
golang-database- Description
- Implement or review Go relational-database code using database/sql, pgx, sqlx, or an existing data layer. Use for query safety, scanning and nullability, transactions, pools, migrations, performance, and database tests while preserving the project's selected datastore and library.
- License
- MIT
- Instructions
- 86 lines in SKILL.md · view on GitHub
Files (3)
- SKILL.md
- query-and-scan.md · references/
- transactions-and-tests.md · references/
SKILL.md (first lines)
# Go Database Engineering Prioritize correctness at transaction and trust boundaries. Match the project's database, driver, migration system, generated code, and error conventions. ## Establish context Before changing code: 1. Read go.mod and the existing database initialization, repository/query layer, schema, migrations, and tests. 2. Identify the database engine and version, driver placeholder syntax, transaction semantics, and deployment migration policy. 3. Trace the requested operation from validated input through query execution and result mapping. 4. Determine whether the public behavior includes not-found, conflict, retry, or idempotency guarantees. Do not switch between database/sql, pgx, sqlx, generated queries, or an ORM merely to apply a preferred style. ## Query safety and correctness - Pass data values through driver parameters. Never concatenate untrusted values into SQL. - Placeholders cannot represent identifiers, keywords, sort direction, or whole clauses. Map those choices from a fixed allowlist to known SQL fragments. - Build dynamic filters so each generated clause and argument stays paired. Test empty and multi-value cases. - Propagate context to query and transaction calls, with deadlines set at an appropriate request or job boundary. - Close rows, then check rows.Err after iteration. Check errors from scanning, commit, rollback when relevant, and affected-row expectations. - Model SQL NULL deliberately with nullable types, pointers, or domain-specific conversion. Do not silently collapse NULL into a meaningful zero value. - Preserve error identity needed by callers while avoiding driver details and secrets in client-facing messages. Use database-specific features only when they materially improve the requirement and the project accepts the portability tradeoff. When implementing a query rather than reviewing its policy, read [query and scan recipes](references/query-and-scan.md) for concrete `database/sql`, `sqlx`, and pgx call shapes. Follow only the branch already selected by `go.mod`. ## Transactions Keep a transaction around one coherent business invariant, not an entire request by default. A safe shape is: 1. Begin with context and an intentional isolation level when the default is insufficient. 2. Arrange rollback on every pre-commit exit; tolerate the expected already-completed result. 3. Run every participating query through the transaction handle. 4. Lock or use atomic statements when a read-modify-write invariant would otherwise race. 5. Commit once, and return a commit failure. Do not add blind retries. Retry only errors documented as transient by the selected database or driver, and only when the complete operation is idempotent or can be safely replayed. Bound attempts and respect context cancellation. Read [transaction and test recipes](references/transactions-and-tests.md) when the change crosses a transaction boundary, depends on locking or isolation, or needs a database-backed test. ## Connections, migrations, and performance sql.DB and most driver pools represent concurrency-safe pools, not one connection. Create and share the pool at application startup, verify connectivity separately when startup must fail fast, and close it during shutdown. Tune pool size, lifetime, and idle behavior from database capacity and observed wait metrics. Avoid universal numeric settings. Measure before changing queries or indexes, and inspect an execution plan for the actual engine and representative data. For migrations: - use the repository's migration tool and naming convention; - make rollout compatibility explicit when old and new application versions overlap; - separate destructive cleanup from the deployment that stops using the old schema; - account for engine-specific locking and transactional-DDL behavior; - never run destructive production migrations merely because a local migration succeeded. Prefer keyset pagination for large, stable ordered datasets when offset cost or consistency is a demonstrated concern. Batch sizes and bulk-loading techniques should be measured, not copied as fixed thresholds. ## Testing strategy Use the narrowest test that proves the behavior: - unit tests for domain logic around a small repository interface; - query-shape tests only when they add signal; - integration tests against the actual database engine for SQL syntax, constraints, isolation, locking, migrations, and driver behavior. Cover empty results, NULL values, duplicate/conflict paths, cancellation, partial iteration errors, transaction rollback, and concurrent invariants where applicable. Keep test data deterministic and isolate parallel tests. ## Review checklist - Values are parameterized and dynamic identifiers are allowlisted. - Context reaches every blocking database operation. - Rows, transactions, and pools have explicit ownership and cleanup. - Not-found and constraint failures are classified without brittle string matching when the driver exposes structured errors. - Transaction boundaries enforce the stated invariant. - Queries do not assume an unordered result is stable. - Pool and index changes are justified by evidence. - Schema and code remain compatible throughout deployment. - Logs and errors do not expose credentials, raw sensitive queries, or personal data. Run the repository's existing database and Go checks, including focused integration tests when the changed behavior depends on the real engine.
From reagin/agent-skills, MIT.
More from reagin/agent-skills
- 0.565score
golang-continuous-integration
reagin
Create, improve, or simplify GitHub Actions for a Go repository, including tests, linting, caching, matrices, and release gates.
SkillAFreshness: AClaude Code +9 - 0.565score
frontend-apple-design
reagin
Design or review Apple-inspired web interfaces with clear hierarchy, consistent typography and materials, restrained motion, and accessible interactions.
SkillAFreshness: AClaude Code +9 - 0.559score
frontend-ui-refinement
reagin
Refine existing web interfaces and simplify their behavioral tests.
SkillAFreshness: AClaude Code +9 - 0.559score
frontend-react-file-structure
reagin
Use for React TypeScript file-structure work involving ownership or folders for new or moved files, multi-file components with narrow public entries, page and…
SkillAFreshness: AClaude Code +9 - 0.529score
golang-context
reagin
Design or repair context propagation, cancellation, deadlines, and request-scoped values in Go APIs.
SkillBFreshness: BClaude Code +9 - 0.529score
golang-design-patterns
reagin
Select or review idiomatic Go patterns for constructors, configuration, lifecycle, resilience, streaming, data flow, and package boundaries.
SkillBFreshness: BClaude Code +9 - 0.529score
golang-benchmark
reagin
Design, run, and interpret Go benchmarks, profiles, traces, and compiler diagnostics.
SkillBFreshness: BClaude Code +9 - 0.529score
golang-cli
reagin
Design or review the framework-independent behavior and architecture of Go command-line applications: command UX, flags, configuration, output and exit…
SkillBFreshness: BClaude Code +9 - 0.529score
golang-concurrency
reagin
Design or review concurrent Go code involving goroutines, channels, locks, atomics, worker pools, or race and leak symptoms.
SkillBFreshness: BClaude Code +9 - 0.529score
golang-error-handling
reagin
Design or review Go error creation, wrapping, inspection, aggregation, logging boundaries, transport mapping, and panic recovery.
SkillBFreshness: BClaude Code +9 - 0.529score
golang-gopls
reagin
Use gopls through an available host LSP integration, MCP surface, or CLI for semantic Go navigation, references, implementations, call hierarchy, diagnostics…
SkillBFreshness: BClaude Code +9 - 0.526score
golang-data-structures
reagin
Choose or review Go collections and memory representations when access patterns, ownership, copying, allocation, or generic APIs matter.
SkillBFreshness: BClaude Code +9
Signals
- Stars
- 0
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Aug 25, 2026 (2 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/reagin/agent-skills
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from reagin
- 0.565score
frontend-apple-design
reagin
Design or review Apple-inspired web interfaces with clear hierarchy, consistent typography and materials, restrained motion, and accessible interactions.
SkillAFreshness: AClaude Code +9 - 0.565score
golang-continuous-integration
reagin
Create, improve, or simplify GitHub Actions for a Go repository, including tests, linting, caching, matrices, and release gates.
SkillAFreshness: AClaude Code +9 - 0.559score
frontend-react-file-structure
reagin
Use for React TypeScript file-structure work involving ownership or folders for new or moved files, multi-file components with narrow public entries, page and…
SkillAFreshness: AClaude Code +9 - 0.559score
frontend-ui-refinement
reagin
Refine existing web interfaces and simplify their behavioral tests.
SkillAFreshness: AClaude Code +9 - 0.529score
golang-context
reagin
Design or repair context propagation, cancellation, deadlines, and request-scoped values in Go APIs.
SkillBFreshness: BClaude Code +9 - 0.529score
golang-concurrency
reagin
Design or review concurrent Go code involving goroutines, channels, locks, atomics, worker pools, or race and leak symptoms.
SkillBFreshness: BClaude Code +9
Cite this page
golang-database skill. Agent Mart. https://agentmart.dev/skills/reagin-golang-database (last updated 2026-10-24)