gorm-sql-query-performance

gorm-sql-query-performance is a skill for Claude Code, Codex from saifoelloh/golang-best-practices-skill. It costs 61 tokens per session (628 once invoked), scanned A, original, MIT.

A review guide for improving database queries written with GORM, a Go library for working with databases, and PostgreSQL, a relational database. It covers slow queries, indexes, repeated queries, connection settings, and large data reads.

In plain words
What is it for?
Use it to review GORM repository code, investigate slow requests, design PostgreSQL indexes, fix N+1 queries, tune connection pools, and process large datasets in batches.
Why use it?
It helps find common causes of slow endpoints and overloaded databases before they become production problems. It gives developers concrete checks for query plans, missing indexes, and inefficient data loading.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to review GORM repository code, investigate slow requests, design PostgreSQL indexes, fix N+1 queries, tune connection pools, and process large datasets in batches.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/saifoelloh/golang-best-practices-skill/query-performance
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 saifoelloh/golang-best-practices-skill --skill query-performance
Clone the repo
git clone --depth 1 https://github.com/saifoelloh/golang-best-practices-skill

Made for: Claude Code, Codex.

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 gorm-sql-query-performance

README.md
[![agentmods](https://agentmods.dev/badge/skills/saifoelloh/golang-best-practices-skill/query-performance/github.svg)](https://agentmods.dev/skills/saifoelloh/golang-best-practices-skill/query-performance)
Your own site
<a href="https://agentmods.dev/skills/saifoelloh/golang-best-practices-skill/query-performance"><img src="https://agentmods.dev/badge/skills/saifoelloh/golang-best-practices-skill/query-performance/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 gorm-sql-query-performance

Your own site · 80×15
<a href="https://agentmods.dev/skills/saifoelloh/golang-best-practices-skill/query-performance"><img src="https://agentmods.dev/badge/skills/saifoelloh/golang-best-practices-skill/query-performance.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 61 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 628 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.
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.00061 $0.00628
Opus 5 $0.00030 $0.00314
Sonnet 5 $0.00012 $0.00126
Haiku 4.5 $0.00006 $0.00063

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

Security

Grade A, and why

gorm-sql-query-performance 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 12d 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.

query-performance/SKILL.md · 68 lines

What it actually says

Query Performance

Expert-level performance review for GORM + PostgreSQL queries. Detects N+1 patterns, missing indexes, connection pool misconfigurations, and memory-inefficient data fetching.

When to Apply

Use this skill when:

  • An endpoint is slow or degrading under load
  • Reviewing repository code for N+1 query patterns
  • Designing indexes for new tables or query patterns
  • Investigating connection pool exhaustion
  • Processing large datasets in background jobs

Rule Categories

Priority Count Focus
Critical 2 N+1 queries, unindexed foreign keys
High 3 EXPLAIN ANALYZE, connection pool, batch processing
Medium 2 COUNT vs len(), partial indexes

Rules Covered (7 total)

Critical Issues (2)

  • critical-n-plus-one — Detect and eliminate N+1 query patterns using Preload
  • critical-unindexed-fk — Index foreign keys and all WHERE clause columns

High-Impact Patterns (3)

  • high-explain-analyze — Use EXPLAIN (ANALYZE, BUFFERS) before declaring a query optimized
  • high-connection-pool — Configure connection pool parameters explicitly for production
  • high-find-in-batches — Use FindInBatches for large dataset processing

Medium Improvements (2)

  • medium-count-query — Use db.Count instead of len() on full fetch
  • medium-partial-index — Use partial indexes for filtered queries on large tables

Trigger Phrases

  • "Why is this query slow?"
  • "Optimize this query"
  • "Check for N+1"
  • "Add an index"
  • "EXPLAIN output"
  • "Performance issue"
  • "Connection pool"
  • "Process large dataset"
Files

What ships with it

7 files 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. 12d ago First seen · 68 lines · 61 tokens per session scan A 9c07c0c4f8e3

Subscribe to this mod's changes

gorm-sql-query-performance is a skill published in the GitHub repository saifoelloh/golang-best-practices-skill (15 stars, last pushed 6mo ago), licensed MIT. It adds 61 tokens to every session and 628 once invoked, about $0.0003 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

multitenant

Architecture multitenant avec approche tiered (Shared/Dedicated Schema/DB), RBAC/ABAC, field-level encryption. Use when working with multitenant applications, tenant isolation, data segregation.

TheBeardedBearSAS/claude-craft · 0 tokens

postgres-drizzle

Proactively apply when creating APIs, backends, or data models. Triggers on PostgreSQL, Postgres, Drizzle, drizzle-orm, drizzle-kit, database, schema, pgTable, tables, columns, indexes, queries, migrations, ORM, relations, relational queries, joins, transactions, SQL, connection pooling, PgBouncer, N+1, JSONB, RLS…

ccheney/robust-skills · 119 tokens

testing-paperclip

Paperclip-Testing-Strategie — Vitest, Plugin-Test-Harness aus @paperclipai/plugin-sdk/testing, echte Postgres-Integration-Tests, Cross-Tenant-Isolation. Verwenden Sie dies beim Schreiben oder Reviewen von Paperclip-Tests.

TheBeardedBearSAS/claude-craft · 57 tokens

database-management

Standards for SQLAlchemy async models, PostgreSQL indexing, UTC datetimes, and Alembic migrations.

aps08/fullstack-clean-architecture · 25 tokens

postgres-patterns

PostgreSQL database patterns for query optimization, schema design, indexing, and security. Based on Supabase best practices.

emilioforrer/go-stack · 28 tokens

alloydb-basics

Manages clusters, instances, and backups for AlloyDB for PostgreSQL, and integrates with AlloyDB Model Context Protocol (MCP) tools for automated database operations. Use when creating, configuring, or administering AlloyDB databases. Do NOT use for general PostgreSQL instances (e.g. Cloud SQL) or other GCP databases.

google/skills · 72 tokens