Generate an RSpec test file for a Ruby class
Generates an RSpec spec file for an existing class, detecting the type (model, service, controller, presenter, job) and creating appropriate test patterns with FactoryBot integration and comprehensive coverage.
/new-spec ProfileService # Generates spec/services/profile_service_spec.rb
/new-spec Profile # Generates spec/models/profile_spec.rb
/new-spec ProfilesController # Generates spec/requests/profiles_spec.rb
/new-spec ProfilePresenter # Generates spec/presenters/profile_presenter_spec.rb
/new-spec Sync::AirtableImportJob # Generates spec/jobs/sync/airtable_import_job_spec.rb
Read reference patterns. Load the spec patterns from:
skills/new-spec/references/spec-examples.mdskills/test/references/rspec-patterns.mdskills/test/references/factory-patterns.mdDetect the class type. Determine what kind of spec to generate:
Service -> service specController -> request specPresenter -> presenter specJob -> job specRead the source file. Analyze the existing class to determine:
Generate the spec file. Create the spec with appropriate patterns:
frozen_string_literal: truerequire 'rails_helper'RSpec.describe with correct type tagsubject for the object under testlet blocks for dependencies using FactoryBotdescribe and context blocks for all test scenariosEnsure factory exists. Check spec/factories/ for a matching factory.
If missing, create one.
Run the spec.
bundle exec rubocop -A spec/<path>_spec.rb
bundle exec rspec spec/<path>_spec.rb
spec/<type>/<path>_spec.rb
spec/factories/<model>.rb (if missing)
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer