ruby-patterns
Ruby Patterns covers essential idioms and architectural approaches for Rails and Ruby development. Learn blocks, procs, lambdas, modules, metaprogramming techniques, pattern matching, and enumerable chains alongside testing strategies with RSpec, error handling patterns, and project structure conventions for gems and Rails apps.
Ruby Patterns teaches Rails and Ruby idioms including blocks, metaprogramming, ActiveRecord, testing, and error handling.
AI-generated summary based on this skill's SKILL.md
Install
softspark/ai-toolkit/ruby-patterns · repository language: Python
git clone https://github.com/softspark/ai-toolkit
cp -r ai-toolkit/app/skills/ruby-patterns ~/.claude/skills/ruby-patternsnpx skillfed install softspark/ai-toolkit/ruby-patternsFrequently asked questions
AI-generated answers based on this skill's SKILL.md and metadata
What does ruby-patterns cover for blocks, procs, and lambdas?
ruby-patterns teaches blocks, procs, and lambdas patterns as core Ruby idioms. The skill covers how to use blocks for iteration and callbacks, understand proc objects and their binding behavior, distinguish lambdas from procs through argument strictness and return semantics, and apply these patterns effectively in Rails and gem development. These foundational constructs underpin much of Ruby's functional programming style.
How does ruby-patterns help with Rails project structure?
ruby-patterns explains Rails project structure best practices including conventional directory layouts, gem organization, service layer architecture, and concern modules for code reuse. You'll learn how to structure both Rails applications and custom gems following community conventions, organize business logic into services, and use mixins and concerns to keep controllers and models clean and maintainable.
What testing strategies does ruby-patterns teach with RSpec?
ruby-patterns covers rails testing with rspec factorybot through comprehensive examples. The skill teaches RSpec fundamentals, mocking and stubbing with doubles, factory setup with FactoryBot, API testing with VCR and WebMock, and integration testing patterns. You'll learn how to write fast, isolated unit tests and realistic integration tests for Rails applications.
How does ruby-patterns address error handling and retry logic?
ruby-patterns teaches ruby error handling rescue exceptions and retry logic backoff exponential strategies. You'll learn custom exception hierarchies, rescue clauses and exception handling patterns, implementing exponential backoff for retries, and designing resilient systems. The skill covers both synchronous error handling and async patterns relevant to background job processing.
What advanced Ruby features does ruby-patterns include?
ruby-patterns covers ruby metaprogramming method_missing, pattern matching ruby 3, and enumerable chaining idioms. You'll explore metaprogramming techniques for dynamic method definition, pattern matching syntax for elegant control flow, advanced enumerable chains for functional data transformation, frozen string literals for performance, and type checking with Sorbet. These advanced features enable elegant, maintainable code.
Does ruby-patterns cover dependency management and linting?
ruby-patterns includes gemfile bundler dependency management and rubocop linting configuration. You'll learn Gemfile syntax, version constraints, bundler workflows, and gem dependency resolution. The skill also covers RuboCop setup for consistent code style, configuration best practices, and integration into development workflows to maintain code quality across teams.
SKILL.md
rendered from the published skill — quoted content, verbatim
Ruby Patterns
Project Structure
Gem Layout
my_gem/
├── lib/
│ ├── my_gem.rb # Entry point, require sub-files
│ └── my_gem/
│ ├── version.rb
│ ├── configuration.rb
│ ├── client.rb
│ └── errors.rb
├── spec/
│ ├── spec_helper.rb
│ ├── my_gem/
│ │ └── client_spec.rb
│ └── fixtures/
├── bin/
│ └── console # IRB with gem loaded
├── sig/ # RBS type signatures
├── Gemfile
├── Rakefile
├── my_gem.gemspec
├── .rubocop.yml
└── .ruby-version
Rails Standard Structure
``` app/ ├── controllers/ │ ├── application_controller.rb │ └── api/v1/ │ └── users_controller.rb ├── models/ │ ├── application_record.rb │ ├── user.rb │ └── concerns/ │ └── searchable.rb ├── services/ │ └── users/ │ ├── create_service.rb │ └── import_service.rb ├── jobs/ │ └── user_sync_job.rb ├── mailers/ ├──
(truncated - see the full file via the links below)
Read as markdown · JSON record · Browse the source repository
File tree — 1 file
app/skills/ruby-patterns/SKILL.md