dhh-rails-style

Enforce DHH RESTful Rails conventions in Ruby code reviews.

24.1k|2.0k|Updated Oct 9, 2025
One-click install
npx skills add https://github.com/EveryInc/compound-engineering-plugin --skill dhh-rails-style
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dhh-rails-style
Source: https://github.com/EveryInc/compound-engineering-plugin/tree/main/plugins/compound-engineering/skills/dhh-rails-style
Command: npx skills add https://github.com/EveryInc/compound-engineering-plugin --skill dhh-rails-style

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Applies DHH's RESTful, conventional Rails patterns and minimal dependencies to Ruby/Rails code.

Core Features & Use Cases

  • RESTful controller patterns; fat models; concerns
  • Current attributes and Turbo/Stimulus
  • Rails integration with minimal coupling
  • Anti-pattern warnings and guidance

Quick Start

Sketch a RESTful controller and a fat-model example.

Frequently Asked Questions about dhh-rails-style

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

FAQPage Schema
How do I structure Rails controllers and models following RESTful conventions?

RESTful Rails architecture uses thin controllers that route to seven standard actions (index, show, new, create, edit, update, destroy) and fat models that contain business logic, validations, and concerns. This separation keeps controllers lightweight and models responsible for domain logic.

What are DHH Rails style conventions and when should I use them?

DHH Rails style enforces conventional patterns from 37signals: RESTful CRUD mappings, fat models with concerns, Current attributes for multi-tenant context, Turbo for dynamic interactions, and minimal external dependencies. Use this approach for Rails applications prioritizing simplicity and framework conventions over custom abstractions.

How do I implement multi-tenant routing and Current attributes in Rails?

Multi-tenant Rails routing uses path-scoped resources with Current attributes to maintain tenant context across requests without explicit parameters. Current provides thread-safe storage for request-scoped data like account or user context, eliminating dependency injection boilerplate.

Can I use Turbo and Stimulus with DHH Rails patterns?

Yes. Turbo drives and morphs HTML without JavaScript frameworks, while Stimulus provides lightweight interactivity. Both integrate directly with Rails conventions and avoid heavy client-side dependencies, aligning with DHH's minimal-coupling philosophy.

What patterns should I avoid in Rails architecture?

Avoid excessive service objects, Redis for core features, GraphQL without clear need, and heavy external dependencies. DHH style favors database-backed design, Rails concerns for shared logic, and REST APIs over custom abstraction layers that obscure conventional Rails behavior.

How do I apply DHH conventions during code review and refactoring?

Review for RESTful action alignment, business logic placement in models, overuse of service objects, and unnecessary dependencies. Refactoring should consolidate thin controllers, push logic to models and concerns, and simplify architecture toward Rails conventions rather than custom patterns.