architecture

Guide Rails code placement across models, services, queries, and presenters.

Updated Mar 3, 2026
One-click install
npx skills add https://github.com/pelletencate/iron-horse --skill architecture-pelletencate
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: architecture
Source: https://github.com/pelletencate/iron-horse/tree/main/skills/architecture
Command: npx skills add https://github.com/pelletencate/iron-horse --skill architecture-pelletencate

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Rails projects often struggle with where to place new code and how to organize cross-cutting concerns; without clear architecture, controllers become bloated and features hard to maintain.

Core Features & Use Cases

  • Guidance on where code belongs (model, service, query, presenter) to promote separation of concerns.
  • Clear layer interaction rules and decision trees to reduce coupling and improve testability.
  • Strategies for refactoring patterns (services, queries, presenters) and evaluating when to extract abstractions.

Quick Start

Decide on the primary responsibility of a new feature, then ask the AI to place code into the appropriate layer (e.g., model for persistence, service for orchestration, query for read-heavy logic, presenter for display).

Frequently Asked Questions about architecture

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

FAQPage Schema
How do I decide where to put new logic in a Rails application?

To decide where to put new Rails logic, identify its primary responsibility: use models for persistence, service objects for orchestration, query objects for read-heavy logic, and presenters for display formatting.

What is the best way to refactor a fat controller in Rails?

The best way to refactor a fat Rails controller is extracting multi-model orchestration into service objects and moving read-heavy retrieval logic into query objects, enforcing single-responsibility per file.

How do Rails service objects and query objects interact?

Rails service objects and query objects interact through one-way calls and explicit layer boundaries. Services orchestrate business logic by calling queries for data retrieval, preventing reverse dependencies and reducing coupling.

When should I extract a presenter in Rails?

Extract a Rails presenter when you need to isolate display formatting logic from models and controllers. This enforces single-responsibility per file and keeps persistence logic separated from view concerns.

Can I use this architecture guidance for multi-model orchestration across controllers?

Yes, this architecture guidance handles multi-model orchestration by directing cross-cutting feature logic into service objects. Controllers coordinate requests while services manage the underlying multi-model interactions.

Why does my Rails codebase have tight coupling between models and controllers?

Tight coupling in Rails happens without clear layer interaction rules. Applying explicit layer boundaries and one-way call directives between models, services, queries, and presenters reduces dependencies and improves testability.