thibautbaissac/rails_ai_agents/state-records
Claude Code and agent skill by thibautbaissac/rails_ai_agents
- community
Checking that the SKILL.md file is still in the repository.
Implements the state-as-records-not-booleans pattern for rich state tracking. Use when modeling state changes, replacing boolean flags with record-based state, or when user mentions state records, closures, publications, or toggling state. WHEN NOT: Technical flags like cached/processed (use booleans), concern extraction (use concern-patterns), general model work (use model-patterns).
Install
npx vskill@latest install thibautbaissac/rails_ai_agents/state-recordsSKILL.md
State Records (37signals)
State as records, not booleans. Instead of closed: boolean, create a Closure record.
Project knowledge
Tech Stack: Rails 8.2 (edge), UUIDs everywhere, ActiveRecord associations Pattern: One state model per boolean you'd normally add Naming: Noun forms (Closure, Publication, Goldness, NotNow, Archival)
Commands:
Why state records over booleans
Boolean columns give you:
- Current state (open/closed)
State records give you:
- Current state (
closure.present?) - When it changed (
closure.created_at) - Who changed it (
closure.user) - Why it changed (
closure.reason) - Change history (via events)
The pattern
Boolean approach (avoid for business state):
State record approach:
State record model template
Every state record model follows this structure:
State concern template
Every state concern follows this structure:
State record with metadata
When state needs additional data (secure tokens, descriptions):
Query patterns with state records
Controller patterns
State changes map to singular resources with create/destroy:
View patterns
When to use state records vs booleans
Use state records when:
- You need to know when state changed
- You need to know who changed it
- You might store metadata (reason, notes)
- State changes are important business events
- You need queries like "recently closed" or "closed by X"
Use booleans when:
- State is purely technical (cached, processed)
- Timestamp/actor don't matter
- Performance is critical (millions of rows, frequent updates)
- State changes are not business events
Quick reference:
- State records: closed, published, archived, suspended, verified, pinned, golden, postponed
- Booleans: admin, cached, processed, visible
See references/state-record-examples.md for complete examples of each state type.
Migration from boolean to state record
- Create state record model + migration
- Backfill existing data
- Update model code to use concern
- Remove boolean column (after verification)
Boundaries
- Always: Create state record for business-meaningful states, track who and when, use
where.missingfor negative scopes, add unique index on parent_id, touch parent record, write tests for state transitions - Ask first: Before using boolean columns for business state, before adding complex metadata (might need separate model)
- Never: Use booleans for important business state, skip who/when tracking, create multiple state records per parent (use
has_onewith unique index), skip event tracking for state changes
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryChecking.claude_37signals/skills/state-records/SKILL.md
Popularity
- Repository stars
- 589
- Repository forks
- 67
- 7-day trend score
- 32
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/thibautbaissac/rails_ai_agents/state-records)