"The best code is the code you don't write. The second best is the code that's obviously correct."
Vanilla Rails is plenty:
- Rich domain models over service objects
- CRUD controllers over custom actions
- Concerns for horizontal code sharing
- Records as state instead of boolean columns
- Database-backed everything (no Redis)
- Build solutions before reaching for gems
What they deliberately avoid:
- devise (custom ~150-line auth instead)
- pundit/cancancan (simple role checks in models)
- sidekiq (Solid Queue uses database)
- redis (database for everything)
- view_component (partials work fine)
- GraphQL (REST with Turbo sufficient)
- factory_bot (fixtures are simpler)
- rspec (Minitest ships with Rails)
- Tailwind (native CSS with layers)
Development Philosophy:
- Ship, Validate, Refine - prototype-quality code to production to learn
- Fix root causes, not symptoms
- Write-time operations over read-time computations
- Database constraints over ActiveRecord validations
- Controllers - REST mapping, concerns, Turbo responses, API patterns
- Models - Concerns, state records, callbacks, scopes, POROs
- Views & Frontend - Turbo, Stimulus, CSS, partials
- Architecture - Routing, multi-tenancy, authentication, jobs, caching
- Testing - Minitest, fixtures, integration tests
- Gems & Dependencies - What to use vs avoid
- Code Review - Review code against DHH style
- General Guidance - Philosophy and conventions
Specify a number or describe your task.
| Response |
Reference to Read |
| 1, controller |
controllers.md |
| 2, model |
models.md |
| 3, view, frontend, turbo, stimulus, css |
frontend.md |
| 4, architecture, routing, auth, job, cache |
architecture.md |
| 5, test, testing, minitest, fixture |
testing.md |
| 6, gem, dependency, library |
gems.md |
| 7, review |
Read all references, then review code |
| 8, general task |
Read relevant references based on context |
After reading relevant references, apply patterns to the user's code.
Verbs: card.close, card.gild, board.publish (not set_style methods)
Predicates: card.closed?, card.golden? (derived from presence of related record)
Concerns: Adjectives describing capability (Closeable, Publishable, Watchable)
Controllers: Nouns matching resources (Cards::ClosuresController)
Scopes:
chronologically, reverse_chronologically, alphabetically, latest
preloaded (standard eager loading name)
indexed_by, sorted_by (parameterized)
active, unassigned (business terms, not SQL-ish)
REST Mapping
Instead of custom actions, create new resources:
POST /cards/:id/close → POST /cards/:id/closure
DELETE /cards/:id/close → DELETE /cards/:id/closure
POST /cards/:id/archive → POST /cards/:id/archival
Ruby Syntax Preferences
# Symbol arrays with spaces inside brackets
before_action :set_message, only: %i[ show edit update destroy ]
# Private method indentation
private
def set_message
@message = Message.find(params[:id])
end
# Expression-less case for conditionals
case
when params[:before].present?
messages.page_before(params[:before])
else
messages.last_page
end
# Bang methods for fail-fast
@message = Message.create!(params)
# Ternaries for simple conditionals
@room.direct? ? @room.users : @message.mentionees
Key Patterns
State as Records:
Card.joins(:closure) # closed cards
Card.where.missing(:closure) # open cards
Current Attributes:
belongs_to :creator, default: -> { Current.user }
Authorization on Models:
class User < ApplicationRecord
def can_administer?(message)
message.creator == self || admin?
end
end
All detailed patterns in references/:
| File |
Topics |
| controllers.md |
REST mapping, concerns, Turbo responses, API patterns, HTTP caching |
| models.md |
Concerns, state records, callbacks, scopes, POROs, authorization, broadcasting |
| frontend.md |
Turbo Streams, Stimulus controllers, CSS layers, OKLCH colors, partials |
| architecture.md |
Routing, authentication, jobs, Current attributes, caching, database patterns |
| testing.md |
Minitest, fixtures, unit/integration/system tests, testing patterns |
| gems.md |
What they use vs avoid, decision framework, Gemfile examples |
|
|
Important Disclaimers:
- LLM-generated guide - may contain inaccuracies
- Code examples from Fizzy are licensed under the O'Saasy License
- Not affiliated with or endorsed by 37signals
1---2name: dhh-rails-style3user-invocable: true4description: This skill should be used when writing Ruby and Rails code in DHH's distinctive 37signals style. It applies when writing Ruby code, Rails applications, creating models, controllers, or any Ruby file. Triggers on Ruby/Rails code generation, refactoring requests, code review, or when the user mentions DHH, 37signals, Basecamp, HEY, or Campfire style. Embodies REST purity, fat models, thin controllers, Current attributes, Hotwire patterns, and the "clarity over cleverness" philosophy.5---67<objective>8Apply 37signals/DHH Rails conventions to Ruby and Rails code. This skill provides comprehensive domain expertise extracted from analyzing production 37signals codebases (Fizzy/Campfire) and DHH's code review patterns.9</objective>1011<essential_principles>12## Core Philosophy1314"The best code is the code you don't write. The second best is the code that's obviously correct."1516**Vanilla Rails is plenty:**17- Rich domain models over service objects18- CRUD controllers over custom actions19- Concerns for horizontal code sharing20- Records as state instead of boolean columns21- Database-backed everything (no Redis)22- Build solutions before reaching for gems2324**What they deliberately avoid:**25- devise (custom ~150-line auth instead)26- pundit/cancancan (simple role checks in models)27- sidekiq (Solid Queue uses database)28- redis (database for everything)29- view_component (partials work fine)30- GraphQL (REST with Turbo sufficient)31- factory_bot (fixtures are simpler)32- rspec (Minitest ships with Rails)33- Tailwind (native CSS with layers)3435**Development Philosophy:**36- Ship, Validate, Refine - prototype-quality code to production to learn37- Fix root causes, not symptoms38- Write-time operations over read-time computations39- Database constraints over ActiveRecord validations40</essential_principles>4142<intake>43What are you working on?44451. **Controllers** - REST mapping, concerns, Turbo responses, API patterns462. **Models** - Concerns, state records, callbacks, scopes, POROs473. **Views & Frontend** - Turbo, Stimulus, CSS, partials484. **Architecture** - Routing, multi-tenancy, authentication, jobs, caching495. **Testing** - Minitest, fixtures, integration tests506. **Gems & Dependencies** - What to use vs avoid517. **Code Review** - Review code against DHH style528. **General Guidance** - Philosophy and conventions5354**Specify a number or describe your task.**55</intake>5657<routing>5859| Response | Reference to Read |60|----------|-------------------|61| 1, controller | [controllers.md](./references/controllers.md) |62| 2, model | [models.md](./references/models.md) |63| 3, view, frontend, turbo, stimulus, css | [frontend.md](./references/frontend.md) |64| 4, architecture, routing, auth, job, cache | [architecture.md](./references/architecture.md) |65| 5, test, testing, minitest, fixture | [testing.md](./references/testing.md) |66| 6, gem, dependency, library | [gems.md](./references/gems.md) |67| 7, review | Read all references, then review code |68| 8, general task | Read relevant references based on context |6970**After reading relevant references, apply patterns to the user's code.**71</routing>7273<quick_reference>74## Naming Conventions7576**Verbs:** `card.close`, `card.gild`, `board.publish` (not `set_style` methods)7778**Predicates:** `card.closed?`, `card.golden?` (derived from presence of related record)7980**Concerns:** Adjectives describing capability (`Closeable`, `Publishable`, `Watchable`)8182**Controllers:** Nouns matching resources (`Cards::ClosuresController`)8384**Scopes:**85- `chronologically`, `reverse_chronologically`, `alphabetically`, `latest`86- `preloaded` (standard eager loading name)87- `indexed_by`, `sorted_by` (parameterized)88- `active`, `unassigned` (business terms, not SQL-ish)8990## REST Mapping9192Instead of custom actions, create new resources:9394```95POST /cards/:id/close → POST /cards/:id/closure96DELETE /cards/:id/close → DELETE /cards/:id/closure97POST /cards/:id/archive → POST /cards/:id/archival98```99100## Ruby Syntax Preferences101102```ruby103# Symbol arrays with spaces inside brackets104before_action :set_message, only: %i[ show edit update destroy ]105106# Private method indentation107 private108 def set_message109 @message = Message.find(params[:id])110 end111112# Expression-less case for conditionals113case114when params[:before].present?115 messages.page_before(params[:before])116else117 messages.last_page118end119120# Bang methods for fail-fast121@message = Message.create!(params)122123# Ternaries for simple conditionals124@room.direct? ? @room.users : @message.mentionees125```126127## Key Patterns128129**State as Records:**130```ruby131Card.joins(:closure) # closed cards132Card.where.missing(:closure) # open cards133```134135**Current Attributes:**136```ruby137belongs_to :creator, default: -> { Current.user }138```139140**Authorization on Models:**141```ruby142class User < ApplicationRecord143 def can_administer?(message)144 message.creator == self || admin?145 end146end147```148</quick_reference>149150<reference_index>151## Domain Knowledge152153All detailed patterns in `references/`:154155| File | Topics |156|------|--------|157| [controllers.md](./references/controllers.md) | REST mapping, concerns, Turbo responses, API patterns, HTTP caching |158| [models.md](./references/models.md) | Concerns, state records, callbacks, scopes, POROs, authorization, broadcasting |159| [frontend.md](./references/frontend.md) | Turbo Streams, Stimulus controllers, CSS layers, OKLCH colors, partials |160| [architecture.md](./references/architecture.md) | Routing, authentication, jobs, Current attributes, caching, database patterns |161| [testing.md](./references/testing.md) | Minitest, fixtures, unit/integration/system tests, testing patterns |162| [gems.md](./references/gems.md) | What they use vs avoid, decision framework, Gemfile examples |163</reference_index>164165<success_criteria>166Code follows DHH style when:167- Controllers map to CRUD verbs on resources168- Models use concerns for horizontal behavior169- State is tracked via records, not booleans170- No unnecessary service objects or abstractions171- Database-backed solutions preferred over external services172- Tests use Minitest with fixtures173- Turbo/Stimulus for interactivity (no heavy JS frameworks)174- Native CSS with modern features (layers, OKLCH, nesting)175- Authorization logic lives on User model176- Jobs are shallow wrappers calling model methods177</success_criteria>178179<credits>180Based on [The Unofficial 37signals/DHH Rails Style Guide](https://github.com/marckohlbrugge/unofficial-37signals-coding-style-guide) by [Marc Köhlbrugge](https://x.com/marckohlbrugge), generated through deep analysis of 265 pull requests from the Fizzy codebase.181182**Important Disclaimers:**183- LLM-generated guide - may contain inaccuracies184- Code examples from Fizzy are licensed under the O'Saasy License185- Not affiliated with or endorsed by 37signals186</credits>