dhh-rails-style

Apply DHH Rails conventions to models, controllers, and concerns.

20|Updated Dec 6, 2024
One-click install
npx skills add https://github.com/newstler/template --skill dhh-rails-style-newstler
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dhh-rails-style
Source: https://github.com/newstler/template/tree/main/.claude/skills/dhh-rails-style
Command: npx skills add https://github.com/newstler/template --skill dhh-rails-style-newstler

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Writing Rails code in DHH's 37signals style helps teams achieve RESTful design, fat models, thin controllers, and clearer conventions across projects.

Core Features & Use Cases

  • Enforces vanilla Rails patterns: RESTful controllers, rich domain models, and focused concerns for shared behavior
  • Encourages Current attributes, Hotwire patterns, and straightforward Stimulus usage for maintainable UIs
  • Serves as a reference guide for teams adopting DHH/Rails discipline in new or existing projects

Quick Start

Apply the DHH Rails style guide to your Rails codebase to align models, controllers, and views with RESTful, clear, and maintainable patterns.

Frequently Asked Questions about dhh-rails-style

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

FAQPage Schema
How do I write Rails controllers that follow DHH conventions for RESTful design?

To write Rails controllers with DHH conventions, keep them thin and RESTful by pushing business logic into rich domain models and using Current attributes for request-scoped state. This approach avoids unnecessary service objects and maintains clear, maintainable code.

What are Vanilla Rails principles and when should I apply them?

Vanilla Rails principles emphasize using built-in framework patterns like RESTful routing, fat models, and concerns for shared behavior instead of adding extra abstractions. Apply them to new or existing Rails projects to ensure code remains cohesive and readable.

Does the DHH Rails style work with Hotwire and Stimulus for front-end development?

Yes, the DHH Rails style works with Hotwire and Stimulus by encouraging straightforward Stimulus usage and Hotwire patterns for maintainable UIs. This keeps front-end code cohesive and integrated with vanilla Rails conventions.

What's the best way to structure shared behavior in Ruby on Rails without service objects?

The best way to structure shared behavior in Rails without service objects is using focused concerns extracted from rich domain models. This DHH style ensures code remains readable and maintainable while avoiding unnecessary abstraction layers.

When should I not use service objects in a Rails application?

You should avoid service objects in Rails when you can express the same business logic through rich domain models, concerns, and Current attributes. The DHH style favors minimal service objects to keep code clear and maintainable within vanilla Rails conventions.