Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add skills/helmedeiros/clean-code-skills/oop-encapsulationnpx skills add helmedeiros/clean-code-skills --skill oop-encapsulationgit clone --depth 1 https://github.com/helmedeiros/clean-code-skillsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/helmedeiros/clean-code-skills/oop-encapsulation)<a href="https://agentmods.dev/skills/helmedeiros/clean-code-skills/oop-encapsulation"><img src="https://agentmods.dev/badge/skills/helmedeiros/clean-code-skills/oop-encapsulation.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00047 | $0.00778 |
| Opus 5 | $0.00023 | $0.00389 |
| Sonnet 5 | $0.00009 | $0.00156 |
| Haiku 4.5 | $0.00005 | $0.00078 |
Grade A, and why
oop-encapsulation scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 87 lines — stays where its author put it; the contents beside it link to each section on GitHub.
OOP: Encapsulation
Protect internal state and enforce invariants by hiding implementation details behind a well-defined public API, exposing behavior rather than data.
When This Skill Applies
- Classes expose their fields directly (public instance variables)
- Getter/setter pairs exist for every field without protecting invariants
- External code manipulates object state instead of asking the object to do something
- The user mentions encapsulation, information hiding, or data protection
- Anemic domain models exist (data classes with no behavior)
Core Principle
Objects should hide how they work and expose what they can do. Encapsulation means bundling data with the methods that operate on it and restricting direct access to internal state. Callers interact through behavior-rich methods that enforce business rules. This protects invariants, reduces coupling, and makes refactoring safe.
Workflow
Step 1: Identify Exposed State
Find classes with public fields, or private fields with trivial getters and setters. Look for external code that reads a field, makes a decision, and writes back — this logic belongs inside the object.
Step 2: Identify the Behavior
Ask: "What decisions does external code make using this data?" Move that decision-making into the object as a method. The method name should describe the behavior, not the data access.
Step 3: Replace Access with Behavior
Replace if (account.balance >= amount) account.balance -= amount with account.withdraw(amount). The object enforces its own rules internally.
Step 4: Remove Unnecessary Accessors
Delete getters and setters that are no longer needed. Keep only those required by framework constraints (serialization, ORM) and mark them accordingly.
Step 5: Verify
Ensure all invariants are enforced by the object itself. No external code should be able to put the object into an invalid state. Run the test suite.
Detection / Indicators
- Public fields or properties with no validation
- Getter/setter pairs for every field (anemic model)
- External code that reads a field, decides, then writes:
if (order.status == 'new') order.status = 'confirmed' - Feature envy: a method in class A uses mostly data from class B
- Objects passed around as data bags with no behavior
- Setters that allow invalid state:
account.setBalance(-100)
What ships with it
1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 5d ago First seen · 87 lines · 47 tokens per session scan A a20a6b88d1ec
oop-encapsulation is a skill published in the GitHub repository helmedeiros/clean-code-skills (2 stars, last pushed 6mo ago), licensed MIT. It adds 47 tokens to every session and 778 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
fp-brief
First-principles briefing from technical documents. Use when: understanding why decisions were made, onboarding to feature reasoning, reviewing decision chains, explaining doc from first principles. Not for: PM/CTO summary (use project-brief), pre-doc analysis (use feasibility-study), code explanation (use…
codex-explain
Explain complex code via Codex exec. Use when: understanding complex logic, tracing data flow, onboarding to unfamiliar code. Not for: code review (use codex-code-review), exploration (use code-explore). Output: structured explanation at chosen depth.
sharingan
Replicate knowledge from any source as sd0x-dev-flow skill definition. Use when: copying skills from repos, adapting patterns from articles/papers/code, converting knowledge to skill format. Not for: research without skill output (use deep-research), creating skills from scratch (use skill-creator), project onboarding…
creating-explainers
Use when creating an interactive explainer - a single self-contained HTML page with hand-built Canvas figures. Handles source-file explainers, topic-driven research explainers, and mixed intake where files provide the spine and research adds support. Trigger phrases include "make an explainer", "turn this paper into…
explaining-codebases
Use when creating an interactive explainer about a codebase, repository, or source files. Handles onboarding overviews, architecture maps, and deep-dives on real implementation paths. Trigger phrases include "explain this codebase", "interactive guide to this repo", "walk through how X works in the code", or…
openehr-assistant
This skill should be used when a conversation touches openEHR outside a task owned by a dedicated skill — e.g. "what is an archetype?", "how do openEHR templates work?", "which composition category fits this data?", "find me a guide on X", "where do I start with openEHR modeling?" — or names openEHR concepts (ADL…