Getting it into your agent
It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.
git clone --depth 1 https://github.com/el-feo/ai-contextnpx agentmods add skills/el-feo/ai-context/design-patterns-rubyWrote 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/el-feo/ai-context/design-patterns-ruby)<a href="https://agentmods.dev/skills/el-feo/ai-context/design-patterns-ruby"><img src="https://agentmods.dev/badge/skills/el-feo/ai-context/design-patterns-ruby/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.
<a href="https://agentmods.dev/skills/el-feo/ai-context/design-patterns-ruby"><img src="https://agentmods.dev/badge/skills/el-feo/ai-context/design-patterns-ruby.svg" alt="Reviewed on agentmods" width="80" 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.00060 | $0.01872 |
| Opus 5.5 | $0.00024 | $0.00749 |
| Sonnet 5.5 | $0.00012 | $0.00374 |
| Haiku 4.5 | $0.00006 | $0.00187 |
Grade A, and why
design-patterns-ruby 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 3mo 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 — 317 lines — stays where its author put it; the contents beside it link to each section on GitHub.
<quick_start> <pattern_selection> Object Creation Problems → Creational Patterns
- Decouple creation from usage → Factory Method
- Families of related objects → Abstract Factory
- Complex objects with many params → Builder
- Clone without concrete class dependency → Prototype
- Single shared instance → Singleton
Structural Problems → Structural Patterns
- Incompatible interfaces → Adapter
- Multiple independent dimensions → Bridge
- Tree structures treated uniformly → Composite
- Add behavior dynamically → Decorator
- Simplify complex subsystems → Facade
- Memory with many similar objects → Flyweight
- Access control/logging/caching → Proxy
Behavioral Problems → Behavioral Patterns
- Multiple handlers in sequence → Chain of Responsibility
- Decouple UI from business logic → Command
- Traverse without exposing internals → Iterator
- Reduce chaotic dependencies → Mediator
- Undo/restore functionality → Memento
- Notify about state changes → Observer
- Behavior varies by state → State
- Switch algorithms at runtime → Strategy
- Algorithm skeleton with custom steps → Template Method
- Operations on complex structures → Visitor </pattern_selection>
<ruby_abstract_method> Ruby doesn't have built-in abstract methods. Use:
def abstract_method
raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}'"
end
</ruby_abstract_method> </quick_start>
<when_to_use> Use this skill when encountering:
- "How do I create objects without specifying exact classes?" → Factory Method/Abstract Factory
- "Constructor has too many parameters" → Builder
- "Need to copy objects without knowing their concrete type" → Prototype
- "Ensure only one instance exists" → Singleton
- "Legacy class interface doesn't match what I need" → Adapter
- "Class explosion from combining multiple features" → Bridge
- "Work with tree/hierarchy uniformly" → Composite
- "Add features without modifying class" → Decorator
- "Simplify interaction with complex library" → Facade
- "Too many similar objects consuming memory" → Flyweight
- "Control access/add logging to object" → Proxy
- "Request goes through chain of handlers" → Chain of Responsibility
- "Need undo/redo or queue operations" → Command
- "Custom iteration over collection" → Iterator
- "Components too tightly coupled" → Mediator
- "Save and restore object state" → Memento
- "Notify multiple objects of changes" → Observer
- "Object behavior depends on state" → State
- "Swap algorithms at runtime" → Strategy
- "Subclasses customize algorithm steps" → Template Method
- "Add operations to class hierarchy" → Visitor </when_to_use>
<pattern_quick_reference> Factory Method - Define interface for creation, let subclasses decide type
class Creator
def factory_method
raise NotImplementedError
end
def operation
product = factory_method
"Working with #{product.operation}"
end
end
class ConcreteCreator < Creator
def factory_method
ConcreteProduct.new
end
end
File: Ruby/src/factory_method/conceptual/main.rb
Singleton (thread-safe)
class Singleton
@instance_mutex = Mutex.new
private_class_method :new
def self.instance
return @instance if @instance
@instance_mutex.synchronize { @instance ||= new }
@instance
end
end
File: Ruby/src/singleton/conceptual/thread_safe/main.rb
See references/creational-patterns.md for Abstract Factory, Builder, Prototype.
def operation @component.operation end end
class ConcreteDecorator < Decorator def operation "Decorated(#{@component.operation})" end end
Stack decorators
decorated = DecoratorB.new(DecoratorA.new(ConcreteComponent.new))
File: `Ruby/src/decorator/conceptual/main.rb`
What ships with it
3 files 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.
- 3mo ago First seen · 317 lines · 60 tokens per session scan A 8fde6c0272ba
design-patterns-ruby is a skill published in the GitHub repository el-feo/ai-context (12 stars, last pushed 10d ago), licensed MIT. It adds 60 tokens to every session and 1,872 once invoked, about $0.0002 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-08-30.
design-patterns-ruby compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| design-patterns-rubyel-feo/ai-context | Skill | 12 | 10d ago | MIT | A | 60 | Claude Code |
| newclacky-ai/openclacky | Skill | 1.2k | yesterday | MIT | A | 10 | Claude Code |
| dhh-rails-styledavekilleen/Dex | Skill | 522 | yesterday | MIT | A | 115 | Claude Code |
| rspec-conventionsrootstrap/rails_api_base | Skill | 635 | 18d ago | MIT | A | 82 | Claude Code |
| ruby-patternssoftspark/ai-toolkit | Skill | 180 | 13d ago | Apache-2.0 | A | 60 | Claude Code |
| rigor-rbs-contractrigortype/rigor | Skill | 108 | yesterday | MPL-2.0 | A | 95 | Claude Code, Codex |
| rails-devtech-leads-club/agent-skills | Skill | 7.2k | 4d ago | none | A | 199 | Claude Code, Codex |