law-of-demeter
✓Use when accessing nested object properties. Use when chaining method calls. Use when reaching through objects to get data.
Installation
SKILL.md
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.
| Tight coupling | Caller knows internal structure | | Fragile code | Structure changes break all callers | | Hidden dependencies | Not obvious what's needed | | Hard to test | Must mock entire chain | | Null danger | Each . is a potential null |
A method m of class C should only call methods on:
Use when accessing nested object properties. Use when chaining method calls. Use when reaching through objects to get data. Source: yanko-belov/code-craft.
Facts (cite-ready)
Stable fields and commands for AI/search citations.
- Install command
npx skills add https://github.com/yanko-belov/code-craft --skill law-of-demeter- Source
- yanko-belov/code-craft
- Category
- {}Data Analysis
- Verified
- ✓
- First Seen
- 2026-02-01
- Updated
- 2026-02-18
Quick answers
What is law-of-demeter?
Use when accessing nested object properties. Use when chaining method calls. Use when reaching through objects to get data. Source: yanko-belov/code-craft.
How do I install law-of-demeter?
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 law-of-demeter 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
Details
- Category
- {}Data Analysis
- Source
- skills.sh
- First Seen
- 2026-02-01