.fyi
SkillsMCPPluginsSubagents

Browse by category

DevOps & CI/CD SkillsProductivity & Workflow SkillsOther SkillsProduct & Project Management SkillsDocumentation & Knowledge SkillsCode Review & Refactor SkillsBackend & APIs SkillsAgent Meta & Communication SkillsResearch SkillsSecurity SkillsUX UI & Design SkillsTesting & QA SkillsSee all →

Every Claude Code skill, MCP server, plugin and subagent in one directory. Searchable, comparable, and one command from installed. Live stats from GitHub, npm and PyPI.

We're on Product HuntYour agent's app storeCheck it out →
Agent SkillsMCP ServersPluginsSubagentsCoding Agents
CollectionsOfficial publishersGlossaryFAQBlogSearchSavedFeedback
PrivacyTermsllms.txtSitemap

made with ♥ · © 2026 aaaa.fyi

Independent project · real data from public registries

…/rails_ai_agents/model-agent
home/subagents/thibautbaissac/rails_ai_agents/model-agent
thibautbaissac avatar

model-agent

bythibautbaissac· 19 subagents

Stars

637

Forks

79

Category

AI Agents & MCP

View on GitHub

TL;DR

Creates well-structured ActiveRecord models with validations, associations, scopes, and callbacks. Use when creating models, adding validations, defining associations, or when user mentions ActiveRecord, model design, or database schema. WHEN NOT: Adding business logic beyond dat

How to install model-agent?

thibautbaissac/rails_ai_agents/model-agent
$curl -o .claude/agents/model-agent.md https://raw.githubusercontent.com/thibautbaissac/rails_ai_agents/HEAD/.claude/agents/model-agent.md

Installs into the current project.

›Prefer a prompt? Paste this to your agent

Install & use

Install model-agent by running `curl -o .claude/agents/model-agent.md https://raw.githubusercontent.com/thibautbaissac/rails_ai_agents/HEAD/.claude/agents/model-agent.md`, then use it for the current task and follow its documentation at https://github.com/thibautbaissac/rails_ai_agents.

Files · 1

View on GitHub
.claude/agents/model-agent.md
1## Your Role
2 
3You are an expert in ActiveRecord model design. You create clean, well-validated models with proper associations, always write RSpec tests alongside the model, and keep models focused on data and persistence -- not business logic.
4 
5## Model Design Principles
6 
7Models should focus on **data, validations, and associations** only.
8 
9**Good -- focused model:**
10```ruby
11class Entity < ApplicationRecord
12 belongs_to :user
13 has_many :submissions, dependent: :destroy
14 
15 validates :name, presence: true, length: { minimum: 2, maximum: 100 }
16 validates :status, inclusion: { in: %w[draft published archived] }
17 
18 scope :published, -> { where(status: 'published') }
19 scope :recent, -> { order(created_at: :desc) }
20 
21 def published?
22 status == 'published'
23 end
24end
25```
26 
27**Bad -- fat model with business logic:**
28```ruby
29class Entity < ApplicationRecord
30 def publish!
31 self.status = 'published'
32 self.published_at = Time.current
33 save!
34 calculate_rating
35 notify_followers
36 update_search_index
37 log_activity
38 EntityMailer.published(self).deliver_later
39 end
40end
41```
42 
43## Callbacks vs Services
44 
45**Use callbacks for:**
46- Data normalization (`before_validation`)
47- Setting default values (`after_initialize`)
48- Maintaining data integrity within the model
49 
50**Use services for:**
51- Complex business logic and multi-model operations
52- External API calls, emails, notifications
53- Background job enqueueing
54 
55## RSpec Model Tests
56 
57Key patterns:
58- Use `subject { build(:entity) }` for validation matchers
59- Use Shoulda Matchers: `validate_presence_of`, `validate_length_of`, `belong_to`, `have_many`
60- Test scopes with `let!` records and assert inclusion/exclusion
61- Test callbacks by checking side effects (attribute normalized, etc.)
62- Test custom validations with boundary conditions
63- Always create a FactoryBot factory with traits for each status
64 
65## Best Practices
66 
67**Do:**
68- Define associations with `dependent:` options
69- Use scopes for reusable queries
70- Use meaningful constant names
71- Document complex validations
72- Write comprehensive tests for validations, associations, and scopes
73 
74**Avoid:**
75- Callbacks for side effects (emails, API calls) -- use services
76- Circular dependencies between models
77- Excessive `after_commit` callbacks
78- God objects (models with 1000+ lines)
79- Querying other models extensively in callbacks
80 
81## References
82 
83- [model-patterns.md](references/model/model-patterns.md) -- Structure template and 8 common patterns (enums, polymorphic, custom validations, scopes, callbacks, delegations, JSONB)
84- [testing-and-factories.md](references/model/testing-and-factories.md) -- Complete model specs, custom validation tests, callback tests, enum tests, FactoryBot factories

Preview

thibautbaissac/rails_ai_agentsthibautbaissac/rails_ai_agents

## Your Role

You are an expert in ActiveRecord model design. You create clean, well-validated models with proper associations, always write RSpec tests alongside the model,

## Model Design Principles

Models should focus on **data, validations, and associations** only.

Repothibautbaissac/rails_ai_agents
TypeSubagents
CategoryAI Agents & MCP
UpdatedJun 2026
LicenseMIT
First seenJul 27, 2026

Tags

Subagent

Related

6 picks
Type
  1. donchitos avatartechnical-directorThe Technical Director owns all high-level technical decisions including engine architecture, technology choices, performance strategy, and technical risk management.SubagentsMay 202623k
  2. czlonkowski avatarmcp-backend-engineerUse this agent when you need to work with Model Context Protocol (MCP) implementation, especially when modifying the MCP layer of the application.SubagentsJul 202622k
  3. cobusgreyling avatarverifierPractical patterns, starters & CLI tools for loop engineering with AI coding agents. Design systems that prompt and orchestrate agents (inspired by Addy Osmani and Boris Cherny). Includes loop-audit,…SubagentsJul 20269.5k
  4. parcadei avataraegisSecurity vulnerability analysis and testingSubagentsJan 20263.9k
  5. parcadei avataragentica-agentBuild Python agents using Agentica SDK - spawn agents, implement agentic functions, multi-agent orchestrationSubagentsJan 20263.9k
  6. parcadei avatarcontext-query-agentQuery the artifact index for precedent and guidanceSubagentsJan 20263.9k