rspec-conventions

A set of conventions for RSpec, Ruby's testing framework, including how to structure tests, create test data, and use mocks and matchers.

In plain words
What is it for?
Use it when writing, reviewing, or editing RSpec test files and factories for models, requests, and other test types.
Why use it?
It gives tests a consistent style and helps reviewers spot unclear or incomplete cases.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/rootstrap/rails_api_base/rspec-conventions
Any agent
npx skills add rootstrap/rails_api_base --skill rspec-conventions
Clone the repo
git clone --depth 1 https://github.com/rootstrap/rails_api_base

Made for: Claude Code, Codex.

Per session 82 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,124 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00082 $0.01124
Opus 5 $0.00041 $0.00562
Sonnet 5 $0.00016 $0.00225
Haiku 4.5 $0.00008 $0.00112

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

Security

Grade A, and why

rspec-conventions 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 2d 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/skills/rspec-conventions/SKILL.md · 88 lines

How it starts

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

RSpec Conventions (Rootstrap)

Apply these whenever producing or modifying RSpec test code. Full guide: https://github.com/rootstrap/tech-guides/blob/master/ruby/rspec/style_guide.md

Complements ruby-conventions — language-level Ruby style still applies.

Structure & Formatting

  • No blank line directly after describe/context/feature opening.
  • Leave one blank line after let/subject groups and after before/after blocks.
  • Group let and subject together; separate them from before/after with a blank line.
  • One blank line around each it block.
  • Use before (not before(:each)); before(:all) should be rare and explicit.

describe & context

  • describe '#method' for instance methods, describe '.method' for class methods.
  • context descriptions must start with when or with, forming a grammatical sentence.
    context 'when the display name is not present'
    
  • Every context should have a matching opposite/negative case — a lone context is a smell.
  • Don't end it descriptions with a conditional ("...if X") — wrap in a context instead.

it / Examples

  • Never start it with "should" / "should not". State behavior directly.
    it 'returns the summary'   # not: 'should return the summary'
    
  • One expectation per it block (split multi-assertion examples).
  • Avoid generating examples via iterators; use shared examples instead.
    shared_examples 'responds successfully' do
      it 'returns 200' do ... end
    end
    it_behaves_like 'responds successfully'
    

let & subject

  • Prefer let over before { @x = ... } for test data (lazy, no instance vars).
  • let is lazy (evaluated on first reference) and cached within a single example, not across examples. Use let! when you need eager evaluation before each example.
  • Use let for values shared across several (not necessarily all) its in a context; avoid overuse — it hurts readability.
  • Use subject when describing a single primary object.
    subject { create(:article) }
    

Read the full file on GitHub · 88 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. 2d ago First seen · 88 lines · 82 tokens per session scan A a8f2321362f4

Subscribe to this mod's changes

rspec-conventions is a skill published in the GitHub repository rootstrap/rails_api_base (631 stars, last pushed 4d ago), licensed MIT. It adds 82 tokens to every session and 1,124 once invoked, about $0.0004 per session on Opus 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

Other skills, from other repositories

tests

Write clear, maintainable Vitest and Playwright tests with precise assertions, consistent structure, and strong behavioral coverage.

scalar/scalar · 25 tokens

completion-rule

大模型代码生成任务的自动自检与纠错规则。 在代码输出后强制执行功能自测、单元测试设计和 Linter 检查。 未通过则自动修正并循环,直到全部通过或达到最大迭代次数。 适用于大模型生成或修改代码且要求正确、可测试、规范的场景。 支持 Python、TypeScript、Go、Java,语言规则通过 references 加载。.

Rain120/qq-music-api · 98 tokens

rails-upgrade

Analyzes Rails applications and generates comprehensive upgrade reports with breaking changes, deprecations, and step-by-step migration guides for Rails 2.3 through 8.1. Use when upgrading Rails applications, planning multi-hop upgrades, or querying version-specific changes. Based on FastRuby.io methodology and "The…

ombulabs/claude-code_rails-upgrade-skill · 73 tokens

test-runner

Run and triage Go tests with correct environment handling; produce compact, actionable failure summaries.

pilinux/gorest · 22 tokens

upgrade-cleanup

Clean up after (or abandon) a Rails upgrade. Drop NextRails.next? and NextRails.current? branches and retire dual-boot scaffolding (Gemfile.next, Gemfile.next.lock, conditional Gemfile groups), keeping either the next or the current version. Trigger when the user says they are done with the upgrade, want to clean up…

ombulabs/claude-code_rails-upgrade-skill · 139 tokens

testing-patterns

Writes Minitest tests with fixtures following 37signals conventions. Uses Minitest (not RSpec) and fixtures (not factories). Use when writing tests, adding test coverage, or creating fixtures. WHEN NOT: For RSpec or FactoryBot patterns (this project uses Minitest + fixtures exclusively). For test configuration/CI…

dilolabs/nosia · 77 tokens