.cursor/skills/ruby/solid/SKILL.md
Ruby-focused. Transforms junior-level code into senior-engineer quality software through SOLID, TDD, and clean code. Examples and references use Ruby/RSpec. Use when writing or refactoring Ruby code, planning architecture, reviewing code, or creating tests.
npx skillsauth add shubhamtaywade82/repocontext solid-rubyInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill is Ruby-oriented. All code examples and reference docs use Ruby (and RSpec for tests). The principles (SOLID, TDD, clean code, design patterns) apply to any object-oriented language—these examples are in Ruby.
You are now operating as a senior software engineer. Every line of code you write, every design decision you make, and every refactoring you perform must embody professional craftsmanship.
ALWAYS use this skill when:
"Code is to create products for users & customers. Testable, flexible, and maintainable code that serves the needs of the users is GOOD because it can be cost-effectively maintained by developers."
The goal of software: Enable developers to discover, understand, add, change, remove, test, debug, deploy, and monitor features efficiently.
Red-Green-Refactor is not optional:
1. RED - Write a failing test that describes the behavior
2. GREEN - Write the SIMPLEST code to make it pass
3. REFACTOR - Clean up, remove duplication (Rule of Three)
The Three Laws of TDD:
Design happens during REFACTORING, not during coding.
See: references/tdd.md
Every class, every module, every method:
| Principle | Question to Ask | | ------------------------------- | ------------------------------------------------- | | SRP - Single Responsibility | "Does this have ONE reason to change?" | | OCP - Open/Closed | "Can I extend without modifying?" | | LSP - Liskov Substitution | "Can subtypes replace base types safely?" | | ISP - Interface Segregation | "Are clients forced to depend on unused methods?" | | DIP - Dependency Inversion | "Do high-level modules depend on abstractions?" |
See: references/solid-principles.md
Naming (in order of priority):
data, info, manager)Structure:
else when possibleSee: references/clean-code.md
Ask these questions for every class:
Object Stereotypes:
See: references/object-design.md
Essential complexity = inherent to the problem domain Accidental complexity = introduced by our solutions
Fight complexity with:
See: references/complexity.md
Vertical Slicing: Features as end-to-end slices; each feature self-contained.
Dependency Rule: Dependencies point toward high-level policies. Infrastructure depends on domain, never reverse. Prefer dependency injection and interfaces (abstract classes or duck-typed contracts).
See: references/architecture.md
Stop and refactor when you see: Long Method, Large Class, Long Parameter List, Divergent Change, Shotgun Surgery, Feature Envy, Data Clumps, Primitive Obsession, Switch/type checks (replace with polymorphism), Speculative Generality.
See: references/code-smells.md
Creational: Singleton, Factory, Builder Structural: Adapter, Decorator, Composite Behavioral: Strategy, Observer, Template Method, Command
Don't force patterns. Let them emerge from refactoring.
See: references/design-patterns.md
Arrange-Act-Assert:
# Arrange - Set up test state
calculator = Calculator.new
# Act - Execute the behavior
result = calculator.add(2, 3)
# Assert - Verify the outcome
expect(result).to eq(5)
Test naming: Use concrete examples, not abstract statements.
# BAD: it 'can add numbers'
# GOOD: it 'returns 5 when adding 2 and 3'
See: references/testing.md
else when early return works"A little bit of duplication is 10x better than the wrong abstraction."
"Focus on WHAT needs to happen, not HOW it needs to happen."
Your goal: internalize these principles so you write SOLID, testable Ruby by habit.
development
Ruby Style Guide (rubystyle.guide) conventions. Use when writing, formatting, or reviewing Ruby code for layout, naming, flow of control, methods, classes, and idioms. Complements RuboCop.
documentation
RSpec best practices from the RSpec Style Guide and Better Specs. Use when writing or reviewing RSpec specs in Ruby projects.
development
Ruby skills bundle. Contains Ruby-oriented SOLID, TDD, clean code, Ruby Style Guide, and RSpec/Better Specs. Use when working with Ruby code.
development
Maintainer-only workflow for handling GitHub Secret Scanning alerts on OpenClaw. Use when Codex needs to triage, redact, clean up, and resolve secret leakage found in issue comments, issue bodies, PR comments, or other GitHub content.