forked from mufeedvh/code2prompt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
refactor.hbs
49 lines (37 loc) · 1.67 KB
/
refactor.hbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
Project Path: {{ absolute_code_path }}
I need your help refactoring this codebase to improve its design, maintainability, and performance. Here are the files involved:
Source Tree:
```
{{ source_tree }}
```
{{#each files}}
{{#if code}}
`{{path}}`:
{{code}}
{{/if}}
{{/each}}
Some areas to focus on during the refactoring:
- Adherence to SOLID principles (Single Responsibility, Open-Closed, Liskov Substitution, Interface Segregation, Dependency Inversion)
- Separation of concerns
- Reducing duplication (DRY - Don't Repeat Yourself)
- Improving naming and code readability
- Enhancing modularity and reusability
- Optimizing performance
- Removing dead or redundant code
- Updating to modern language features or idioms where appropriate
- Ensuring consistent code style and formatting
To refactor effectively:
- Understand the current design and architecture
- Identify pain points, code smells, and areas for improvement
- Break down the refactoring into manageable steps
- Ensure the existing tests pass after each refactoring step
- Look for opportunities to extract reusable functions, classes or modules
- Consider performance implications of design changes
- Keep the code readable and maintainable
- Preserve the original functionality and API contracts
For each major refactoring you propose, please provide:
- File path(s) and line number(s)
- Description of the current code and why it needs refactoring
- Explanation of your proposed changes and their benefits
- Updated code snippets with your refactoring applied
After refactoring, please share the updated codebase. Update any relevant documentation to reflect the changes. Add new unit tests for the refactored code if applicable.