encapsulation

Community

Protect internal state, expose safe behavior.

Authoryanko-belov
Version1.0.0
Installs0

System Documentation

What problem does it solve?

Encapsulation helps maintain invariants by preventing external access to internal state and by routing mutations through controlled methods.

Core Features & Use Cases

  • Hides internal data via private fields and exposes behavior through methods.
  • Prevents invariants from being violated by external callers and supports safe evolution.
  • Recommends getters/setters with validation and returns copies for collections to avoid aliasing.

Quick Start

Start by identifying public mutable state in a class, replace it with private fields, add public methods to mutate state with validation, and ensure callers use these methods rather than directly changing fields.

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: encapsulation
Download link: https://github.com/yanko-belov/code-craft/archive/main.zip#encapsulation

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.