AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Rails Llm Integration

skill-nagstler-rails-llm-integration-rails-llm-integration · by nagstler

>

No reviews yet
0 installs
22 views
0.0% view→install

Install

$ agentstack add skill-nagstler-rails-llm-integration-rails-llm-integration

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-nagstler-rails-llm-integration-rails-llm-integration)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
5mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Rails Llm Integration? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Rails LLM Integration Skill

What This Skill Does

Teaches Claude to write LLM integrations the Rails Way -- treating LLM calls like first-class Rails citizens alongside ActionMailer (email), ActiveJob (background work), and ActionController (HTTP). Instead of scattered API calls, you get conventions.

When to Use

  • Adding any AI/LLM feature to a Rails application
  • Using ruby_llm gem, langchain-rb gem, ruby-openai, or anthropic-rb in Rails
  • Setting up prompt management, model routing, or cost tracking
  • Building eval pipelines with Braintrust
  • Building RAG pipelines with langchain-rb and pgvector
  • Auditing existing LLM usage for anti-patterns
  • Testing AI-powered features

Architecture Overview

app/
  services/
    llm/
      base_service.rb          # All LLM calls inherit from this
      concerns/                # Traceable, Retryable, CostTrackable
      product_description_service.rb
      ticket_triage_service.rb
      errors.rb                # Typed error hierarchy
      result.rb                # Result monad
  jobs/
    llm/
      base_job.rb              # Async LLM calls inherit from this
      generate_description_job.rb
  prompts/                     # Prompts as views (ERB templates)
    product_descriptions/
      generate.text.erb
      generate.system.erb
    ticket_triage/
      classify.text.erb
config/
  llm.yml                     # Model config like database.yml
  initializers/
    llm.rb                    # Boot-time config validation
lib/
  llm/
    client.rb                 # Client factory: LLM::Client.for(model)
    clients/
      openai_client.rb        # Wraps ruby-openai gem
      anthropic_client.rb     # Wraps anthropic-rb gem
      ruby_llm_client.rb      # Wraps ruby_llm gem (multi-provider)
      langchain_client.rb     # Wraps langchain-rb gem
      proxy_client.rb         # LiteLLM/Portkey via Faraday
      stub_client.rb          # Test double
    config.rb                 # Loads config/llm.yml
    router.rb                 # Task-based model routing
    cost_tracker.rb           # Redis-backed cost tracking
    prompt_renderer.rb        # ERB-based prompt rendering
db/
  migrate/
    create_llm_batches.rb     # Batch job tracking
    create_llm_dead_letters.rb # Permanent failure tracking
    create_llm_eval_cases.rb  # Eval dataset storage
    create_llm_experiment_logs.rb # Shadow experiment results

Installation

rails generate llm:install       # Sets up everything above
rails generate llm:service ProductDescription generation  # Scaffold a new service

Reference Files

| File | Read When You Need To... | |------|--------------------------| | references/client-setup.md | Wire up ruby_llm, langchain-rb, ruby-openai, anthropic-rb, or proxy clients (start here) | | references/service-patterns.md | Build LLM service objects with Result, tracing, retries | | references/job-patterns.md | Make LLM calls async with ActiveJob + Sidekiq | | references/proxy-routing.md | Route between models, optimize costs, set budgets | | references/eval-pipeline.md | Set up Braintrust evals and quality scoring | | references/prompt-management.md | Manage prompts as ERB templates (prompts-as-views) | | references/testing-guide.md | Test LLM features with stubs, VCR, and CI strategy | | references/generators.md | Rails generators for llm:install and llm:service | | templates/migrations/ | Database schemas for batches, dead letters, eval cases | | scripts/audit_llm_usage.rb | Scan a Rails app for LLM anti-patterns |

Core Principles

  1. Rails conventions wrap LLM libraries -- ruby_llm and langchain-rb are the engine,

Rails patterns are the chassis. Use service objects, ActiveJob, ERB templates, and YAML config. The gem handles the API; the convention handles everything else.

  1. Async by default -- Every LLM call goes through ActiveJob unless the user is

actively waiting (streaming). Never block a web request on a 3-second API call.

  1. Cost-aware routing -- Every call has an estimated cost. Route cheap tasks to

cheap models. Set daily budgets. Alert before you hit them.

  1. Eval-first development -- Log every call with Braintrust. Build eval datasets

from production traces. Score quality automatically. Gate deployments on eval regressions.

  1. Prompts are views -- Prompts live in app/prompts/ as ERB templates, versioned

in git, rendered with locals, tested independently from API calls.

  1. Errors are typed -- RateLimitError, TimeoutError, ContentFilterError,

BudgetExceededError. Each has its own retry and alerting strategy.

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.