Token导航 LogoToken导航

Agent Skill · 运维和基础设施

design-patterns-ruby(设计模式 Ruby)

用于辅助界面设计、视觉规范、排版、配色、布局和交互体验优化。它适合让 Agent 根据产品场景整理页面结构、生成 UI 方案、检查视觉一致性或改进组件层级。使用时需要结合现有品牌、设计系统和用户任务,不应只堆装饰元素;涉及真实页面改动时,应通过截图或浏览器预览检查文本溢出、对齐和响应式表现。

design-patterns-ruby 是运维和基础设施类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为只读;许可证为 MIT,第三方扫描有提醒项,按安装量在运维和基础设施类的 2,449 个 Skill 里排第 1,292。

总安装 685周安装 28GitHub Stars 8下载 222核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
MIT

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:design-patterns-ruby(设计模式 Ruby)
来源仓库:https://github.com/el-feo/ai-context
仓库路径:skills/design-patterns-ruby
安装命令:
npx skills add https://github.com/el-feo/ai-context --skill design-patterns-ruby
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/el-feo/ai-context --skill design-patterns-ruby

这个 Skill 是做什么的

运维和基础设施类 Skill 处理部署、监控、日志和云资源,多数需要较高的执行权限。

提供 Ruby 语言中常用设计模式的分类与使用指导,涵盖创建型、结构型和行为型模式。适合 Ruby 开发者查找模式匹配问题,如对象创建、接口适配和访问控制等场景。使用时可指定文件或模式名称,Agent 将按问题类型推荐对应解决方案。

安装需通过 npx 添加指定 GitHub 仓库,适用于 Codex、Claude 等宿主环境。design-patterns-ruby 属于运维和基础设施类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/design-patterns-ruby

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/el-feo/ai-context --skill design-patterns-ruby;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它标注为只读,先用只读任务试一次,确认行为符合预期再扩大使用范围。

常见问题

6 条

design-patterns-ruby 怎么安装?

在终端执行 npx skills add https://github.com/el-feo/ai-context --skill design-patterns-ruby。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

design-patterns-ruby 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

design-patterns-ruby 需要什么权限?

权限级别是只读。该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

design-patterns-ruby 是免费的吗?

来源标注的许可证是 MIT。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

design-patterns-ruby 用的人多吗?

公开数据是累计安装 685 次,近一周安装 28 次,下载 222 次,GitHub 8 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

design-patterns-ruby 安全吗?

第三方扫描有提醒项,说明存在需要人工确认的行为。安装前请打开源码看清它读了什么、联网到哪里。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 3 个目录同时收录,说明这个 Skill 流传比较广。
  • 许可证明确为 MIT,商用和分发边界好判断。
  • 标注为只读权限,试用阶段不容易误改本地文件。

先想清楚的地方

  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理运维和基础设施类任务、又不想每次都手写提示词的人。
  • 只想先试试效果、不希望它改动本地文件的人。

不太适合

  • 需要厂商级技术支持和 SLA 的生产系统。

运维和基础设施类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
brainstorming

头脑风暴 · Codex、Claude

3,148,776173,131操作浏览器MIT通过
copywriting

文案写作 · Codex、Claude

1,996,72425,583需要联网MIT通过
openclaw-secure-linux-cloud

OpenClaw secure linux cloud 命令行 · Codex、Claude

1,853,08840接触敏感数据未明确未通过
xget

xget 命令行 · Codex、Claude

1,799,28040执行命令未明确未通过
requesting-code-review

代码审查请求 · Codex、Claude

1,590,144173,103权限未标注MIT通过
design-patterns-ruby

设计模式 Ruby · 本页

6858只读MIT有提醒

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

<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`

**Adapter** - Convert interface to expected format

class Adapter < Target def initialize(adaptee) @adaptee = adaptee end

def request "Adapted: #{@adaptee.specific_request}" end end


File: `Ruby/src/adapter/conceptual/main.rb`

See [references/structural-patterns.md](https://github.com/el-feo/ai-context/blob/HEAD/plugins/ruby-rails/skills/design-patterns-ruby/references/structural-patterns.md) for Bridge, Composite, Facade, Flyweight, Proxy.

def initialize(strategy) @strategy = strategy end

def execute @strategy.do_algorithm(data) end end

# Switch strategy at runtime

context = Context.new(StrategyA.new) context.strategy = StrategyB.new

File: Ruby/src/strategy/conceptual/main.rb

Observer - Notify subscribers of state changes

class Subject
  def initialize
    @observers = []
  end

  def attach(observer)
    @observers << observer
  end

  def detach(observer)
    @observers.delete(observer)
  end

  def notify
    @observers.each { |observer| observer.update(self) }
  end
end

File: Ruby/src/observer/conceptual/main.rb

State - Object behavior changes based on internal state

class Context
  attr_accessor :state

  def transition_to(state)
    @state = state
    @state.context = self
  end

  def request
    @state.handle
  end
end

File: Ruby/src/state/conceptual/main.rb

See references/behavioral-patterns.md for Chain of Responsibility, Command, Iterator, Mediator, Memento, Template Method, Visitor. </pattern_quick_reference>

<ruby_idioms> <deep_copy> For Prototype pattern, use Marshal for deep copying:

Marshal.load(Marshal.dump(object))

</deep_copy>

<thread_safety> For Singleton and shared resources, use Mutex:

@mutex = Mutex.new
@mutex.synchronize { @instance ||= new }

</thread_safety>

<private_constructor> For Singleton pattern:

private_class_method :new

</private_constructor>

<type_docs> Use YARD-style documentation:

# @param [String] value
# @return [Boolean]
def method(value)
end

</type_docs> </ruby_idioms>

<running_examples>

ruby Ruby/src/<pattern>/conceptual/main.rb

# Examples:
ruby Ruby/src/singleton/conceptual/thread_safe/main.rb
ruby Ruby/src/observer/conceptual/main.rb
ruby Ruby/src/strategy/conceptual/main.rb
ruby Ruby/src/decorator/conceptual/main.rb

Requires Ruby 3.2+. </running_examples>

<detailed_references>

<success_criteria>

  • Pattern correctly solves the identified design problem
  • Ruby idioms used appropriately (NotImplementedError, Marshal, Mutex)
  • Code follows Ruby conventions (snake_case, attr_* accessors)
  • Example runs without errors via ruby Ruby/src/<pattern>/conceptual/main.rb </success_criteria>

平台分布

Claude Code

28.9%
按下载量换算64

Gemini CLI

25.48%
按下载量换算57

Antigravity

19.02%
按下载量换算42

windsurf

13.77%
按下载量换算31

github-copilot

7.69%
按下载量换算17

Codex

3.13%
按下载量换算7

安全审计

Gen Agent Trust Hub

可疑

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。

继续浏览同类 Skills