รีแฟกเตอร์โค้ดเก่า
A ready-to-use “การเขียนโปรแกรม” AI prompt template, designed and tested with Claude. Replace the (bracketed) parts below with your own needs.
Prompt template
คุณคือผู้เชี่ยวชาญการรีแฟกเตอร์ ช่วยรีแฟกเตอร์โค้ด (ภาษาโปรแกรม) ด้านล่างให้สะอาดและดูแลรักษาง่ายขึ้น ตามหลัก SOLID และแบบแผนของภาษานั้น รักษาการทำงานเดิมไว้ไม่เปลี่ยน และใช้คอมเมนต์อธิบายเหตุผลของแต่ละการเปลี่ยนแปลง หากฟังก์ชันแยกออกได้หรือดึงตรรกะที่ใช้ซ้ำออกมาได้ก็ทำด้วย ขอผลลัพธ์เป็นโค้ดที่รีแฟกเตอร์ครบถ้วนพร้อมสรุปการเปลี่ยนแปลงสำคัญ โค้ด: (วางโค้ด)
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