Pdpa Compliance
Skill Profile
(Select at least one profile to enable specific modules)
Overview
PDPA (Personal Data Protection Act) is Thailand's comprehensive data protection law that regulates how organizations collect, use, and store personal data. This skill provides patterns for implementing PDPA compliance across all aspects of data processing.
Why This Matters
PDPA compliance is essential for:
- Legal Requirements: Mandatory for organizations processing personal data in Thailand
- Risk Mitigation: Avoiding fines up to 5 million THB
- User Trust: Demonstrating commitment to data protection
- Market Access: Enabling business in Thailand market
- Brand Reputation: Maintaining a positive public image
Core Concepts & Rules
1. Core Principles
- Follow established patterns and conventions
- Maintain consistency across codebase
- Document decisions and trade-offs
2. Implementation Guidelines
- Start with the simplest viable solution
- Iterate based on feedback and requirements
- Test thoroughly before deployment
Inputs / Outputs / Contracts
- Inputs:
- <e.g., env vars, request payload, file paths, schema>
- Entry Conditions:
- <Pre-requisites: e.g., Repo initialized, DB running, specific branch checked out>
- Outputs:
- <e.g., artifacts (PR diff, docs, tests, dashboard JSON)>
- Artifacts Required (Deliverables):
- <e.g., Code Diff, Unit Tests, Migration Script, API Docs>
- Acceptance Evidence:
- <e.g., Test Report (screenshot/log), Benchmark Result, Security Scan Report>
- Success Criteria:
- <e.g., p95 < 300ms, coverage ≥ 80%>
Skill Composition
- Depends on: None
- Compatible with: None
- Conflicts with: None
- Related Skills: None
Quick Start / Implementation Example
- Review requirements and constraints
- Set up development environment
- Implement core functionality following patterns
- Write tests for critical paths
- Run tests and fix issues
- Document any deviations or decisions
# Example implementation following best practices
def example_function():
# Your implementation here
pass
Assumptions
- Organization processes personal data of Thai residents
- Consent can be obtained and tracked
- Data subject requests can be processed within time limits
- Data breach can be reported within required timeframe
Compatibility
- PDPA B.E. 2562 compliant (Data Collection)
- PDPA B.E. 2563 compliant (Data Use)
- PDPA B.E. 2564 compliant (Data Security)
- PDPA B.E. 2565 compliant (Data Subject Rights)
Test Scenario Matrix
| Scenario |
Input |
Expected Output |
Priority |
| Check data classification |
Data type |
Classification details |
P0 |
| Record consent |
User ID, data type, purpose |
Consent record created |
P0 |
| Withdraw consent |
User ID, data type |
Consent marked as withdrawn |
P0 |
| Submit access request |
User ID |
Request created and processed |
P0 |
| Submit erasure request |
User ID, reason |
Request created and processed |
P0 |
| Report breach |
Breach details |
Breach reported to PDPC |
P0 |
| Check DPO requirement |
Data type |
Boolean result |
P0 |
Technical Guardrails & Security Threat Model
1. Security & Privacy (Threat Model)
- Top Threats: Injection attacks, authentication bypass, data exposure
2. Performance & Resources
3. Architecture & Scalability
4. Observability & Reliability
Agent Directives & Error Recovery
(ข้อกำหนดสำหรับ AI Agent ในการคิดและแก้ปัญหาเมื่อเกิดข้อผิดพลาด)
- Thinking Process: Analyze root cause before fixing. Do not brute-force.
- Fallback Strategy: Stop after 3 failed test attempts. Output root cause and ask for human intervention/clarification.
- Self-Review: Check against Guardrails & Anti-patterns before finalizing.
- Output Constraints: Output ONLY the modified code block. Do not explain unless asked.
Definition of Done (DoD) Checklist
Anti-patterns
- Pre-checked Consent: Consent must be affirmative, not pre-checked
- Bundled Consent: Consent must be granular, not bundled
- Hard to Withdraw: Withdrawal must be as easy as giving consent
- No Legal Basis: Processing without documented legal basis
- Ignoring DPO Requirements: Not appointing DPO when required
Reference Links & Examples
- Internal documentation and examples
- Official documentation and best practices
- Community resources and discussions
Versioning & Changelog
- Version: 1.0.0
- Changelog:
- 2026-02-22: Initial version with complete template structure
1---2name: pdpa-compliance3description: PDPA (Personal Data Protection Act) is Thailand's comprehensive data protection law that regulates how organizations collect, use, and store personal data. This skill provides patterns for implementin4---5
6# Pdpa Compliance
7
8## Skill Profile
9*(Select at least one profile to enable specific modules)*
10- [ ] **DevOps**
11- [x] **Backend**
12- [ ] **Frontend**
13- [ ] **AI-RAG**
14- [ ] **Security Critical**
15
16## Overview
17PDPA (Personal Data Protection Act) is Thailand's comprehensive data protection law that regulates how organizations collect, use, and store personal data. This skill provides patterns for implementing PDPA compliance across all aspects of data processing.
18
19## Why This Matters
20PDPA compliance is essential for:
21- **Legal Requirements**: Mandatory for organizations processing personal data in Thailand
22- **Risk Mitigation**: Avoiding fines up to 5 million THB
23- **User Trust**: Demonstrating commitment to data protection
24- **Market Access**: Enabling business in Thailand market
25- **Brand Reputation**: Maintaining a positive public image
26
27---
28
29## Core Concepts & Rules
30
31### 1. Core Principles
32- Follow established patterns and conventions
33- Maintain consistency across codebase
34- Document decisions and trade-offs
35
36### 2. Implementation Guidelines
37- Start with the simplest viable solution
38- Iterate based on feedback and requirements
39- Test thoroughly before deployment
40
41
42## Inputs / Outputs / Contracts
43* **Inputs**:
44 - <e.g., env vars, request payload, file paths, schema>
45* **Entry Conditions**:
46 - <Pre-requisites: e.g., Repo initialized, DB running, specific branch checked out>
47* **Outputs**:
48 - <e.g., artifacts (PR diff, docs, tests, dashboard JSON)>
49* **Artifacts Required (Deliverables)**:
50 - <e.g., Code Diff, Unit Tests, Migration Script, API Docs>
51* **Acceptance Evidence**:
52 - <e.g., Test Report (screenshot/log), Benchmark Result, Security Scan Report>
53* **Success Criteria**:
54 - <e.g., p95 < 300ms, coverage ≥ 80%>
55
56## Skill Composition
57* **Depends on**: None
58* **Compatible with**: None
59* **Conflicts with**: None
60* **Related Skills**: None
61
62## Quick Start / Implementation Example
63
641. Review requirements and constraints
652. Set up development environment
663. Implement core functionality following patterns
674. Write tests for critical paths
685. Run tests and fix issues
696. Document any deviations or decisions
70
71```python
72# Example implementation following best practices
73def example_function():
74 # Your implementation here
75 pass
76```
77
78
79## Assumptions
80- Organization processes personal data of Thai residents
81- Consent can be obtained and tracked
82- Data subject requests can be processed within time limits
83- Data breach can be reported within required timeframe
84
85## Compatibility
86- PDPA B.E. 2562 compliant (Data Collection)
87- PDPA B.E. 2563 compliant (Data Use)
88- PDPA B.E. 2564 compliant (Data Security)
89- PDPA B.E. 2565 compliant (Data Subject Rights)
90
91---
92
93## Test Scenario Matrix
94| Scenario | Input | Expected Output | Priority |
95|----------|-------|-----------------|----------|
96| Check data classification | Data type | Classification details | P0 |
97| Record consent | User ID, data type, purpose | Consent record created | P0 |
98| Withdraw consent | User ID, data type | Consent marked as withdrawn | P0 |
99| Submit access request | User ID | Request created and processed | P0 |
100| Submit erasure request | User ID, reason | Request created and processed | P0 |
101| Report breach | Breach details | Breach reported to PDPC | P0 |
102| Check DPO requirement | Data type | Boolean result | P0 |
103
104---
105
106## Technical Guardrails & Security Threat Model
107
108### 1. Security & Privacy (Threat Model)
109* **Top Threats**: Injection attacks, authentication bypass, data exposure
110- [ ] **Data Handling**: Sanitize all user inputs to prevent Injection attacks. Never log raw PII
111- [ ] **Secrets Management**: No hardcoded API keys. Use Env Vars/Secrets Manager
112- [ ] **Authorization**: Validate user permissions before state changes
113
114### 2. Performance & Resources
115- [ ] **Execution Efficiency**: Consider time complexity for algorithms
116- [ ] **Memory Management**: Use streams/pagination for large data
117- [ ] **Resource Cleanup**: Close DB connections/file handlers in finally blocks
118
119### 3. Architecture & Scalability
120- [ ] **Design Pattern**: Follow SOLID principles, use Dependency Injection
121- [ ] **Modularity**: Decouple logic from UI/Frameworks
122
123### 4. Observability & Reliability
124- [ ] **Logging Standards**: Structured JSON, include trace IDs `request_id`
125- [ ] **Metrics**: Track `error_rate`, `latency`, `queue_depth`
126- [ ] **Error Handling**: Standardized error codes, no bare except
127- [ ] **Observability Artifacts**:
128 - **Log Fields**: timestamp, level, message, request_id
129 - **Metrics**: request_count, error_count, response_time
130 - **Dashboards/Alerts**: High Error Rate > 5%
131
132
133## Agent Directives & Error Recovery
134*(ข้อกำหนดสำหรับ AI Agent ในการคิดและแก้ปัญหาเมื่อเกิดข้อผิดพลาด)*
135
136- **Thinking Process**: Analyze root cause before fixing. Do not brute-force.
137- **Fallback Strategy**: Stop after 3 failed test attempts. Output root cause and ask for human intervention/clarification.
138- **Self-Review**: Check against Guardrails & Anti-patterns before finalizing.
139- **Output Constraints**: Output ONLY the modified code block. Do not explain unless asked.
140
141
142## Definition of Done (DoD) Checklist
143
144- [ ] Tests passed + coverage met
145- [ ] Lint/Typecheck passed
146- [ ] Logging/Metrics/Trace implemented
147- [ ] Security checks passed
148- [ ] Documentation/Changelog updated
149- [ ] Accessibility/Performance requirements met (if frontend)
150
151
152## Anti-patterns
153- **Pre-checked Consent**: Consent must be affirmative, not pre-checked
154- **Bundled Consent**: Consent must be granular, not bundled
155- **Hard to Withdraw**: Withdrawal must be as easy as giving consent
156- **No Legal Basis**: Processing without documented legal basis
157- **Ignoring DPO Requirements**: Not appointing DPO when required
158
159## Reference Links & Examples
160
161* Internal documentation and examples
162* Official documentation and best practices
163* Community resources and discussions
164
165
166## Versioning & Changelog
167
168* **Version**: 1.0.0
169* **Changelog**:
170 - 2026-02-22: Initial version with complete template structure
171