thai-id-validate
Skill4 starsChanged 2 months agoMITView on GitHub
Use this skill for any task validating a Thai national ID or tax ID checksum, normalizing a Thai phone number, or generating a PromptPay QR code payload. Trigger on "เลขบัตรประชาชน", "เลขประจำตัวผู้เสียภาษี", "checksum บัตรประชาชน", "PromptPay QR", "สร้าง QR พร้อมเพย์", "Thai national ID validate", "13 digit ID checksum". If the task only needs a regex length check with no checksum or QR generation, this skill is still the right one to load — a naive 13-digit regex is exactly the mistake this skill exists to prevent.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- Boom-Vitt/claude-thai-skillstheir own version, first seen Nov 1, 2026
- Aether-GenesiZ/thai-agent-skillstheir own version, first seen Nov 1, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- Boom-Vitt/claude-thai-skills★ 58same name
- Aether-GenesiZ/thai-agent-skills★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository58 other files it gives its agents.
- AGENTS.mdAGENTS.md
- skills/project-docs-prep/templates/AGENTS.mdAGENTS.md
- skills/project-docs-prep/templates/CLAUDE.mdCLAUDE.md
- deep-planningSkill
- deep-planningSkill
- deprecatedSkill
- architecture-reviewSkill
- code-reviewSkill
- diagnoseSkill
- tddSkill
- ui-design-engineeringSkill
- ux-ui-design-assessmentSkill
- in-progressSkill
- mcp-tool-managementSkill
- skill-managementSkill
- obsidian-canvasSkill
- obsidian-markdownSkill
- obsidian-notion-bridgeSkill
- obsidian-vault-workflowSkill
- boomz-preferencesSkill
- personal-agent-workflowSkill
- personalSkill
- automation-designSkill
- grill-with-docsSkill
- handoffSkill
- inbox-meeting-triageSkill
- markdown-reportSkill
- prompt-improvementSkill
- project-docs-prepSkill
- claim-citation-checkSkill
- daily-news-reportSkill
- github-skill-researchSkill
- project-discoverySkill
- repo-tourSkill
- research-methodologySkill
- seo-website-evaluatorSkill
- thaiSkill
- thai-addressSkill
- thai-customer-serviceSkill
- thai-date-formatSkill
- thai-festival-cardSkill
- thai-government-formSkill
- thai-invoiceSkill
- thai-pdpaSkill
- thai-resumeSkill
- thai-social-captionSkill
- thai-text-processingSkill
- thai-translateSkill
- backtest-expertSkill
- dividend-value-screenerSkill
- drawdown-circuit-breakerSkill
- exposure-coachSkill
- market-breadth-analyzerSkill
- portfolio-managerSkill
- position-sizerSkill
- tradingSkill
- trader-memory-coreSkill
- uptrend-analyzerSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 70
Run python3 validate.py for the self-test — includes a CRC-16/CCITT-FALSE reference check value ("123456789" → 0x29B1, the standard …
- Very specific: line 76
Only mobile-number and national-ID proxy types are implemented.
- Distinctive: line 77
All example IDs used in this skill's self-test are generated by the checksum function itself — never hardcode or commit a real person's …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Thai ID / Phone / PromptPay Validation
Overview
A Thai national ID (and tax ID, same 13-digit scheme) has a checksum digit, not just a fixed length — a model that validates with ^\d{13}$ alone will happily accept an ID that fails the real check. PromptPay QR codes are EMVCo TLV-encoded with a CRC-16 checksum; hand-rolling this without the exact tag structure and CRC algorithm produces a QR code that scanner apps reject. This skill supplies the real checksum algorithm, phone normalization, and a working EMVCo payload builder.
When to use
- ตรวจเลขบัตรประชาชน/เลขผู้เสียภาษี 13 หลักว่า checksum ผ่านไหม
- Normalizing a Thai phone number from mixed formats (
081-234-5678,+66 81 234 5678,66812345678) to a single canonical form - Generating a PromptPay QR payload string for a mobile number or national ID proxy, static or with a fixed amount
When NOT to use
- The task needs to verify an ID belongs to a real, specific person — that requires a government lookup (DOPA), not a checksum; checksum only proves the number is well-formed, not that it is real or belongs to anyone in particular
- The task needs an actual scannable QR image — this skill produces the payload string; rendering it as a QR code image needs a QR-encoding library (e.g.
qrcodein Python), which is outside this skill's scope
Core knowledge
National ID / tax ID checksum (13 digits, weighted mod-11):
sum = Σ d[i] * (13 - i) for i = 0..11 (first 12 digits)
check_digit = (11 - (sum % 11)) % 10The 13th digit must equal check_digit. This is the same algorithm for a personal national ID and a juristic-person tax ID.
Phone normalization: canonical local form is 0 + 9 digits (10 digits total, e.g. 0812345678). International form drops the leading 0 and prefixes 66 (e.g. 66812345678 or +66 81 234 5678).
PromptPay QR payload (EMVCo QR Code for Payment Systems, Thai PromptPay profile): a flat TLV (tag-length-value) string:
| Tag | Meaning | Value |
00 | Payload Format Indicator | 01 |
01 | Point of Initiation Method | 11 static (no amount) / 12 dynamic (fixed amount) |
29 | Merchant Account Info (PromptPay) | nested TLV: 00=GUID A000000677010111, 01=mobile proxy (0066 + 9-digit phone) or 02=13-digit national/tax ID proxy |
53 | Transaction Currency | 764 (ISO 4217 numeric code for THB) |
54 | Transaction Amount | THB amount, 2 decimals — only present on a dynamic QR |
58 | Country Code | TH |
63 | CRC | CRC-16/CCITT-FALSE (poly 0x1021, init 0xFFFF, no reflect, xorout 0) of everything up to and including the 6304 tag+length prefix, appended as 4 uppercase hex digits |
Each TLV entry is tag(2 chars) + length(2-digit decimal) + value.
Common mistakes
- Validating a Thai ID with only a
^\d{13}$length regex — misses the checksum entirely, the most common "looks valid, isn't" bug. - Computing the checksum with the wrong digit order or off-by-one weight — the weight is
13 - ifor 0-indexedi, not12 - ior reversed. - Normalizing a phone number by just stripping dashes without handling the
+66/66international prefix — produces an 11-12 digit string that isn't the canonical local form. - Building a PromptPay payload with the wrong CRC algorithm (e.g. plain CRC-16/IBM or a reflected variant) — the spec requires CRC-16/CCITT-FALSE specifically; any other variant produces a QR that fails the bank app's checksum check even though it looks structurally right.
- Forgetting that the CRC is computed over the payload string up to and including the literal
6304prefix, not the full string with a placeholder CRC already in it. - Using proxy type
02(national ID) with an ID that hasn't been checksum-validated first — a malformed ID produces a QR that scans but routes to nothing.
Code
validate.py — no dependencies:
validate_thai_id(id_number)→bool, accepts input with spaces/dashescompute_thai_id_checksum(first_12_digits)→ the check digitgenerate_test_id(first_12_digits)→ checksum-valid synthetic ID, for test fixtures onlynormalize_phone(raw)→ canonical0XXXXXXXXXformbuild_promptpay_payload(proxy_type, proxy_value, amount=None)→proxy_typeis"mobile"or"national_id"crc16_ccitt_false(data: bytes)→ the raw CRC, independently testable against the standard catalogue vector
Run python3 validate.py for the self-test — includes a CRC-16/CCITT-FALSE reference check value ("123456789" → 0x29B1, the standard catalogue test vector) plus round-trip checksum generation/validation and full TLV round-trip parsing of a generated PromptPay payload.
Known limitations
- Checksum validation proves the number is well-formed, not that it belongs to a real, specific person — never treat a passing checksum as identity verification.
build_promptpay_payloaddoes not render an image; pass the returned string to a QR-encoding library to get a scannable image.- Only mobile-number and national-ID proxy types are implemented; e-Wallet ID proxy (tag
03) is not covered. - All example IDs used in this skill's self-test are generated by the checksum function itself — never hardcode or commit a real person's national ID as a "test fixture."
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.

