Writes comprehensive RSpec tests for Rails applications. Use when writing model specs, request specs, system specs, job specs, mailer specs, channel specs, or storage specs. Triggers on "write tests for", "add specs to", "test the User model", "create request specs", "write RSpec", "add test coverage".
View on GitHubaviflombaum/claude-code-in-avinyc
rspec-writer
January 25, 2026
Select agents to install to:
npx add-skill https://github.com/aviflombaum/claude-code-in-avinyc/blob/main/plugins/rspec-writer/skills/write-test/SKILL.md -a claude-code --skill write-testInstallation paths:
.claude/skills/write-test/# RSpec Test Writer You write comprehensive, production-ready RSpec tests for Rails applications. **CRITICAL RULES:** - NEVER edit rails_helper.rb or spec_helper.rb - NEVER add testing gems to Gemfile - Use fixtures, not factories: `users(:admin)`, not `create(:user)` - Use `--fail-fast` flag when running specs - Modern syntax only: `expect().to`, never `should` ## Workflow 1. **Parse the request** - Identify what needs testing (model, controller, job, etc.) 2. **Find the source file** - Use Glob/Grep to locate the code to test 3. **Read the code** - Understand validations, methods, associations, behavior 4. **Check existing fixtures** - Look in `spec/fixtures/*.yml` for test data 5. **Determine spec type** - Use the decision framework below 6. **Consult patterns** - Reference the appropriate pattern file 7. **Write the spec file** - Follow the patterns exactly 8. **Run with `--fail-fast`** - Execute: `bundle exec rspec <spec_file> --fail-fast` 9. **Fix failures** - Iterate until green 10. **Apply DRY patterns** - Check spec/support for existing helpers ## Decision Framework ``` What am I testing? ├── Data & Business Logic → Model specs → @./patterns/model-specs.md ├── HTTP & Controllers → Request specs → @./patterns/request-specs.md ├── User Interface → System specs → @./patterns/system-specs.md ├── Background Processing → Job specs → @./patterns/job-specs.md ├── Email → Mailer specs → @./patterns/mailer-specs.md ├── File Uploads → Storage specs → @./patterns/storage-specs.md ├── Real-time Features → Channel specs → @./patterns/channel-specs.md └── External Services → Use isolation → @./patterns/isolation.md ``` ## Spec Type Quick Reference | Type | Location | Use For | |------|----------|---------| | Model | `spec/models/` | Validations, scopes, methods, callbacks | | Request | `spec/requests/` | HTTP routing, auth, status codes, redirects | | System | `spec/s