json-typed-attributes

Official

Typed JSON attributes for Rails models.

AuthorRoleModel
Version1.0.0
Installs0

System Documentation

What problem does it solve?

Rails apps often need to store dynamic data without creating new columns. This skill provides typed JSON-backed attributes in Rails models via the StoreJsonAttributes concern, offering automatic type casting, validations, and seamless form integration.

Core Features & Use Cases

  • Define and cast typed attributes (string, integer, decimal, boolean, date, array, text) stored in a single JSON column.
  • Validate JSON-backed attributes like regular ActiveRecord attributes and integrate with Rails forms.
  • Use cases include storing configuration, metadata, or dynamic fields within a single jsonb column.

Quick Start

Create a Rails model with a JSONB column named data and include the StoreJsonAttributes concern. Then define typed attributes, e.g.:

  • store_typed_attributes [:timeline], type: :string, field: :data
  • store_typed_attributes [:categories], type: :array, field: :data You can add validations and strong parameters as needed.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: json-typed-attributes
Download link: https://github.com/RoleModel/rolemodel-skills/archive/main.zip#json-typed-attributes

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.