Skip to content
Back to skills

Database Hoangnguyen0403 Agent Skills Standar

ASecurity

Standards for database interaction, connection pooling, and repository patterns in Golang.

  • 666 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added February 8, 2026
databasesgosqldatabaseperformance

Security analysis

A100/100

Scanned February 12, 2026

npx -y skills add majiayu000/claude-skill-registry --skill database-hoangnguyen0403-agent-skills-standar --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Database Hoangnguyen0403 Agent Skills Standar?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Database Hoangnguyen0403 Agent Skills Standar
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/majiayu000-database-hoangnguyen0403-agent-skills-standar/badge)](https://www.skillsdirectory.com/skills/majiayu000-database-hoangnguyen0403-agent-skills-standar)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: Database
description: Standards for database interaction, connection pooling, and repository patterns in Golang.
metadata:
  labels: [golang, database, sql, postgres, repository]
  triggers:
    files: ['internal/adapter/repository/**']
    keywords: [database, sql, postgres, gorm, sqlc, pgx]
---

# Golang Database Standards

## **Priority: P0 (CRITICAL)**

## Principles

- **Prefer Raw SQL/Builders over ORMs**: Go structs map well to SQL. ORMs (GORM) can obscure performance. Recommended: `sqlc` (type-safe SQL generation).
- **Repository Pattern**: Abstract DB access behind interfaces in `internal/port/` (e.g., `UserRepository`).
- **Connection Pooling**: Always configure `SetMaxOpenConns`, `SetMaxIdleConns`, `SetConnMaxLifetime`.
- **Transactions**: Logic requiring ACID MUST use transactions. Pass `context.Context` everywhere.

## Drivers

- **PostgreSQL**: `jackc/pgx` (Prefer `pgx/v5` for performance and features).
- **MySQL**: `go-sql-driver/mysql`.
- **SQLite**: `mattn/go-sqlite3` or `modernc.org/sqlite` (pure Go).

## Anti-Patterns

- **Global DB Connection**: Do not use global `var db *sql.DB`. Inject it.
- **Ignoring Context**: Always use `db.QueryContext` or `db.ExecContext` to handle timeouts.
- **Leaking Rows**: ALWAYS `defer rows.Close()` and check `rows.Err()`.

## References

- [Repository Pattern Implementation](references/repository-pattern.md)
- [Connection Tuning](references/connection-tuning.md)

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.