law-of-demeter

Community

Ask objects directly, avoid chained access.

Authoryanko-belov
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This Skill helps developers avoid deep object access and chained method calls by enforcing the Law of Demeter, reducing coupling and fragility in codebases.

Core Features & Use Cases

  • Promotes explicit data access: Replaces nested property chaining with well-defined accessors.
  • Refactoring guidance: Provides patterns to move logic from chained calls into owner methods.
  • Use Case: When you see code like user.getProfile().getAddress().getCity(), apply this skill to introduce a getCity() method on User or related objects.

Quick Start

Detect chained access patterns and replace them with explicit accessor methods. Example: replace order.customer.paymentMethod.last4 with order.getPaymentLast4() by adding a getter on Order or Customer as appropriate.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: law-of-demeter
Download link: https://github.com/yanko-belov/code-craft/archive/main.zip#law-of-demeter

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.