The method
Use this prompt by pasting it into ChatGPT/Gemini/Claude. Provide a code snippet from a Magento module or theme. Specify the area of concern (performance, security, readability). The LLM refactors the code based on best practices.
The prompts
                                            Prompt 1
                                            
                                        
                                        Please analyze the following Magento 2 code snippet and refactor it to improve its performance, security, and maintainability. Specifically, address any potential issues related to database queries, caching, event observers, and code complexity. Provide a detailed explanation of the changes made and the reasons behind them. The code snippet is:
```php
                                    ```php
                                            Prompt 2
                                            
                                        
                                        Analyze the following Magento 2 code. Identify and suggest improvements to enhance security, focusing on preventing SQL injection, cross-site scripting (XSS), and other common vulnerabilities.  Provide a detailed breakdown of potential security flaws and corresponding mitigation strategies. The given code is:
```php
                                    ```php
