"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 |
references/controllers.md |
| 2, model |
references/models.md |
| 3, view, frontend, turbo, stimulus, css |
references/frontend.md |
| 4, architecture, routing, auth, job, cache |
references/architecture.md |
| 5, test, testing, minitest, fixture |
references/testing.md |
| 6, gem, dependency, library |
references/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 |
references/controllers.md |
REST mapping, concerns, Turbo responses, API patterns, HTTP caching |
references/models.md |
Concerns, state records, callbacks, scopes, POROs, authorization, broadcasting |
references/frontend.md |
Turbo Streams, Stimulus controllers, CSS layers, OKLCH colors, partials |
references/architecture.md |
Routing, authentication, jobs, Current attributes, caching, database patterns |
references/testing.md |
Minitest, fixtures, unit/integration/system tests, testing patterns |
references/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: ce-dhh-rails-style3description: 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.4---56<objective>7Apply 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.8</objective>910<essential_principles>11## Core Philosophy1213"The best code is the code you don't write. The second best is the code that's obviously correct."1415**Vanilla Rails is plenty:**16- Rich domain models over service objects17- CRUD controllers over custom actions18- Concerns for horizontal code sharing19- Records as state instead of boolean columns20- Database-backed everything (no Redis)21- Build solutions before reaching for gems2223**What they deliberately avoid:**24- devise (custom ~150-line auth instead)25- pundit/cancancan (simple role checks in models)26- sidekiq (Solid Queue uses database)27- redis (database for everything)28- view_component (partials work fine)29- GraphQL (REST with Turbo sufficient)30- factory_bot (fixtures are simpler)31- rspec (Minitest ships with Rails)32- Tailwind (native CSS with layers)3334**Development Philosophy:**35- Ship, Validate, Refine - prototype-quality code to production to learn36- Fix root causes, not symptoms37- Write-time operations over read-time computations38- Database constraints over ActiveRecord validations39</essential_principles>4041<intake>42What are you working on?43441. **Controllers** - REST mapping, concerns, Turbo responses, API patterns452. **Models** - Concerns, state records, callbacks, scopes, POROs463. **Views & Frontend** - Turbo, Stimulus, CSS, partials474. **Architecture** - Routing, multi-tenancy, authentication, jobs, caching485. **Testing** - Minitest, fixtures, integration tests496. **Gems & Dependencies** - What to use vs avoid507. **Code Review** - Review code against DHH style518. **General Guidance** - Philosophy and conventions5253**Specify a number or describe your task.**54</intake>5556<routing>5758| Response | Reference to Read |59|----------|-------------------|60| 1, controller | `references/controllers.md` |61| 2, model | `references/models.md` |62| 3, view, frontend, turbo, stimulus, css | `references/frontend.md` |63| 4, architecture, routing, auth, job, cache | `references/architecture.md` |64| 5, test, testing, minitest, fixture | `references/testing.md` |65| 6, gem, dependency, library | `references/gems.md` |66| 7, review | Read all references, then review code |67| 8, general task | Read relevant references based on context |6869**After reading relevant references, apply patterns to the user's code.**70</routing>7172<quick_reference>73## Naming Conventions7475**Verbs:** `card.close`, `card.gild`, `board.publish` (not `set_style` methods)7677**Predicates:** `card.closed?`, `card.golden?` (derived from presence of related record)7879**Concerns:** Adjectives describing capability (`Closeable`, `Publishable`, `Watchable`)8081**Controllers:** Nouns matching resources (`Cards::ClosuresController`)8283**Scopes:**84- `chronologically`, `reverse_chronologically`, `alphabetically`, `latest`85- `preloaded` (standard eager loading name)86- `indexed_by`, `sorted_by` (parameterized)87- `active`, `unassigned` (business terms, not SQL-ish)8889## REST Mapping9091Instead of custom actions, create new resources:9293```94POST /cards/:id/close → POST /cards/:id/closure95DELETE /cards/:id/close → DELETE /cards/:id/closure96POST /cards/:id/archive → POST /cards/:id/archival97```9899## Ruby Syntax Preferences100101```ruby102# Symbol arrays with spaces inside brackets103before_action :set_message, only: %i[ show edit update destroy ]104105# Private method indentation106 private107 def set_message108 @message = Message.find(params[:id])109 end110111# Expression-less case for conditionals112case113when params[:before].present?114 messages.page_before(params[:before])115else116 messages.last_page117end118119# Bang methods for fail-fast120@message = Message.create!(params)121122# Ternaries for simple conditionals123@room.direct? ? @room.users : @message.mentionees124```125126## Key Patterns127128**State as Records:**129```ruby130Card.joins(:closure) # closed cards131Card.where.missing(:closure) # open cards132```133134**Current Attributes:**135```ruby136belongs_to :creator, default: -> { Current.user }137```138139**Authorization on Models:**140```ruby141class User < ApplicationRecord142 def can_administer?(message)143 message.creator == self || admin?144 end145end146```147</quick_reference>148149<reference_index>150## Domain Knowledge151152All detailed patterns in `references/`:153154| File | Topics |155|------|--------|156| `references/controllers.md` | REST mapping, concerns, Turbo responses, API patterns, HTTP caching |157| `references/models.md` | Concerns, state records, callbacks, scopes, POROs, authorization, broadcasting |158| `references/frontend.md` | Turbo Streams, Stimulus controllers, CSS layers, OKLCH colors, partials |159| `references/architecture.md` | Routing, authentication, jobs, Current attributes, caching, database patterns |160| `references/testing.md` | Minitest, fixtures, unit/integration/system tests, testing patterns |161| `references/gems.md` | What they use vs avoid, decision framework, Gemfile examples |162</reference_index>163164<success_criteria>165Code follows DHH style when:166- Controllers map to CRUD verbs on resources167- Models use concerns for horizontal behavior168- State is tracked via records, not booleans169- No unnecessary service objects or abstractions170- Database-backed solutions preferred over external services171- Tests use Minitest with fixtures172- Turbo/Stimulus for interactivity (no heavy JS frameworks)173- Native CSS with modern features (layers, OKLCH, nesting)174- Authorization logic lives on User model175- Jobs are shallow wrappers calling model methods176</success_criteria>177178<credits>179Based 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.180181**Important Disclaimers:**182- LLM-generated guide - may contain inaccuracies183- Code examples from Fizzy are licensed under the O'Saasy License184- Not affiliated with or endorsed by 37signals185</credits>186