model-conventions

Standardize Go model struct tags for database mappings and JSON.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/griffnb/claude-plugins --skill model-conventions
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: model-conventions
Source: https://github.com/griffnb/claude-plugins/tree/main/plugins/backend/skills/model-conventions
Command: npx skills add https://github.com/griffnb/claude-plugins --skill model-conventions

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Standardize model field definitions and struct tag usage across the codebase.

Core Features & Use Cases

  • Database Field Naming: enforce snake_case for database fields via struct tags.
  • JSONB Sub-Structs: ensure JSON tags use snake_case in nested structures.
  • Boolean Values Guideline: store booleans as smallint 0/1 and provide default handling.
  • Struct Tag Annotations: comprehensive set of tags to guide migrations and constraints.
  • Use Case: when adding a new model or updating an existing one, apply these conventions to ensure consistency and correctness.

Quick Start

Apply these conventions when defining a new model to ensure correct column names, JSON tags, and migration metadata.

Frequently Asked Questions about model-conventions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce snake_case for database column names in Go struct tags?

You can enforce snake_case for database column names by applying standardized model field conventions to your Go models, ensuring database mappings use consistent struct tag annotations across the codebase.

What is the best way to handle boolean values in Go models for database migrations?

The recommended approach for boolean values in Go models is storing them as smallint 0/1 and providing default handling, which ensures safe and consistent migration constraints across the codebase.

How do I standardize JSON tags for JSONB sub-structs in Go?

You can standardize JSON tags for JSONB sub-structs by enforcing snake_case naming conventions within nested structures, ensuring consistent JSON tag usage across your Go models and their database mappings.

Does this model conventions approach work with existing Go models or only new ones?

These conventions apply to both new and existing Go models; when adding or updating a model, applying them ensures correct column names, JSON tags, and migration metadata for consistency.

Can I use struct tag annotations to guide database migration constraints in Go?

Yes, you can use comprehensive struct tag annotations to guide database migration constraints in Go, applying standardized conventions to ensure correct column names and migration metadata.