gorm

gorm is a skill for Claude Code, Codex from fanqingxuan/awesome-skills. It costs 209 tokens per session (2,816 once invoked), scanned A, original, MIT.

A development guide for GORM, a Go library that maps program data to database records and supports database operations.

In plain words
What is it for?
Use it to define models and schemas, connect to databases, perform create/read/update/delete operations, query data, manage relationships, run migrations, and add hooks.
Why use it?
It provides consistent examples for the traditional GORM API and avoids mixing them with the library's generic API.

Skill for Claude CodeCodex

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

Good fit Use it to define models and schemas, connect to databases, perform create/read/update/delete operations, query data, manage relationships, run migrations, and add hooks.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/fanqingxuan/awesome-skills/gorm
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 fanqingxuan/awesome-skills --skill gorm
Clone the repo
git clone --depth 1 https://github.com/fanqingxuan/awesome-skills

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/fanqingxuan/awesome-skills/gorm/github.svg)](https://agentmods.dev/skills/fanqingxuan/awesome-skills/gorm)
Your own site
<a href="https://agentmods.dev/skills/fanqingxuan/awesome-skills/gorm"><img src="https://agentmods.dev/badge/skills/fanqingxuan/awesome-skills/gorm/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

Your own site · 80×15
<a href="https://agentmods.dev/skills/fanqingxuan/awesome-skills/gorm"><img src="https://agentmods.dev/badge/skills/fanqingxuan/awesome-skills/gorm.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 209 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,816 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.00209 $0.02816
Opus 5 $0.00105 $0.01408
Sonnet 5 $0.00042 $0.00563
Haiku 4.5 $0.00021 $0.00282

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

Security

Grade A, and why

gorm 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.

skills/gorm/SKILL.md · 465 lines

How it starts

The opening of the file, as written. The whole thing — 465 lines — stays where its author put it; the contents beside it link to each section on GitHub.

GORM 开发指南

GORM 是 Go 语言最流行的 ORM 库,提供完整的数据库操作功能。

⚠️ 重要说明

本 skill 专注于 GORM 的传统 API(Traditional API),不使用泛型方式。

所有示例代码均使用传统的链式调用方式,确保与现有代码和 GORM 插件的完全兼容性。

传统 API vs 泛型 API

// ✅ 使用传统 API(推荐)
var user User
db.Where("name = ?", "John").First(&user)
db.Create(&user)
db.Model(&user).Update("age", 30)

// ❌ 不使用泛型 API
// result := gorm.Query[User](db).Where("name = ?", "John").First()

快速开始

安装

go get -u gorm.io/gorm
go get -u gorm.io/driver/mysql
go get -u gorm.io/driver/postgres
go get -u gorm.io/driver/sqlite

连接数据库

package main

import (
    "gorm.io/driver/mysql"
    "gorm.io/gorm"
)

func main() {
    // MySQL
    dsn := "user:password@tcp(127.0.0.1:3306)/dbname?charset=utf8mb4&parseTime=True&loc=Local"
    db, err := gorm.Open(mysql.Open(dsn), &gorm.Config{})
    if err != nil {
        panic("failed to connect database")
    }

    // PostgreSQL
    // dsn := "host=localhost user=gorm password=gorm dbname=gorm port=9920 sslmode=disable"
    // db, err := gorm.Open(postgres.Open(dsn), &gorm.Config{})

    // SQLite
    // db, err := gorm.Open(sqlite.Open("test.db"), &gorm.Config{})
}

模型定义

基础模型

type User struct {
    ID        uint           `gorm:"primaryKey"`
    Name      string         `gorm:"size:100;not null"`
    Email     string         `gorm:"uniqueIndex;size:100"`
    Age       int            `gorm:"default:0"`
    Birthday  *time.Time
    CreatedAt time.Time
    UpdatedAt time.Time
    DeletedAt gorm.DeletedAt `gorm:"index"`
}

使用 gorm.Model

type User struct {
    gorm.Model
    Name  string
    Email string
}

// gorm.Model 包含:
// ID        uint
// CreatedAt time.Time
// UpdatedAt time.Time
// DeletedAt gorm.DeletedAt

字段标签

type User struct {
    ID        uint      `gorm:"primaryKey"`
    Name      string    `gorm:"size:100;not null;index"`
    Email     string    `gorm:"uniqueIndex;size:100"`
    Age       int       `gorm:"default:18"`
    Active    bool      `gorm:"default:true"`
    Salary    float64   `gorm:"type:decimal(10,2)"`
    Profile   string    `gorm:"type:text"`
    Extra     string    `gorm:"-"` // 忽略该字段
}

Read the full file on GitHub · 465 lines

Files

What ships with it

45 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 · 465 lines · 209 tokens per session scan A f5942ad5fe90

Subscribe to this mod's changes

gorm is a skill published in the GitHub repository fanqingxuan/awesome-skills (27 stars, last pushed 4mo ago), licensed MIT. It adds 209 tokens to every session and 2,816 once invoked, about $0.0010 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

golang-pro

Implements concurrent Go patterns using goroutines and channels, designs and builds microservices with gRPC or REST, optimizes Go application performance with pprof, and enforces idiomatic Go with generics, interfaces, and robust error handling. Use when building Go applications requiring concurrent programming…

Jeffallan/claude-skills · 95 tokens

golang-database

Comprehensive guide for Go database access — parameterized queries, struct scanning, NULLable columns, transactions, isolation levels, SELECT FOR UPDATE, connection pool, batch processing, context propagation, and migration tooling. Use when writing, reviewing, or debugging Golang code that interacts with PostgreSQL…

samber/cc-skills-golang · 99 tokens

golang-samber-hot

In-memory caching in Golang using samber/hot — eviction algorithms (LRU, LFU, TinyLFU, W-TinyLFU, S3FIFO, ARC, TwoQueue, SIEVE, FIFO), TTL, cache loaders, sharding, stale-while-revalidate, missing key caching, and Prometheus metrics. Apply when using or adopting samber/hot, when the codebase imports…

samber/cc-skills-golang · 122 tokens

vendor-update

Upgrade Go/Node.js vendor dependencies and sync tool versions. Use whenever the user says "upgrade dependencies", "update vendors", "vendor update", "run vendor-upgrade", "bump dependencies", "update packages", or asks to run the vendor-update Make target. This skill also checks scripts/build/version.mk after…

apache/skywalking-banyandb · 95 tokens

ecto-patterns

Ecto patterns — schemas, changesets, queries, migrations, Multi, associations, preloads, upserts. Use when editing Repo calls, Ecto.Query, or schema fields. Skip for Ash.

oliver-kriska/claude-elixir-phoenix · 45 tokens

compiling

Compile and build the SkyWalking BanyanDB project. Use when the user asks to compile, build, or generate code for this project.

apache/skywalking-banyandb · 31 tokens