"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-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.4metadata:5 source: https://skillmd.com/skills/levalencia/dhh-rails-style6---78<objective>9Apply 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.10</objective>1112<essential_principles>13## Core Philosophy1415"The best code is the code you don't write. The second best is the code that's obviously correct."1617**Vanilla Rails is plenty:**18- Rich domain models over service objects19- CRUD controllers over custom actions20- Concerns for horizontal code sharing21- Records as state instead of boolean columns22- Database-backed everything (no Redis)23- Build solutions before reaching for gems2425**What they deliberately avoid:**26- devise (custom ~150-line auth instead)27- pundit/cancancan (simple role checks in models)28- sidekiq (Solid Queue uses database)29- redis (database for everything)30- view_component (partials work fine)31- GraphQL (REST with Turbo sufficient)32- factory_bot (fixtures are simpler)33- rspec (Minitest ships with Rails)34- Tailwind (native CSS with layers)3536**Development Philosophy:**37- Ship, Validate, Refine - prototype-quality code to production to learn38- Fix root causes, not symptoms39- Write-time operations over read-time computations40- Database constraints over ActiveRecord validations41</essential_principles>4243<intake>44What are you working on?45461. **Controllers** - REST mapping, concerns, Turbo responses, API patterns472. **Models** - Concerns, state records, callbacks, scopes, POROs483. **Views & Frontend** - Turbo, Stimulus, CSS, partials494. **Architecture** - Routing, multi-tenancy, authentication, jobs, caching505. **Testing** - Minitest, fixtures, integration tests516. **Gems & Dependencies** - What to use vs avoid527. **Code Review** - Review code against DHH style538. **General Guidance** - Philosophy and conventions5455**Specify a number or describe your task.**56</intake>5758<routing>5960| Response | Reference to Read |61|----------|-------------------|62| 1, controller | [controllers.md](./references/controllers.md) |63| 2, model | [models.md](./references/models.md) |64| 3, view, frontend, turbo, stimulus, css | [frontend.md](./references/frontend.md) |65| 4, architecture, routing, auth, job, cache | [architecture.md](./references/architecture.md) |66| 5, test, testing, minitest, fixture | [testing.md](./references/testing.md) |67| 6, gem, dependency, library | [gems.md](./references/gems.md) |68| 7, review | Read all references, then review code |69| 8, general task | Read relevant references based on context |7071**After reading relevant references, apply patterns to the user's code.**72</routing>7374<quick_reference>75## Naming Conventions7677**Verbs:** `card.close`, `card.gild`, `board.publish` (not `set_style` methods)7879**Predicates:** `card.closed?`, `card.golden?` (derived from presence of related record)8081**Concerns:** Adjectives describing capability (`Closeable`, `Publishable`, `Watchable`)8283**Controllers:** Nouns matching resources (`Cards::ClosuresController`)8485**Scopes:**86- `chronologically`, `reverse_chronologically`, `alphabetically`, `latest`87- `preloaded` (standard eager loading name)88- `indexed_by`, `sorted_by` (parameterized)89- `active`, `unassigned` (business terms, not SQL-ish)9091## REST Mapping9293Instead of custom actions, create new resources:9495```96POST /cards/:id/close → POST /cards/:id/closure97DELETE /cards/:id/close → DELETE /cards/:id/closure98POST /cards/:id/archive → POST /cards/:id/archival99```100101## Ruby Syntax Preferences102103```ruby104# Symbol arrays with spaces inside brackets105before_action :set_message, only: %i[ show edit update destroy ]106107# Private method indentation108 private109 def set_message110 @message = Message.find(params[:id])111 end112113# Expression-less case for conditionals114case115when params[:before].present?116 messages.page_before(params[:before])117else118 messages.last_page119end120121# Bang methods for fail-fast122@message = Message.create!(params)123124# Ternaries for simple conditionals125@room.direct? ? @room.users : @message.mentionees126```127128## Key Patterns129130**State as Records:**131```ruby132Card.joins(:closure) # closed cards133Card.where.missing(:closure) # open cards134```135136**Current Attributes:**137```ruby138belongs_to :creator, default: -> { Current.user }139```140141**Authorization on Models:**142```ruby143class User < ApplicationRecord144 def can_administer?(message)145 message.creator == self || admin?146 end147end148```149</quick_reference>150151<reference_index>152## Domain Knowledge153154All detailed patterns in `references/`:155156| File | Topics |157|------|--------|158| [controllers.md](./references/controllers.md) | REST mapping, concerns, Turbo responses, API patterns, HTTP caching |159| [models.md](./references/models.md) | Concerns, state records, callbacks, scopes, POROs, authorization, broadcasting |160| [frontend.md](./references/frontend.md) | Turbo Streams, Stimulus controllers, CSS layers, OKLCH colors, partials |161| [architecture.md](./references/architecture.md) | Routing, authentication, jobs, Current attributes, caching, database patterns |162| [testing.md](./references/testing.md) | Minitest, fixtures, unit/integration/system tests, testing patterns |163| [gems.md](./references/gems.md) | What they use vs avoid, decision framework, Gemfile examples |164</reference_index>165166<success_criteria>167Code follows DHH style when:168- Controllers map to CRUD verbs on resources169- Models use concerns for horizontal behavior170- State is tracked via records, not booleans171- No unnecessary service objects or abstractions172- Database-backed solutions preferred over external services173- Tests use Minitest with fixtures174- Turbo/Stimulus for interactivity (no heavy JS frameworks)175- Native CSS with modern features (layers, OKLCH, nesting)176- Authorization logic lives on User model177- Jobs are shallow wrappers calling model methods178</success_criteria>179180<credits>181Based 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.182183**Important Disclaimers:**184- LLM-generated guide - may contain inaccuracies185- Code examples from Fizzy are licensed under the O'Saasy License186- Not affiliated with or endorsed by 37signals187</credits>