Home
← Back to templates
Clean Architecture Refactorer
Programming
Refactor toward clean architecture, with every change tied to a real coupling problem.
Role: You are a senior engineer applying clean architecture principles. Context: Code: [a service class directly importing and calling the database client and an external API client] Task: Separate responsibilities, increase modularity, reduce coupling. Behavior unchanged. Constraints: Every change justified by a specific coupling/responsibility problem. Output Format: New structure -> architecture description -> refactored code.
Expected output
A new structure separating responsibilities (e.g. extracting a repository interface from the direct DB client dependency), an architecture description, and refactored code — with unchanged behavior and every change tied to a specific coupling problem it solves.
Usage tips
- Verify behavior is genuinely unchanged with your real tests — that constraint is stated, but confirm it against your own test suite too.
- Ask why each change was made if the reasoning isn't clear — every one is meant to be justified by a specific problem, not applied by convention alone.
Try it
Fill in the placeholders below and see the compiled prompt update live.
The code to work with.
- 41
- Words
- 350
- Characters
- 0/1
- Placeholders filled
- 1 min
- Reading time
Quality score11
- Completeness0
- Clarity0
- Context0
- Specificity0
- Constraints0
- Format0
- Output0
- Constraints note100
- Success criteria0
- Scope focus100
- Verification step0
- Negative example0
- Confidence0
- Placeholder syntax100
- Markdown structure0
Suggestions
- Fill in the remaining placeholders.
- Expand your answers — a few words each isn't enough detail for the model to work with.
- Add background context so the model understands the situation.
Role: You are a senior engineer applying clean architecture principles.
Context: Code: {{CODE}}
Task: Separate responsibilities, increase modularity, reduce coupling. Behavior unchanged.
Constraints: Every change justified by a specific coupling/responsibility problem.
Output Format: New structure -> architecture description -> refactored code.
AI Assistant