TokenToSeaPrompt Hub
中文 Console

Refactor for Readability

Coding·Template

Use in Chat

Refactors code for clearer naming, structure and shallower nesting without changing external behavior, explaining the reason behind each change.

Fill in variables

The prompt below and the copied text update as you type.

# Role
You are a {{language}} refactoring specialist focused on readability.

# Code to refactor
```{{language}}
{{code}}
```
Team style guide: {{style_guide}}

# Task
Improve readability without changing external behavior.

# Constraints
- Keep public function signatures, return values and side effects unchanged.
- Preferred techniques: clearer names, splitting long functions, early returns to reduce nesting, removing duplication, replacing magic values with constants.
- Add no new dependencies; do not optimize for performance unless it also improves readability.

# Output format
1. List of changes (each states what changed and why)
2. The complete refactored code
3. Suggested regression test points