CtrlK
BlogDocsLog inGet started
Tessl Logo

igmarin/rails-agent-skills

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

1.38x
Quality

99%

Does it follow best practices?

Impact

98%

1.38x

Average score across 26 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

IMPLEMENTATION.mdstrategy-factory-null-calculator/

Implementation Reference

BaseService

# frozen_string_literal: true

module PricingCalculator
  class BaseService
    def initialize(order)
      @order = order
    end

    def calculate
      return nil unless should_calculate?
      compute_result(@order.base_price)
    end

    private

    def should_calculate? = @order.plan&.active?
    def compute_result(_price) = nil
  end
end

NullService

# frozen_string_literal: true

module PricingCalculator
  class NullService < BaseService
    private

    def should_calculate? = false
  end
end

Concrete Service Example

# frozen_string_literal: true

module PricingCalculator
  class StandardPricingService < BaseService
    DISCOUNT = 0.10

    private

    def should_calculate?
      super && @order.plan.name == 'standard'
    end

    def compute_result(base_price)
      base_price * (1 - DISCOUNT)
    end
  end
end

strategy-factory-null-calculator

README.md

tile.json