RubyLLM::Skills

Agent Skills for RubyLLM. Teach your AI how to do things your way.

Gem Version CI Compound Engineered

Installation

gem "ruby_llm-skills"

Quick Start

chat = RubyLLM.chat
chat.with_skills
chat.ask "Create a PDF report from this data"

The LLM discovers skills, calls the skill tool, and gets instructions.

Usage

chat.with_skills                              # app/skills (default)
chat.with_skills("lib/skills")                # custom path
chat.with_skills("app/skills", "app/commands") # multiple paths
chat.with_skills("app/skills", user.skills)   # with database records

With RubyLLM::Agent (v1.12+)

class SupportAgent < RubyLLM::Agent
  model "gpt-5-nano"
  instructions "You are a support assistant."
  skills "app/skills", only: [:faq, :troubleshooting]
end

chat = SupportAgent.chat
chat.ask("How do I reset my password?")

agent = SupportAgent.new
agent.with_skills("extra/skills")
agent.ask("What can you help with?")

agent.with_skills(...) replaces the current skill tool configuration. To combine sources, pass all sources in a single skills/with_skills call.

Creating Skills

app/skills/

SKILL.md requires frontmatter:

---
name: pdf-report
description: Generate PDF reports. Use when asked to create reports or export to PDF.
---

# PDF Report Generator

Instructions here...

Slash Commands

Single-file skills work as commands:

app/commands/
chat.with_skills("app/skills", "app/commands")
chat.ask "/write-poem about robots"

Database Skills

Store skills or commands in your database:

create_table :skills do |t|
  t.string :name, null: false
  t.text :description, null: false
  t.text :content, null: false  # SKILL.md body
  t.references :user
  t.timestamps
end

chat.with_skills(user.skills)
chat.ask "/my-command args"  # works as command too

Records must respond to #name, #description, and #content. For skills with scripts/references, use filesystem skills.

Rails

Default path auto-configured to Rails.root/app/skills.

rails generate skill pdf-report --description "Generate PDF reports"

Development

Setup

bin/setup

Running Tests

bundle exec rake test        # Unit tests (151 tests)
bundle exec rake test_rails  # Rails integration tests (25+ tests)
bundle exec rake test_all    # Both
bundle exec rake             # Tests + linting

Dummy Rails App

A minimal Rails 8 app at test/dummy/ tests Rails integration:

  • Filesystem skills: app/skills/greeting/ tests directory-based loading
  • Database skills: Skill model tests ActiveRecord-based loading
  • Generator tests: Tests for rails generate skill
  • Composite loading: Tests combining filesystem + database sources
cd test/dummy
bundle exec rails test  # Run Rails tests directly

Resources

License

MIT