agentleFS
crmnecrmne/ruby_llm/skills/rubyllm/SKILL.md

rubyllm

Skill4.4k starsChanged 3 months agoMITView on GitHub

Build and maintain Ruby or Rails applications with the RubyLLM AI framework. Use for chats, agents, tools, MCP servers, structured output, judgments, evaluations, media generation, transcription, OCR, moderation, embeddings, reranking, tracing, Rails integration, and RubyLLM upgrades; not for contributing to the framework itself.

1 other project uses a version of this.

Trending

Less talk lately.about the whole repository

Dec 2025: 0 mentionsJan 2026: 0 mentionsFeb 2026: 1 mentionMar 2026: 0 mentionsApr 2026: 0 mentionsMay 2026: 2 mentionsJun 2026: 33 mentionsJul 2026: 5 mentionsAug 2026: 2 mentionsSep 2026: 0 mentionsOct 2026: 1 mentionNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the crmne/ruby_llm repository that our weekly crawl found. There is no adoption data for this file yet.

Most recently taken up by

Who's talking about crmne/ruby_llm

The biggest 5 of 87 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 87

Talked about on GitHub, Bluesky and Hacker News (87 times).

On GitHub · 46

41 more on GitHub

On Bluesky · 32

27 more on Bluesky
  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. kaka-ruto/skills★ 4same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository4 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

10 rules. About 0 are common, 1 is distinctive, and 9 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 9

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use the application's installed RubyLLM version and existing conventions.

    line 11
  2. Distinctive:

    Read the relevant page instead of loading the entire documentation site:

    line 32
  3. Very specific:

    Start with RubyLLM.chat for a conversation.

    line 64
  4. Very specific:

    Read text through message.content and structured output through message.parsed.

    line 67
  5. Very specific:

    Use with_thinking, with_caching, with_compaction, and with_citations without arguments to enable them and false to disable them.

    line 69
  6. Very specific:

    Use with_fallbacks for alternate models, with_provider_tools for provider-hosted tools, and progress inside a long-running tool with …

    line 72
  7. Very specific:

    Use RubyLLM.context for per-tenant credentials or endpoints, and an agent context block when the configuration depends on the agent's …

    line 73
  8. Very specific:

    Use shared RubyLLM options when available.

    line 74
  9. Very specific:

    Read tokens through message.tokens.input, .output, .cache_read, .cache_write, and .thinking.

    line 75
  10. Very specific:

    Run with bin/rails "ruby_llm:eval[SupportEvaluation]", SupportEvaluation.run, or evaluates SupportEvaluation in RSpec or Minitest after …

    line 98

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Build with RubyLLM

Use the application's installed RubyLLM version and existing conventions. This skill describes the 2.x API; features marked 2.1 need RubyLLM 2.1 or later. Read Gemfile.lock, or inspect the installed gem before choosing an API:

bundle exec ruby -rruby_llm -e 'puts RubyLLM::VERSION'
bundle show ruby_llm

For a 1.x application, use its version's documentation and keep the requested change on 1.x unless the user asks for an upgrade. Adding an AI feature does not require upgrading the application's framework.

Choose the API for the task

RubyLLM has two public API families: conversations use chats, messages, tools, agents, structured output, streaming, and loop control; individual operations use paint, animate, speak, transcribe, ocr, moderate, embed, rerank, judge, tokenize, and research. Individual operations return typed results without requiring a chat. Some stream or have an asynchronous lifecycle.

Providers supply service endpoints, authentication, catalogs, and protocol selection. Protocols translate requests and responses. Both API families use this integration layer and shared services for model selection, configuration, accounting, and instrumentation. Build against the public API and let RubyLLM handle the service formats.

Rails integration adds persistence, attachments, streaming UI support, jobs, and generators around the same Ruby API.

Find the relevant API

The installed gem's public method signatures and RDoc describe the code the application actually runs. Use them when online documentation differs. Find the matching version through RubyLLM's documentation. The root site documents the latest stable release. Unreleased changes on main are under rubyllm.com/next/, and 1.x under rubyllm.com/v1/.

Read the relevant page instead of loading the entire documentation site:

TaskGuide path under the matching documentation version
Understand the framework's structureoverview/
Configure a provider or select a modelconfiguration/, configuration-providers/, models/
Chat, stream, or attach fileschat/, streaming/, attachments/
Declare tools or require approvaltools/, tool-parameters/, tool-execution/
Use tools from MCP servers (2.1)mcp/
Use provider-hosted tools such as web searchprovider-tools/, citations/
Parse structured outputstructured-output/
Build reusable agentsagents/, prompt-rendering/
Enable thinking or prompt cachingthinking/, prompt-caching/
Generate images or videoimage-generation/, video-generation/
Generate speech or transcribe audiotext-to-speech/, audio-transcription/
Extract document text or moderate contentocr/, moderation/
Embed text or rank search resultsembeddings/, rerank/, rag/
Classify, score, or decide with typed answers (2.1)judgments/
Measure answer quality against a dataset (2.1)evaluations/, evaluation-datasets/, evaluation-evaluators/, evaluation-running/, evaluation-examples/
Count tokens, upload provider files, or run hosted researchtokenization/, files/, hosted-research/
Persist chats, attach files, or stream with Hotwirerails/, rails-persistence/, rails-streaming/, rails-generators/, rails-advanced-config/
Resume agents in background jobsdurable-agents/
Track spend or handle failurescost-and-usage-tracking/, error-handling/
Observe calls, group workflows, or trace with OpenTelemetryinstrumentation/, opentelemetry/ (2.1)
Submit batches or drive the conversation loopbatches/, agentic-workflows/
Upgrade an existing applicationupgrading/

Markdown guides use the same name with .md, such as chat.md. The API reference starts at api/RubyLLM.md; class references include api/RubyLLM/Chat.md and api/RubyLLM/Agent.md. If fetching documentation is unavailable, inspect the installed source and identify any remaining uncertainty.

Use the 2.x API consistently

  • Configure credentials through RubyLLM.configure, following the application's secret storage. Select an existing configured provider. Verify explicit model IDs with RubyLLM.models.find(id, provider: ...); do not invent IDs or use assume_model_exists to hide a typo.
  • Start with RubyLLM.chat for a conversation. Set options with chainable with_* methods. Use RubyLLM::Agent when instructions, tools, or options should be reused. Ordinary Ruby methods and jobs compose workflows.
  • Use individual operations directly for media, document processing, moderation, embeddings, and reranking. Read their typed results and use save on generated images, video, and speech. Check each operation's provider, model, and credentials; a configured chat provider may not offer every operation. animate waits for completion; use animate_later when the application needs to manage the job.
  • ask runs the conversation and returns a message. ask_later stages input and returns the chat. For explicit loop control, use generate, run_tools, step, and complete?. Approval can park the loop before completion; inspect awaiting_approval? and resume after approve or deny.
  • Read text through message.content and structured output through message.parsed. Declare schemas with Schematist::Schema or the schema DSL. Do not assume content is a parsed Hash.
  • Subclass RubyLLM::Tool. Use description, parameter, or a parameters block, and keyword arguments on execute. Register tools with with_tools; configure choice and concurrency with with_tool_options. Keep application authorization in the tool or underlying service. Use requires_approval when the product needs a user's decision before execution.
  • Use with_thinking, with_caching, with_compaction, and with_citations without arguments to enable them and false to disable them. They reject nil. Read the relevant guide for supported options and model requirements.
  • Connect MCP servers by subclassing RubyLLM::MCP (url or command, then only and requires_approval to shape tools) and attach them with chat.with_mcp(...) or the agent mcp macro (2.1). Do not add a separate MCP client gem.
  • For a yes/no probability, a choice, or a score about application data, subclass RubyLLM::Judge and call .judge(input) instead of parsing free text from a chat (2.1). Backends are TypeSafe's Jev, OpenAI Decisions, and local decision models such as Clef with provider: :ollama.
  • Use with_fallbacks for alternate models, with_provider_tools for provider-hosted tools, and progress inside a long-running tool with after_tool_progress on the chat (2.1) to report it.
  • Use RubyLLM.context for per-tenant credentials or endpoints, and an agent context block when the configuration depends on the agent's inputs (2.1).
  • Use shared RubyLLM options when available. Reserve provider_options for provider-specific request fields. Do not add a second provider SDK for functionality RubyLLM already supplies.
  • Read tokens through message.tokens.input, .output, .cache_read, .cache_write, and .thinking; read cost through message.cost.total. Unknown cost is nil, not zero. The ledger includes individual attempts; a successful answer can include earlier failed attempts. Attribute usage outside a chat record with owner: or RubyLLM.with_usage_owner.
  • Group related calls with RubyLLM.workflow and workflow.step for instrumentation. To send traces to an existing OpenTelemetry setup, call RubyLLM::OpenTelemetry.enable after configuring the SDK (2.1). RubyLLM never configures the SDK or exporters, and does not export prompts or responses.
  • RubyLLM enums are Symbols: finish_reason == :stop, thinking effort :high. Provider slugs and model IDs remain Strings.

Integrate with Rails

For a new integration, use bin/rails generate ruby_llm:install, review its migrations, and follow the application's migration workflow. Load packaged model data with bin/rails ruby_llm:load_models. RubyLLM.models.refresh performs a network refresh and persists the result.

Applications own their chat and message models, declared with acts_as_chat and acts_as_message. RubyLLM owns the supporting model, tool-call, usage, and batch tables, plus MCP credential and provider file tables from 2.1. Do not generate application Model or ToolCall classes from 1.x examples. Pass custom chat and message mappings to the generators when the application uses different names.

Use the same chat API on persisted records. Persisted ask returns the application's message record. Use the existing job backend for background work; retrieve and configure agents through their documented persistence API when a job resumes in another process. Prompt templates live under app/prompts by convention.

Pass Active Storage attachments through with: and retain the message attachment association set up by the install generator. For a Hotwire UI, use the Rails streaming guide or ruby_llm:chat_ui generator: persisted messages provide the targets for Turbo Streams. Individual operations work directly in Rails services and jobs with the same methods as plain Ruby.

For an upgrade, read the complete matching upgrade guide before editing migrations. Each release's upgrade covers only the changes since the previous release, so upgrade one release at a time; a 1.x application completes the 2.0 upgrade first. The 2.0 cutover requires preparation, backfill, finish, and application-specific reconciliation before affected activity resumes. Legacy-column cleanup is a later phase. Checkpoints make a stopped backfill resumable; retained columns do not make a 1.x code rollback safe. Rehearse against an isolated snapshot and respect the application's deployment and recovery process.

Evaluate AI behavior

Specs check code; evaluations check how often the model gets the answer right (2.1). Put a RubyLLM::Evaluation subclass and its dataset in app/evals, named after the class (support_evaluation.rb and support_evaluation.yml). perform(input) runs the application and returns a string, Message, Chat, or Agent. Each case has name, inputs, and usually expected_output.

  • Without declared criteria, a model checks each answer against expected_output, which every case must then supply. evaluation :name, "statement" declares criteria and replaces that default; evaluation :correctness without a description keeps it.
  • assertions uses Minitest assertions with output, tool_calls, messages, input, expected_output, and metadata. Assertions do not turn off grading; evaluator false does. Outside Rails, assertions need gem "minitest".
  • Choose the grader with evaluator model: ..., an Agent class, or a Judge class with evaluation :name, minimum: 0.8.
  • Run with bin/rails "ruby_llm:eval[SupportEvaluation]", SupportEvaluation.run, or evaluates SupportEvaluation in RSpec or Minitest after extending RubyLLM::Evaluation::RSpec or RubyLLM::Evaluation::Minitest. Model grading costs money on every run, so keep graded evaluations out of the default test run unless the application records requests.

Verify the application change

Run the application's relevant tests. Test tool business behavior, structured parsing, persisted conversation reconstruction, and job resumption where the change depends on them. Verify model calls with the application's existing recording or integration-test setup when needed; report which provider behavior was actually exercised. Keep the implementation within the requested feature and existing application architecture.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.