# Inheritance Vs Composition Advisor

> inheritance-vs-composition-advisor

- Skill: `45ck/inheritance-vs-composition-advisor` (Agent Skill)
- Install (CLI): `npx skillmds@latest add 45ck/inheritance-vs-composition-advisor`
- Raw SKILL.md: https://api.skillmd.com/api/skills/45ck/inheritance-vs-composition-advisor/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: 45ck (https://skillmd.com/u/45ck)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/45ck/inheritance-vs-composition-advisor

---

# inheritance-vs-composition-advisor

## Purpose
Decide whether a relationship should be modeled through inheritance, composition, aggregation, or delegation.

## Trigger this skill when
- A base class feels forced.
- Reuse is being modeled structurally rather than behaviorally.
- You need to choose between subclassing and containment/delegation.

## Expected inputs
- class relationships
- reuse goal
- behavioral variance
- state ownership
- extensibility needs

## Deliverables
- relationship decision
- rationale
- tradeoff summary
- alternative structure proposal
- recommended next step

## Operating procedure
1. Identify the object-oriented concern this skill is meant to assess.
2. Separate facts from inferred design intent.
3. Review the current structure against OOP fundamentals: responsibility, invariants, ownership, exposure, abstraction, and lifecycle where relevant.
4. Surface concrete risks, tradeoffs, and improvement options.
5. Prefer minimal structural change that materially improves clarity or safety.
6. Hand off to the next most relevant skill if the issue is broader than this skill alone can resolve.

## Quality gates
- Findings are tied to concrete code structure or stated design intent.
- Recommendations explain *why*, not just *what*.
- Tradeoffs are stated when multiple designs could work.
- Output avoids style nitpicks unless they affect abstraction or maintainability.

## Handoff targets
- class-responsibility-checker
- overloading-overriding-reviewer
- object-lifecycle-reviewer

## Output style
- Be explicit about uncertainty.
- Prefer short, evidence-based findings over long vague critique.
- Distinguish design defects from mere preference.
- End with recommended next actions.

## Failure modes to avoid
- Do not invent framework constraints without evidence.
- Do not recommend sweeping refactors without naming the benefit.
- Do not confuse naming/style issues with true design problems unless they affect abstraction.
- Do not force inheritance, immutability, or statics as ideology.

## Minimum output skeleton
```md
## Summary
## Findings
## Risks
## Recommendations
## Tradeoffs
## Recommended next skill
```

