rspec-agent

rspec-agent is an agent for Claude Code from ThibautBaissac/rails_ai_agents. It costs 0 tokens per session (829 once invoked), scanned A, original, MIT.

An RSpec test-writing agent for Ruby on Rails applications. RSpec is a tool for describing expected code behavior, while FactoryBot creates test data and Capybara tests web interactions.

In plain words
What is it for?
Writing or updating tests for models, HTTP requests, services, view components, queries, presenters, authorization policies, and full browser flows. It can also create supporting factories and test helpers.
Why use it?
It reduces the manual work of adding tests after Rails code changes and helps catch broken behavior. It supports the red step of test-driven development (TDD), where a failing test comes before the implementation.

Agent for Claude Code

Written for Claude Code: installed under .claude/. Also seen: model in frontmatter.

Good fit Writing or updating tests for models, HTTP requests, services, view components, queries, presenters, authorization policies, and full browser flows. It can also create supporting factories and test helpers.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/thibautbaissac/rails_ai_agents/rspec-agent
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/ThibautBaissac/rails_ai_agents

Made for: Claude Code.

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-agent

README.md
[![agentmods](https://agentmods.dev/badge/agents/thibautbaissac/rails_ai_agents/rspec-agent.svg)](https://agentmods.dev/agents/thibautbaissac/rails_ai_agents/rspec-agent)
Your own site
<a href="https://agentmods.dev/agents/thibautbaissac/rails_ai_agents/rspec-agent"><img src="https://agentmods.dev/badge/agents/thibautbaissac/rails_ai_agents/rspec-agent.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 829 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.00000 $0.00829
Opus 5 $0.00000 $0.00415
Sonnet 5 $0.00000 $0.00166
Haiku 4.5 $0.00000 $0.00083

Measured 8d ago against content hash ba573e5b32cf, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

rspec-agent 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 8d 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.

.claude/agents/rspec-agent.md · 76 lines

How it starts

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

You are an expert QA engineer specialized in RSpec testing for modern Rails applications.

Your Role

  • Expert in RSpec, FactoryBot, Capybara and Rails testing best practices
  • Write comprehensive, readable and maintainable tests for a developer audience
  • Analyze code in app/ and write or update tests in spec/
  • Understand Rails architecture: models, controllers, services, view components, queries, presenters, policies

RSpec Testing Standards

Rails 8 Testing Notes

  • Solid Queue: Test jobs with perform_enqueued_jobs block
  • Turbo Streams: Use assert_turbo_stream helpers
  • Hotwire: System specs work with Turbo/Stimulus out of the box

Test File Structure

spec/
├── models/           # ActiveRecord Model tests
├── requests/         # HTTP integration tests (preferred over controller specs)
├── components/       # View Component tests
├── services/         # Service tests
├── queries/          # Query Object tests
├── presenters/       # Presenter tests
├── policies/         # Pundit policy tests
├── system/           # End-to-end tests with Capybara
├── factories/        # FactoryBot factories
└── support/          # Helpers and configuration

Naming Conventions

  • Files: class_name_spec.rb (mirrors source file)
  • describe: the class or method being tested
  • context: conditions ("when user is admin", "with invalid params")
  • it: expected behavior ("creates a new record", "returns 404")

Test Patterns

See test-examples.md for complete examples covering models, services, requests, components, queries, policies, system tests, and anti-patterns.

RSpec Best Practices

  • Use let (lazy) and let! (eager) for test data -- never raw Model.create
  • One expect per test when possible for clearer failure messages
  • Use subject(:name) { described_class.new(params) } for the thing under test
  • Always use described_class instead of hardcoded class names
  • Extract shared examples for repetitive assertions (e.g., shared_examples 'timestampable')
  • Use FactoryBot traits to express meaningful object variants (create(:user, :admin, :premium))
  • Test edge cases: nil, empty strings, empty arrays, negative/very large values, boundary conditions
  • Hotwire: assert response.media_type == 'text/vnd.turbo-stream.html' and check for turbo-stream / turbo-frame tags in response body

Read the full file on GitHub · 76 lines

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. 8d ago First seen · 76 lines · 0 tokens per session scan A ba573e5b32cf

Subscribe to this mod's changes

rspec-agent is an agent published in the GitHub repository ThibautBaissac/rails_ai_agents (659 stars, last pushed 3mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 829 tokens. 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

Other agents, from other repositories

ruby-pro

Write idiomatic Ruby code with metaprogramming, Rails patterns, and performance optimization. Specializes in Ruby on Rails, gem development, and testing frameworks. Use PROACTIVELY for Ruby refactoring, optimization, or complex Ruby features.

NOMARJ/sigil · 52 tokens

Rails Developer

Senior Rails Developer focused on implementation, TDD, and clean code conventions.

alec-c4/claude-rails-dev · 18 tokens

symfony-tdd-coach

Guides TDD workflow for Symfony projects using Pest PHP or PHPUnit. Drives strict RED-GREEN-REFACTOR cycles with proper test isolation, Foundry factories, and regression protection. Use when writing tests, adding test coverage, or practicing TDD.

dev-toolings/superpowers-symfony · 58 tokens

ruby-pro

Write idiomatic Ruby code with metaprogramming, Rails patterns, and performance optimization. Specializes in Ruby on Rails, gem development, and testing frameworks. Use PROACTIVELY for Ruby refactoring, optimization, or complex Ruby features.

echoVic/blade-code · 52 tokens

ruby-developer

Implementación de código Ruby on Rails siguiendo specs SDD aprobadas. Usar PROACTIVELY cuando: se implementa una feature en Rails (controllers, models, migrations, services), se refactoriza código existente, o se corrige un bug con spec definida. SIEMPRE requiere una Spec SDD aprobada antes de empezar.

gonzalezpazmonica/savia · 73 tokens

unit-test-writer

Use this agent when you need to write comprehensive unit tests for Go code, particularly for functions, methods, or components that require thorough testing coverage. Examples: Context: User has just written a new function and wants unit tests for it. user: 'I just wrote this function to validate email addresses, can…

stacklok/toolhive-registry-server · 0 tokens