เขียน Architecture Decision Record (ADR) สำหรับการตัดสินใจทางเทคนิค
สร้าง ADR ที่ครบถ้วนและอ่านง่าย บันทึกบริบท ตัวเลือกที่พิจารณา เหตุผลการตัดสินใจ และ trade-off ที่ยอมรับ ช่วยให้ทีมปัจจุบันและนักพัฒนารุ่นต่อไปเข้าใจว่าทำไมจึงตัดสินใจเช่นนั้น

คัดลอกพรอมต์ฉบับมีตัวแปร {{...}} ไปแก้ไขในเครื่องมือของคุณเอง
ตัวอย่างผลลัพธ์ที่จะได้
ก่อนเริ่มลงมือปรับพรอมต์ ดูตัวอย่างผลลัพธ์ที่คุณจะได้จริงเพื่อให้แน่ใจว่าพรอมต์นี้ตรงกับงานที่ต้องการ
ADR-0012: Use PostgreSQL instead of MongoDB for User and Order Data
Date: 2026-05-01 Status: Accepted Deciders: Engineering Team
Context
The e-commerce platform (~100,000 MAU) requires a primary database to store users, orders, and inventory records. The team of five engineers is preparing for a production launch in Q3 2026. Data access patterns are predominantly relational — orders reference users and products, and checkout operations must atomically update orders, payments, and inventory in a single transaction. The team has existing SQL expertise and no prior production experience with document databases.
Decision Drivers
- Multi-table ACID transactions are required for the order-payment-inventory checkout flow
- Query patterns involve significant JOINs across users, orders, and products
- Team SQL expertise reduces onboarding cost and time-to-production
ปรับให้เข้ากับงานของคุณ
แก้ค่าตัวแปรด้านล่าง พรอมต์ฉบับสมบูรณ์จะอัปเดตอัตโนมัติ พร้อมคัดลอกไปวางใน Claude หรือ ChatGPT ได้ทันที
หมายเลข ADR ตามลำดับในโปรเจกต์ เช่น 0001, 0012, 0043
ชื่อการตัดสินใจ เขียนเป็น English กระชับได้ใจความ เช่น 'Adopt GraphQL over REST for Mobile API'
บริบทของโปรเจกต์และทีม เช่น ขนาดระบบ จำนวนทีม ช่วงเวลา และ tech stack หลัก
ปัญหาหรือ requirement ที่ทำให้ต้องตัดสินใจ ระบุให้ชัดว่าต้องการอะไรและทำไม
รายชื่อตัวเลือกที่ประเมิน อย่างน้อย 2 ตัวเลือก พร้อมคำอธิบายสั้นๆ แต่ละตัว
ตัวเลือกที่ทีมตัดสินใจเลือก ระบุชื่อตรงกับที่ปรากฏใน options_considered
ผลที่ตามมาทั้งด้านดีและ trade-off ที่ยอมรับ ต้องระบุทั้งสองด้านอย่างซื่อสัตย์
**Input:**
- ADR number: 0012
- Decision title: Use PostgreSQL instead of MongoDB for User and Order Data
- Project/system context: Mid-size e-commerce platform, ~100,000 MAU, team of 5 engineers, targeting production launch in Q3 2026
- Problem being solved: Need a primary database for users, orders, and inventory that supports multi-table ACID transactions and complex relational queries
- Options that were evaluated: 1. PostgreSQL — mature relational DB with JSONB support
2. MongoDB — document-oriented with flexible schema
3. MySQL — familiar relational option with weaker JSONB support
- Decision made: PostgreSQL
- Known consequences and trade-offs: Gains: full ACID guarantee across multi-table transactions, team already has SQL expertise, JSONB covers flexible product attributes. Trade-offs: schema migrations require planning and versioning with a tool like Flyway; horizontal read scaling needs read replicas configured separately
**Output — use this exact structure, no extra sections:**
---
# ADR-0012: [Decision Title]
**Date:** [today's date]
**Status:** Accepted
**Deciders:** Engineering Team
## Context
[2–4 sentences describing the situation, constraints, and why a decision was required. Be specific: mention scale, team size, or system boundaries where relevant.]
## Decision Drivers
- [Driver 1 — technical, business, or operational]
- [Driver 2]
- [Driver 3]
## Options Considered
### Option 1: [Name]
**Pros:** [specific advantages]
**Cons:** [specific disadvantages]
### Option 2: [Name]
**Pros:** ...
**Cons:** ...
[Repeat for all options provided]
## Decision
[2–3 sentences stating the chosen option and the primary reasoning. Reference the decision drivers explicitly. Do not use vague justifications like 'it's simpler' — explain *why* it is simpler in this specific context.]
## Consequences
### Positive
- [Concrete benefit 1]
- [Concrete benefit 2]
### Negative / Trade-offs Accepted
- [Trade-off 1 — be honest and specific]
- [Trade-off 2]
### Risks & Mitigations
| Risk | Mitigation |
|------|------------|
| [Risk 1] | [Concrete action to address it] |
| [Risk 2] | [Concrete action to address it] |
## Links & References
- [Related ADRs, tickets, RFCs, or documentation]
---
**Constraints:**
- Write entirely in English. ADRs are engineering documents intended for long-term archival; English maximises readability across future team members.
- Do NOT omit the "Negative / Trade-offs Accepted" section. Honest documentation of trade-offs is the most valuable part of an ADR.
- Do NOT use vague qualitative claims. Every advantage or disadvantage must reference a specific technical property, constraint, or measurable outcome.
- Keep tone neutral and factual. Do not retroactively advocate for the decision — document it objectively.
- Do not add sections beyond those listed in the format above.
เข้าใจเทคนิคที่ซ่อนอยู่
คลิกที่ส่วนไฮไลต์ในพรอมต์เพื่อกระโดดไปดูคำอธิบายเทคนิคแต่ละจุด ใช้ความเข้าใจนี้เพื่อปรับพรอมต์อื่นของคุณเองในภายหลัง
**Input:**
- ADR number: {{adr_number}}
- Decision title: {{decision_title}}
- Project/system context: {{project_context}}
- Problem being solved: {{problem_statement}}
- Options that were evaluated: {{options_considered}}
- Decision made: {{chosen_option}}
- Known consequences and trade-offs: {{consequences}}
**Output — use this exact structure, no extra sections2:**
---
# ADR-{{adr_number}}: [Decision Title]
**Date:** [today's date]
**Status:** Accepted
**Deciders:** Engineering Team
## Context
[2–4 sentences describing the situation, constraints, and why a decision was required. Be specific: mention scale, team size, or system boundaries where relevant.]
## Decision Drivers
- [Driver 1 — technical, business, or operational]
- [Driver 2]
- [Driver 3]
## Options Considered
### Option 1: [Name]
**Pros:** [specific advantages]
**Cons:** [specific disadvantages]
### Option 2: [Name]
**Pros:** ...
**Cons:** ...
[Repeat for all options provided]
## Decision
[2–3 sentences stating the chosen option and the primary reasoning. Reference the decision drivers explicitly. Do not use vague justifications like 'it's simpler' — explain *why* it is simpler in this specific context.5]
## Consequences
### Positive
- [Concrete benefit 1]
- [Concrete benefit 2]
### Negative / Trade-offs Accepted
- [Trade-off 1 — be honest and specific]
- [Trade-off 2]
### Risks & Mitigations
| Risk | Mitigation |
|------|------------|
| [Risk 1] | [Concrete action to address it] |
| [Risk 2] | [Concrete action to address it] |
## Links & References
- [Related ADRs, tickets, RFCs, or documentation]
---
**Constraints:**
- Write entirely in English. ADRs are engineering documents intended for long-term archival; English maximises readability across future team members.
- Do NOT omit the "Negative / Trade-offs Accepted" section. Honest documentation of trade-offs is the most valuable part of an ADR.3
- Do NOT use vague qualitative claims. Every advantage or disadvantage must reference a specific technical property, constraint, or measurable outcome.4
- Keep tone neutral and factual. Do not retroactively advocate for the decision — document it objectively.
- Do not add sections beyond those listed in the format above.
แตะส่วนที่ไฮไลต์เพื่อดูคำอธิบายเทคนิคแต่ละจุด · {{ }} คือตัวแปรที่ปรับได้
"You are a senior software architect writing an Architecture Decision Record (ADR) for an important technical decision."
การกำหนด role ที่เจาะจงทำให้โมเดลเลือกใช้ tone และ vocabulary ที่เหมาะกับ engineering documentation แทนที่จะเขียนแบบทั่วไป ส่งผลให้ภาษาที่ออกมามีความเป็น professional และ precise มากขึ้น
"use this exact structure, no extra sections"
การล็อก template ป้องกันโมเดลจากการเพิ่ม section ที่ไม่จำเป็นหรือจัดรูปแบบต่างออกไปในแต่ละครั้ง ทำให้ ADR ทุกฉบับในทีมมีโครงสร้างเดียวกันและอ่านได้ง่ายในระยะยาว
"Do NOT omit the "Negative / Trade-offs Accepted" section. Honest documentation of trade-offs is the most valuable part of an ADR."
โมเดลมีแนวโน้มเขียนเชิงบวกตามสิ่งที่ผู้ใช้ระบุ การห้ามชัดเจนพร้อมอธิบายเหตุผลทำให้โมเดลรักษา section สำคัญที่มักถูกละเลยไว้เสมอ แทนที่จะตัดออกเพื่อความกระชับ
"Do NOT use vague qualitative claims. Every advantage or disadvantage must reference a specific technical property, constraint, or measurable outcome."
การห้ามคำคลุมเครือพร้อมนิยามว่า 'specific' หมายถึงอะไร บังคับให้โมเดลเขียน rationale ที่มีประโยชน์จริงแทนที่จะเขียนแค่ 'ดีกว่า' หรือ 'ง่ายกว่า' ซึ่งไม่ช่วยให้ทีมเรียนรู้อะไรได้
"Do not use vague justifications like 'it's simpler' — explain *why* it is simpler in this specific context."
การยกตัวอย่าง anti-pattern ที่ชัดเจนพร้อมบอกทางที่ถูกต้องช่วยให้โมเดลเข้าใจระดับความละเอียดที่ต้องการได้ดีกว่าการบอกแค่ 'be specific' เพราะโมเดลมีตัวอย่างรูปแบบที่ผิดให้หลีกเลี่ยงอย่างชัดเจน
เห็นความต่างระหว่างพรอมต์ทั่วไปกับพรอมต์ที่ใช้เทคนิค
คนส่วนใหญ่เริ่มต้นด้วยคำสั่งสั้น ๆ แบบพรอมต์ที่ใช้กันทั่วไป แต่ผลลัพธ์มักไม่ตรงใจและต้องถามซ้ำหลายรอบ พรอมต์แบบที่ใช้เทคนิคข้างต้นช่วยแก้ปัญหานี้
ช่วยเขียน ADR สำหรับการเลือก database หน่อย
- กำหนด role เป็น senior software architect และระบุเป้าหมายว่า ADR ต้องอธิบายทั้ง 'what' และ 'why'
- รับ input 7 fields เพื่อ ground โมเดลด้วยข้อมูลจริงของโปรเจกต์ก่อนสร้างเอกสาร
- บังคับโครงสร้าง 7 sections ด้วย template แน่นอน ห้ามเพิ่มหรือลด section
- ห้ามละเว้น Negative/Trade-offs section พร้อมระบุว่าเป็น section ที่มีคุณค่าสูงสุด
- ห้ามใช้คำคลุมเครือและต้องอ้างอิง technical property ที่วัดหรือสังเกตได้


