Guides modern Rails 8 code architecture decisions and patterns. Use when deciding where to put code, choosing between patterns (service objects vs concerns vs query objects), designing feature architecture, refactoring for better organization, or when user mentions architecture, code organization, design patterns, or layered design.
Install with Tessl CLI
npx tessl i github:ThibautBaissac/rails_ai_agents --skill rails-architecture93
Does it follow best practices?
Agent success when using this skill
Validation for skill structure
Service object pattern with Result objects
Result object returned
100%
100%
Result has data/error/code
50%
100%
Typed error codes
0%
100%
Namespaced service naming
0%
100%
Single #call method
100%
100%
Constructor injection
50%
100%
Errors caught and wrapped
100%
100%
Transaction for multi-model writes
0%
100%
Skinny controller
100%
100%
Controller checks result code
25%
100%
Correct file placement
75%
100%
Result file exists
0%
100%
Without context: $0.2316 · 54s · 10 turns · 11 in / 3,607 out tokens
With context: $0.5569 · 1m 24s · 22 turns · 318 in / 4,700 out tokens
Multi-tenancy scoping and query objects
Account-scoped queries
0%
100%
No unscoped queries
100%
100%
Query object created
100%
100%
Constructor accepts account
0%
100%
Query file placement
100%
100%
Uses .includes() for N+1
100%
100%
Skinny controller
80%
100%
Query returns relation
25%
100%
Aggregation logic in query
100%
100%
Correct SQL aggregation
83%
75%
Without context: $0.2841 · 1m 16s · 11 turns · 12 in / 4,866 out tokens
With context: $1.1342 · 3m 31s · 30 turns · 4,903 in / 14,493 out tokens
Architectural layer selection and refactoring
Service extracted
100%
100%
Service in app/services/
100%
100%
Controller is thin
100%
75%
Query object for search
70%
100%
Query scoped through account
62%
100%
Presenter for display
70%
100%
Geocoding moved out of callback
50%
62%
Validations stay in model
100%
100%
Scopes stay in model
100%
100%
Refactoring plan explains layers
100%
100%
No premature abstractions
87%
87%
Service returns Result
100%
100%
Without context: $1.0836 · 3m 51s · 39 turns · 39 in / 15,450 out tokens
With context: $1.1540 · 3m 12s · 40 turns · 86 in / 12,449 out tokens
Table of Contents
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.