Pii Detection
Skill Profile
(Select at least one profile to enable specific modules)
Overview
Personally Identifiable Information (PII) detection is the process of identifying data that can be used to identify, contact, or locate an individual. Effective PII detection is critical for:
- Compliance: GDPR, CCPA, PDPA, HIPAA requirements
- Security: Preventing data breaches and unauthorized access
- Privacy: Protecting user information
- Risk Management: Understanding what sensitive data you have and where
Why This Matters
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 / Constraints / Non-goals
- Assumptions:
- Development environment is properly configured
- Required dependencies are available
- Team has basic understanding of domain
- Constraints:
- Must follow existing codebase conventions
- Time and resource limitations
- Compatibility requirements
- Non-goals:
- This skill does not cover edge cases outside scope
- Not a replacement for formal training
Compatibility & Prerequisites
- Supported Versions:
- Python 3.8+
- Node.js 16+
- Modern browsers (Chrome, Firefox, Safari, Edge)
- Required AI Tools:
- Code editor (VS Code recommended)
- Testing framework appropriate for language
- Version control (Git)
- Dependencies:
- Language-specific package manager
- Build tools
- Testing libraries
- Environment Setup:
.env.example keys: API_KEY, DATABASE_URL (no values)
Test Scenario Matrix (QA Strategy)
| Type |
Focus Area |
Required Scenarios / Mocks |
| Unit |
Core Logic |
Must cover primary logic and at least 3 edge/error cases. Target minimum 80% coverage |
| Integration |
DB / API |
All external API calls or database connections must be mocked during unit tests |
| E2E |
User Journey |
Critical user flows to test |
| Performance |
Latency / Load |
Benchmark requirements |
| Security |
Vuln / Auth |
SAST/DAST or dependency audit |
| Frontend |
UX / A11y |
Accessibility checklist (WCAG), Performance Budget (Lighthouse score) |
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 / Pitfalls
- ⛔ Don't: Log PII, catch-all exception, N+1 queries
- ⚠️ Watch out for: Common symptoms and quick fixes
- 💡 Instead: Use proper error handling, pagination, and logging
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
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: pii-detection3description: Personally Identifiable Information (PII) detection is the process of Use when this capability is needed.4---56# Pii Detection78## Skill Profile9*(Select at least one profile to enable specific modules)*10- [ ] **DevOps**11- [x] **Backend**12- [ ] **Frontend**13- [ ] **AI-RAG**14- [ ] **Security Critical**1516## Overview17Personally Identifiable Information (PII) detection is the process of identifying data that can be used to identify, contact, or locate an individual. Effective PII detection is critical for:1819- **Compliance**: GDPR, CCPA, PDPA, HIPAA requirements20- **Security**: Preventing data breaches and unauthorized access21- **Privacy**: Protecting user information22- **Risk Management**: Understanding what sensitive data you have and where2324## Why This Matters25- **<Benefit>**: <short explanation>26- **<Benefit>**: <short explanation>27- **<Benefit>**: <short explanation>2829## Core Concepts & Rules3031### 1. Core Principles32- Follow established patterns and conventions33- Maintain consistency across codebase34- Document decisions and trade-offs3536### 2. Implementation Guidelines37- Start with the simplest viable solution38- Iterate based on feedback and requirements39- Test thoroughly before deployment404142## Inputs / Outputs / Contracts43* **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%>5556## Skill Composition57* **Depends on**: None58* **Compatible with**: None59* **Conflicts with**: None60* **Related Skills**: None6162## Quick Start / Implementation Example63641. Review requirements and constraints652. Set up development environment663. Implement core functionality following patterns674. Write tests for critical paths685. Run tests and fix issues696. Document any deviations or decisions7071```python72# Example implementation following best practices73def example_function():74 # Your implementation here75 pass76```777879## Assumptions / Constraints / Non-goals8081* **Assumptions**:82 - Development environment is properly configured83 - Required dependencies are available84 - Team has basic understanding of domain85* **Constraints**:86 - Must follow existing codebase conventions87 - Time and resource limitations88 - Compatibility requirements89* **Non-goals**:90 - This skill does not cover edge cases outside scope91 - Not a replacement for formal training929394## Compatibility & Prerequisites9596* **Supported Versions**:97 - Python 3.8+98 - Node.js 16+99 - Modern browsers (Chrome, Firefox, Safari, Edge)100* **Required AI Tools**:101 - Code editor (VS Code recommended)102 - Testing framework appropriate for language103 - Version control (Git)104* **Dependencies**:105 - Language-specific package manager106 - Build tools107 - Testing libraries108* **Environment Setup**:109 - `.env.example` keys: `API_KEY`, `DATABASE_URL` (no values)110111112## Test Scenario Matrix (QA Strategy)113114| Type | Focus Area | Required Scenarios / Mocks |115| :--- | :--- | :--- |116| **Unit** | Core Logic | Must cover primary logic and at least 3 edge/error cases. Target minimum 80% coverage |117| **Integration** | DB / API | All external API calls or database connections must be mocked during unit tests |118| **E2E** | User Journey | Critical user flows to test |119| **Performance** | Latency / Load | Benchmark requirements |120| **Security** | Vuln / Auth | SAST/DAST or dependency audit |121| **Frontend** | UX / A11y | Accessibility checklist (WCAG), Performance Budget (Lighthouse score) |122123124## Technical Guardrails & Security Threat Model125126### 1. Security & Privacy (Threat Model)127* **Top Threats**: Injection attacks, authentication bypass, data exposure128- [ ] **Data Handling**: Sanitize all user inputs to prevent Injection attacks. Never log raw PII129- [ ] **Secrets Management**: No hardcoded API keys. Use Env Vars/Secrets Manager130- [ ] **Authorization**: Validate user permissions before state changes131132### 2. Performance & Resources133- [ ] **Execution Efficiency**: Consider time complexity for algorithms134- [ ] **Memory Management**: Use streams/pagination for large data135- [ ] **Resource Cleanup**: Close DB connections/file handlers in finally blocks136137### 3. Architecture & Scalability138- [ ] **Design Pattern**: Follow SOLID principles, use Dependency Injection139- [ ] **Modularity**: Decouple logic from UI/Frameworks140141### 4. Observability & Reliability142- [ ] **Logging Standards**: Structured JSON, include trace IDs `request_id`143- [ ] **Metrics**: Track `error_rate`, `latency`, `queue_depth`144- [ ] **Error Handling**: Standardized error codes, no bare except145- [ ] **Observability Artifacts**:146 - **Log Fields**: timestamp, level, message, request_id147 - **Metrics**: request_count, error_count, response_time148 - **Dashboards/Alerts**: High Error Rate > 5%149150151## Agent Directives & Error Recovery152*(ข้อกำหนดสำหรับ AI Agent ในการคิดและแก้ปัญหาเมื่อเกิดข้อผิดพลาด)*153154- **Thinking Process**: Analyze root cause before fixing. Do not brute-force.155- **Fallback Strategy**: Stop after 3 failed test attempts. Output root cause and ask for human intervention/clarification.156- **Self-Review**: Check against Guardrails & Anti-patterns before finalizing.157- **Output Constraints**: Output ONLY the modified code block. Do not explain unless asked.158159160## Definition of Done (DoD) Checklist161162- [ ] Tests passed + coverage met163- [ ] Lint/Typecheck passed164- [ ] Logging/Metrics/Trace implemented165- [ ] Security checks passed166- [ ] Documentation/Changelog updated167- [ ] Accessibility/Performance requirements met (if frontend)168169170## Anti-patterns / Pitfalls171172* ⛔ **Don't**: Log PII, catch-all exception, N+1 queries173* ⚠️ **Watch out for**: Common symptoms and quick fixes174* 💡 **Instead**: Use proper error handling, pagination, and logging175176177## Reference Links & Examples178179* Internal documentation and examples180* Official documentation and best practices181* Community resources and discussions182183184## Versioning & Changelog185186* **Version**: 1.0.0187* **Changelog**:188 - 2026-02-22: Initial version with complete template structure189190---191> Converted and distributed by [TomeVault](https://tomevault.io/claim/amnadtaowsoam) — claim your Tome and manage your conversions.192<!-- tomevault:4.0:skill_md:2026-04-13 -->