Curated library of AI agent skills for Ruby on Rails development. Covers code review, architecture, security, testing (RSpec), engines, service objects, DDD patterns, and workflow automation.
98
99%
Does it follow best practices?
Impact
98%
1.38xAverage score across 26 eval scenarios
Passed
No known issues
One API for the client: Calculator::Factory.for(entity).calculate. The factory picks the strategy; NullService handles unknown variants safely.
For each component (Factory → BaseService → NullService → Concrete):
| Component | Responsibility |
|---|---|
| Factory | Dispatch to correct service class via SERVICE_MAP; fall back to NullService |
| BaseService | Guard with should_calculate?; delegate to compute_result |
| NullService | Always returns nil safely — never raises |
| Concrete | Override should_calculate? (add variant check on top of super) and compute_result |
app/services/<calculator_name>/
├── factory.rb
├── base_service.rb
├── null_service.rb
├── standard_service.rb
├── premium_service.rb# frozen_string_literal: true
module PricingCalculator
class Factory
SERVICE_MAP = {
'standard' => StandardPricingService,
'premium' => PremiumPricingService
}.freeze
def self.for(order)
plan = order.plan
return NullService.new(order) unless plan&.active?
service_class = SERVICE_MAP[plan.name] || NullService
service_class.new(order)
end
end
endNo qualifying context or unknown variant → NullService. For full BaseService and NullService implementations, see IMPLEMENTATION.md.
price = PricingCalculator::Factory.for(order).calculateSingle entry point rule: Factory.for(entity) is the only permitted access path. Clients never instantiate service classes directly. If you see StandardPricingService.new(order) outside of Factory, that is a bug — route through the factory.
Factory dispatch (all branches):
RSpec.describe PricingCalculator::Factory do
describe '.for' do
it 'returns NullService when plan is nil' do
order = create(:order, plan: nil)
expect(described_class.for(order)).to be_a(PricingCalculator::NullService)
end
it 'returns StandardPricingService for standard plan' do
order = create(:order, plan: create(:plan, name: 'standard', active: true))
expect(described_class.for(order)).to be_a(PricingCalculator::StandardPricingService)
end
end
endCover inactive plan, each variant, and unknown variant. See TESTING.md for NullService and concrete service specs.
| Pitfall | Fix |
|---|---|
| SERVICE_MAP key mismatch | Verify keys match exactly what is stored in the database — typos cause silent NullService fallbacks |
| Missing NullService spec | Always add a spec context for unknown/nil variants or tests will never catch the fallback regression |
Direct service instantiation (ServiceClass.new(entity)) | Route through Factory.for(entity) — it is the sole public entry point; direct instantiation bypasses the NullService safety net |
| Skill | When to chain |
|---|---|
| rspec-service-testing | For complete Factory, BaseService, NullService, and concrete strategy specs |
| ruby-service-objects | For naming conventions, YARD docs, and frozen_string_literal baseline |
api-rest-collection
create-prd
ddd-boundaries-review
ddd-rails-modeling
ddd-ubiquitous-language
docs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10
scenario-11
scenario-12
scenario-13
scenario-14
scenario-15
scenario-16
scenario-17
scenario-18
scenario-19
scenario-20
scenario-21
scenario-22
scenario-23
scenario-24
scenario-25
scenario-26
generate-tasks
mcp_server
rails-architecture-review
rails-background-jobs
rails-bug-triage
rails-code-conventions
rails-code-review
rails-engine-compatibility
rails-engine-docs
rails-engine-extraction
rails-engine-installers
rails-engine-release
rails-engine-reviewer
rails-engine-testing
rails-graphql-best-practices
rails-migration-safety
rails-review-response
rails-security-review
rails-skills-orchestrator
rails-stack-conventions
rails-tdd-slices
refactor-safely
rspec-best-practices
rspec-service-testing
ruby-service-objects
strategy-factory-null-calculator
ticket-planning
yard-documentation