ข้ามไปยังเนื้อหา

เขียน PR และ README ที่ดี

ใน code review คำอธิบาย PR ของคุณคือจุดเริ่มต้นสำหรับผู้ตรวจสอบ คำอธิบาย PR ที่ดีช่วย:

  • ✅ ให้ผู้ตรวจสอบเข้าใจได้อย่างรวดเร็วว่าคุณทำอะไร
  • ✅ ลดคำถามไปมา
  • ✅ แสดงว่าคุณคิดรอบคอบ

สรุปสั้นๆ หนึ่งประโยค

Refactor authentication flow to support OAuth2 and magic link sign-up

สำนวนสำคัญ:

  • Add X — เพิ่มฟีเจอร์ใหม่
  • Fix X — แก้ bug
  • Refactor X — เขียน code ใหม่ (ไม่เปลี่ยนฟังก์ชัน)
  • Optimize X — ปรับปรุงประสิทธิภาพ

ส่วนที่มักถูกละเลยมากที่สุด อธิบายบริบทและแรงจูงใจ

Why:
- Users requested passwordless sign-up option
- Current session-based auth doesn't scale to multiple domains

ภาพรวมเทคนิคระดับสูง

How:
1. Created JWT service using Web Crypto API
2. Replaced SessionMiddleware with AuthMiddleware
3. Added OAuth2 routes for Google/GitHub sign-in
Breaking changes:
- Clients now need to store and send JWT in Authorization header
Testing:
- Manual testing: Verified OAuth2 sign-in with Google and GitHub
- Existing auth tests pass (147 tests)
- Added 23 new tests
## What
[สรุปหนึ่งประโยค]
## Why
- [เหตุผล 1]
- [เหตุผล 2]
## How
1. [การเปลี่ยนแปลง 1]
2. [การเปลี่ยนแปลง 2]
## Testing
- [คุณทดสอบอะไร]
## Related
Closes #123

หลักการ: ปัจจุบันกาลสำหรับสิ่งที่ code ทำ, อดีตกาลสำหรับการเปลี่ยนแปลงที่คุณทำ

ผิดถูก
”The function was created to handle X""The function handles X"
"The code will validate input""The code validates input”
PassiveActive (ดีกว่า)
“The JWT is generated by the server""The server generates the JWT"
"Breaking changes were introduced""This PR introduces breaking changes”
คำการใช้งาน
Addเพิ่มฟีเจอร์ใหม่: “Add OAuth2 support”
Fixแก้ bug: “Fix race condition in cache”
Refactorปรับปรุง code โดยไม่เปลี่ยนฟังก์ชัน
Optimizeปรับปรุงประสิทธิภาพ
  • ส่วน What อธิบายการเปลี่ยนแปลงอย่างชัดเจน
  • ส่วน Why มีเหตุผลทางธุรกิจหรือเทคนิค
  • ส่วน How แสดงการออกแบบระดับสูง
  • ส่วน Testing ระบุการครอบคลุมการทดสอบ
  • ไม่มี passive voice มากเกินไป
  • ลิงก์ไปยัง issue ที่เกี่ยวข้อง (ถ้ามี)