37signals-state-records

Model business states as timestamped records with user associations in Rails apps.

1|Updated Feb 3, 2026
One-click install
npx skills add https://github.com/joshyorko/agent-skills --skill 37signals-state-records
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: 37signals-state-records
Source: https://github.com/joshyorko/agent-skills/tree/main/plugins/rails-37signals-patterns/skills/37signals-state-records
Command: npx skills add https://github.com/joshyorko/agent-skills --skill 37signals-state-records

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Models complex business states as records instead of booleans to capture timestamped history, accountability, and rich metadata for state transitions.

Core Features & Use Cases

  • One state model per boolean (e.g., Closure for closed, Publication for published) to capture who, when, and why.
  • Queryable state with positive/negative scopes using where.missing and joins to support open/closed, published/private, archived/active.
  • Supports tenancy and associations to multi-tenant apps, plus lightweight event-like tracking for audits.

Quick Start

Create a Closure for a target record to begin tracking who changed its state, when, and why.

Frequently Asked Questions about 37signals-state-records

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

FAQPage Schema
How do I track state changes in Rails without just using boolean columns?

Model complex business states as records instead of booleans to capture timestamped history and accountability. This approach creates a has_one state model per parent to track who, when, and why for each transition.

How do I query open and closed states in Rails using state records?

Query state records using positive and negative scopes with where.missing and joins. This pattern supports open/closed, published/private, and archived/active filtering by checking the presence or absence of associated state records.

Does this state records pattern work with multi-tenant Rails applications?

Yes, the state records pattern supports tenancy and associations for multi-tenant Rails apps. It includes lightweight event-like tracking to provide per-change provenance and audit capabilities across tenant data.

What is the best way to audit who changed a record's state in Rails?

Create a dedicated state record, such as a Closure for closed states, to begin tracking who changed its state, when, and why. This enforces user associations and timestamped events for full audit provenance.

When should I model state as a record instead of using a boolean in Rails?

Use state records when you need per-change provenance, timestamped history, and rich metadata for transitions. Booleans lack accountability, whereas state records enforce user associations and capture why each state change occurred.