Token导航 LogoToken导航

Agent Skill · 运维和基础设施

design-patterns(设计模式)

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

design-patterns 是运维和基础设施类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为需要联网;许可证为 MIT,第三方扫描已通过,按安装量在运维和基础设施类的 2,449 个 Skill 里排第 905。

总安装 1,257周安装 54GitHub Stars 35下载 441核验 2026-05-01

安装说明

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

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/ratacat/claude-skills --skill design-patterns

这个 Skill 是做什么的

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

用于辅助界面设计、视觉规范和交互体验优化。适合让 Agent 整理页面结构、生成 UI 方案或检查视觉一致性。使用时需结合品牌和设计系统,避免堆砌装饰元素;改动应通过预览验证。

安装命令:npx skills add https://github.com/ratacat/claude-skills --skill design-patterns 适用于 Codex、Claude、Cursor、Gemini CLI,建议先确认设计系统边界。

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

上手步骤

4 步
  1. 1

    确认自己的宿主工具

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

  2. 2

    拿到安装命令

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

  3. 3

    安装后重启宿主

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

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

design-patterns 怎么安装?

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

design-patterns 支持哪些 AI 工具?

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

design-patterns 需要什么权限?

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

design-patterns 是免费的吗?

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

design-patterns 用的人多吗?

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

design-patterns 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

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

值得选的地方

  • 同时适配 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

设计模式 · 本页

1,25735需要联网MIT通过

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

SKILL.md 原文

Design Patterns

Overview

Design patterns are proven solutions to recurring software design problems. They provide a shared vocabulary for discussing design and capture collective wisdom refined through decades of real-world use.

Core Philosophy: Patterns are templates you adapt to your context, not blueprints to copy. Use the right pattern when it genuinely simplifies your design—not to impress or over-engineer.

Foundational Principles

These principles underpin all good design:

PrincipleMeaningViolation Symptom
Encapsulate What VariesIsolate changing parts from stable partsChanges ripple through codebase
Program to InterfacesDepend on abstractions, not concretionsCan't swap implementations
Composition Over InheritanceBuild behavior by composing objectsDeep rigid class hierarchies
Loose CouplingMinimize interdependency between objectsCan't change one thing without breaking another
Open-ClosedOpen for extension, closed for modificationMust edit existing code for new features
Single ResponsibilityOne reason to change per classClasses doing too many things
Dependency InversionHigh-level modules don't depend on low-levelBusiness logic coupled to infrastructure

Pattern Selection Guide

By Problem Type

CREATING OBJECTS
├── Complex/conditional creation ──────────→ Factory Method
├── Families of related objects ───────────→ Abstract Factory
├── Step-by-step construction ─────────────→ Builder
├── Clone existing objects ────────────────→ Prototype
└── Single instance needed ────────────────→ Singleton (use sparingly!)

STRUCTURING/COMPOSING OBJECTS
├── Incompatible interface ────────────────→ Adapter
├── Simplify complex subsystem ────────────→ Facade
├── Tree/hierarchy structure ──────────────→ Composite
├── Add behavior dynamically ──────────────→ Decorator
└── Control access to object ──────────────→ Proxy

MANAGING COMMUNICATION/BEHAVIOR
├── One-to-many notification ──────────────→ Observer
├── Encapsulate requests as objects ───────→ Command
├── Behavior varies by internal state ─────→ State
├── Swap algorithms at runtime ────────────→ Strategy
├── Algorithm skeleton with hooks ─────────→ Template Method
├── Reduce N-to-N communication ───────────→ Mediator
└── Sequential handlers ───────────────────→ Chain of Responsibility

MANAGING DATA ACCESS
├── Abstract data source ──────────────────→ Repository
├── Track changes for atomic commit ───────→ Unit of Work
├── Ensure object identity ────────────────→ Identity Map
├── Defer expensive loading ───────────────→ Lazy Load
├── Map objects to database ───────────────→ Data Mapper
└── Shape data for transfer ───────────────→ DTO

By Symptom

SymptomConsider
Giant switch/if-else on typeStrategy, State, or polymorphism
Duplicate code across classesTemplate Method, Strategy
Need to notify many objects of changesObserver
Complex object creation logicFactory, Builder
Adding features bloats classDecorator
Third-party API doesn't fit your codeAdapter
Too many dependencies between componentsMediator, Facade
Can't test without database/networkRepository, Dependency Injection
Need undo/redoCommand
Object behavior depends on stateState
Request needs processing by multiple handlersChain of Responsibility

Domain Logic: Transaction Script vs Domain Model

FactorTransaction ScriptDomain Model
Logic complexitySimple (< 500 lines)Complex, many rules
Business rulesFew, straightforwardMany, interacting
OperationsCRUD-heavyRich behavior
Team/timelineSmall team, quick deliveryLong-term maintenance
TestingIntegration testsUnit tests on domain

Rule of thumb: Start with Transaction Script. Refactor to Domain Model when procedural code becomes hard to maintain.

Quick Reference

Tier 1: Essential Patterns (Master First)

PatternOne-LineWhen to UseReference
StrategyEncapsulate interchangeable algorithmsMultiple ways to do something, swap at runtimestrategy.md
ObserverNotify dependents of state changesEvent systems, reactive updatesobserver.md
FactoryEncapsulate object creationComplex/conditional instantiationfactory.md
DecoratorAdd behavior dynamicallyExtend without inheritancedecorator.md
CommandEncapsulate requests as objectsUndo/redo, queuing, loggingcommand.md

Tier 2: Structural Patterns

PatternOne-LineWhen to UseReference
AdapterConvert interfacesIntegrate incompatible codeadapter.md
FacadeSimplify complex subsystemsHide complexity behind simple APIfacade.md
CompositeUniform tree structuresPart-whole hierarchiescomposite.md
ProxyControl access to objectsLazy load, access control, cachingproxy.md

Tier 3: Enterprise/Architectural Patterns

PatternOne-LineWhen to UseReference
RepositoryCollection-like data accessDecouple domain from data layerrepository.md
Unit of WorkCoordinate atomic changesTransaction managementunit-of-work.md
Service LayerOrchestrate business operationsDefine application boundaryservice-layer.md
DTOShape data for transferAPI contracts, prevent over-exposuredto.md

Additional Important Patterns

PatternOne-LineWhen to UseReference
BuilderStep-by-step object constructionComplex objects, fluent APIsbuilder.md
StateBehavior changes with stateState machines, workflowstate.md
Template MethodAlgorithm skeleton with hooksFramework extension pointstemplate-method.md
Chain of ResponsibilityPass request along handlersMiddleware, pipelineschain-of-responsibility.md
MediatorCentralize complex communicationReduce component couplingmediator.md
Lazy LoadDefer expensive loadingPerformance, large object graphslazy-load.md
Identity MapEnsure object identityORM, prevent duplicatesidentity-map.md

Common Mistakes

MistakeSymptomFix
Pattern OveruseSimple operations require navigating many classesOnly use when solving real problem
Wrong PatternCode feels forced, awkwardRe-examine actual problem
Inheritance AbuseDeep hierarchies, fragile base classFavor composition (Strategy, Decorator)
Singleton AbuseGlobal state, hidden dependencies, hard to testUse dependency injection instead
Premature AbstractionInterfaces with single implementationWait for real need to vary

Anti-Patterns to Recognize

  • God Object: One class does everything → Split using SRP
  • Anemic Domain Model: Objects are just data bags → Move behavior to objects
  • Golden Hammer: Same pattern everywhere → Match pattern to problem
  • Lava Flow: Dead code nobody removes → Delete it, VCS has your back

Modern Variations

Modern PatternBased OnDescription
Dependency InjectionStrategy + FactoryContainer creates and injects dependencies
MiddlewareDecorator + Chain of ResponsibilityRequest/response pipeline
Event SourcingCommandStore state changes as events
CQRSCommand/Query separationSeparate read/write models
Hooks (React/Vue)Observer + StrategyFunctional lifecycle subscriptions

Implementation Checklist

Before implementing a pattern:

  • Pattern solves a real problem in this codebase
  • Considered simpler alternatives
  • Trade-offs acceptable for this context
  • Team understands the pattern
  • Won't over-engineer the solution

平台分布

Claude Code

29.87%
按下载量换算132

Antigravity

23.7%
按下载量换算105

Codex

20.11%
按下载量换算89

OpenCode

12.71%
按下载量换算56

Gemini CLI

8.12%
按下载量换算36

windsurf

3.36%
按下载量换算15

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

继续浏览同类 Skills