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
An animal shelter management company runs a Rails application that tracks animals across multiple shelter locations. They use a third-party data warehouse API (already integrated with Auth, Client, and Fetcher layers in the codebase) to store and query shelter records. A new requirement has arrived: the application needs to query animals records from the warehouse, exposing only the fields tag_number, name, species_id, shelter_id, and intake_date. There must also be a way to look up a single animal by its tag_number.
The existing integration module is app/services/shelter_api/ and already contains auth.rb, client.rb, and fetcher.rb. You need to add the missing transformation and domain layers so the application can request and use animal data safely. A particular concern is that the warehouse API returns many more fields than are needed — leaking internal API schema details into the application domain would make refactoring painful.
Add the Builder and Domain Entity layers to the existing shelter_api integration. Also write specs for the new components.
Expected output files:
app/services/shelter_api/builder.rbapp/services/shelter_api/animal.rb (domain entity)spec/services/shelter_api/builder_spec.rbspec/services/shelter_api/animal_spec.rbspec/factories/shelter_api/animal_response.rb (FactoryBot hash factory for API response test data)The following files are provided as inputs. Extract them before beginning.
=============== FILE: app/services/shelter_api/client.rb =============== module ShelterApi class Client include HTTParty
MISSING_CONFIGURATION_ERROR = 'Missing required configuration'
DEFAULT_TIMEOUT = 30
DEFAULT_RETRIES = 3
class Error < StandardError; end
def self.default
token = Auth.default.token
host = Rails.configuration.secrets[:shelter_api_host]
new(token:, host:)
end
def initialize(token:, host:, timeout: DEFAULT_TIMEOUT, max_retries: DEFAULT_RETRIES)
raise Error, MISSING_CONFIGURATION_ERROR if [token, host].any?(&:blank?)
@token = token
@host = host
@timeout = timeout
@max_retries = max_retries
end
def execute_query(payload)
response = self.class.post(
"#{@host}/api/query",
headers: { 'Authorization' => "Bearer #{@token}", 'Content-Type' => 'application/json' },
body: payload.to_json,
timeout: @timeout
)
JSON.parse(response.body)
rescue JSON::ParserError, HTTParty::Error => e
raise Error, "Request failed: #{e.message}"
endend end
=============== FILE: app/services/shelter_api/fetcher.rb =============== module ShelterApi class Fetcher MAX_RETRIES = 3 RETRY_DELAY_IN_SECONDS = 2
def initialize(client, data_builder:, default_query:)
@client = client
@data_builder = data_builder
@default_query = default_query
end
def execute_query(query = @default_query)
retries = 0
begin
raw_response = @client.execute_query(query)
@data_builder.build(raw_response)
rescue ShelterApi::Client::Error => e
retries += 1
if retries < MAX_RETRIES
sleep(RETRY_DELAY_IN_SECONDS ** retries)
retry
end
raise
end
end
alias query execute_queryend end
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