1---2name: encapsulation-reviewer3description: encapsulation-reviewer4---5# encapsulation-reviewer67## Purpose8Review fields, methods, and object interactions for information hiding, invariant protection, and leakage of internal state.910## Trigger this skill when11- Objects expose too much mutable state.12- Invariants can be broken from outside the class.13- APIs feel leaky or too permissive.1415## Expected inputs16- class definitions17- fields and methods18- mutation paths19- public API surface20- invariants if known2122## Deliverables23- exposure findings24- invariant risks25- API surface recommendations26- state-protection suggestions27- follow-up actions2829## Operating procedure301. Identify the object-oriented concern this skill is meant to assess.312. Separate facts from inferred design intent.323. Review the current structure against OOP fundamentals: responsibility, invariants, ownership, exposure, abstraction, and lifecycle where relevant.334. Surface concrete risks, tradeoffs, and improvement options.345. Prefer minimal structural change that materially improves clarity or safety.356. Hand off to the next most relevant skill if the issue is broader than this skill alone can resolve.3637## Quality gates38- Findings are tied to concrete code structure or stated design intent.39- Recommendations explain *why*, not just *what*.40- Tradeoffs are stated when multiple designs could work.41- Output avoids style nitpicks unless they affect abstraction or maintainability.4243## Handoff targets44- visibility-modifier-reviewer45- immutability-opportunity-finder46- constructor-sanity-checker4748## Output style49- Be explicit about uncertainty.50- Prefer short, evidence-based findings over long vague critique.51- Distinguish design defects from mere preference.52- End with recommended next actions.5354## Failure modes to avoid55- Do not invent framework constraints without evidence.56- Do not recommend sweeping refactors without naming the benefit.57- Do not confuse naming/style issues with true design problems unless they affect abstraction.58- Do not force inheritance, immutability, or statics as ideology.5960## Minimum output skeleton61```md62## Summary63## Findings64## Risks65## Recommendations66## Tradeoffs67## Recommended next skill68```
Run npx skillmds@latest add 45ck/encapsulation-reviewer in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
encapsulation-reviewer It is listed under Coding & Dev Tools on SkillMD.
This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
45ck (@45ck) published this skill. Their other Agent Skills are listed on their SkillMD profile.