law-of-demeter

Installation
SKILL.md

Law of Demeter (Don't Talk to Strangers)

Overview

Only talk to your immediate friends, not strangers.

A method should only call methods on: itself, its parameters, objects it creates, or its direct components. Never reach through an object to access another object's internals.

When to Use

  • Accessing nested properties: obj.a.b.c
  • Chaining method calls: obj.getA().getB().getC()
  • Reaching through objects for data
  • Long dot chains in your code

The Iron Rule

NEVER chain through objects. Ask, don't reach.
Related skills
Installs
26
GitHub Stars
10
First Seen
Jan 22, 2026