model-patterns

Model Ruby on Rails domain entities with associations, validations, scopes, and business logic.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/hidalgofdz/prestamista --skill model-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: model-patterns
Source: https://github.com/hidalgofdz/prestamista/tree/main/.claude/skills/model-patterns
Command: npx skills add https://github.com/hidalgofdz/prestamista --skill model-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill streamlines the creation of comprehensive domain models by embedding validations, associations, and business logic directly within the model, reducing redundancy and improving maintainability.

Core Features & Use Cases

  • Rich Model Construction: Facilitates designing models that encapsulate validations, scopes, callbacks, and business methods.
  • Scalability: Supports complex object relationships, polymorphic associations, and default values, enabling scalable application architectures.
  • Use Case: When developing an application to manage tasks, this Skill helps in defining models like "Task" with validations, state enums, and behavior methods for actions like completing or moving tasks.

Quick Start

Use this Skill to define a new model called 'Card' with attributes and methods for managing task statuses.

Frequently Asked Questions about model-patterns

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

FAQPage Schema
How do I add business logic and validations to Rails models?

You build rich domain models by integrating validations, associations, scopes, and business logic directly within Ruby on Rails models. This approach makes models self-sufficient and reduces code redundancy for scalable web architectures.

What is the best way to structure complex domain models in Rails?

The best way to structure complex domain models in Rails is encapsulating behavior, state enums, and relationships directly inside the model. This supports complex object relationships, polymorphic associations, and default values for scalable application architectures.

Can I use this approach to manage polymorphic associations and default values?

Yes, this approach supports building scalable application architectures by managing complex object relationships, polymorphic associations, and default values directly within your Rails domain models.

How do I define a Rails model with state enums and behavior methods?

You define a Rails model by adding attributes, validations, state enums, and behavior methods for actions like completing or moving tasks. This encapsulates the entity's logic, ensuring the model remains self-sufficient and maintainable.

When should I embed business logic directly in a Ruby on Rails model?

You should embed business logic directly in a Ruby on Rails model when you need to streamline the creation of comprehensive domain entities and improve maintainability by reducing redundancy across your application's core data structures.