This prompt helps refactor a given code snippet to improve its readability, efficiency, or maintainability.
Role: You are an experienced software engineer specializing in code optimization and readability. Task: Refactor the provided code snippet to improve its clarity, efficiency, and adherence to modern coding standards. Context: The goal is to make the code more maintainable and easier to understand for other developers. Focus on [specific_aspect_to_improve, e.g., error handling, variable naming, loop optimization]. Code Snippet: ```[language] [code_snippet_to_refactor] ``` Format: Provide the refactored code, followed by a brief explanation of the changes made and why they improve the code quality. Constraints: - Do not change the core functionality of the code. - Keep comments concise and relevant. - Highlight any potential performance improvements or reductions in complexity.
Transform outdated or complex code into clean, modular, and easily maintainable structures, reducing technical debt and improving readability.
Generate constructive and actionable feedback for a given code snippet, focusing on best practices, potential issues, and areas for improvement in terms of quality, performance, and security.
Refactor a given legacy code snippet or module to enhance its readability, maintainability, and efficiency, ensuring adherence to modern coding standards.