install
source · Clone the upstream repo
git clone https://github.com/ComeOnOliver/skillshub
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ComeOnOliver/skillshub "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/pproenca/dot-skills/37signals-rails" ~/.claude/skills/comeonoliver-skillshub-37signals-rails && rm -rf "$T"
manifest:
skills/pproenca/dot-skills/37signals-rails/SKILL.mdsource content
37signals Rails Best Practices
Comprehensive coding principles and conventions for Ruby on Rails applications, as practiced at 37signals (Basecamp, HEY, Fizzy). Contains 56 rules across 8 categories, prioritized by architectural impact. Derived from official 37signals sources: the Fizzy codebase, STYLE.md, AGENTS.md, the Rails Doctrine, DHH's "On Writing Software Well" series, and the unofficial 37signals style guide (265 Fizzy PRs).
When to Apply
Reference these guidelines when:
- Writing new Rails controllers, models, or views
- Deciding between gems and vanilla Rails
- Modeling state and database schema
- Setting up background jobs, caching, or real-time features
- Reviewing code for 37signals-style conventions
- Refactoring toward rich domain models
- Choosing authentication or authorization approach
- Adding Stimulus controllers or Turbo patterns
Rule Categories by Priority
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Architecture Fundamentals | CRITICAL | |
| 2 | Controllers & REST | CRITICAL | |
| 3 | Domain Modeling | HIGH | |
| 4 | State Management | HIGH | |
| 5 | Database & Infrastructure | HIGH | |
| 6 | Views & Frontend | MEDIUM | |
| 7 | Code Style | MEDIUM | |
| 8 | Testing | MEDIUM | |
Quick Reference
1. Architecture Fundamentals (CRITICAL)
- Rich Domain Models Over Service Objectsarch-rich-models
- Vanilla Rails is Plentyarch-vanilla-rails
- Deliberately Avoided Patterns and Gemsarch-avoid-patterns
- Earn Abstractions Through Rule of Threearch-earn-abstractions
- Build It Yourself Before Reaching for Gemsarch-build-before-gems
- Start Simple — Add Complexity Only After Validationarch-ship-to-learn
- Domain Models as Facades Over Internal Complexityarch-domain-facades
- Single Layer for Business Logicarch-single-business-layer
- Custom Passwordless Auth Over Devisearch-custom-auth
2. Controllers & REST (CRITICAL)
- CRUD Controllers Over Custom Actionsctrl-crud-only
- Model Non-CRUD Operations as Separate Resourcesctrl-model-as-resources
- Thin Controllers with Rich Domain Modelsctrl-thin-controllers
- Use params.expect() for Parameter Validationctrl-params-expect
- Controller Concerns for Cross-Cutting Behaviorctrl-controller-concerns
- Nested Resources with scope modulectrl-nested-resources
3. Domain Modeling (HIGH)
- Concerns for Horizontal Code Sharingmodel-concerns
- Use normalizes Macro for Data Cleaningmodel-normalizes
- Use store_accessor for JSON Column Accessmodel-store-accessor
- Use delegated_type for Polymorphismmodel-delegated-type
- Counter Caches to Prevent N+1 Count Queriesmodel-counter-caches
- Touch Chains for Cache Invalidationmodel-touch-chains
- Callbacks for Auxiliary Complexitymodel-callbacks-auxiliary
- Polymorphic Event Model for Activity Trackingmodel-event-tracking
- Namespace POROs Under Parent Modelsmodel-poro-namespacing
4. State Management (HIGH)
- Records as State Over Boolean Columnsstate-records-over-booleans
- Timestamps for State Transitionsstate-timestamps
- Enums for Categorical Statesstate-enums
- Database Constraints Over ActiveRecord Validationsstate-db-constraints
- Compute at Write Time Not Read Timestate-write-time
5. Database & Infrastructure (HIGH)
- Database-Backed Everythingdb-backed-everything
- Solid Queue for Background Jobsdb-solid-queue
- Solid Cable for Real-Time Pub/Subdb-solid-cable
- Solid Cache for Application Cachingdb-solid-cache
- Path-Based Multi-Tenancy with Current.accountdb-multi-tenancy
- UUIDs as Primary Keysdb-uuid-primary-keys
- No Foreign Key Constraintsdb-no-foreign-keys
6. Views & Frontend (MEDIUM)
- Turbo Frames for Scoped Page Fragmentsview-turbo-frames
- Turbo Streams for Real-Time Updatesview-turbo-streams
- Stimulus Targets Over CSS Selectorsview-stimulus-targets
- Stimulus Controller Design Principlesview-stimulus-design
- Extract Logic to Helpers Not Partialsview-helpers-not-partials
- Progressive Enhancement as Primary Patternview-progressive-enhancement
- Fragment Caching for View Performanceview-fragment-caching
- HTTP Caching with fresh_when and ETagsview-http-caching
7. Code Style (MEDIUM)
- Expanded Conditionals Over Guard Clausesstyle-conditionals
- Methods Ordered by Call Sequencestyle-method-ordering
- Use Positive Names for Methods and Scopesstyle-positive-names
- Method Names Reflect Return Valuesstyle-naming-return-values
- Visibility Modifier Formattingstyle-visibility-modifiers
- Bang Methods Only When Non-Bang Existsstyle-bang-methods
- Use _later and _now Suffixes for Async Operationsstyle-async-naming
8. Testing (MEDIUM)
- Minitest Over RSpectest-minitest
- Database Fixtures Over FactoryBottest-fixtures
- No Test-Induced Design Damagetest-no-damage
- Integration Tests Over System Teststest-no-system-tests
- Test Behavior Not Implementationtest-behavior
How to Use
Read individual reference files for detailed explanations and code examples:
- Section definitions - Category structure and impact levels
- Rule template - Template for adding new rules
Reference Files
| File | Description |
|---|---|
| references/_sections.md | Category definitions and ordering |
| assets/templates/_template.md | Template for new rules |
| metadata.json | Version and reference information |