@tank/design-patterns

Recommends JavaScript/TypeScript design patterns for given software problems with TypeScript implementation guidance.

1|1|Updated Feb 20, 2026
One-click install
npx skills add https://github.com/tankpkg/packages --skill tank-design-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: @tank/design-patterns
Source: https://github.com/tankpkg/packages/tree/main/skills/design-patterns
Command: npx skills add https://github.com/tankpkg/packages --skill tank-design-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you choose and apply the right JavaScript or TypeScript design pattern for a real software problem, so you can avoid overengineering, reduce coupling, and structure code more clearly.

Core Features & Use Cases

  • Pattern Selection Guidance: Compare creational, structural, behavioral, and modern JS/TS patterns to find the best fit for a given problem.
  • Implementation Reference: Get practical TypeScript examples for patterns such as Factory, Strategy, Observer, Decorator, Repository, Middleware, and Plugin systems.
  • Anti-Pattern Checks: Recognize when a pattern is unnecessary or harmful, such as using Singleton for dependency sharing or Builder for trivial objects.
  • Use Case: A developer designing an extensible API service can use this Skill to decide whether to model request handling as middleware, a command pipeline, or a repository-backed architecture.

Quick Start

Ask for the best JavaScript or TypeScript design pattern for your problem and request a production-ready example with guidance on when to use it and when to avoid it.

Frequently Asked Questions about @tank/design-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What is the best JavaScript design pattern for handling extensible API request processing?

For extensible API request processing, the middleware pattern is often the best JavaScript design pattern, allowing you to chain handlers flexibly. Alternatively, a command pipeline or repository-backed architecture might suit your needs depending on coupling and data access requirements.

How do I choose the right TypeScript design pattern for object creation?

To choose the right TypeScript design pattern for object creation, compare creational patterns like Factory against your object complexity. Use Factory for variable object types, but avoid the Builder pattern for trivial objects to prevent overengineering.

When should I not use the Singleton pattern for dependency sharing in TypeScript?

You should not use the Singleton pattern for dependency sharing in TypeScript when it creates hidden coupling and complicates testing. Recognizing this as an anti-pattern helps reduce coupling and structure code more clearly without unnecessary global state.

How do I implement the Observer pattern in TypeScript with real-world examples?

To implement the Observer pattern in TypeScript, define a notification interface for subscribers and let subjects broadcast changes. This Skill provides practical TypeScript examples and real-world implementation guidance for behavioral coordination scenarios like this.

Middleware vs Repository pattern in JS: which structural composition fits my architecture?

Choosing between middleware and repository patterns in JS depends on your architecture: middleware handles sequential request transformations, while the repository pattern abstracts data persistence. Compare structural and modern JS/TS patterns to find the best fit.