37signals-rails
28
总安装量
28
周安装量
#13400
全站排名
安装命令
npx skills add https://github.com/pproenca/dot-skills --skill 37signals-rails
Agent 安装分布
codex
25
gemini-cli
24
github-copilot
24
kimi-cli
23
opencode
23
amp
22
Skill 文档
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 | arch- |
| 2 | Controllers & REST | CRITICAL | ctrl- |
| 3 | Domain Modeling | HIGH | model- |
| 4 | State Management | HIGH | state- |
| 5 | Database & Infrastructure | HIGH | db- |
| 6 | Views & Frontend | MEDIUM | view- |
| 7 | Code Style | MEDIUM | style- |
| 8 | Testing | MEDIUM | test- |
Quick Reference
1. Architecture Fundamentals (CRITICAL)
arch-rich-models– Rich Domain Models Over Service Objectsarch-vanilla-rails– Vanilla Rails is Plentyarch-avoid-patterns– Deliberately Avoided Patterns and Gemsarch-earn-abstractions– Earn Abstractions Through Rule of Threearch-build-before-gems– Build It Yourself Before Reaching for Gemsarch-ship-to-learn– Start Simple â Add Complexity Only After Validationarch-domain-facades– Domain Models as Facades Over Internal Complexityarch-single-business-layer– Single Layer for Business Logicarch-custom-auth– Custom Passwordless Auth Over Devise
2. Controllers & REST (CRITICAL)
ctrl-crud-only– CRUD Controllers Over Custom Actionsctrl-model-as-resources– Model Non-CRUD Operations as Separate Resourcesctrl-thin-controllers– Thin Controllers with Rich Domain Modelsctrl-params-expect– Use params.expect() for Parameter Validationctrl-controller-concerns– Controller Concerns for Cross-Cutting Behaviorctrl-nested-resources– Nested Resources with scope module
3. Domain Modeling (HIGH)
model-concerns– Concerns for Horizontal Code Sharingmodel-normalizes– Use normalizes Macro for Data Cleaningmodel-store-accessor– Use store_accessor for JSON Column Accessmodel-delegated-type– Use delegated_type for Polymorphismmodel-counter-caches– Counter Caches to Prevent N+1 Count Queriesmodel-touch-chains– Touch Chains for Cache Invalidationmodel-callbacks-auxiliary– Callbacks for Auxiliary Complexitymodel-event-tracking– Polymorphic Event Model for Activity Trackingmodel-poro-namespacing– Namespace POROs Under Parent Models
4. State Management (HIGH)
state-records-over-booleans– Records as State Over Boolean Columnsstate-timestamps– Timestamps for State Transitionsstate-enums– Enums for Categorical Statesstate-db-constraints– Database Constraints Over ActiveRecord Validationsstate-write-time– Compute at Write Time Not Read Time
5. Database & Infrastructure (HIGH)
db-backed-everything– Database-Backed Everythingdb-solid-queue– Solid Queue for Background Jobsdb-solid-cable– Solid Cable for Real-Time Pub/Subdb-solid-cache– Solid Cache for Application Cachingdb-multi-tenancy– Path-Based Multi-Tenancy with Current.accountdb-uuid-primary-keys– UUIDs as Primary Keysdb-no-foreign-keys– No Foreign Key Constraints
6. Views & Frontend (MEDIUM)
view-turbo-frames– Turbo Frames for Scoped Page Fragmentsview-turbo-streams– Turbo Streams for Real-Time Updatesview-stimulus-targets– Stimulus Targets Over CSS Selectorsview-stimulus-design– Stimulus Controller Design Principlesview-helpers-not-partials– Extract Logic to Helpers Not Partialsview-progressive-enhancement– Progressive Enhancement as Primary Patternview-fragment-caching– Fragment Caching for View Performanceview-http-caching– HTTP Caching with fresh_when and ETags
7. Code Style (MEDIUM)
style-conditionals– Expanded Conditionals Over Guard Clausesstyle-method-ordering– Methods Ordered by Call Sequencestyle-positive-names– Use Positive Names for Methods and Scopesstyle-naming-return-values– Method Names Reflect Return Valuesstyle-visibility-modifiers– Visibility Modifier Formattingstyle-bang-methods– Bang Methods Only When Non-Bang Existsstyle-async-naming– Use _later and _now Suffixes for Async Operations
8. Testing (MEDIUM)
test-minitest– Minitest Over RSpectest-fixtures– Database Fixtures Over FactoryBottest-no-damage– No Test-Induced Design Damagetest-no-system-tests– Integration Tests Over System Teststest-behavior– Test Behavior Not Implementation
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 |