# Apply Proven TypeScript Code Patterns

Choosing a suitable implementation pattern can slow design and code review. This skill provides concise TypeScript references for common object, error, async, and data patterns.

## Install

```bash
npx skillstore add benny9193/code-patterns
```

## Metadata

- Status: approved
- Slug: benny9193-code-patterns
- Skillstore revision: r2
- Version status: missing
- Tree hash: a804e2d3d6eccb6d172a263c01165ad5656d15e62c4fcdf0f5e804105df4e586
- Author: Benny9193
- GitHub username: Benny9193
- License: MIT
- Repository: https://github.com/Benny9193/devflow/tree/master/skills/code-patterns
- Ref: 8c3e20bba512c392d9b02ee748b18e0b09d4982c
- Supported tools: Claude, Codex, Claude Code
- Audit status: complete
- Agent install advisory: allowed
- Manual install advisory: allowed
- Artifact signature: available
- Audit attestation: unavailable
- Human verification: not\_verified
- Risk factors: external\_commands
- Quality score: 78
- Quality tier: bronze
- Public page: https://skillstore.pages.dev/skills/benny9193-code-patterns
- Manifest: https://skillstore.pages.dev/api/skills/benny9193-code-patterns/manifest

## Capabilities

- Explains when to use 13 common creational, structural, behavioral, error, asynchronous, and data-access patterns.
- Provides concise TypeScript examples for Factory, Builder, Singleton, Adapter, Decorator, Strategy, and Observer.
- Shows Result, retry with backoff, Promise Queue, and debounce techniques.
- Demonstrates Repository and Unit of Work structures for data access and transactions.
- Maps common software design problems to suggested patterns in a quick-reference table.

## Use Cases

- Select an implementation pattern: Compare patterns for a feature and choose one that matches its object creation, behavior, or data needs.
- Review architecture decisions: Check whether a proposed pattern improves boundaries and maintainability without adding unnecessary complexity.
- Learn patterns through examples: Study compact TypeScript examples and connect each pattern to the problem it addresses.

## Prompt Templates

### Choose a pattern

```
Explain which pattern from this reference fits [problem]. Compare it with one alternative and provide a small TypeScript example.
```

### Refactor an implementation

```
Refactor this TypeScript class using [pattern]. Preserve behavior, identify tradeoffs, and note project-specific assumptions: [paste code].
```

### Review pattern usage

```
Review this design for pattern misuse: [design]. Recommend only changes that reduce complexity, then outline focused tests.
```

### Design a coordinated workflow

```
Design [workflow] using patterns from this reference. Explain boundaries, failure handling, concurrency, transactions, and reasons for rejecting alternatives.
```

## Limitations

- Examples are simplified and may require project-specific types, validation, and error handling.
- The reference does not inspect a codebase or automatically verify an implementation.
- Examples use TypeScript, although many concepts apply to other languages.
- The skill does not provide tests, benchmarks, dependencies, or production security guidance.

## Best Practices

- Start with the problem and select a pattern only when it clarifies responsibilities or behavior.
- Adapt each example to project types, failure modes, validation rules, and testing conventions.
- Document the chosen pattern, its tradeoffs, and the simpler alternatives considered.

## Anti Patterns

- Do not apply patterns only to make straightforward code appear more sophisticated.
- Do not copy simplified examples into production without tests and domain-specific safeguards.
- Do not use Singleton for ordinary dependency management or uncontrolled global state.

## Security Audit

- Audited at: 2026-07-23T11:20:58.956\+00:00
- Summary: All 38 static findings are false positives caused by Markdown fences, TypeScript template literals, generic database APIs, and benign text. SKILL.md contains no executable scripts, shell invocation, system reconnaissance, sensitive database files, or prompt injection. No remediation is required.

## Stats

- Views: 204
- Downloads: 8
- Favorites: 0
- Popularity score: 0
