Spec Organization

Organize RSpec test suites with directory patterns, shared examples, and tags.

3|Updated Jan 9, 2026
One-click install
npx skills add https://github.com/bastos/ruby-plugin-marketplace --skill spec-organization
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Spec Organization
Source: https://github.com/bastos/ruby-plugin-marketplace/tree/main/plugins/rspec/skills/spec-organization
Command: npx skills add https://github.com/bastos/ruby-plugin-marketplace --skill spec-organization

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Well-organized RSpec specs are easier to maintain, faster to run, and clearer to read. This skill provides patterns for structuring test suites, including how to organize directories, share reusable setup and behavior, and label tests for efficient filtering.

Core Features & Use Cases

  • Directory organization patterns: guidance on common layouts (models, controllers, services, requests, system specs) to align with project structure.
  • Shared logic reuse: how to define and apply shared_examples and shared_contexts to reduce duplication and improve consistency, with examples showing usage in model and service specs.
  • Tagging and filtering strategies: how to annotate specs for selective execution and CI performance, plus practical examples of filtering by tags during runs.

Quick Start

Describe your current test structure and ask for a recommended layout for organizing an RSpec suite.

Frequently Asked Questions about Spec Organization

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I organize RSpec test suites for better maintainability?

To organize RSpec test suites effectively, structure directories to align with your project layout and use shared examples and contexts to reduce duplication. This improves maintainability and readability across unit, model, controller, service, and feature specs.

What is the best way to use shared examples and shared contexts in RSpec?

Using shared examples and shared contexts in RSpec reduces duplication by defining reusable setup and behavior. You can define them once and apply them across model and service specs to improve consistency and clarity.

How do I use RSpec tagging to filter tests for CI performance?

RSpec tagging annotates specs for selective execution and CI performance optimization. You can label tests with specific tags and then filter by those tags during test runs to execute only the relevant subsets of your suite.

How should I structure describe and context blocks in RSpec for readability?

Structuring describe and context blocks in RSpec requires consistent naming conventions to separate behaviors and conditions. Clear sections within your specs improve readability and make maintaining the test suite significantly easier.

Can I apply RSpec directory organization patterns to both model and feature specs?

Yes, RSpec directory organization patterns apply to unit, model, controller, service, request, and system specs. Aligning your spec directories with your project structure ensures consistent conventions across the entire test suite.