sinatra-test

A command that creates tests for Sinatra applications. Sinatra is a Ruby web framework; the tests can cover web routes, middleware that processes requests, and helper methods.

In plain words
What is it for?
Use it to generate tests for routes, middleware, helpers, or all three, using the testing framework your project prefers.
Why use it?
It saves time finding the relevant application code and writing the initial test cases for it. You can choose RSpec or Minitest, two common Ruby testing frameworks.

Command

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 commands/geoffjay/claude-plugins/sinatra-test
Clone the repo
git clone --depth 1 https://github.com/geoffjay/claude-plugins
Per session 18 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 5,196 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. 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.00018 $0.05196
Opus 5 $0.00009 $0.02598
Sonnet 5 $0.00004 $0.01039
Haiku 4.5 $0.00002 $0.00520

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

Security

Grade A, and why

sinatra-test scanned grade A with 0 findings 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/ruby-sinatra-advanced/commands/sinatra-test.md · 861 lines

How it starts

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

Sinatra Test Command

Generates comprehensive test suites for Sinatra applications including route tests, middleware tests, helper tests, and integration tests using RSpec or Minitest.

Arguments

  • $1: test-type (optional) - Type of tests to generate: routes, middleware, helpers, or all (default: all)
  • $2: framework (optional) - Testing framework: rspec or minitest (default: rspec)

Usage Examples

# Generate all tests using RSpec
/sinatra-test

# Generate only route tests with RSpec
/sinatra-test routes

# Generate all tests using Minitest
/sinatra-test all minitest

# Generate middleware tests with Minitest
/sinatra-test middleware minitest

# Generate helper tests with RSpec
/sinatra-test helpers rspec

Workflow

Step 1: Analyze Application Structure

Discovery Phase:

  1. Identify application type (classic vs modular)
  2. Locate controller files
  3. Extract route definitions
  4. Find middleware stack
  5. Identify helper methods
  6. Check existing test structure
  7. Detect testing framework if already configured

Files to Analyze:

# Controllers
app/controllers/**/*.rb
app.rb (classic style)

# Middleware
config.ru
config/**/*.rb

# Helpers
app/helpers/**/*.rb
helpers/ directory

# Existing tests
spec/**/*_spec.rb
test/**/*_test.rb

Route Extraction:

# Parse routes from controller files
# Identify: HTTP method, path, parameters, conditions

# Example routes to extract:
get '/users' do
  # Handler
end

get '/users/:id', :id => /\d+/ do
  # Handler with constraint
end

post '/users', :provides => [:json] do
  # Handler with content negotiation
end

Step 2: Generate Test Structure (RSpec)

Create spec_helper.rb if missing:

# spec/spec_helper.rb
ENV['RACK_ENV'] = 'test'

require 'simplecov'
SimpleCov.start do
  add_filter '/spec/'
  add_filter '/config/'
end

require_relative '../config/environment'
require 'rack/test'
require 'rspec'
require 'json'

# Database setup (if applicable)
if defined?(Sequel)
  require 'database_cleaner/sequel'

  RSpec.configure do |config|
    config.before(:suite) do
      DatabaseCleaner.strategy = :transaction
      DatabaseCleaner.clean_with(:truncation)
    end

    config.around(:each) do |example|
      DatabaseCleaner.cleaning do
        example.run
      end
    end
  end
end

RSpec.configure do |config|
  config.include Rack::Test::Methods

  config.expect_with :rspec do |expectations|
    expectations.include_chain_clauses_in_custom_matcher_descriptions = true
  end

  config.mock_with :rspec do |mocks|
    mocks.verify_partial_doubles = true
  end

  config.shared_context_metadata_behavior = :apply_to_host_groups
  config.filter_run_when_matching :focus
  config.example_status_persistence_file_path = 'spec/examples.txt'
  config.disable_monkey_patching!
  config.warnings = true
  config.order = :random
  Kernel.srand config.seed
end

# Helper methods for all specs
module SpecHelpers
  def json_response
    JSON.parse(last_response.body)
  end

  def auth_header(token)
    { 'HTTP_AUTHORIZATION' => "Bearer #{token}" }
  end
end

RSpec.configure do |config|
  config.include SpecHelpers
end

Read the full file on GitHub · 861 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 · 861 lines · 18 tokens per session scan A f31035c2637b

Subscribe to this mod's changes

sinatra-test is a command published in the GitHub repository geoffjay/claude-plugins (8 stars, last pushed 10mo ago), licensed MIT. It adds 18 tokens to every session and 5,196 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.