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/rails-design-system" ~/.claude/skills/comeonoliver-skillshub-rails-design-system && rm -rf "$T"
manifest:
skills/pproenca/dot-skills/rails-design-system/SKILL.mdsource content
Community Ruby on Rails Design System Best Practices
Comprehensive design system guide for Ruby on Rails applications, maintained by Community. Contains 51 rules across 9 categories, prioritized by impact to guide automated refactoring and code generation. Covers the full Rails frontend stack: Turbo (Drive, Frames, Streams), Stimulus, ERB partials, design tokens, form builders, and view helpers. Complements
rails-dev (controllers, models, queries) and tailwind (CSS patterns) by covering the systematic UI component architecture layer.
When to Apply
Reference these guidelines when:
- Deciding whether to extract a partial, component, or helper
- Defining design tokens with Tailwind CSS
@theme - Creating or refactoring ERB partials with explicit locals
- Decomposing pages into Turbo Frames for targeted updates
- Using Turbo Streams for multi-element CRUD updates
- Coordinating Turbo navigation with Stimulus controllers
- Building ViewComponent or Phlex components for complex UI
- Implementing a custom FormBuilder for consistent forms
- Writing view helpers for badges, icons, and conditional classes
- Adding Stimulus controllers for interactive behaviors
- Managing JavaScript dependencies with Import Maps
- Auditing the codebase for UI duplication and naming drift
Rule Categories by Priority
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Design Decisions | CRITICAL | |
| 2 | Design Tokens | CRITICAL | |
| 3 | Turbo Integration | HIGH | |
| 4 | Partial Patterns | HIGH | |
| 5 | Component Architecture | HIGH | |
| 6 | Form System | MEDIUM-HIGH | |
| 7 | Helper Patterns | MEDIUM | |
| 8 | Stimulus Behaviors | MEDIUM | |
| 9 | Consistency & Organization | LOW-MEDIUM | |
Quick Reference
1. Design Decisions (CRITICAL)
- Extract only after a pattern appears in 3+ placesdecide-three-uses-rule
- Choose partials for simple reuse, components for complex logicdecide-partial-vs-component
- Use helpers for tiny HTML fragments, partials for layout blocksdecide-helper-vs-partial
- Prove patterns in production before abstractingdecide-prove-then-extract
- Avoid thin wrappers that add indirection without valuedecide-avoid-wrapper-components
- Scope the design system to what the app actually needsdecide-design-system-scope
2. Design Tokens (CRITICAL)
- Define tokens with Tailwind CSS @theme directivetoken-tailwind-theme
- Name colors by purpose, not appearancetoken-semantic-color-names
- Use a constrained spacing scale for consistent layouttoken-spacing-scale
- Define a typography scale for headings, body, and UI texttoken-typography-scale
- Create component-level tokens for repeated patternstoken-component-tokens
- Share token values between CSS and Ruby when neededtoken-share-tokens-with-ruby
3. Turbo Integration (HIGH)
- Let Turbo Drive handle navigation by defaultturbo-drive-defaults
- Decompose pages into Turbo Frames for targeted updatesturbo-frame-decompose
- Name Turbo Frames with dom_id conventionsturbo-frame-naming
- Choose Turbo Frames vs Turbo Streams by scope of changeturbo-frame-vs-stream
- Use Turbo Streams for multi-element page updatesturbo-stream-crud
- Coordinate Turbo and Stimulus without conflictsturbo-stimulus-coordination
4. Partial Patterns (HIGH)
- Always pass locals explicitly to partialspartial-explicit-locals
- Use presenter objects to encapsulate view logicpartial-presenter-objects
- Name partials by what they render, prefixed with underscorepartial-naming-conventions
- Use yield blocks for flexible partial layoutspartial-yield-blocks
- Use collection rendering with spacer templatespartial-collection-with-spacer
- Place cross-controller partials in app/views/sharedpartial-shared-directory
5. Component Architecture (HIGH)
- Use components when partials outgrow simple renderingcomp-when-to-use
- Define explicit typed arguments for every componentcomp-explicit-args
- Use slots for caller-provided markup blockscomp-slots-for-markup
- Test components by asserting on rendered HTMLcomp-test-rendered-output
6. Form System (MEDIUM-HIGH)
- Create a custom FormBuilder for consistent form renderingform-custom-builder
- Set the custom builder as the application defaultform-set-default-builder
- Display field errors inline with consistent markupform-error-display
- Generate accessible labels and ARIA attributes automaticallyform-accessible-labels
- Wrap label + input + error in a consistent group elementform-group-wrapper
- Standardize submit buttons through the form builderform-button-consistency
7. Helper Patterns (MEDIUM)
- Use tag helpers for small generated HTML fragmentshelper-tag-helpers
- Use class_names for conditional CSS classeshelper-conditional-classes
- Create an icon helper for consistent icon renderinghelper-icon-helper
- Build a badge helper for status indicatorshelper-badge-pattern
- Scope helpers to specific domains, not generic utilitieshelper-scope-to-domain
8. Stimulus Behaviors (MEDIUM)
- Write general-purpose controllers, not one-off scriptsstim-general-purpose
- Configure behavior through data attributes, not JavaScriptstim-data-attribute-config
- Keep controllers small and single-responsibilitystim-small-controllers
- Compose multiple controllers on one elementstim-composable-controllers
- Use outlets for cross-controller communicationstim-use-outlets
- Use stimulus-components before writing custom controllersstim-leverage-library
9. Consistency & Organization (LOW-MEDIUM)
- Follow consistent naming across partials, components, and helpersorg-naming-conventions
- Organize design system files in predictable locationsorg-file-structure
- Periodically audit views for duplicated patternsorg-deduplication-audit
- Use Import Maps for zero-build JavaScript deliveryorg-import-maps
- Preview components with Lookbook in developmentorg-preview-with-lookbook
- Document design system decisions in ADRsorg-document-design-decisions
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 |