model-usage

Expose typed model field access via Get() and Set() methods in Go workflows.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Models often require manual, error-prone code to access or mutate fields across different types. This skill provides a consistent, type-safe way to read and write model data using Get() and Set() methods, reducing boilerplate and mistakes.

Core Features & Use Cases

  • Typed constructors for basic and joined models.
  • Get/Set methods for all fields, including JSONB struct fields, with GetI() variant when you want a value without error handling.
  • Patterns for updating, reading, and persisting models, with support for nil fields via SetNull().

Quick Start

Create a new model instance and initialize its fields using the provided Set methods.

Frequently Asked Questions about model-usage

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

FAQPage Schema
How do I safely access and mutate fields in Go models without writing error-prone boilerplate?

You can safely access and mutate Go model fields using typed Get() and Set() methods. This enforces type safety at compile time, reducing manual boilerplate and preventing field mutation mistakes across basic and joined types.

Does Go support type-safe JSONB struct field handling for concurrent data workflows?

Yes, type-safe JSONB struct field handling is supported for concurrent Go workflows. You can use typed Get() and Set() methods to read and write JSONB fields, ensuring thread-safe data access across concurrent routines.

What is the best way to handle optional or nil fields in Go data models?

The best way to handle optional fields in Go models is using the SetNull() method to explicitly set nil values. Additionally, the GetI() method retrieves field values without requiring error handling for optional or nullable fields.

Can I use typed constructors for both basic models and joined types in Go?

Yes, you can use typed constructors for both basic models and joined types in Go. This allows you to initialize complex data structures and apply consistent data-access patterns when creating, reading, and updating records.

Why does manual field access cause issues in concurrent Go applications?

Manual field access in concurrent Go applications causes issues because it lacks type safety and consistent locking patterns. Using standardized Get() and Set() methods enforces thread-safe access and prevents data races during concurrent model updates.