encapsulation

Installation
SKILL.md

Encapsulation

Overview

Hide internal state. Expose behavior, not data. Control access through methods.

Public fields let anyone modify your object's internals, bypassing validation and breaking invariants. Encapsulation protects data integrity.

When to Use

  • Designing classes with state
  • Tempted to make fields public
  • External code directly modifies object state
  • Invariants can be violated by direct access

The Iron Rule

Installs
26
GitHub Stars
11
First Seen
Jan 22, 2026
encapsulation — yanko-belov/code-craft