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
The platform team at CloudSub has recently shipped a SubscriptionBillingService that handles plan upgrades, downgrades, and cancellations. The service is already implemented and all specs are passing, but the module has no inline documentation. Two junior engineers joining the team next week need to consume these classes from a new payment gateway integration, and the tech lead wants the public API fully documented before the onboarding begins.
The service handles complex input hashes and can raise several exceptions. Without proper docs, consumers will have to read the full implementation to understand what parameters are accepted, what the return shape looks like, and what exceptions they need to rescue.
Your task is to add YARD documentation to the provided Ruby source file. Do not change the logic — only add documentation.
The following file is provided as input. Extract it before beginning.
=============== FILE: app/services/subscription_billing_service.rb ===============
module Billing class SubscriptionBillingService VALID_PLANS = %w[starter growth enterprise].freeze
def self.call(params)
new(params).call
end
def initialize(params)
@params = params
end
def call
validate!
result = process_change
{ success: true, response: result }
rescue InvalidPlanError => e
{ success: false, response: { error: e.message } }
rescue PaymentGatewayError => e
{ success: false, response: { error: e.message, retryable: true } }
end
def self.supported_plans
VALID_PLANS
end
private
def validate!
raise InvalidPlanError, "Unknown plan: #{@params[:plan]}" unless VALID_PLANS.include?(@params[:plan])
raise ArgumentError, "customer_id is required" unless @params[:customer_id]
end
def process_change
case @params[:action]
when "upgrade" then upgrade_plan
when "downgrade" then downgrade_plan
when "cancel" then cancel_subscription
else raise ArgumentError, "Unknown action: #{@params[:action]}"
end
end
def upgrade_plan
{ plan: @params[:plan], effective_date: Time.current, previous_plan: @params[:current_plan] }
end
def downgrade_plan
{ plan: @params[:plan], effective_date: end_of_billing_period, previous_plan: @params[:current_plan] }
end
def cancel_subscription
{ cancelled_at: Time.current, refund_eligible: @params[:plan] != "starter" }
end
def end_of_billing_period
Time.current.end_of_month
endend
class InvalidPlanError < StandardError; end class PaymentGatewayError < StandardError; end end
Produce a single updated file:
app/services/subscription_billing_service.rb — the source file with YARD documentation added to all public surfaces (the class itself, self.call, self.supported_plans, initialize)Do not modify the Ruby logic — only add YARD comments.
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