Squashed commit message
Some checks failed
Telegram Mini App Shop Builder / Compute version metadata (push) Has been cancelled
Telegram Mini App Shop Builder / Run Frontend tests (push) Has been cancelled
Telegram Mini App Shop Builder / Run Backend tests (push) Has been cancelled
Telegram Mini App Shop Builder / Run PHP_CodeSniffer (push) Has been cancelled
Telegram Mini App Shop Builder / Build module. (push) Has been cancelled
Telegram Mini App Shop Builder / release (push) Has been cancelled
Some checks failed
Telegram Mini App Shop Builder / Compute version metadata (push) Has been cancelled
Telegram Mini App Shop Builder / Run Frontend tests (push) Has been cancelled
Telegram Mini App Shop Builder / Run Backend tests (push) Has been cancelled
Telegram Mini App Shop Builder / Run PHP_CodeSniffer (push) Has been cancelled
Telegram Mini App Shop Builder / Build module. (push) Has been cancelled
Telegram Mini App Shop Builder / release (push) Has been cancelled
This commit is contained in:
87
.cursor/prompts/refactoring.md
Normal file
87
.cursor/prompts/refactoring.md
Normal file
@@ -0,0 +1,87 @@
|
||||
# Prompts for refactoring
|
||||
|
||||
## General refactoring
|
||||
|
||||
```
|
||||
Analyze the code in file [FILE_PATH] and perform refactoring:
|
||||
1. Remove duplicated code
|
||||
2. Improve readability
|
||||
3. Apply SOLID principles
|
||||
4. Add error handling where necessary
|
||||
5. Improve typing
|
||||
6. Add documentation for public methods
|
||||
7. Ensure the code follows the project's MVC-L architecture
|
||||
8. Use existing utilities and services instead of creating new ones
|
||||
```
|
||||
|
||||
## Refactoring a Handler
|
||||
|
||||
```
|
||||
Refactor Handler [HANDLER_NAME]:
|
||||
1. Extract business logic into a separate Service
|
||||
2. Add validation for input data
|
||||
3. Improve error handling with logging
|
||||
4. Use DTOs for data transfer
|
||||
5. Add PHPDoc comments
|
||||
6. Ensure Dependency Injection is used
|
||||
7. Optimize database queries if needed
|
||||
```
|
||||
|
||||
## Refactoring a Model
|
||||
|
||||
```
|
||||
Refactor Model [MODEL_NAME]:
|
||||
1. Ensure all queries use the Query Builder
|
||||
2. Add methods for common operations (findBy, findAll, create, update)
|
||||
3. Add data validation before saving
|
||||
4. Improve method typing
|
||||
5. Add PHPDoc comments
|
||||
6. Use transactions for complex operations
|
||||
```
|
||||
|
||||
## Refactoring a Vue component
|
||||
|
||||
```
|
||||
Refactor Vue component [COMPONENT_NAME]:
|
||||
1. Extract logic into composable functions
|
||||
2. Improve typing for props and emits
|
||||
3. Optimize computed properties
|
||||
4. Add error handling
|
||||
5. Improve template structure
|
||||
6. Add loading states
|
||||
7. Use existing project utilities
|
||||
```
|
||||
|
||||
## Removing duplication
|
||||
|
||||
```
|
||||
Find and remove code duplication in:
|
||||
- [FILE_PATH_1]
|
||||
- [FILE_PATH_2]
|
||||
- [FILE_PATH_3]
|
||||
|
||||
Create shared utilities/services where appropriate, following the project architecture.
|
||||
```
|
||||
|
||||
## Improving performance
|
||||
|
||||
```
|
||||
Analyze performance of the code in [FILE_PATH]:
|
||||
1. Optimize database queries (use indexes, avoid N+1)
|
||||
2. Add caching where appropriate
|
||||
3. Optimize algorithms
|
||||
4. Reduce the number of API calls
|
||||
5. Use lazy loading on the frontend
|
||||
```
|
||||
|
||||
## Improving security
|
||||
|
||||
```
|
||||
Improve security of the code in [FILE_PATH]:
|
||||
1. Add validation for all input data
|
||||
2. Use prepared statements (Query Builder)
|
||||
3. Add CSRF protection where necessary
|
||||
4. Validate access rights
|
||||
5. Sanitize output data
|
||||
6. Add rate limiting where necessary
|
||||
```
|
||||
Reference in New Issue
Block a user