/agent-skills:encapsulationfrom agent-skills
Encapsulation — bundling an object's state together with the behavior that operates on it, and closing off direct access to that state so every mutation goes through methods that keep it valid. Use when a caller can read or write a field directly instead of calling a method, when state is being assigned into an object from outside instead of a method deciding the assignment, or when checking whether a class formed from loose functions actually hides its fields and protects an invariant.
Ships in agent-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
An object encapsulates when its state and the behavior that operates on that state live in one place, and nothing outside that place can touch the state directly. The payoff isn't hiding for its own sake — it's that every caller is structurally unable to put the state into a combination the object itself would reject.
Say six functions that each took name: string have just been combined into a class — now an SbxClient with name captured once in the constructor. That move alone buys grouping, not hiding: if name and every other field is still public, callers can still reach in and reassign them, and the class is just the old parameter list wearing a constructor. Encapsulation's job starts here — keep the mechanics (exact argv construction, execFileSync vs spawnSync, the temp-file write/copy/cleanup dance) as private fields and private helper methods, reachable only through a small set of public methods (exists(), create(), exec(), writeSettings()). The same applies to a test fixture closing over a temp bin dir, a temp state dir, a log path, and a saved PATH: turning it into a class is one move, but making those four fields private — so the only way to interact with them is readLog(), cpMirrorPath(), teardown() — is the encapsulation move.
Hide the representation; keep the capability. The representation is how — argv construction for a wrapped CLI, execFileSync vs spawnSync, the temp-file dance inside a write, the exact shape of an internal map. The capability is what a caller needs done — exists(), create(), exec(), writeSettings(). Decompose around hiding the design decision most likely to change, so that when it changes, exactly one module's internals are touched and every caller's code is untouched. If the real CLI's argument shape changes tomorrow, the question to ask of your own design is: how many files does that touch? One means it was actually hidden; more than one means the decision leaked past the boundary you drew.
Bundling data and methods into a class doesn't automatically deliver this — a class can bundle data and methods and still expose every field as public, or hand back a mutable reference to its internals. Bundling is necessary but not sufficient; the access control has to actually close the gap for the hiding to happen.
Once state lives inside an object, its methods are the only gate — so make the gate check something. A constructor should refuse to build an inconsistent instance rather than build one and hope callers fix it up before using it; a mutating method should refuse a change that would leave its own invariant broken, rather than trust the caller to have checked first. Prefer tell, don't ask: push the decision into the method that owns the state (account.withdraw(amount)) instead of reading the state out, deciding externally, and writing a new value back in (if (account.balance >= amount) account.balance -= amount) — the external version means the invariant ("balance never goes negative") now has to be remembered at every call site instead of enforced once.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub joachimwedin/agent-skills --plugin agent-skills32 skills in this plugin
/blackbox-test-casesGenerate exhaustive, non-negotiably rigorous black-box test case descriptions (Given/When/Then, not code) for a public API's external contract — never its implementation. Use for zero-tolerance test coverage, an extremely strict/exhaustive black-box test case sweep, or whenever "thorough" test-case generation isn't thorough enough. Produces an API handoff file, one case file per sub-agent — each is its own source of truth — and a master index file pointing at all of them. Every case carries a checkbox so a later implementing agent can track what's been turned into runnable tests. This skill never writes runnable tests itself./brand-palettePick a primary and accent color that fit a given project and fit each other, or — given an explicit primary — pick three accent candidates that each fit the primary and the project, then generate the full Tailwind v4 color-token system (raw OKLCH scales plus the semantic layer, light and dark) for all three candidates as copy-paste CSS and a visual HTML report written into the project. Use when the user wants brand colors chosen for a project, a Tailwind color system generated from a repo, or a secondary/accent color picked to pair with a primary they already have./codebase-designShared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.