rspec

rspec is a skill for Claude Code from el-feo/ai-context. It costs 44 tokens per session (2,890 once invoked), scanned A, original, MIT.

A guide to RSpec, a testing framework commonly used with Ruby and Rails. It covers tests for models, web requests, full browser-like workflows, test data, and test doubles, which stand in for real dependencies.

In plain words
What is it for?
Use it to write and run Ruby or Rails tests for business logic, validations, web requests, user flows, and isolated dependencies.
Why use it?
It helps find incorrect behavior and edge cases before changes reach users, including when following TDD, where tests guide implementation.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is require_relative '../config/environment'.

Part of the ruby-rails plugin — 13 skills, 3 commands shipped together

Good fit Use it to write and run Ruby or Rails tests for business logic, validations, web requests, user flows, and isolated dependencies.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/el-feo/ai-context
agentmods
npx agentmods add skills/el-feo/ai-context/rspec

Made for: Claude Code.

Or install ruby-rails, the plugin that ships this one along with the rest of its 13 skills, 3 commands.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for rspec

README.md
[![agentmods](https://agentmods.dev/badge/skills/el-feo/ai-context/rspec/github.svg)](https://agentmods.dev/skills/el-feo/ai-context/rspec)
Your own site
<a href="https://agentmods.dev/skills/el-feo/ai-context/rspec"><img src="https://agentmods.dev/badge/skills/el-feo/ai-context/rspec/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for rspec

Your own site · 80×15
<a href="https://agentmods.dev/skills/el-feo/ai-context/rspec"><img src="https://agentmods.dev/badge/skills/el-feo/ai-context/rspec.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 44 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,890 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00044 $0.02890
Opus 5.5 $0.00018 $0.01156
Sonnet 5.5 $0.00009 $0.00578
Haiku 4.5 $0.00004 $0.00289

Measured 3mo ago against content hash b32a65f6620a, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

rspec 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 3mo 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-rails/skills/rspec/SKILL.md · 421 lines

How it starts

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

RSpec Testing Skill

Expert guidance for writing comprehensive tests in RSpec for Ruby and Rails applications. This skill provides immediate, actionable testing strategies with deep-dive references for complex scenarios.

Quick Start

Basic RSpec Structure

# spec/models/user_spec.rb
RSpec.describe User, type: :model do
  describe '#full_name' do
    it 'returns the first and last name' do
      user = User.new(first_name: 'John', last_name: 'Doe')
      expect(user.full_name).to eq('John Doe')
    end
  end
end

Key concepts:

  • describe: Groups related tests (classes, methods)
  • context: Describes specific scenarios
  • it: Individual test example
  • expect: Makes assertions using matchers

Running Tests

# Run all specs
bundle exec rspec

# Run specific file
bundle exec rspec spec/models/user_spec.rb

# Run specific line
bundle exec rspec spec/models/user_spec.rb:12

# Run with documentation format
bundle exec rspec --format documentation

# Run only failures from last run
bundle exec rspec --only-failures

Core Testing Patterns

1. Model Specs

Test business logic, validations, associations, and methods:

RSpec.describe Article, type: :model do
  # Test validations
  describe 'validations' do
    it { should validate_presence_of(:title) }
    it { should validate_length_of(:title).is_at_most(100) }
  end

  # Test associations
  describe 'associations' do
    it { should belong_to(:author) }
    it { should have_many(:comments) }
  end

  # Test instance methods
  describe '#published?' do
    context 'when publish_date is in the past' do
      it 'returns true' do
        article = Article.new(publish_date: 1.day.ago)
        expect(article.published?).to be true
      end
    end

    context 'when publish_date is in the future' do
      it 'returns false' do
        article = Article.new(publish_date: 1.day.from_now)
        expect(article.published?).to be false
      end
    end
  end

  # Test scopes
  describe '.recent' do
    it 'returns articles from the last 30 days' do
      old = create(:article, created_at: 31.days.ago)
      recent = create(:article, created_at: 1.day.ago)

      expect(Article.recent).to include(recent)
      expect(Article.recent).not_to include(old)
    end
  end
end

Read the full file on GitHub · 421 lines

Files

What ships with it

7 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 3mo ago First seen · 421 lines · 44 tokens per session scan A b32a65f6620a

Subscribe to this mod's changes

rspec is a skill published in the GitHub repository el-feo/ai-context (12 stars, last pushed 10d ago), licensed MIT. It adds 44 tokens to every session and 2,890 once invoked, about $0.0002 per session on Opus 5.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-30.

Related

rspec compared with skills from other repositories

rspec next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
rspecel-feo/ai-contextSkill1210d agoMITA44Claude Code
Codeception TestingPramodDutta/qaskillsSkill25328d agoMITA42Claude Code, Codex
JMeter Load TestingPramodDutta/qaskillsSkill25328d agoMITA32Claude Code, Codex
testing-symfonyTheBeardedBearSAS/claude-craftSkill10814d agoMITA36Claude Code
javascript-testing-patternsRudyCity/superagentSkill73yesterdayMITB63Claude Code, Codex
testing-pythonTheBeardedBearSAS/claude-craftSkill10814d agoMITA28Claude Code
effective-rails-testingtriskweline/skillsSkill822d agoMITA98Claude Code, Codex