# Apply SOLID Principles to Object-Oriented Code

Object-oriented code becomes difficult to test and extend when responsibilities and dependencies are unclear. This skill provides practical SOLID reviews, examples, and refactoring guidance.

## Install

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

## Metadata

- Status: approved
- Slug: benny9193-solid-principles
- Skillstore revision: r2
- Version status: missing
- Tree hash: a8a863bb233ad775a54ce9ae0c38fa5fb6b614616e18d1d3ec05b9e1cf0fa4a4
- Author: Benny9193
- GitHub username: Benny9193
- License: MIT
- Repository: https://github.com/Benny9193/devflow/tree/master/skills/solid-principles
- 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: 70
- Public page: https://skillstore.pages.dev/skills/benny9193-solid-principles
- Manifest: https://skillstore.pages.dev/api/skills/benny9193-solid-principles/manifest

## Capabilities

- Explains each SOLID principle with TypeScript examples.
- Identifies common design smells linked to individual principles.
- Compares problematic designs with more maintainable alternatives.
- Suggests focused interfaces, dependency injection, and composition.
- Provides a checklist for reviewing object-oriented designs.

## Use Cases

- Review a Feature Design: Map classes and interfaces to SOLID principles before implementation begins.
- Refactor Legacy Services: Find mixed responsibilities, rigid conditionals, and tightly coupled dependencies in existing services.
- Teach Design Principles: Use concise examples and review questions during mentoring or team workshops.

## Prompt Templates

### Explain One Principle

```
Explain the {principle} principle using a small example in {language}. Include one violation and one improved design.
```

### Review a Class

```
Review this {class description} for SOLID violations. Name each issue, explain its impact, and suggest focused changes.
```

### Plan a Refactor

```
Create an incremental SOLID refactoring plan for {component}. Preserve behavior, identify tests first, and explain each design tradeoff.
```

### Evaluate an Architecture

```
Evaluate {architecture description} against all five SOLID principles. Prioritize material risks and avoid abstractions without a current use case.
```

## Limitations

- Examples are TypeScript-oriented and may require adaptation for other languages.
- The skill provides design guidance, not automated static analysis.
- Examples omit production details such as error handling and persistence security.
- SOLID recommendations require context and may add unnecessary abstraction to simple code.

## Best Practices

- Apply SOLID where change, testing, or reuse creates measurable pressure.
- Preserve behavior with tests before restructuring responsibilities or dependencies.
- Prefer small, domain-focused abstractions with more than one realistic implementation.

## Anti Patterns

- Do not split every method into a separate class.
- Do not introduce interfaces only to follow a principle mechanically.
- Do not ignore security, performance, or domain constraints during refactoring.

## Security Audit

- Audited at: 2026-07-23T11:23:32.641\+00:00
- Summary: All 16 static findings are false positives caused by Markdown fences or TypeScript template literals, with no external command execution, database file access, or reconnaissance. However, the recommended dependency inversion example directly interpolates an identifier into SQL. This pattern can enable SQL injection when adapted to executable code.

## Stats

- Views: 181
- Downloads: 14
- Favorites: 0
- Popularity score: 0
