Token导航 LogoToken导航TokenDH.com
前端设计只读github未标认证来源可访问许可证需确认审计通过

design-patterns设计模式

Agent Skill

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

总安装

235

周安装

10

GitHub Stars

2

下载量

82
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/pluginagentmarketplace/custom-plugin-software-design --skill design-patterns

简介

用于辅助软件架构设计与模式应用参考。

  • 适合梳理 Observer、Factory 等模式适用场景。
  • 需结合具体语言特性实现解耦方案。design-patterns 属于前端设计类 Skill,可作为该场景下的辅助能力补充。
  • 避免为用模式而增加不必要的抽象层。
  • 安装后建议用 UML 图验证类关系合理性。

SKILL.md

Design Patterns Skill

Atomic skill for design pattern identification and implementation

Skill Definition

skill_id: design-patterns
responsibility: Single - Pattern identification, implementation, teaching
atomic: true
idempotent: true

Parameter Schema

interface SkillParams {
  // Required
  action: 'identify' | 'implement' | 'detect_antipattern' | 'teach';

  // Conditional
  problem_description?: string;    // Required for 'identify'
  pattern_name?: string;           // Required for 'implement', 'teach'
  code?: string;                   // Required for 'detect_antipattern'
  language?: string;               // Required for 'implement'

  // Optional
  category?: 'creational' | 'structural' | 'behavioral';
  include_uml?: boolean;
}

interface SkillResult {
  patterns?: PatternMatch[];       // For identify
  implementation?: string;         // For implement
  antipatterns?: AntipatternReport[]; // For detect
  explanation?: PatternExplanation;   // For teach
}

Validation Rules

input_validation:
  action:
    required: true
    enum: [identify, implement, detect_antipattern, teach]

  problem_description:
    required_when: action == 'identify'
    min_length: 20

  pattern_name:
    required_when: action in ['implement', 'teach']
    valid_patterns: [singleton, factory, builder, adapter, decorator, observer, strategy, command, ...]

  language:
    required_when: action == 'implement'
    allowed: [typescript, javascript, python, java, csharp, go, ruby, kotlin]

Retry Logic

retry_config:
  max_attempts: 3
  backoff:
    type: exponential
    initial_delay_ms: 1000
    max_delay_ms: 8000
    multiplier: 2

  retryable_errors:
    - TIMEOUT
    - RATE_LIMIT

  non_retryable_errors:
    - INVALID_PATTERN
    - UNSUPPORTED_LANGUAGE

Logging & Observability

logging:
  level: INFO
  events:
    - pattern_identification_started
    - pattern_matched
    - implementation_generated
    - antipattern_detected
    - teaching_session_started

metrics:
  - name: pattern_match_confidence
    type: gauge
  - name: patterns_identified_count
    type: counter
  - name: implementation_generation_time_ms
    type: histogram

tracing:
  span_name: design_patterns_skill
  attributes:
    - action
    - pattern_name
    - language

Pattern Catalog

Creational Patterns

singleton:
  intent: Ensure single instance with global access
  indicators:
    - Global state requirement
    - Resource pooling
    - Configuration management
  implementation_variants:
    - eager
    - lazy
    - thread_safe

factory_method:
  intent: Delegate object creation to subclasses
  indicators:
    - Multiple product types
    - Creation logic varies by context
  implementation_variants:
    - simple_factory
    - factory_method
    - abstract_factory

builder:
  intent: Construct complex objects step by step
  indicators:
    - Many constructor parameters
    - Optional parameters
    - Immutable objects with variations

Structural Patterns

adapter:
  intent: Make incompatible interfaces compatible
  indicators:
    - Legacy system integration
    - Third-party library wrapping
  implementation_variants:
    - class_adapter
    - object_adapter

decorator:
  intent: Add behavior dynamically
  indicators:
    - Feature combinations
    - Subclass explosion risk
  implementation_variants:
    - inheritance_based
    - composition_based

facade:
  intent: Simplified interface to complex subsystem
  indicators:
    - Multiple subsystem interactions
    - Complex initialization sequences

Behavioral Patterns

observer:
  intent: One-to-many dependency notification
  indicators:
    - Event systems
    - State change propagation
  implementation_variants:
    - push_model
    - pull_model
    - reactive_streams

strategy:
  intent: Encapsulate interchangeable algorithms
  indicators:
    - Multiple algorithm variants
    - Runtime algorithm selection
  implementation_variants:
    - interface_based
    - function_based

command:
  intent: Encapsulate requests as objects
  indicators:
    - Undo/redo requirements
    - Request queuing
    - Macro recording

Usage Examples

Pattern Identification

// Input
{
  action: "identify",
  problem_description: "I need to create different types of documents (PDF, Word, HTML) and the creation logic is complex for each type"
}

// Output
{
  patterns: [
    {
      name: "Factory Method",
      fit_score: 0.92,
      rationale: "Multiple product types with varying creation logic",
      category: "creational"
    },
    {
      name: "Abstract Factory",
      fit_score: 0.78,
      rationale: "Could work if document families are needed",
      category: "creational"
    }
  ]
}

Pattern Implementation

// Input
{
  action: "implement",
  pattern_name: "observer",
  language: "typescript"
}

// Output
{
  implementation: `
    interface Observer<T> {
      update(data: T): void;
    }

    class Subject<T> {
      private observers: Observer<T>[] = [];

      subscribe(observer: Observer<T>): void {
        this.observers.push(observer);
      }

      unsubscribe(observer: Observer<T>): void {
        this.observers = this.observers.filter(o => o !== observer);
      }

      notify(data: T): void {
        this.observers.forEach(o => o.update(data));
      }
    }
  `
}

Unit Test Template

describe('DesignPatternsSkill', () => {
  describe('identify', () => {
    it('should recommend Factory for object creation scenarios', async () => {
      const result = await skill.execute({
        action: 'identify',
        problem_description: 'Need to create different payment processors based on payment type'
      });

      expect(result.patterns[0].name).toBe('Factory Method');
      expect(result.patterns[0].fit_score).toBeGreaterThan(0.8);
    });
  });

  describe('implement', () => {
    it('should generate valid TypeScript for Observer pattern', async () => {
      const result = await skill.execute({
        action: 'implement',
        pattern_name: 'observer',
        language: 'typescript'
      });

      expect(result.implementation).toContain('interface Observer');
      expect(result.implementation).toContain('subscribe');
      expect(result.implementation).toContain('notify');
    });
  });

  describe('detect_antipattern', () => {
    it('should detect God Object antipattern', async () => {
      const code = `class AppManager { /* 50 methods */ }`;

      const result = await skill.execute({
        action: 'detect_antipattern',
        code
      });

      expect(result.antipatterns).toContainEqual(
        expect.objectContaining({ name: 'God Object' })
      );
    });
  });
});

Error Handling

errors:
  INVALID_PATTERN:
    code: 400
    message: "Unknown pattern name"
    recovery: "Check pattern catalog for valid names"

  UNSUPPORTED_LANGUAGE:
    code: 400
    message: "Language not supported for implementation"
    recovery: "Use supported language or request teaching mode"

  INSUFFICIENT_CONTEXT:
    code: 400
    message: "Problem description too vague"
    recovery: "Provide more specific requirements"

Integration

requires:
  - code_generator
  - pattern_matcher

emits:
  - pattern_identified
  - pattern_implemented
  - antipattern_detected

consumed_by:
  - 02-design-patterns (bonded agent)
  - 01-design-principles (for pattern suggestions)
  - 04-refactoring (for antipattern fixes)

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

34.65%
按下载量换算28

Claude

29.11%
按下载量换算24

Cursor

19.5%
按下载量换算16

Gemini CLI

9.9%
按下载量换算8

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

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

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills