ruby-idioms
SkillAI & modelsRuby rewards expressiveness, convention, and developer happiness. Modern Ruby (3.x) favors pattern matching, Ractor for concurrency, and strict typing via Sorbet/RBS. Idiomatic Ruby = readable, tested, convention-following.
Available today. Use it from your connected AI after setup.
No other account needed.
Connect ahel once, and every AI you use reads what you have installed.
Then ask your AI: use the ruby-idioms skill
About this capability
Comprehensive sets of standards and practices designed to elevate the capabilities of AI coding agents.
What this skill tells your AI
The instructions your AI receives, as published by irahardianto/awesome-agv in .agents/skills/ruby-idioms/SKILL.md and read by ahel’s review.
Ruby Idioms and Patterns
Ruby rewards expressiveness, convention, and developer happiness. Modern Ruby (3.x) favors pattern matching, Ractor for concurrency, and strict typing via Sorbet/RBS. Idiomatic Ruby = readable, tested, convention-following.
Scope: Ruby coding idioms. Test naming: .agents/rules/testing-strategy.md. Logging:
@.agents/skills/logging-implementation/SKILL.md.
Modern Ruby Features (3.x)
-
Pattern matching:
case result in { status: :success, data: Task => task } render json: task in { status: :not_found, id: String => id } render json: { error: "Task #{id} not found" }, status: :not_found end -
Endless methods for simple accessors:
def full_name = "#{first_name} #{last_name}" -
Data class (3.2+) for immutable value objects:
TaskResult = Data.define(:task, :status) result = TaskResult.new(task: task, status: :created)
Error Handling
-
Domain exception hierarchies:
class DomainError < StandardError; end class NotFoundError < DomainError attr_reader :resource, :resource_id def initialize(resource, resource_id) @resource = resource @resource_id = resource_id super("#{resource} '#{resource_id}' not found") end end -
rescuespecific exceptions — never barerescue. -
Use
ensurefor cleanup — equivalent tofinally.
Naming
- snake_case for methods, variables, file names.
- PascalCase for classes, modules.
- UPPER_SNAKE_CASE for constants.
?suffix for boolean queries:active?,valid?.!suffix for destructive or dangerous methods:save!,delete!.
Testing
-
RSpec (preferred) or Minitest:
RSpec.describe TaskService do describe '#create' do it 'creates a task with valid attributes' do task = service.create(title: 'Test', priority: :high) expect(task.title).to eq('Test') end it 'raises ValidationError for blank title' do expect { service.create(title: '', priority: :high) } .to raise_error(ValidationError) end end end -
letfor lazy setup,beforefor eager setup. -
Factory Bot for test data — never fixtures for complex models.
Formatting and Static Analysis
| Tool | Purpose | Command |
|---|---|---|
| RuboCop | Formatting + linting | rubocop --autocorrect |
| Sorbet | Type checking | srb tc |
| Brakeman | Security scanning | brakeman --no-pager |
bundle audit | CVE scanning | bundle audit check --update |
Related
- Code Idioms and Conventions .agents/rules/code-idioms-and-conventions.md
- Testing Strategy .agents/rules/testing-strategy.md
- Error Handling Principles .agents/rules/error-handling-principles.md
Signals
- GitHub stars
- 156
- Forks
- 53
- Last commit
- Aug 2026
Advanced
- Catalog kind
- skill
- Gateway key
ruby-idioms- Source
- github.com/irahardianto/awesome-agv