Skip to content
Back to skills

Applying Oop

ASecurity

Use when designing classes or class hierarchies or applying OOP principles. Triggers on classes, inheritance, polymorphism, encapsulation, SOLID, design patterns, or interfaces, even when the user doesn't say 'OOP'.

  • 6 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 30, 2026
ai-agentsgo

Security analysis

A100/100

Pro scans all 5 files and shows the line behind each finding

Scanned November 30, 2026

npx -y skills add xonovex/platform --skill applying-oop --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Applying Oop?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Applying Oop
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/xonovex-applying-oop/badge)](https://www.skillsdirectory.com/skills/xonovex-applying-oop)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: applying-oop
description: "Use when designing classes or class hierarchies or applying OOP principles. Triggers on classes, inheritance, polymorphism, encapsulation, SOLID, design patterns, or interfaces, even when the user doesn't say 'OOP'."
---

# General Object-Oriented Programming Guidelines

Use composition, focused interfaces, and encapsulated state to keep object-oriented code easy to change.

## Stances

- Prefer composition over inheritance; program to interfaces, reserving abstract classes for shared implementation.
- Keep state private; expose behavior through methods.
- SOLID: single responsibility, open/closed, Liskov substitution, interface segregation, dependency inversion.
- Apply patterns (Factory, Strategy, Observer) only when they simplify code, never speculatively.

## Design smells

Recognizers for common OO-design problems and the principle each violates.

- **God Object / Large Class**: one class with many responsibilities and low cohesion; split by responsibility (single responsibility).
- **Refused Bequest**: a subclass that ignores or throws on inherited behavior breaks the base-class contract (Liskov substitution); prefer composition over that inheritance.
- **Downcasting**: a cast that asks "which subtype is this really?" breaks the abstraction and usually signals a Liskov violation; dispatch through the interface instead.
- **Divergent Change**: one class edited for many unrelated reasons; separate the reasons into focused classes (single responsibility).
- **Parallel Inheritance Hierarchies**: every new subclass in one tree forces a mirrored subclass in another; collapse or fold the hierarchies.
- **Alternative Classes with Different Interfaces**: two classes do the same job with unswappable signatures; unify the interface so callers don't choose sides.
- **Temporary Field**: a field populated only in some circumstances, empty otherwise; extract the conditional behavior (often into a method object) so the field isn't left dangling.

## Gotchas

- Liskov substitution is about behavior, not just signatures: `Square extends Rectangle` is the classic violation despite matching types
- Mutable shared state plus method calls = order-dependent behavior; making fields `final`/`readonly` is the cheapest correctness lever

Files in this skill

  • SKILL.md2.2 KB
  • eval-output.json2.7 KB
  • eval-trigger.json5.4 KB
  • moon.yml86 B
  • sources.json2.2 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.