design-patterns-skill

design-patterns-skill is a skill for Claude Code, Codex from darellchua2/opencode-config-template. It costs 32 tokens per session (689 once invoked), scanned A, original, Apache-2.0.

A guide to common object-oriented design patterns, such as Factory, Adapter, Strategy, and Observer, with practical examples. It helps decide when a pattern fits and when a simpler solution is better.

In plain words
What is it for?
Use it to recognize suitable patterns, refactor existing code, and extend behavior without unnecessary rewrites.
Why use it?
It reduces guesswork when code has repeated conditionals, complex object creation, or behavior that keeps expanding. It also helps avoid adding abstractions that make code harder to maintain.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions OpenCode.

Good fit Use it to recognize suitable patterns, refactor existing code, and extend behavior without unnecessary rewrites.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/darellchua2/opencode-config-template/design-patterns-skill
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.

Any agent
npx skills add darellchua2/opencode-config-template --skill design-patterns-skill
Clone the repo
git clone --depth 1 https://github.com/darellchua2/opencode-config-template

Made for: Claude Code, Codex.

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 design-patterns-skill

README.md
[![agentmods](https://agentmods.dev/badge/skills/darellchua2/opencode-config-template/design-patterns-skill/github.svg)](https://agentmods.dev/skills/darellchua2/opencode-config-template/design-patterns-skill)
Your own site
<a href="https://agentmods.dev/skills/darellchua2/opencode-config-template/design-patterns-skill"><img src="https://agentmods.dev/badge/skills/darellchua2/opencode-config-template/design-patterns-skill/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for design-patterns-skill

Your own site · 80×15
<a href="https://agentmods.dev/skills/darellchua2/opencode-config-template/design-patterns-skill"><img src="https://agentmods.dev/badge/skills/darellchua2/opencode-config-template/design-patterns-skill.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 32 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 689 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to medium

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • medium Data Exfiltration · line 249
    Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
    Fix: Verify the destination URL is trusted and necessary. Remove or replace with documented APIs. Ensure no secrets, tokens, or PII are transmitted.
How audits are shown
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.1 $0.00032 $0.00689
Opus 5.5 $0.00013 $0.00276
Sonnet 5.5 $0.00006 $0.00138
Haiku 4.5 $0.00003 $0.00069

Measured 2mo ago against content hash 5c9ff2effabc, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

design-patterns-skill 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 2mo 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/design-patterns-skill/SKILL.md · 38 lines

How it starts

The opening of the file, as written. The whole thing — 38 lines — stays where its author put it; the contents beside it link to each section on GitHub.

What I do

Apply design patterns where they fit — and refuse to force them. Patterns solve problems you HAVE, not problems you MIGHT have; let them emerge from refactoring, not upfront design.

When to use me

  • A design problem you recognize (repeated type-switching, behavior addable without modification, complex object construction)
  • You're tempted to add a pattern and want a second opinion on whether it's warranted

House Learnings

Learning: zai-client-class

Instead of per-endpoint adapters, wrap all API endpoints in a single client class handling key resolution, base URL config, and error mapping centrally (combined Adapter + Facade): one ZaiClient with _headers()/_request() internals and typed endpoint methods (search, summarize, analyze); missing ZAI_API_KEY raises at construction.

Learning: enum-strategy-resolution

Dispatch via str + Enum with a default member: one dispatch point, Open/Closed-compliant (new strategies need no dispatcher edit), callers pass raw strings or enum members interchangeably. Unknown values fall through to the UNKNOWN member's handler instead of raising.

Learning: atomic-sql-update-race-free-transition

Use a single UPDATE ... WHERE expected_state RETURNING cols as an optimistic lock — the WHERE guards the transition, RETURNING fetches columns in one round-trip, losers re-read and reconcile idempotently. Never read-then-write state transitions (two workers both commit, duplicate side effects). Detection: rg 'get_.*\(|fetch_.*\(' --type py -A 10 | rg 'status|state' | rg 'commit|save|update'

Learning: double-checked-locking-async-refresh

Async token/cache refresh must use double-checked locking (unlocked check → acquire lock → RE-CHECK → refresh only if still invalid) so exactly ONE caller hits the upstream provider per expiry window; hot path stays lock-free. Pair with time.monotonic() (NTP-immune) and proactive refresh at 80% of TTL. Detection: rg 'async with self\._lock|async with.*Lock' --type py -A 15 | rg 'await.*refresh|await.*fetch' | rg -v 'if.*stale|if.*expired'

Read the full file on GitHub · 38 lines

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. 2mo ago Changed · -835 lines 5c9ff2effabc
  2. 3mo ago First seen · 873 lines · 32 tokens per session scan A 94968fc1f697

Subscribe to this mod's changes

design-patterns-skill is a skill published in the GitHub repository darellchua2/opencode-config-template (6 stars, last pushed 2mo ago), licensed Apache-2.0. It adds 32 tokens to every session and 689 once invoked, about $0.0001 per session on Opus 5.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-09-03.

Related

design-patterns-skill compared with skills from other repositories

design-patterns-skill next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
design-patterns-skilldarellchua2/opencode-config-templateSkill62mo agoApache-2.0A32Claude Code, Codex
brooks-sweephyhmrright/brooks-lintSkill1.6kyesterdayMITA178Claude Code
driftdadbodgeoff/driftSkill7954d agoApache-2.0A84Claude Code
llm-friendly-contextshinpr/claude-code-workflowsSkill7254d agoMITA52Claude Code
laravel-owasp-securityAsyrafHussin/agent-skillsSkill116yesterdayMITA111Claude Code
laravel-audit-databaseMrPunyapal/laravel-auditorSkill85yesterdayMITA33Claude Code, Codex
megalinter-checkoxsecurity/megalinterSkill2.7ktodayAGPL-3.0A116Claude Code