ruby — Claude Code skill: Ruby style and RSpec rules
Tells the agent how to write Ruby: idiomatic style, Ruby 3.x features, RSpec testing. Useful when you work on a Ruby codebase.
npx skills add Mindrally/skills --skill ruby -a claude-codeWhat ruby does
The skill gives your assistant a working knowledge of Ruby conventions. Files, methods and variables stay snake_case; classes and modules get CamelCase. Descriptive names are preferred, so predicates read like user_signed_in?.
Ruby 3.x gets its own section: pattern matching with case/in, endless methods for one-liners, keyword arguments, the safe navigation operator &.. Blocks, procs and lambdas are covered, with a note to keep metaprogramming in check.
Testing is the meatiest part. Specs are organised with describe for classes and methods, context for scenarios, and let plus FactoryBot instead of fixtures. The skill pushes for independent tests and mocks only around external services. Error handling, SOLID, composition over inheritance and profiling before optimising round it out. Install is a single npx skills command, no API key involved.
What it helps with
- bring Ruby code in line with community style
- structure RSpec specs with describe and context
- adopt Ruby 3.x features without a full rewrite
- move shared class behaviour into mixin modules
- close gaps in input handling and database queries
Example prompts for the agent
- Refactor this Ruby class: drop the inheritance and move shared behaviour into a module
- Write RSpec specs for
calculate_total, including edge cases - Check this code against the Ruby Style Guide and suggest where pattern matching fits
How to install ruby
1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill ruby -a claude-code2Manually: put the files in place
~/.claude/skills/ruby/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/ruby/
1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill ruby -a codex2Manually: put the files in place
.agents/skills/ruby/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill ruby -a cursor2Manually: put the files in place
.cursor/skills/ruby/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install Mindrally/skills ruby2Manually: put the files in place
.github/skills/ruby/SKILL.md1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill ruby -a gemini-cli2Platform CLI
gemini skills install https://github.com/Mindrally/skills --path rubyManually: put the files in place
.devin/skills/ruby/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add Mindrally/skills --skill ruby -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about ruby
How do I install the ruby skill in Claude?
Run npx skills add Mindrally/skills --skill ruby -a claude-code. The skill file lands at ~/.claude/skills/ruby/SKILL.md.
What does the ruby skill do?
It gives the agent Ruby development guidelines: code style, Ruby 3.x features, RSpec testing, error handling and performance habits.
Which platforms support the ruby skill?
Claude, Codex, Cursor, GitHub Copilot, Gemini CLI and OpenCode. Each has its own install command, for example npx skills add Mindrally/skills --skill ruby -a cursor for Cursor.
Source text
SKILL.md · Apache-2.0
---
name: ruby
description: Ruby development guidelines covering idiomatic code style, Ruby 3.x features, testing with RSpec, and best practices for building maintainable Ruby applications.
metadata:
maintainer: Mindrally
source: https://github.com/Mindrally/skills
---
# Ruby Development
You are an expert in Ruby development, including Ruby 3.x features, testing frameworks, and modern Ruby best practices.
## Code Style and Structure
- Write concise, idiomatic Ruby code with accurate examples
- Adhere to Ruby community conventions and style guides
- Use snake_case for files, methods, and variables
- Use CamelCase for classes and modules
- Favor descriptive names like `user_signed_in?` and `calculate_total`
## Ruby Language Features
- Leverage Ruby 3.x capabilities including:
- Pattern matching with `case/in`
- Endless methods for simple one-liners
- Keyword arguments for clarity
- Safe navigation operator (`&.`)
- Use blocks, procs, and lambdas effectively
- Apply metaprogramming judiciously
## Syntax and Formatting
- Follow the Ruby Style Guide
- Employ expressive syntax features
- Prefer single quotes except when string interpolation is needed
- Use meaningful method and variable names
- Keep methods small and focused (Single Responsibility Principle)
## Error Handling
- Apply exceptions for genuine edge cases only
- Implement proper logging with user-friendly messages
- Use custom exception classes for domain-specific errors
- Handle errors gracefully with appropriate rescue blocks
## Object-Oriented Design
- Follow SOLID principles
- Favor composition over inheritance
- Use modules for shared behavior (mixins)
- Keep classes focused and cohesive
## Testing Best Practices
### RSpec Guidelines
- Write comprehensive coverage of typical cases, edge cases, and error conditions
- Use clear, descriptive naming conventions for test blocks
- Organize logically with `describe` for classes/methods and `context` for scenarios
- Use `let` and factories (FactoryBot) instead of fixtures
- Ensure test independence with minimal shared state
- Mock external services strategically while testing real behavior when possible
### Test Structure
```ruby
describe ClassName do
describe '#method_name' do
context 'when condition exists' do
it 'does expected behavior' do
expect(result).to eq(expected)
end
end
end
end
```
## Performance Optimization
- Profile code before optimizing
- Use appropriate data structures
- Leverage lazy enumerators for large collections
- Cache expensive computations
## Security
- Sanitize user input
- Use parameterized queries
- Keep dependencies updated
- Follow security best practices for handling sensitive data
© Mindrally · Apache-2.0 · Mindrally/skills