💬
Prompts
Refactoring
Рефакторинг кода с сохранением поведения
Refactor this code while:
1. **Preserving behavior** — All existing functionality must work the same
2. **Improving readability** — Clearer naming, better structure
3. **Reducing complexity** — Simpler logic, fewer nested conditions
4. **Following conventions** — Rails/Ruby best practices
5. **Extracting patterns** — Service objects, concerns, helpers where appropriate
Constraints:
- No new dependencies unless absolutely necessary
- Keep changes focused and reviewable
- Explain each change and why it improves the code
Show before/after comparison for each change.