complying-with-thai-pdpa
Skill1 starsChanged 5 months agoMITView on GitHub
Implement Thailand PDPA (Personal Data Protection Act) compliance in apps and services, especially when handling sensitive data like health, biometric, children's data, or cross-border data transfer. Use this skill when designing data collection flows, building consent UX, implementing right-to-access or right-to-deletion, choosing database regions, or before any deployment that touches user data in the Thai market.
In this repository14 other files it gives its agents.
- AGENTS.mdAGENTS.md
- template/AGENTS.mdAGENTS.md
- backing-up-solo-projectsSkill
- complying-with-thai-pdpaSkill
- concurrency-and-hidden-bugsSkill
- debugging-disciplineSkill
- preparing-mobile-store-submissionSkill
- verifying-ai-outputSkill
- backing-up-solo-projectsSkill
- preparing-mobile-store-submissionSkill
- verifying-ai-outputSkill
- writing-feature-specsSkill
- verifying-ai-outputSkill
- writing-feature-specsSkill
The file
Files
Complying with Thai PDPA
Codex reference: P-28 (PDPA / Data Minimization) Law: พ.ร.บ.คุ้มครà¸à¸‡à¸‚้à¸à¸¡à¸¹à¸¥à¸ªà¹ˆà¸§à¸™à¸šà¸¸à¸„คล พ.ศ. 2562 (มีผลบังคับใช้เต็ม 1 มิ.ย. 2565) Regulator: PDPC (สำนัà¸à¸‡à¸²à¸™à¸„ณะà¸à¸£à¸£à¸¡à¸à¸²à¸£à¸„ุ้มครà¸à¸‡à¸‚้à¸à¸¡à¸¹à¸¥à¸ªà¹ˆà¸§à¸™à¸šà¸¸à¸„คล) Penalty: สูงสุด 5,000,000 บาท/ครั้ง + à¸à¸²à¸à¸² (à¸à¸£à¸“ีà¸à¹ˆà¸²à¸à¸·à¸™à¸£à¹‰à¸²à¸¢à¹à¸£à¸‡)
Disclaimer: Skill นี้สรุปจาภPDPA + PDPC guidelines ปี 2022-2026 — ไม่ใช่คำปรึà¸à¸©à¸²à¸—างà¸à¸Žà¸«à¸¡à¸²à¸¢ à¸à¸£à¸“ีซับซ้à¸à¸™à¸›à¸£à¸¶à¸à¸©à¸²à¸—นาย/DPO ที่ certified
หลัà¸à¸à¸²à¸£ 6 ข้ภ(PDPA มาตรา 22-23)
- Lawfulness — มีà¸à¸²à¸™à¸—างà¸à¸Žà¸«à¸¡à¸²à¸¢à¹ƒà¸™à¸à¸²à¸£à¹ƒà¸Šà¹‰à¸‚้à¸à¸¡à¸¹à¸¥ (consent, contract, legal obligation, vital interest, public interest, legitimate interest)
- Purpose limitation — ใช้ตามวัตถุประสงค์ที่à¹à¸ˆà¹‰à¸‡à¹€à¸—่านั้น
- Data minimization — collect เฉพาะที่จำเป็น
- Accuracy — ต้à¸à¸‡à¸–ูà¸à¸•้à¸à¸‡ à¸à¸±à¸žà¹€à¸”ท
- Storage limitation — เà¸à¹‡à¸šà¹€à¸—่าที่จำเป็น
- Integrity and confidentiality — security + access control
Special Categories (มาตรา 26 — ต้à¸à¸‡ explicit consent)
ข้à¸à¸¡à¸¹à¸¥à¸—ี่ต้à¸à¸‡à¸à¸²à¸£ consent ที่ ชัดเจน + à¹à¸¢à¸à¸à¸à¸à¸¡à¸² (ไม่ใช่รวมà¸à¸±à¸š Terms):
- Health data (เช่น Pippa, Da'Neng Care)
- Biometric (ลายนิ้วมืà¸, face ID, voice print)
- Genetic data
- Sexual orientation / activity
- Religion / philosophical belief
- Political opinion
- Criminal record
- Race / ethnic origin
- Trade union membership
Children data:
- à¸à¸²à¸¢à¸¸ < 10 ปี → ต้à¸à¸‡ parental consent
- 10-20 ปี → consent ขà¸à¸‡à¹€à¸”็ภ+ guardian (ถ้ายังไม่บรรลุนิติภาวะ)
Mandatory Implementation Baseline
1. Data Minimization Audit
ทุภfield ที่ collect ตà¸à¸šà¸„ำถาม:
[ ] จำเป็นสำหรับ feature ที่ user ใช้จริงตà¸à¸™à¸™à¸µà¹‰à¹„หม?
[ ] ใช้เพื่à¸à¸§à¸±à¸•ถุประสงค์ที่à¹à¸ˆà¹‰à¸‡à¹ƒà¸™ Privacy Policy ไหม?
[ ] มี alternative ที่ collect น้à¸à¸¢à¸à¸§à¹ˆà¸²à¹„หม?
[ ] เà¸à¹‡à¸šà¸™à¸²à¸™à¹à¸„่ไหน? นโยบายà¸à¸²à¸£à¸¥à¸š?ถ้าตà¸à¸š "à¸à¸²à¸ˆà¹ƒà¸Šà¹‰à¹ƒà¸™à¸à¸™à¸²à¸„ต" → ไม่ collect
ตัวà¸à¸¢à¹ˆà¸²à¸‡:
- ⌠Collect เบà¸à¸£à¹Œà¹‚ทร "เผื่ภmarketing" → ไม่ได้
- ✅ Collect เบà¸à¸£à¹Œà¹‚ทร "สำหรับ OTP login" → ได้ + ต้à¸à¸‡à¸¥à¸šà¹€à¸¡à¸·à¹ˆà¸ user delete account
2. Consent Flow
[Modal/Screen: ขภconsent]
├── à¸à¸˜à¸´à¸šà¸²à¸¢à¸Šà¸±à¸”: เà¸à¹‡à¸šà¸à¸°à¹„ร / ทำไม / à¸à¸±à¸šà¹ƒà¸„ร
├── à¹à¸¢à¸ consent ต่à¸à¸§à¸±à¸•ถุประสงค์ (granular)
│ [ ] Functional (จำเป็น) — pre-checked, can't uncheck
│ [ ] Analytics — opt-in
│ [ ] Marketing — opt-in
│ [ ] Health data processing — opt-in, à¹à¸¢à¸ checkbox
├── Link: Privacy Policy + Terms
└── ปุ่ม [ยà¸à¸¡à¸£à¸±à¸š] / [ปà¸à¸´à¹€à¸ªà¸˜]Anti-patterns ที่ผิด PDPA:
- ⌠Bundled consent ("ยà¸à¸¡à¸£à¸±à¸šà¸—ั้งหมดเป็น default")
- ⌠Pre-checked checkbox สำหรับ optional consent
- ⌠Dark pattern (ปุ่ม "ยà¸à¸¡à¸£à¸±à¸š" ใหà¸à¹ˆà¸à¸§à¹ˆà¸² "ปà¸à¸´à¹€à¸ªà¸˜")
- ⌠"เพื่à¸à¹ƒà¸Šà¹‰à¹à¸à¸›à¸•้à¸à¸‡à¸¢à¸à¸¡à¸£à¸±à¸šà¸—ุà¸à¸à¸¢à¹ˆà¸²à¸‡"
3. Consent Log Schema
ทุภconsent ต้à¸à¸‡à¸šà¸±à¸™à¸—ึภ(audit trail):
{
"userId": "u_abc123",
"consentId": "c_xyz789",
"policyVersion": "2026.06.01",
"consentItems": {
"functional": true,
"analytics": true,
"marketing": false,
"health_processing": true,
"child_data_parental": true
},
"timestamp": 1718888888000,
"ipAddress": "hashed_sha256",
"userAgent": "...",
"method": "explicit_button_click",
"withdrawnAt": null,
"withdrawalReason": null
}เà¸à¹‡à¸šà¹ƒà¸™ collection à¹à¸¢à¸ — ห้ามลบ (เป็น audit trail) à¹à¸¡à¹‰ user ขภdelete account
4. Right to Access (มาตรา 30)
User ขภexport data ขà¸à¸‡à¸•ัวเà¸à¸‡ → ต้à¸à¸‡à¸ªà¹ˆà¸‡à¸ ายใน 30 วัน
Implementation:
[ ] ปุ่ม "ดาวน์โหลดข้à¸à¸¡à¸¹à¸¥à¸‚à¸à¸‡à¸‰à¸±à¸™" ใน Settings
[ ] Generate JSON/CSV ขà¸à¸‡à¸—ุภdata ที่เà¸à¸µà¹ˆà¸¢à¸§à¸à¸±à¸š user นั้น
[ ] รวม: profile, activity log, consent history, files
[ ] ส่งผ่าน email หรืภin-app download
[ ] Log à¸à¸²à¸£ request ในระบบ// ตัวà¸à¸¢à¹ˆà¸²à¸‡ endpoint
async function exportUserData(userId) {
const data = {
profile: await getProfile(userId),
activity: await getActivity(userId),
consents: await getConsents(userId),
files: await getFileMetadata(userId)
};
await logRequest('access', userId);
return data;
}5. Right to Deletion (มาตรา 33)
User ขà¸à¸¥à¸š → ต้à¸à¸‡à¸¥à¸šà¸ ายใน 30 วัน
Implementation:
[ ] ปุ่ม "ลบบัà¸à¸Šà¸µà¸‚à¸à¸‡à¸‰à¸±à¸™" ใน Settings
[ ] Confirmation 2-step (à¸à¸±à¸™ accidental)
[ ] Soft delete ทันที (mark deleted=true, hide from UI)
[ ] Hard delete ภายใน 30 วัน (cron job ลบจริงจาภDB + backup)
[ ] ส่ง confirmation email
[ ] เà¸à¹‡à¸š consent log + minimal record สำหรับ audit (legal basis)ข้à¸à¸¢à¸à¹€à¸§à¹‰à¸™à¸—ี่เà¸à¹‡à¸šà¹„ด้ (ต้à¸à¸‡ document):
- Legal obligation (เช่น tax record 5 ปี)
- Public interest research (anonymized only)
- Defense of legal claims (เà¸à¹‡à¸šà¹„ด้à¹à¸•่ต้à¸à¸‡ justify)
6. Data Residency
| Region | PDPA Status | ใช้ยังไง |
| Thailand | ✅ Adequate | Default safe |
| Singapore (asia-southeast1) | ✅ Adequate (PDPC interpretation) | ใช้ได้ + disclose ใน policy |
| EU (europe-west1) | ✅ Adequate (GDPR similar) | ใช้ได้ + disclose |
| US (us-central1) | âš ï¸ Not adequate | ต้à¸à¸‡à¸¡à¸µ SCC / Binding Corporate Rules |
| à¸à¸·à¹ˆà¸™à¹† | âš ï¸ Case-by-case | ต้à¸à¸‡ assessment |
Pippa/Da'Neng (health data + children):
- ใช้ Firebase asia-southeast1 (Singapore) = ปลà¸à¸”ภัย
- ถ้าใช้ AI API (Claude/OpenAI/Gemini ที่ host us) สำหรับ health processing → ต้à¸à¸‡à¸¡à¸µ DPA + disclose
7. Breach Notification
ถ้าข้à¸à¸¡à¸¹à¸¥à¸£à¸±à¹ˆà¸§:
ภายใน 72 ชั่วโมง:
[ ] à¹à¸ˆà¹‰à¸‡ PDPC ทาง online form
[ ] à¹à¸ˆà¹‰à¸‡ user ที่ affected (ถ้า risk สูง)
[ ] เปิดเผยใน Privacy Center ขà¸à¸‡ app
[ ] รวบรวม evidence + remediation planสิ่งที่ต้à¸à¸‡à¹€à¸•รียมà¸à¹ˆà¸à¸™à¹€à¸à¸´à¸”:
- Incident response plan
- DPO contact ที่ active 24/7
- Forensic capability (logs ที่ตรวจสà¸à¸šà¹„ด้)
- Communication template
DPO Requirements
ต้à¸à¸‡à¸¡à¸µ DPO (มาตรา 41) ถ้า:
- เป็น Data Controller ที่ process ข้à¸à¸¡à¸¹à¸¥à¸ˆà¸³à¸™à¸§à¸™à¸¡à¸²à¸ (regular + systematic monitoring)
- Process Special Category data เป็น core business (เช่น health app)
Pippa/Da'Neng → ต้à¸à¸‡à¸¡à¸µ DPO เพราะเป็น health data + children
DPO contact ต้à¸à¸‡:
- มี email สาธารณะ
- ระบุใน Privacy Policy
- ติดต่à¸à¹„ด้จริงภายใน reasonable time
Privacy Policy Template Sections
ต้à¸à¸‡à¸„รà¸à¸šà¸„ลุม:
1. ข้à¸à¸¡à¸¹à¸¥à¸—ี่เà¸à¹‡à¸š (รายละเà¸à¸µà¸¢à¸”ต่ภcategory)
2. วัตถุประสงค์à¸à¸²à¸£à¹€à¸à¹‡à¸š + à¸à¸²à¸™à¸—างà¸à¸Žà¸«à¸¡à¸²à¸¢
3. ระยะเวลาเà¸à¹‡à¸š
4. ใครเข้าถึงได้ (third party, vendor)
5. ส่งข้à¸à¸¡à¸¹à¸¥à¸‚้ามประเทศ (region + safeguards)
6. สิทธิขà¸à¸‡ Data Subject (access, deletion, rectification, withdraw consent, portability, object)
7. à¸à¸²à¸£à¸•ิดต่ภDPO
8. à¸à¸²à¸£à¹€à¸›à¸¥à¸µà¹ˆà¸¢à¸™à¹à¸›à¸¥à¸‡ policy (notification process)
9. Cookie policy (web)
10. Children data (ถ้ามี)Code Patterns
Consent Check Wrapper
async function withConsent(userId, consentType, fn) {
const consents = await getConsents(userId);
if (!consents[consentType]) {
throw new Error(`Missing consent: ${consentType}`);
}
return fn();
}
// Usage
await withConsent(userId, 'analytics', () => {
trackEvent('feature_used', { feature: 'baby_log' });
});Data Minimization in API
// ⌠Bad — return everything
app.get('/user/:id', async (req, res) => {
const user = await db.users.findById(req.params.id);
res.json(user); // ส่งทุภfield รวม sensitive
});
// ✅ Good — explicit projection
app.get('/user/:id', async (req, res) => {
const user = await db.users.findById(req.params.id, {
fields: ['displayName', 'avatar', 'bio'] // เฉพาะที่ public
});
res.json(user);
});PII Logging Filter
// ⌠Never log PII raw
console.log('User created:', { email: user.email, phone: user.phone });
// ✅ Use safe logger
logger.info('User created', {
userId: user.id,
email: hash(user.email), // or mask: u***@example.com
region: user.region
});Automated Pre-Deploy Scanner
???? deploy ????????????? user data — ??? pdpa-guard ????? scan ?????????:
npx pdpa-guard .???? 4 ????????? AI ??????????:
- Cloud Region — Firebase/Supabase ???????? region ??? (us-central1 = cross-border transfer ?????)
- Security Rules — llow read, write: if true ????????????? production
- PII Fields — grep ?? field ????, ?????, ???????????, ???????, ????? (???+??????)
- Subprocessors — SDK ???????????????????????? (Sentry, Gemini, LINE API, Omise ???)
???????????????? pdpa-report.md ????? checklist ??????????
????? CI/pre-deploy hook:
# package.json
"scripts": { "predeploy": "npx pdpa-guard . --fail-on critical" }package: https://npmjs.com/package/pdpa-guard
Quarterly Audit Checklist
ทุภ3 เดืà¸à¸™:
[ ] Data inventory ยังตรงà¸à¸±à¸š collect จริง?
[ ] Privacy Policy ยัง up-to-date?
[ ] Consent flow ทำงานครบทุภfield ใหม่?
[ ] Right to access ทดสà¸à¸š export ได้จริง?
[ ] Right to deletion ทดสà¸à¸šà¸¥à¸šà¹„ด้จริงครบ backup?
[ ] Data residency ขà¸à¸‡ vendor ทุà¸à¸•ัวยังตรง?
[ ] Breach response plan ยัง valid (contacts, escalation)?
[ ] DPO contact ยัง active?
[ ] Vendor DPA ทุà¸à¸•ัวยังไม่ expire?
[ ] Staff awareness training (ถ้ามีพนัà¸à¸‡à¸²à¸™)?Anti-patterns ที่ต้à¸à¸‡à¸«à¸¥à¸µà¸à¹€à¸¥à¸µà¹ˆà¸¢à¸‡
- ⌠Bundled consent
- ⌠Pre-checked optional consent
- ⌠Privacy Policy ที่ copy มาจาภapp à¸à¸·à¹ˆà¸™
- ⌠Collect "เผื่à¸à¸à¸™à¸²à¸„ต"
- ⌠Log PII ใน console / file ที่ไม่ secure
- ⌠Share data à¸à¸±à¸š third party โดยไม่ disclose
- ⌠Cross-border transfer โดยไม่มี safeguard
- ⌠ละเลย consent withdrawal
- ⌠Delay right to access/deletion เà¸à¸´à¸™ 30 วัน
Common Misconceptions
| Misconception | Reality |
| "PDPA ใช้à¸à¸±à¸šà¸šà¸£à¸´à¸©à¸±à¸—ใหà¸à¹ˆà¹€à¸—่านั้น" | ผิด — ใช้à¸à¸±à¸šà¸—ุภdata controller รวม solo |
| "เà¸à¹‡à¸šà¸—ี่ Firebase = ปลà¸à¸”ภัย" | ผิด — region สำคัภ+ ต้à¸à¸‡à¸¡à¸µ DPA |
| "User à¸à¸” accept Terms = consent ครบ" | ผิด — Special category ต้à¸à¸‡ explicit + separate |
| "Anonymized data = ไม่ใช่ PII" | บางครั้งผิด — ถ้า re-identify ได้ ยังเป็น PII |
| "Delete จาภUI = ลบครบ" | ผิด — ต้à¸à¸‡à¸¥à¸šà¸ˆà¸²à¸ backup + cache + analytics |
Resources
- PDPA full text: https://www.ratchakitcha.soc.go.th
- PDPC guidelines: https://www.pdpc.or.th
- TPQI/DEPA DPO certification: ถ้าจะเป็น DPO certified
สำหรับ project ที่มี health data + children → consult ทนาย PDPA + DPO certified à¸à¸¢à¹ˆà¸²à¸‡à¸™à¹‰à¸à¸¢ 1 ครั้งà¸à¹ˆà¸à¸™ production deploy
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

