GitHub - polleverywhere/ruby-prism-skill: Use Ruby's Prism gem for token-efficient ruby code exploration.

2 min read Original article ↗

Ruby Prism Banner

Ruby Prism Skill

This skill helps your AI agent understand Ruby files in as few tokens as possible.

The main features are:

  1. Print the outline of a file
  2. Print the definition of a method

Combined, these allow the agent to quickly understand a file without needing to read the entire thing.

We've used this internally at Poll Everywhere for the last few months, and it's been one of the tools agents, unprompted, use most frequently.

Example

Get a file outline with --outline:

$ scripts/prism --outline app/models/user.rb

Concerns::Searchable (module) [4-14]
User < ApplicationRecord [17-78]
  includes Concerns::Searchable
  ::ROLES [21]
  @password (rw) [23]
  has_many :posts, dependent: :destroy
  validates :email, presence: true, uniqueness: true
  before_save :normalize_email
  scope :active, -> { where(active: true) }
  #full_name [42-44]
  .find_by_credentials(email, password) [46-49]
  #normalize_email~ [53-55]
  #custom_validation- [59-61]
Admin < User [80-92]

Sigil key: # instance method, . class method, :: constant, @ attribute, ~ protected, - private

Extract a specific method with --method:

$ scripts/prism --method full_name app/models/user.rb

=== METHOD: full_name ===
Lines 42-44:
  def full_name
    "#{first_name} #{last_name}"
  end

Installation

Amp

amp skill add polleverywhere/ruby-prism-skill/ruby-prism

Or manually clone to ~/.config/agents/skills/ruby-prism/.

Claude Code

# From GitHub
git clone https://github.com/polleverywhere/ruby-prism-skill.git
cp -r ruby-prism-skill/ruby-prism ~/.claude/skills/

# Or using the command palette (Ctrl+Shift+P / Cmd+Shift+P)
# Run: "Claude Code: Import Skill" and provide the GitHub URL

Skills are loaded from:

  • ~/.claude/skills/ (user-wide)
  • .claude/skills/ (project-specific)

Codex

# From GitHub
git clone https://github.com/polleverywhere/ruby-prism-skill.git
cp -r ruby-prism-skill/ruby-prism ~/.agents/skills/

Skills are loaded from:

  • ~/.agents/skills/ (user-wide)
  • .agents/skills/ (project-specific)

OpenCode

# From GitHub
git clone https://github.com/polleverywhere/ruby-prism-skill.git
cp -r ruby-prism-skill/ruby-prism ~/.config/opencode/skills/

Skills are loaded from:

  • ~/.config/opencode/skills/ (user-wide)

Requirements

Ruby 3.3+ (Prism is bundled with Ruby 3.3+). No gem installation needed.