design-patterns-implementation

Apply appropriate design patterns (Singleton, Factory, Observer, Strategy, etc.) to solve architectural problems. Use when refactoring code architecture,…

INSTALLATION
npx skills add https://github.com/aj-geddes/useful-ai-prompts --skill design-patterns-implementation
Run in your project or agent environment. Adjust flags if your CLI version differs.

SKILL.md

Design Patterns Implementation

Table of Contents

  • [Overview](#overview)
  • [When to Use](#when-to-use)
  • [Quick Start](#quick-start)
  • [Reference Guides](#reference-guides)
  • [Best Practices](#best-practices)

Overview

Apply proven design patterns to create maintainable, extensible, and testable code architectures.

When to Use

  • Solving common architectural problems
  • Making code more maintainable and testable
  • Implementing extensible plugin systems
  • Decoupling components
  • Following SOLID principles
  • Code reviews identifying architectural issues

Quick Start

Minimal working example:

class DatabaseConnection {

  private static instance: DatabaseConnection;

  private connection: any;

  private constructor() {

    this.connection = this.createConnection();

  }

  public static getInstance(): DatabaseConnection {

    if (!DatabaseConnection.instance) {

      DatabaseConnection.instance = new DatabaseConnection();

    }

    return DatabaseConnection.instance;

  }

  private createConnection() {

    return {

      /* connection logic */

    };

  }

}

// Usage

const db1 = DatabaseConnection.getInstance();

const db2 = DatabaseConnection.getInstance();

// ... (see reference guides for full implementation)

Reference Guides

Detailed implementations in the references/ directory:

GuideContents
Singleton PatternSingleton Pattern
Factory PatternFactory Pattern
Observer PatternObserver Pattern
Strategy PatternStrategy Pattern
Decorator PatternDecorator Pattern
Repository PatternRepository Pattern
Dependency InjectionDependency Injection

Best Practices

✅ DO

  • Choose patterns that solve actual problems
  • Keep patterns simple and understandable
  • Document why patterns were chosen
  • Consider testability
  • Follow SOLID principles
  • Use dependency injection
  • Prefer composition over inheritance

❌ DON'T

  • Apply patterns without understanding them
  • Over-engineer simple solutions
  • Force patterns where they don't fit
  • Create unnecessary abstraction layers
  • Ignore team familiarity with patterns
BrowserAct

Let your agent run on any real-world website

Bypass CAPTCHA & anti-bot for free. Start local, scale to cloud.

Explore BrowserAct Skills →

Stop writing automation&scrapers

Install the CLI. Run your first Skill in 30 seconds. Scale when you're ready.

Start free
free · no credit card