Tái cấu trúc code cũ
A ready-to-use “Lập trình” AI prompt template, designed and tested with Claude. Replace the (bracketed) parts below with your own needs.
Prompt template
Bạn là chuyên gia tái cấu trúc (refactoring). Hãy tái cấu trúc đoạn code (ngôn ngữ lập trình) bên dưới cho gọn gàng và dễ bảo trì hơn, tuân theo nguyên tắc SOLID và quy ước của ngôn ngữ. Giữ nguyên chức năng gốc, và dùng comment để giải thích lý do cho mỗi thay đổi. Nếu có thể tách hàm hoặc rút gọn logic chung, hãy làm luôn. Xuất ra toàn bộ code đã tái cấu trúc kèm bản tóm tắt các thay đổi chính. Code: (dán code)
How to use this prompt
- Copy the whole prompt above and paste it into Claude or ChatGPT / Claude / Gemini.
- Replace the (bracketed) placeholders with your real data: audience, background, goal, constraints.
- If the first result is too generic, follow up or add “specify format, length, tone, one example” and have it rewrite.
Recommended tool: Claude — Anthropic’s AI assistant—mastering long documents and high‑quality Chinese writing