code-smells/oo-abusers
Detect and refactor OO Abusers — incorrect or incomplete application of OOP principles.
Skill by gentleman-programming
Install
Works with Claude Code. Read the repository before you give any tool access to your data.
npx agentmarket install skill/johnnystefan-code-smells-oo-abusers
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/code-smells-oo-abusers
Tools it pre-approves 7
From allowed-tools in SKILL.md: the agent may use these without asking you each time.
Read,Edit,Write,Glob,Grep,Bash,Task
What's inside
- Skill name
code-smells/oo-abusers- Description
- Detect and refactor OO Abusers — incorrect or incomplete application of OOP principles. Trigger: When identifying Switch Statements, Temporary Fields, Refused Bequest, or Alternative Classes with Different Interfaces.
- License
- Apache-2.0
- Allowed tools
- Read,, Edit,, Write,, Glob,, Grep,, Bash,, Task
- Metadata
- author: gentleman-programming · version: 1.0 · auto_invoke: Reviewing OOP design and polymorphism usage
- Instructions
- 104 lines in SKILL.md · view on GitHub
Before installing
- Pre-approves some shell commands
Agent Skills spec issues
- name: only lowercase letters, digits and single hyphens allowed
- name: "code-smells/oo-abusers" does not match folder "oo-abusers"
Files (1)
- SKILL.md
SKILL.md (first lines)
# Skill: Detect and Refactor Object-Orientation Abusers
## Purpose
This skill enables the agent to identify "OO Abusers" — code structures that result from an incomplete or incorrect application of object-oriented programming principles. The agent will replace these structures with proper polymorphic behavior and cleaner class hierarchies.
## Domain Knowledge: The 4 OO Abusers
1. **Switch Statements:** Complex `switch` operators or sequences of `if` statements that perform different actions based on an object's type or state.
2. **Temporary Field:** Fields that only get values under certain specific circumstances, remaining empty or `null` otherwise.
3. **Refused Bequest:** A subclass that uses only a small portion of the methods and properties inherited from its parent. The hierarchy is "off-kilter."
4. **Alternative Classes with Different Interfaces:** Two classes that perform identical or very similar functions but have different method names.
## Procedural Instructions
### 1. Detection Phase
- **Identify Switch logic:** Look for methods where behavior is branched based on a `type` code or class name.
- **Audit Field Usage:** Check if certain fields in a class are only used by one specific method and otherwise ignored.
- **Review Inheritance:** Check if a subclass throws "Not Supported" exceptions for inherited methods or simply leaves them empty.
- **Compare Classes:** Look for different classes that seem to do the same work but use different naming conventions (e.g., `getTotal()` vs `calculateSum()`).
### 2. Treatment Phase
- **For Switch Statements:**
- Use **Extract Method** to isolate the switch.
- Use **Move Method** to put it in the right class.
- Apply **Replace Conditional with Polymorphism**.
- **For Temporary Fields:**
- Use **Extract Class** to create a separate object for the fields and the operations that use them.
- Use **Introduce Null Object** to eliminate conditional checks for the field's existence.
- **For Refused Bequest:**
- If inheritance makes no sense, use **Replace Inheritance with Delegation**.
- If inheritance is appropriate but the parent is too fat, use **Extract Superclass** to pull up only the common parts.
- **For Alternative Classes:**
- Use **Rename Method** to align signatures.
- Use **Move Method** or **Extract Superclass** to merge the functionalities.
## TypeScript Examples
### Switch Statements vs. Polymorphism
```typescript
// BAD: Switch statement based on type
class Bird {
getSpeed(type: string) {
switch (type) {
case 'EUROPEAN':
return 10;
case 'AFRICAN':
return 15;
default:
return 0;
}
}
}
// GOOD: Replace with Polymorphism
interface Bird {
getSpeed(): number;
}
class European implements Bird {
getSpeed() {
return 10;
}
}
class African implements Bird {
getSpeed() {
return 15;
}
}
```
### Refused Bequest
```typescript
// BAD: A Chair is not an Animal, even if they both have legs
class Animal {
eat() {
console.log('Eating...');
}
}
class Chair extends Animal {
eat() {
throw new Error("Chairs don't eat!");
} // Refused Bequest
}
// GOOD: No false "is-a" relationship
class Chair {
legs: number = 4;
}
```
## Payoff
- **Flexibility:** Adding a new type no longer requires finding and changing every switch statement in the codebase.
- **Code Clarity:** Classes no longer contain "ghost" fields that are only used 1% of the time.
- **Logical Hierarchies:** Inheritance trees represent real "is-a" relationships, making the code predictable.From johnnystefan/test-saas-business, Apache-2.0.
More from johnnystefan/test-saas-business
- 0.403score
accessibility
web-quality-skills
Audit and improve web accessibility following WCAG 2.2 guidelines.
SkillDFreshness: DClaude Code +9 - 0.347score
pattern-state
gentleman-programming
Teaches and applies the State behavioral design pattern — allowing an object to alter its behavior when its internal state changes, appearing as if the object…
SkillDFreshness: DClaude Code - 0.347score
pattern-iterator
gentleman-programming
Teaches and applies the Iterator behavioral design pattern — providing sequential access to elements of a collection without exposing its internal…
SkillDFreshness: DClaude Code - 0.347score
pattern-mediator
gentleman-programming
Teaches and applies the Mediator behavioral design pattern — reducing direct dependencies between objects by forcing them to communicate only through a…
SkillDFreshness: DClaude Code - 0.347score
pattern-memento
gentleman-programming
Teaches and applies the Memento behavioral design pattern — capturing and externalizing an object's internal state without violating encapsulation, enabling…
SkillDFreshness: DClaude Code - 0.347score
pattern-observer
gentleman-programming
Teaches and applies the Observer behavioral design pattern — defining a subscription mechanism to notify multiple objects about events in the observed object.
SkillDFreshness: DClaude Code - 0.347score
pattern-chain-of-responsibility
gentleman-programming
Teaches and applies the Chain of Responsibility behavioral design pattern — passing requests along a chain of handlers where each handler decides to process…
SkillDFreshness: DClaude Code - 0.347score
pattern-command
gentleman-programming
Teaches and applies the Command behavioral design pattern — encapsulating requests as objects to support parameterization, queuing, logging, and undo/redo…
SkillDFreshness: DClaude Code - 0.341score
code-smells/change-preventers
gentleman-programming
Detect and refactor Change Preventers — flaws that hinder software evolution.
SkillDFreshness: DClaude Code - 0.341score
code-smells/couplers
gentleman-programming
Detect and refactor Couplers — excessive coupling or over-delegation between classes.
SkillDFreshness: DClaude Code - 0.341score
code-smells/dispensables
gentleman-programming
Detect and remove Dispensables — pointless and unneeded code elements.
SkillDFreshness: DClaude Code - 0.341score
code-smells/bloaters
gentleman-programming
Detect and refactor Bloaters — code, methods, and classes that have grown too large.
SkillDFreshness: DClaude Code
Signals
- Stars
- 0
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Apr 1, 2026 (7 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- Version
- 1.0
- License
- Apache-2.0
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from gentleman-programming
- 0.724score
gentleman-bubbletea
gentleman-programming
Bubbletea TUI patterns for Gentleman.Dots installer.
SkillAFreshness: A★ 7.6KClaude Code +9 - 0.723score
engram-backlog-triage
gentleman-programming
Backlog triage protocol for Engram: audit open issues and PRs, classify each item, infer maintainer ideology from comments, and produce an actionable…
SkillAFreshness: A★ 7.6KClaude Code +9 - 0.720score
engram-commit-hygiene
gentleman-programming
Commit and branch naming standards for Engram contributors, enforced by GitHub rulesets.
SkillAFreshness: A★ 7.6KClaude Code +9 - 0.720score
engram-architecture-guardrails
gentleman-programming
Architecture guardrails for Engram across local store, cloud sync, dashboard, and plugins.
SkillAFreshness: A★ 7.6KClaude Code +9 - 0.720score
engram-branch-pr
gentleman-programming
PR creation workflow for Engram following the issue-first enforcement system.
SkillAFreshness: A★ 7.6KClaude Code +9 - 0.720score
engram-business-rules
gentleman-programming
Product and business-rule guardrails for Engram.
SkillAFreshness: A★ 7.6KClaude Code +9
Cite this page
code-smells/oo-abusers skill. Agent Mart. https://agentmart.dev/skills/johnnystefan-code-smells-oo-abusers (last updated 2026-10-24)