data-access-patterns
Installation
SKILL.md
Data Access Patterns Skill
Use this skill when writing or modifying database access code in internal/models/.
This project uses explicit SQL over ORMs for performance, readability, and fine-grained control.
Core Principles
- No ORM: Use
database/sqldirectly. Do NOT introduce or use any ORM. - PostgreSQL Driver: The project uses
github.com/lib/pq(imported ininternal/db/db.go). - Raw SQL: Write explicit, readable SQL queries. Use PostgreSQL-specific features (JSONB, ON CONFLICT) and
$1, $2placeholders. - Transactional Integrity: Use
*sql.Txwhen multiple operations must complete together or fail (atomicity). - Separation of Concerns: Keep database models and access logic in
internal/models/. Repository functions should focus on data retrieval and persistence.