# Apply SOLID Principles to TypeScript Code

Teams often know SOLID terms but struggle to apply them in TypeScript. This skill provides practical refactoring patterns, examples, and review prompts.

## Install

```bash
npx skillstore add doubleslashse/solid-principles
```

## Metadata

- Status: approved
- Slug: doubleslashse-solid-principles
- Skillstore revision: r1
- Version status: missing
- Tree hash: eb9eafd96d702fc28734b9c0f7d61f66053f7d40e85fa82538c5892bf4a43e4c
- Author: DoubleslashSE
- GitHub username: DoubleslashSE
- License: MIT
- Repository: https://github.com/DoubleslashSE/claude-workflows/tree/main/Plugins/dotnet-tdd/skills/solid-principles
- Ref: 72d5025b022c77f7a51bdf5c1637c689c80e89d1
- 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/doubleslashse-solid-principles
- Manifest: https://skillstore.pages.dev/api/skills/doubleslashse-solid-principles/manifest

## Capabilities

- Explains each SOLID principle for Node.js and TypeScript projects.
- Shows before-and-after refactoring examples for service design.
- Demonstrates factory functions, abstractions, and dependency injection.
- Uses typed Result patterns for validation and error handling examples.
- Shows how focused interfaces improve testing and implementation swapping.
- Includes practical order-service examples with repositories, payment, and notification boundaries.

## Use Cases

- Refactor Service Classes: Break large TypeScript services into validation, persistence, payment, and notification responsibilities.
- Review Architecture Changes: Check new modules for SOLID violations before merging feature work.
- Teach Practical Design: Use concrete TypeScript examples to explain SOLID tradeoffs during mentoring or onboarding.

## Prompt Templates

### Explain a Principle

```
Explain the Single Responsibility Principle for a TypeScript service. Use one small before-and-after example and list one testability benefit.
```

### Review a Module

```
Review this TypeScript module for SOLID violations. Focus on responsibility boundaries, abstractions, and dependencies. Suggest a minimal refactor plan.
```

### Refactor Toward SOLID

```
Refactor this order workflow toward SOLID design. Separate validation, persistence, payment, and notification concerns. Keep behavior unchanged.
```

### Design Extensible Architecture

```
Design a TypeScript architecture for this feature using SOLID principles. Define interfaces, dependency injection points, tests, and extension paths.
```

## Limitations

- The skill is documentation-only and does not run code or tests.
- Examples focus on TypeScript and Node.js rather than every language.
- The sample code is illustrative and may need project-specific adaptation.
- It does not replace architecture review for complex production systems.

## Best Practices

- Start with the smallest responsibility split that improves readability or testing.
- Use interfaces or function types where a dependency may change or needs a test double.
- Keep refactors behavior-preserving before adding new features or abstractions.

## Anti Patterns

- Do not create abstractions only to satisfy a principle label.
- Do not hide business rules behind generic names or unclear factories.
- Do not combine validation, persistence, integration calls, and notification in one workflow function.

## Security Audit

- Audited at: 2026-07-06T11:30:28.646\+00:00
- Summary: All 33 static findings were adjudicated as false positives after reviewing SKILL.md and examples.md. The medium findings are Markdown code fences or TypeScript template literals, and the low findings are ordinary sample validation, lookup, result, or test lines. No prompt injection, data exfiltration, command execution, or malicious semantic behavior was found.

## Stats

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