Curated library of 16 public Ruby AI agent skills: 10 atomic skills (YARD docs, service objects, calculator pattern, API clients, DDD, bug triage, code review, skill routing), 5 process-discipline skills (TDD, refactoring, review, security, test planning), and 1 planning skill (TDD task generation). Zero agents — this is a foundational library consumed by framework-specific tiles like rails-agent-skills and hanakai-yaku.
95
96%
Does it follow best practices?
Impact
95%
1.05xAverage score across 16 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.
| 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 |
Tests Gate Implementation
For each component (Factory → BaseService → NullService → Concrete):
1. Write the spec/test — contexts per variant, plus the NullService path
2. Run it — verify it fails because the component does not exist yet
3. Implement the component — minimum code to make the test pass
4. Run again — confirm green, then proceed to the next component
Each component gets its own RED command/output and GREEN command/output before
the next component starts. Do not collapse NullService and concrete services
into a single verification step.Output requirements per component:
NullService.calculate that delegates to compute_result if should_calculate? is true.should_calculate? and nil for compute_result.should_calculate? and compute_result. Always call super in should_calculate?.Factory.for(entity) is the only permitted access path.services/<calculator_name>/
├── factory.rb
├── base_service.rb
├── null_service.rb
├── standard_service.rb
├── premium_service.rb# factory.rb
module PricingCalculator
class Factory
SERVICE_MAP = {
"standard" => StandardService,
"premium" => PremiumService
}.freeze
def self.for(entity)
SERVICE_MAP.fetch(entity.plan_variant, NullService).new(entity)
end
end
end# null_service.rb
module PricingCalculator
class NullService < BaseService
def should_calculate? = false
def compute_result = nil
end
end# base_service.rb
module PricingCalculator
class BaseService
def initialize(entity)
@entity = entity
end
def calculate
return nil unless should_calculate?
compute_result
end
private
def should_calculate?
@entity.present?
end
def compute_result
raise NotImplementedError
end
end
end# Single public entry point — never instantiate service classes directly
price = PricingCalculator::Factory.for(order).calculateFull implementations for all components including multi-variant expansion are in IMPLEMENTATION.md. Full test examples are in TESTING.md.
Pitfalls
| Pitfall | Fix |
|---|---|
| SERVICE_MAP key mismatch | Verify keys match exactly what is stored in the database — typos cause silent NullService fallbacks |
| Missing NullService spec/test | Always add a test 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 |
Forgetting super in concrete should_calculate? | Always call super — skipping it removes the base nil/presence guard |
| Skill | When to chain |
|---|---|
| write-tests | For writing spec files |
| create-service-object | For naming conventions, YARD docs, and frozen_string_literal baseline |
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
skills
code-quality
respond-to-review
ddd
define-domain-language
model-domain
review-domain-boundaries
docs
write-yard-docs
orchestration
skill-router
patterns
create-service-object
implement-calculator-pattern
planning
generate-tdd-tasks
process
testing
triage-bug