Agent skill · software engineering · thebushidocollective
ruby-oop
Use when working with Ruby's object-oriented programming features including classes, modules, inheritance, mixins, and method visibility.
Why this skill is useful
Provides specific Ruby OOP patterns and advanced techniques that the AI wouldn't reliably generate on its own.
What it needs
About 3k tokens when loaded. Last updated 2026-07-19. 187 stars on the source repository.
What this skill does
Ruby Object-Oriented Programming Master Ruby's elegant object-oriented programming features. Ruby is a pure object-oriented language where everything is an object. Class Definition Basic Class Structure Method Visibility Inheritance Single Inheritance Method Override and Super Modules and Mixins Module as Namespace Module as Mixin Extend vs Include Advanced OOP Patterns Singleton Pattern Method Missing (Dynamic Methods) Class Instance Variables Struct and OpenStruct Struct (Immutable-ish) OpenStruct (Dynamic Attributes) Composition Over Inheritance Comparable and Enumerable Making Classes Comparable Class Variables vs Instance Variables Best Practices 1. Prefer composition over inheritance for complex relationships 2. Use modules for mixins to share behavior across unrelated classes 3. Keep classes small and focused (Single Responsibility Principle) 4. Use attraccessor/reader/writer instead of manual getters/setters 5. Make use of private/protected to encapsulate implementation details 6. Prefer instance variables over class variables to avoid unexpected sharing 7. Use Struct for simple data objects instead of full classes 8. Override tos for debugging to provide meaningful string representations Anti-Patterns ❌ Don't use class variables unnecessarily - they're shared across inheritance hierarchy ❌ Don't create god objects - keep classes focused and small ❌ Don't expose internal state - use methods instead of direct instance variable access ❌ Don't overuse inheritance - prefer composition or modules ❌ Don't ignore visibility modifiers - they exist for encapsulation Related Skills ruby-metaprogramming - For dynamic class/method generation ruby-blocks-procs-lambdas - For functional programming patterns ruby-modules - For advanced module usage
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills thebushidocollective/ruby-object-oriented-programming