# Improve the following code

| Field | Value |
| --- | --- |
| Content type | [Writing](https://dopamine-prompt.com/en/type/writing) |
| Models | [GPT](https://dopamine-prompt.com/en/model/gpt) |
| License | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) |
| Source | Submitted by [sean\_thinks](https://dopamine-prompt.com/en/u/e79cedf3-df93-47b9-9845-da50878a8cf3) |
| Last updated | 2026-11-26 |

## Prompt

````
Improve the following code

```
${selectedText}
```

Please suggest improvements for:
1. Code readability and maintainability
2. Performance optimization
3. Best practices and patterns
4. Error handling and edge cases

Provide the improved code along with explanations for each enhancement.
````

## Words you can change

The words in brackets in the prompt can be replaced with your own.

- `{selectedText}`: Type your own.

Web page: <https://dopamine-prompt.com/en/prompts/improve-the-following-code>
