state-records

Implement state-as-records pattern in Rails applications with state history tracking.

Updated Jun 9, 2026
One-click install
npx skills add https://github.com/arthun01/achados-uesc --skill state-records
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: state-records
Source: https://github.com/arthun01/achados-uesc/tree/main/.opencode/skills/state-records
Command: npx skills add https://github.com/arthun01/achados-uesc --skill state-records

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill helps developers manage complex state changes in Rails applications by replacing boolean flags with record-based state tracking, improving data integrity and maintainability.

Core Features & Use Cases

  • State Record Tracking: Replace boolean flags with dedicated state records for tracking open/closed, published/unpublished, or any other state change.
  • Rich State History: Maintain a history of state changes, including who made the change and when.
  • Customizable State Models: Create custom state models for different types of states with optional metadata.
  • Use Case: If you are developing a feature like a card closure in a project management app, this Skill can help you track the state of each card more effectively.

Quick Start

Generate a state record for a card with bin/rails generate model Closure card:references:uuid user:references:uuid account:references:uuid.

Frequently Asked Questions about state-records

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

FAQPage Schema
How do I track state history in Rails without using boolean flags?

Replace boolean flags with dedicated state records using the state-as-records pattern to maintain rich state history, capturing who made each change and when it occurred for better data integrity.

What is the state-as-records pattern in Rails state management?

The state-as-records pattern in Rails state management creates dedicated database records for each business state transition, such as open or closed, ensuring detailed history tracking and improved maintainability over simple flags.

Does the state-as-records pattern work with older Rails versions?

The state-as-records pattern requires Ruby 3.3+ and Rails 8.0+ to implement record-based state tracking in your application, ensuring compatibility with modern Rails framework features.

How do I generate a state record model for a Rails business object?

Generate a state record model for a Rails business object by running a command like `bin/rails generate model Closure card:references:uuid user:references:uuid account:references:uuid` to create dedicated tracking tables.

When should I use record-based state tracking instead of boolean columns?

Use record-based state tracking instead of boolean columns when your Rails application requires detailed state history, change attribution, or custom metadata for business states like published, archived, or closed.

Can I add custom metadata to state transition records in Rails?

Yes, you can add custom metadata to state transition records by creating customizable state models within the state-as-records pattern, allowing different state types to carry optional metadata fields.