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/solid-open-closednpx skills add helmedeiros/clean-code-skills --skill solid-open-closedgit 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/solid-open-closed)<a href="https://agentmods.dev/skills/helmedeiros/clean-code-skills/solid-open-closed"><img src="https://agentmods.dev/badge/skills/helmedeiros/clean-code-skills/solid-open-closed.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 | $0.00050 | $0.00697 |
| Opus 5 | $0.00025 | $0.00349 |
| Sonnet 5 | $0.00010 | $0.00139 |
| Haiku 4.5 | $0.00005 | $0.00070 |
Grade A, and why
solid-open-closed 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 3d 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 — 74 lines — stays where its author put it; the contents beside it link to each section on GitHub.
SOLID: Open-Closed Principle
Design modules that are open for extension but closed for modification — new behavior is added by writing new code, not by changing existing code.
When This Skill Applies
- Adding a new feature requires modifying existing, tested code
- Switch statements or if-else chains grow with each new requirement
- The user wants to add behavior without risking regression
- A system needs plugin-like extensibility
- The user mentions OCP or open-closed principle
Core Principle
Software entities should be open for extension but closed for modification. When requirements change, you should be able to add new behavior by adding new code (new classes, new modules) rather than changing existing code. This protects working code from regression and enables parallel development.
Workflow
Step 1: Identify the Variation Point
Find where the system changes when new requirements arrive. If adding a new payment type means editing processPayment(), that function is the variation point.
Step 2: Define an Abstraction
Create an interface or abstract class that captures the behavior that varies. The existing code depends on this abstraction instead of concrete implementations.
Step 3: Implement Variants
Create a new class for each variant that implements the abstraction. Existing variants remain untouched.
Step 4: Use a Factory or Registry
Provide a mechanism to select the right implementation at runtime — a factory method, a registry, dependency injection, or configuration.
Step 5: Verify Extensibility
Add a new variant by creating only a new class and registering it. No existing code should change. Run all tests.
Detection / Indicators
- Adding a new type requires editing a switch or if-else chain
- Multiple places in the codebase change for the same new feature
- Existing tests break when adding unrelated functionality
- Methods have boolean parameters that select between behaviors
- The same conditional pattern repeats across multiple methods
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.
- 3d ago First seen · 74 lines · 50 tokens per session scan A 3b28cedccaf6
solid-open-closed is a skill published in the GitHub repository helmedeiros/clean-code-skills (2 stars, last pushed 6mo ago), licensed MIT. It adds 50 tokens to every session and 697 once invoked, about $0.0003 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
offensive-vuln-classes
Exploit development curriculum covering core vulnerability classes with real-world CVE case studies: stack/heap buffer overflows, use-after-free, integer overflows, format strings, type confusion, and race conditions. Use when learning or teaching vuln classes, researching specific CVE patterns, or building exploit…
scientific-critical-thinking
Evaluate scientific claims and evidence quality. Use for assessing experimental design validity, identifying biases and confounders, applying evidence grading frameworks (GRADE, Cochrane Risk of Bias), or teaching critical analysis. Best for understanding evidence quality, identifying flaws. For formal peer review…
offensive-osint-methodology
Structured OSINT methodology framework: target definition, source selection, collection workflows, data correlation, timeline reconstruction, and reporting. Use to guide systematic OSINT campaigns or teach OSINT methodology.
practice-cognition
触发:当你提出了方案、假设或判断,需要通过实践验证、试错迭代或复盘升级认知时调用;常见信号包括 experiment、prototype、validate、iterate、feedback loop。 English: Trigger when an idea, hypothesis, or plan must be tested in practice and improved through iteration. Use this skill to move from action to understanding and back to action in a spiral learning loop.
offensive-exploit-dev-course
Full exploit development course roadmap and syllabus: weekly topics, recommended reading, lab setup, and learning path from vulnerability classes through advanced exploitation. Use to structure exploit dev training or onboard new researchers.
re0-loop
Run repeated build -> QA -> re0-memo -> re0-work cycles while preserving learning and letting code die. Use for long agentic projects where progress must be measured by quality-cleared templates, reusable modules, and eliminated anti-patterns rather than hours spent or features accumulated.