ruby-conventions
Ruby code conventions covering Ruby 3.2+, RuboCop, RBS type checking, RSpec/Minitest, security scanning, exception handling, composition, Bundler, and gem packaging. Load when writing or reviewing Rub
SKILL.mdinternal/builtins/languages/ruby/skills/ruby-conventions/SKILL.md
GitHub- Ruby 3.2+,
frozen_string_literal: true,.ruby-versionfile. - Linting: a linter/formatter (e.g., RuboCop) with auto-fix (120 char max), plus its RSpec/performance plugins.
- Type checking: RBS with a type checker (e.g., steep). Use
rbs prototypefor scaffolding type signatures. - Testing: RSpec (or Minitest) with
describe/context/it, factories over fixtures, a coverage tool (e.g., SimpleCov) at 80%+. - Security: a SAST tool (e.g., Brakeman for Rails),
bundler-auditfor dependency CVE scanning. - Error handling: specific exceptions inheriting
StandardError, no barerescue. - Composition over inheritance,
Comparable/Enumerablemixins,case/inpattern matching. - Dependencies:
bundler, commitGemfile.lock, pessimistic~>constraints. - Gem packaging: use
gemspecwithbundlergem template,rake releasefor distribution. &:method_nameblock shorthand,=>pattern matching destructuring (3.2+).- Anti-patterns: monkey patching,
method_missingwithoutrespond_to_missing?,evalwith user input.