·composition-over-inheritance
</>

composition-over-inheritance

yanko-belov/code-craft

Use when tempted to use class inheritance. Use when creating class hierarchies. Use when subclass needs only some parent behavior.

18Installs·0Trend·@yanko-belov

Installation

$npx skills add https://github.com/yanko-belov/code-craft --skill composition-over-inheritance

SKILL.md

Inheritance creates tight coupling and rigid hierarchies. Composition creates flexible, reusable components that can be mixed and matched.

Default to composition. Use inheritance only for true type hierarchies.

| Diamond problem | Duck needs Flying AND Swimming | | Tight coupling | Child knows parent internals | | Rigid hierarchy | Can't change parent without breaking children | | Forced inheritance | Gets methods it doesn't need | | Fragile base class | Parent changes break all children |

Use when tempted to use class inheritance. Use when creating class hierarchies. Use when subclass needs only some parent behavior. Source: yanko-belov/code-craft.

View raw

Facts (cite-ready)

Stable fields and commands for AI/search citations.

Install command
npx skills add https://github.com/yanko-belov/code-craft --skill composition-over-inheritance
Category
</>Dev Tools
Verified
First Seen
2026-02-01
Updated
2026-02-18

Quick answers

What is composition-over-inheritance?

Use when tempted to use class inheritance. Use when creating class hierarchies. Use when subclass needs only some parent behavior. Source: yanko-belov/code-craft.

How do I install composition-over-inheritance?

Open your terminal or command line tool (Terminal, iTerm, Windows Terminal, etc.) Copy and run this command: npx skills add https://github.com/yanko-belov/code-craft --skill composition-over-inheritance Once installed, the skill will be automatically configured in your AI coding environment and ready to use in Claude Code or Cursor

Where is the source repository?

https://github.com/yanko-belov/code-craft