dhh-rails-style

Apply 37signals Rails conventions to Ruby and Rails code.

Updated Jun 28, 2022
One-click install
npx skills add https://github.com/pcasaretto/nix-home --skill dhh-rails-style-pcasaretto
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dhh-rails-style
Source: https://github.com/pcasaretto/nix-home/tree/main/home-manager/modules/common/pi/compound-engineering/skills/dhh-rails-style
Command: npx skills add https://github.com/pcasaretto/nix-home --skill dhh-rails-style-pcasaretto

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill helps developers write Ruby and Rails code that adheres to the distinctive, pragmatic, and efficient style championed by David Heinemeier Hansson (DHH) and the 37signals team.

Core Features & Use Cases

  • Convention Enforcement: Guides users on adopting 37signals' preferred patterns for models, controllers, views, and architecture.
  • Code Review: Assists in reviewing code against DHH's philosophy of "clarity over cleverness" and "vanilla Rails is plenty."
  • Use Case: A developer is building a new feature in a Rails application and wants to ensure their code follows best practices for maintainability, performance, and developer productivity, aligning with the 37signals approach.

Quick Start

Use the dhh-rails-style skill to refactor a Rails controller to follow REST purity and thin controller 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 refactor a Rails controller to follow DHH's coding style?

To write Rails code in DHH's style, enforce REST purity, keep controllers thin by moving logic to fat models, adopt Hotwire patterns, and prioritize clarity over cleverness for maintainability.

What are 37signals' best practices for Ruby on Rails models?

37signals' best practices for Rails models emphasize fat models that encapsulate business logic, adhere to REST purity, and follow the philosophy that vanilla Rails is plenty for most application architectures.

How do I review Ruby code against DHH's clarity over cleverness philosophy?

Review Ruby code against DHH's clarity over cleverness philosophy by checking for unnecessary metaprogramming, ensuring vanilla Rails conventions are used, and verifying that Hotwire patterns and Current attributes are applied correctly.

Does DHH's Rails style use Hotwire patterns for new features?

Yes, DHH's Rails style actively incorporates Hotwire patterns for building new features, aligning with the 37signals approach of leveraging vanilla Rails to achieve efficient and maintainable web application architecture.

When should I use Current attributes in a Rails application?

Use Current attributes in a Rails application to manage request-scoped global state cleanly, a pattern endorsed by 37signals to maintain thin controllers and fat models without overcomplicating your Ruby code.

What is the best way to adopt 37signals conventions for Ruby code generation?

The best way to adopt 37signals conventions for Ruby code generation is to apply DHH's Rails style, focusing on REST purity, fat models, thin controllers, and the pragmatic clarity over cleverness philosophy.