structural-design-principles

Enforce Composition Over Inheritance, Law of Demeter, and Tell Don't Ask in Elixir and TypeScript/React codebases.

187|20|Updated Nov 20, 2025
One-click install
npx skills add https://github.com/TheBushidoCollective/han --skill structural-design-principles
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: structural-design-principles
Source: https://github.com/TheBushidoCollective/han/tree/main/core/skills/structural-design-principles
Command: npx skills add https://github.com/TheBushidoCollective/han --skill structural-design-principles

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Share universal design principles that apply across paradigms to reduce coupling and clarify boundaries.

Core Features & Use Cases

  • Composition Over Inheritance: Build flexible, composable systems.
  • Law of Demeter: Minimize chaining and dependencies.
  • Tell, Don't Ask / Encapsulation: Push logic to owning modules and protect internals.

Quick Start

Create a small module that composes behaviors and exposes a simple API surface.

Frequently Asked Questions about structural-design-principles

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I reduce coupling between modules in my codebase?

Reduce coupling by applying composition over inheritance, the Law of Demeter to minimize chaining, and encapsulation to push logic to owning modules. These structural design principles clarify boundaries and enforce minimal dependencies across Elixir, TypeScript, React, and multi-paradigm codebases.

What's the difference between composition and inheritance for building flexible systems?

Composition builds behavior by combining smaller, independent modules rather than inheriting from parent classes. This approach avoids tight hierarchies, improves testability, and lets you compose behaviors dynamically—critical for refactoring and dependency management in large systems.

How do I design module interfaces that enforce clear boundaries?

Tell, Don't Ask: push decision logic into the module that owns the data, and expose only what's necessary through its API. Pair this with the Law of Demeter to avoid deep chaining. This protects internals, clarifies responsibilities, and improves interface clarity.

Can I apply these design principles across different programming paradigms?

Yes. Composition, encapsulation, and the Law of Demeter are universal principles that work across paradigms. They apply to Elixir modules, TypeScript components, React services, and multi-paradigm teams implementing modules, components, and services together.

Why does the Law of Demeter matter for dependency management?

The Law of Demeter restricts how deeply you can chain object calls, forcing you to communicate only with immediate neighbors. This minimizes hidden dependencies, reduces coupling, and makes it easier to refactor or swap implementations without cascading breaks.

How do I test code that follows these design principles?

Clear boundaries and minimal coupling make testing simpler: each module owns its behavior, dependencies are explicit, and concerns are isolated. Composition and encapsulation let you mock or substitute components without restructuring test setup.