solid-open-closed

solid-open-closed is a skill for Claude Code, Codex from helmedeiros/clean-code-skills. It costs 50 tokens per session (697 once invoked), scanned A, original, MIT.

A design guide for the open-closed principle: add new behavior by adding new code while leaving working code unchanged. This is a way to make software easier to extend.

In plain words
What is it for?
Use it to design extensible modules, plugin-like systems, and features such as new payment types without repeatedly editing the same core code.
Why use it?
It reduces the risk of breaking existing behavior when new requirements arrive, especially in growing conditional logic.

Skill for Claude CodeCodex

Part of the clean-code-skills plugin — 21 skills, 2 commands shipped together

Install

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.

agentmods
npx agentmods add skills/helmedeiros/clean-code-skills/solid-open-closed
Any agent
npx skills add helmedeiros/clean-code-skills --skill solid-open-closed
Clone the repo
git clone --depth 1 https://github.com/helmedeiros/clean-code-skills

Made for: Claude Code, Codex.

Or install clean-code-skills, the plugin that ships this one along with the rest of its 21 skills, 2 commands.

Wrote 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.

agentmods badge for solid-open-closed

README.md
[![agentmods](https://agentmods.dev/badge/skills/helmedeiros/clean-code-skills/solid-open-closed.svg)](https://agentmods.dev/skills/helmedeiros/clean-code-skills/solid-open-closed)
Your own site
<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>
Per session 50 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 697 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce 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

Measured 3d ago against content hash 3b28cedccaf6, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

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.

skills/solid-open-closed/SKILL.md · 74 lines

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

Read the full file on GitHub · 74 lines

Files

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.

Changes

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.

  1. 3d ago First seen · 74 lines · 50 tokens per session scan A 3b28cedccaf6

Subscribe to this mod's changes

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.

Related

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…

SnailSploit/Claude-Red · 0 tokens

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…

K-Dense-AI/claude-scientific-writer · 63 tokens

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.

SnailSploit/Claude-Red · 0 tokens

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.

HughYau/qiushi-skill · 92 tokens

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.

SnailSploit/Claude-Red · 0 tokens

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.

LilMGenius/paperthin · 60 tokens