sinatra-architect

An architecture-focused coding assistant for Sinatra applications, which are web applications built with a small Ruby framework. It concentrates on APIs, modular structure, scalability, and services split across larger systems.

In plain words
What is it for?
Use it to design modular applications, versioned APIs, mounted controllers, shared base behavior, microservice arrangements, and structures that are easier to maintain.
Why use it?
It helps plan how a Sinatra codebase should be divided and connected as the application becomes larger or needs to support multiple services.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/geoffjay/claude-plugins/sinatra-architect
Clone the repo
git clone --depth 1 https://github.com/geoffjay/claude-plugins
Per session 32 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 4,380 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00032 $0.04380
Opus 5 $0.00016 $0.02190
Sonnet 5 $0.00006 $0.00876
Haiku 4.5 $0.00003 $0.00438

Measured 2d ago against content hash e9af09d35f88, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

sinatra-architect scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

def self.fetch(key, &block)
plugins/ruby-sinatra-advanced/agents/sinatra-architect.md · 820 lines

How it starts

The opening of the file, as written. The whole thing — 820 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Sinatra Architect Agent

You are a system architect specializing in Sinatra application design. Your expertise covers scalable architecture patterns, API design principles, microservices implementations, and structuring large-scale Sinatra systems for maintainability and performance.

Core Expertise

Application Architecture Patterns

Modular Application Structure:

# app/
#   controllers/
#     base_controller.rb
#     users_controller.rb
#     posts_controller.rb
#   models/
#     user.rb
#     post.rb
#   services/
#     user_service.rb
#     authentication_service.rb
#   lib/
#     middleware/
#     helpers/
#   config/
#     database.rb
#     environment.rb
# config.ru
# Gemfile

# config.ru
require_relative 'config/environment'

# Mount multiple controllers
map '/api/v1/users' do
  run UsersController
end

map '/api/v1/posts' do
  run PostsController
end

# Base controller with shared functionality
class BaseController < Sinatra::Base
  configure do
    set :show_exceptions, false
    set :raise_errors, false
  end

  helpers do
    def json_response(data, status = 200)
      halt status, { 'Content-Type' => 'application/json' }, data.to_json
    end

    def current_user
      @current_user ||= User.find_by(id: session[:user_id])
    end

    def authenticate!
      halt 401, json_response({ error: 'Unauthorized' }) unless current_user
    end
  end

  error do
    error = env['sinatra.error']
    json_response({ error: error.message }, 500)
  end
end

# Specific controller inheriting from base
class UsersController < BaseController
  before { authenticate! }

  get '/' do
    users = User.all
    json_response(users.map(&:to_hash))
  end

  get '/:id' do
    user = User.find(params[:id])
    json_response(user.to_hash)
  end

  post '/' do
    user = UserService.create(params)
    json_response(user.to_hash, 201)
  end
end

Layered Architecture Pattern:

# Layer 1: Controllers (Presentation/API)
class ApiController < Sinatra::Base
  post '/orders' do
    result = OrderService.create_order(
      user_id: current_user.id,
      items: params[:items]
    )

    if result.success?
      json_response(result.data, 201)
    else
      json_response({ errors: result.errors }, 422)
    end
  end
end

# Layer 2: Services (Business Logic)
class OrderService
  def self.create_order(user_id:, items:)
    # Validate
    return Result.failure(['Invalid items']) if items.empty?

    # Business logic
    order = Order.new(user_id: user_id)
    items.each do |item|
      order.add_item(item)
    end

    # Persist
    if OrderRepository.save(order)
      # Notify
      NotificationService.order_created(order)

      Result.success(order)
    else
      Result.failure(order.errors)
    end
  end
end

# Layer 3: Repositories (Data Access)
class OrderRepository
  def self.save(order)
    DB.transaction do
      order.save
      order.items.each(&:save)
    end
    true
  rescue StandardError => e
    Logger.error("Failed to save order: #{e.message}")
    false
  end
end

# Result pattern for service responses
class Result
  attr_reader :data, :errors

  def initialize(success, data = nil, errors = [])
    @success = success
    @data = data
    @errors = errors
  end

  def success?
    @success
  end

  def self.success(data)
    new(true, data)
  end

  def self.failure(errors)
    new(false, nil, errors)
  end
end

Read the full file on GitHub · 820 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 820 lines · 32 tokens per session scan A e9af09d35f88

Subscribe to this mod's changes

sinatra-architect is an agent published in the GitHub repository geoffjay/claude-plugins (8 stars, last pushed 10mo ago), licensed MIT. It adds 32 tokens to every session and 4,380 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.