Agent skill

Rails Architecture

by ThibautBaissac in ThibautBaissac/rails_ai_agents

Guides modern Rails 8 code architecture decisions and patterns.

MITAuto-check passedDevelopment

Install Rails Architecture

skills CLI
$ npx skills add ThibautBaissac/rails_ai_agents --skill rails-architecture -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install ThibautBaissac/rails_ai_agents rails-architecture --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/ThibautBaissac/rails_ai_agents.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/rails-architecture .claude/skills/rails-architecture && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
rails-architecture
GitHub stars
665
Token cost
~1.5k tokens
SKILL.md length
384 words
Files
6 (incl. references)
Skills in repo
19
Repo updated
First seen
Licence
MIT

At a glance

Guides modern Rails 8 code architecture decisions and patterns.

  • Works in 9 steps: Model - Define data structure… → Policy - Add authorization rules… → Service - Create for complex logic… → …
  • Deciding where to put code
  • SKILL.md covers Architecture Decision Tree, Layer Responsibilities, When NOT to Abstract and When TO Abstract, plus 5 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Rails Architecture is an agent skill from ThibautBaissac/rails_ai_agents. 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. WHEN NOT: Implementing specific patterns (use specialist agents like service-agent or query-agent), writing tests, or debugging runtime errors.

Its SKILL.md is about 1.5k tokens, which your agent loads only when the skill is triggered. The skill folder holds 6 other files, including reference files (for example `references/error-handling.md`, `references/layer-interactions.md` and `references/query-patterns.md`).

It sits in Development, covering Backend development, Design patterns and Refactoring. It works with Ruby on Rails. The repository describes itself as: Specialized AI skills, agents, rules and hooks for modern Rails AI driven-development + Spec-Driven-Development kit + MCP. The licence is MIT.

When your agent uses it

  • Deciding where to put code
  • Choosing between patterns (service objects vs concerns vs query objects)
  • Designing feature architecture
  • Refactoring for better organization

Example prompts

  • “Use the rails-architecture skill to guide modern Rails 8 code architecture decisions and patterns”
  • “/rails-architecture”

Workflow steps

9 steps, taken from the first numbered list in SKILL.md.

  1. Model - Define data structure (@migration-agent, @model-agent)
  2. Policy - Add authorization rules (@policy-agent)
  3. Service - Create for complex logic (@service-agent)
  4. Query - Add for complex queries (@query-agent)
  5. Controller - Keep it thin (@controller-agent)
  6. Presenter - Format for display (@presenter-agent)
  7. Component - Build reusable UI (@viewcomponent-agent)
  8. Mailer - Add transactional emails (@mailer-agent)
  9. Job - Add background processing (@job-agent)

What it can do on your machine

Read from SKILL.md and the folder at commit 03622f2. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are ruby).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Rails Architecture loads about 1.5k tokens when it runs, and up to ~12k if it reads all its reference files. Until then it costs about 124 tokens; SKILL.md has 384 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~124
When it runs · the whole SKILL.md, loaded when a task matches
~1.5k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~12k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from ThibautBaissac/rails_ai_agents at commit 03622f2, republished under its MIT licence (© ThibautBaissac). 384 words, ~1,478 tokens.

Download SKILL.mdSave it as .claude/skills/rails-architecture/SKILL.md (or your agent's skills folder). This skill also uses 5 other files; get the full folder from GitHub.
name
rails-architecture
description
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. WHEN NOT: Implementing specific patterns (use specialist agents like service-agent or query-agent), writing tests, or debugging runtime errors.
model
sonnet
effort
high

Modern Rails 8 Architecture Patterns

Architecture Decision Tree

Where should this code go?
|
+- View/display formatting?       -> Presenter (@presenter-agent)
+- Complex business logic?        -> Service Object (@service-agent)
+- Complex database query?        -> Query Object (@query-agent)
+- Shared behavior across models? -> Concern (/rails-concern skill)
+- Authorization logic?           -> Policy (@policy-agent)
+- Reusable UI with logic?        -> ViewComponent (@viewcomponent-agent)
+- Async/background work?         -> Job (@job-agent, /solid-queue-setup skill)
+- Complex form (multi-model)?    -> Form Object (@form-agent)
+- Transactional email?           -> Mailer (@mailer-agent)
+- Real-time/WebSocket?           -> Channel (/action-cable-patterns skill)
+- Data validation only?          -> Model (@model-agent)
+- HTTP request/response only?    -> Controller (@controller-agent)

Layer Responsibilities

LayerResponsibilityShould NOT contain
ControllerHTTP, params, responseBusiness logic, queries
ModelData, validations, relationsDisplay logic, HTTP
ServiceBusiness logic, orchestrationHTTP, display logic
QueryComplex database queriesBusiness logic
PresenterView formatting, badgesBusiness logic, queries
PolicyAuthorization rulesBusiness logic
ComponentReusable UI encapsulationBusiness logic
JobAsync processingHTTP, display logic
FormComplex form handlingPersistence logic
MailerEmail compositionBusiness logic
ChannelWebSocket communicationBusiness logic

When NOT to Abstract

SituationKeep It SimpleDon't Create
Simple CRUD (< 10 lines)Keep in controllerService object
Used only onceInline the codeAbstraction
Simple query with 1-2 conditionsModel scopeQuery object
Basic text formattingHelper methodPresenter
Single model formform_with model:Form object
Simple partial without logicPartialViewComponent

When TO Abstract

SignalAction
Same code in 3+ placesExtract to concern/service
Controller action > 15 linesExtract to service
Model > 300 linesExtract concerns
Complex conditionalsExtract to policy/service
Query joins 3+ tablesExtract to query object
Form spans multiple modelsExtract to form object

See /extraction-timing skill for detailed extraction guidance.

Core Patterns

Skinny Controllers
ruby
# GOOD: Thin controller delegates to service
class OrdersController < ApplicationController
  def create
    result = Orders::CreateService.call(user: current_user, params: order_params)
    if result.success?
      redirect_to result.data, notice: t(".success")
    else
      flash.now[:alert] = result.error
      render :new, status: :unprocessable_entity
    end
  end
end
Result Objects for Services

All services return a consistent Result object:

ruby
Result = Data.define(:success, :data, :error) do
  def success? = success
  def failure? = !success
end
Multi-Tenancy by Default
ruby
# GOOD: Scoped through account
def index
  @events = current_account.events.recent
end

Rails 8 Specific Features

FeaturePurposeSkill/Agent
Authenticationhas_secure_password generator/authentication-flow
Background JobsSolid Queue (database-backed)/solid-queue-setup, @job-agent
Real-timeAction Cable + Solid Cable/action-cable-patterns
CachingSolid Cache (database-backed)/caching-strategies
AssetsPropshaft + Import Maps(built-in)
DeploymentKamal 2 + Thruster(built-in)
Show full SKILL.md (138 more words)Show less

Testing Strategy by Layer

LayerTest TypeFocus
ModelUnitValidations, scopes, methods
ServiceUnitBusiness logic, edge cases
QueryUnitQuery results, tenant isolation
PresenterUnitFormatting, HTML output
ControllerRequestIntegration, HTTP flow
ComponentComponentRendering, variants
PolicyUnitAuthorization rules
SystemE2ECritical user paths

New Feature Checklist

  1. Model - Define data structure (@migration-agent, @model-agent)
  2. Policy - Add authorization rules (@policy-agent)
  3. Service - Create for complex logic (@service-agent)
  4. Query - Add for complex queries (@query-agent)
  5. Controller - Keep it thin (@controller-agent)
  6. Presenter - Format for display (@presenter-agent)
  7. Component - Build reusable UI (@viewcomponent-agent)
  8. Mailer - Add transactional emails (@mailer-agent)
  9. Job - Add background processing (@job-agent)

References

© ThibautBaissac, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 5 other files (references) in .agents/skills/rails-architecture of ThibautBaissac/rails_ai_agents.

  • SKILL.md
  • references/error-handling.md
  • references/layer-interactions.md
  • references/query-patterns.md
  • references/service-patterns.md
  • references/testing-strategy.md

Open the folder on GitHubat commit 03622f2

Compare with similar skills

Rails Architecture next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Rails Architecture compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Rails Architecture this skillThibautBaissac/rails_ai_agents665—~1.5kAutomated safety check: PassMIT
Rubyericrisco/rsc-harness180—~3.2kAutomated safety check: PassMIT
Antipattern Preventiondoorkeeper-gem/doorkeeper5.5k—~1.1kAutomated safety check: PassMIT
Layered Railsevilmartians/redprints-cfp1081 repos~4.1kAutomated safety check: PassNone
Architecture Patternssecondsky/claude-skills22711 repos~2.4kAutomated safety check: PassMIT
Rails Best Practices Coremarckohlbrugge/37signals-skills724—~1.7kAutomated safety check: PassNone

Similar skills

  • Ruby

    ericrisco/rsc-harness

    A skill your agent uses when writing or refactoring plain Ruby outside Rails — scripts, CLIs, gems, libraries: Enumerable chains and blocks, module mixins and value objects, Bundler/gemspec…

    180 GitHub stars~3.2k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Antipattern Prevention

    doorkeeper-gem/doorkeeper

    Avoid common Ruby and Rails antipatterns that degrade maintainability and performance.

    5.5k GitHub stars~1.1k tokensUpdated yesterday
    Backend & APIsAuto-check passed
  • Layered Rails

    evilmartians/redprints-cfp

    Write, refactor, and review Rails code using layered architecture principles from "Layered Design for Ruby on Rails Applications".

    108 GitHub starsUsed in 1 repo~4.1k tokens
    Backend & APIsAuto-check passed
  • Architecture Patterns

    secondsky/claude-skills

    Implement proven backend architecture patterns including Clean Architecture, Hexagonal Architecture, and Domain-Driven Design.

    227 GitHub starsUsed in 11 repos~2.4k tokens
    DevelopmentAuto-check passed
  • Rails Best Practices Core

    marckohlbrugge/37signals-skills

    Apply core Ruby on Rails best practices for architecture, naming, safety, and maintainability.

    724 GitHub stars~1.7k tokensUpdated 4 mo ago
    DevelopmentAuto-check passed
  • A skill your agent uses when implementing, debugging, refactoring, or testing existing BootUI Java code, including framework-neutral engine logic, Spring MVC and WebFlux adapters, Quarkus runtime…

    314 GitHub stars~1.3k tokensUpdated today
    DevelopmentAuto-check passed

More from ThibautBaissac/rails_ai_agents

All 19 skills in this repo
  • Accessibility Review

    ThibautBaissac/rails_ai_agents

    Audits Rails application accessibility against WCAG 2.2 Level AA, detects violations with axe-core / Lighthouse / Pa11y, and reports remediation guidance for ERB views, ViewComponents, Stimulus…

    665 GitHub stars~2.9k tokensUpdated 4 mo ago
    Auto-check: notes
  • Action Cable Patterns

    ThibautBaissac/rails_ai_agents

    Implements real-time features with Action Cable and WebSockets.

    665 GitHub stars~1.2k tokensUpdated 4 mo ago
    Auto-check passed
  • Active Storage Setup

    ThibautBaissac/rails_ai_agents

    Configures Active Storage for file uploads with variants and direct uploads.

    665 GitHub stars~1.2k tokensUpdated 4 mo ago
    Auto-check passed
  • Authentication Flow

    ThibautBaissac/rails_ai_agents

    Implements authentication using Rails 8 built-in generator. An agent skill from ThibautBaissac/rails_ai_agents.

    665 GitHub stars~1.9k tokensUpdated 4 mo ago
    Auto-check passed
  • Caching Strategies

    ThibautBaissac/rails_ai_agents

    Implements Rails caching patterns for performance optimization.

    665 GitHub stars~1.4k tokensUpdated 4 mo ago
    Auto-check passed
  • I18n Patterns

    ThibautBaissac/rails_ai_agents

    Implements internationalization with Rails I18n for multi-language support.

    665 GitHub stars~1.4k tokensUpdated 4 mo ago
    Auto-check passed

Works with

Questions about Rails Architecture

What does Rails Architecture do?

Guides modern Rails 8 code architecture decisions and patterns. Rails Architecture is an agent skill from ThibautBaissac/rails_ai_agents. Guides modern Rails 8 code architecture decisions and patterns.

When should I use Rails Architecture?

Rails Architecture fits situations like: deciding where to put code; choosing between patterns (service objects vs concerns vs query objects); designing feature architecture; refactoring for better organization.

How do I install Rails Architecture in Claude Code?

Run `npx skills add ThibautBaissac/rails_ai_agents --skill rails-architecture -a claude-code`. Or copy the skill folder (.agents/skills/rails-architecture in ThibautBaissac/rails_ai_agents) into .claude/skills/rails-architecture in your project. Claude Code loads it when a task matches its description.

How do I install Rails Architecture in Codex?

Run `npx skills add ThibautBaissac/rails_ai_agents --skill rails-architecture -a codex`. Or copy the skill folder (.agents/skills/rails-architecture in ThibautBaissac/rails_ai_agents) into .agents/skills/rails-architecture in your project. Codex loads it when a task matches its description.

Can I use Rails Architecture in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add ThibautBaissac/rails_ai_agents --skill rails-architecture -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/rails-architecture, .gemini/skills/rails-architecture, .github/skills/rails-architecture and .opencode/skills/rails-architecture in your project.

What does Rails Architecture need to run?

SKILL.md names no scripts, command-line tools or credentials: Rails Architecture is instructions for the agent only.

Does Rails Architecture access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Rails Architecture safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Rails Architecture use?

Rails Architecture is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Rails Architecture use?

About 1.5k tokens (SKILL.md is roughly 5.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 10k tokens, read only when the agent opens those files.

What are the alternatives to Rails Architecture?

Skills that share tags, products or a category with Rails Architecture: Ruby (ericrisco/rsc-harness, 180 stars), Antipattern Prevention (doorkeeper-gem/doorkeeper, 5.5k stars), Layered Rails (evilmartians/redprints-cfp, 108 stars) and Architecture Patterns (secondsky/claude-skills, 227 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Rails Architecture?

ThibautBaissac (a GitHub user) maintains it in ThibautBaissac/rails_ai_agents, which has 665 GitHub stars. The repository holds 19 skills in this directory. The repository was last updated on June 1, 2026.

Source: ThibautBaissac/rails_ai_agents on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.