Back to Skills

write-test

verified

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 GitHub

Marketplace

claude-code-in-avinyc

aviflombaum/claude-code-in-avinyc

Plugin

rspec-writer

Repository

aviflombaum/claude-code-in-avinyc
21stars

plugins/rspec-writer/skills/write-test/SKILL.md

Last Verified

January 25, 2026

Install Skill

Select agents to install to:

Scope:
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-test

Installation paths:

Claude
.claude/skills/write-test/
Powered by add-skill CLI

Instructions

# 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

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
5045 chars