Gorm query patterns

From saifoelloh/golang-best-practices-skill · View interactive version

Gorm query patterns is an AI agent skill from the GitHub repository saifoelloh/golang-best-practices-skill. GORM ORM query pattern review for PostgreSQL. Use when reviewing or writing Go database code using GORM — covers N+1, Preload vs Joins, transactions, error checking, Save vs Updates, and context propagation. Trigger on any GORM method usage.

How to use this skill

Skill file

GORM Query Patterns

Expert-level review of GORM ORM usage in Go services backed by PostgreSQL. Covers correctness, safety, and idiomatic patterns.

When to Apply

Use this skill when:

Rule Categories

| Priority | Count | Focus |

|---|---|---|

| Critical | 3 | SQL injection, silent errors, partial writes |

| High | 5 | N+1, First vs Find, Save vs Updates, context, column selection |

| Medium | 3 | Scopes, pagination, association upserts |

Rules Covered (11 total)

Critical Issues (3)

High-Impact Patterns (5)

Medium Improvements (3)

Trigger Phrases

Related Skills

Output Format

## Critical Issues Found: X

### [Rule ID] (File: repository.go, approx. line Y)
**Issue**: Brief description
**Fix**: Suggested correction
**Example**:

// Corrected code here


## High-Impact Patterns: X
## Medium Improvements: X
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.