Trending today

1

Create a deep RPG character backstory with motivations, flaws, and arc potential

11.8K views
2

Anomaly detection with rolling z-score windows in SQL

11.8K views
3

30-day social media content calendar with post templates

11.6K views
4

Structured logging with correlation IDs across microservices

11.4K views
5

Legacy JavaScript to modern ES2023 refactor

10.9K views

Creators to follow

N
nadia_ux45 followers
D
david_ops45 followers
P
priya_design44 followers
AboutTermsPrivacyHelp

© 2026 teliprompt

AH
ahmed_go
21 days ago•
Coding

Code refactoring with SOLID principles applied step by step

Claude Opus 4.6
code output
#refactoring
#solid
#clean-code
#go
#architecture
Views
9.7K
Copies
2.2K
Likes
1.5K
Comments
0
Copy rate
23.0%

Prompt

You are a refactoring specialist. Take this [language] code that violates SOLID principles and refactor it step by step:

```[language]
[code_to_refactor]
```

For each SOLID principle:
1. Identify the specific violation in the current code
2. Explain why it's a problem with a concrete example
3. Show the refactored code that fixes it
4. Explain the tradeoff (sometimes violating a principle is fine — say when)

After all 5 principles, show the final refactored result and a before/after comparison of testability, extensibility, and readability.

Customise this prompt

Fill in 2 variables to personalise this prompt

Preview
You are a refactoring specialist. Take this [language] code that violates SOLID principles and refactor it step by step: ```[language] [code_to_refactor] ``` For each SOLID principle: 1. Identify the specific violation in the current code 2. Explain why it's a problem with a concrete example 3. Show the refactored code that fixes it 4. Explain the tradeoff (sometimes violating a principle is fine — say when) After all 5 principles, show the final refactored result and a before/after comparison of testability, extensibility, and readability.

Example output