model-agent

Create validated ActiveRecord models with associations, scopes, and RSpec tests.

Updated Nov 1, 2025
One-click install
npx skills add https://github.com/nschneble/rails-superstack --skill model-agent-nschneble
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: model-agent
Source: https://github.com/nschneble/rails-superstack/tree/main/.agents/skills/model-agent
Command: npx skills add https://github.com/nschneble/rails-superstack --skill model-agent-nschneble

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Creates clear, well-structured ActiveRecord models with strong validations, meaningful associations, and clean persistence patterns to reduce design drift and speeding up Rails development.

Core Features & Use Cases

  • Provides templates and conventions for building Rails models with validations, associations, scopes, and callbacks.
  • Includes testing guidance with RSpec, FactoryBot, and Shoulda Matchers to ensure robust persistence layers.
  • Use Case: Design a typical domain model (e.g., User, Post, Booking) following the patterns and verify behavior with generated specs.

Quick Start

Create a basic model called Entity with a belongs_to association and validations, then add a corresponding spec to verify the design.

Frequently Asked Questions about model-agent

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

FAQPage Schema
How do I create Rails models with validations and associations?

Rails models with validations are built by defining ActiveRecord classes using validation macros and association declarations. This approach applies templates and conventions for clean persistence patterns, reducing design drift while accelerating development.

How do I test Rails ActiveRecord models using RSpec and FactoryBot?

Testing Rails ActiveRecord models with RSpec and FactoryBot requires generating specs that verify validation behavior, associations, and scopes. This process uses Shoulda Matchers to ensure a robust persistence layer and enforce correctness across domain models.

What is the best way to organize Rails model files like validators and queries?

Organizing Rails model files involves structuring concerns into specific directories like app/models, app/validators, app/services, and app/queries. This separation maintains clean persistence patterns and prevents design drift across complex domain models.

Does this model design approach work for typical domain models like bookings and posts?

This model design approach works for typical domain models like bookings and posts by applying standard ActiveRecord conventions. It supports lightweight callbacks, scopes, and validations, paired with generated RSpec and FactoryBot tests to verify behavior.

When should I use custom validators instead of standard ActiveRecord validations?

Use custom validators instead of standard ActiveRecord validations when domain logic requires reusable, isolated validation rules. Placing these in app/validators keeps app/models clean and ensures complex validation behavior remains thoroughly testable and maintainable.