dry-rb-patterns

Apply dry-rb patterns for validation, types, and monads in Rails apps.

7|Updated Mar 22, 2026
One-click install
npx skills add https://github.com/slbug/claude-ruby-grape-rails --skill dry-rb-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dry-rb-patterns
Source: https://github.com/slbug/claude-ruby-grape-rails/tree/main/plugins/ruby-grape-rails/skills/dry-rb-patterns
Command: npx skills add https://github.com/slbug/claude-ruby-grape-rails --skill dry-rb-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Ruby on Rails teams often struggle with maintaining clean validation, strong typing, and predictable domain logic across services. This Skill shows how to apply the dry-rb ecosystem (dry-validation, dry-types, dry-structs, dry-monads, dry-transaction, dry-system) to build resilient Rails code.

Core Features & Use Cases

  • Structured contracts for params and forms via dry-validation.
  • Strongly typed data with dry-types and immutable value objects via dry-struct.
  • Composable service objects and transactions using dry-monads and dry-transaction.
  • Dependency wiring and modular design with dry-system for scalable Rails apps.
  • Use Case: validate input in controllers, compose operations in services, and propagate errors cleanly.

Quick Start

Create a sample Dry::Validation contract and demonstrate applying it in a Rails controller to validate params.

Frequently Asked Questions about dry-rb-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I use dry-validation contracts for params validation in Rails controllers?

Use dry-validation contracts to validate Rails controller params by defining structured schemas that explicitly check input types and rules, returning clean success or error results without relying on ActiveRecord validations.

What is the best way to build composable service objects in Rails?

Build composable Rails service objects using dry-monads and dry-transaction to chain operations predictably, propagating failures cleanly and halting execution upon encountering the first error.

How do dry-types and dry-struct create immutable value objects in Ruby on Rails?

Dry-types defines strongly typed attributes while dry-struct builds immutable value objects, ensuring your Rails domain logic strictly enforces data shapes and prevents unexpected type mutations.

Does dry-system support dependency injection for modular Rails applications?

Yes, dry-system supports dependency wiring and modular design for scalable Rails apps, automatically resolving and injecting dependencies to keep your domain logic decoupled and maintainable.

When should I use dry-monads instead of standard Rails exceptions for service failures?

Use dry-monads instead of standard Rails exceptions when you need explicit, composable failure handling in service objects, allowing operations to return typed success or failure results without relying on exception-driven control flow.