← 返回 Skills 市场
149
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install china-idcard
功能描述
中国居民身份证号码解析与验证。Use when the user provides a Chinese ID card number and wants to extract information (province, city, district, birthdate, gender, age) or val...
使用说明 (SKILL.md)
中国身份证解析 China ID Card Parser
解析中国居民身份证18位号码,提取全部信息并验证合法性。完全离线,零依赖。
触发时机
- 用户提供身份证号码,要求解析或验证
- "这个身份证号是哪里的" / "帮我验证一下这个身份证号"
- "这个人多大了" / "这个号码是男是女"
- 表单校验、信息核对、年龄计算场景
身份证号码结构(18位)
[1-2位] 省级代码
[3-4位] 市级代码
[5-6位] 县区代码
[7-14位] 出生日期(YYYYMMDD)
[15-17位] 顺序码(奇数=男,偶数=女)
[18位] 校验码(0-9或X)
第一步:格式预处理
1. 去除空格、横线等分隔符
2. 统一转为大写(末位X)
3. 验证长度必须为18位
4. 验证前17位全为数字,第18位为数字或X
第二步:校验码验证(必须执行)
加权系数:7 9 10 5 8 4 2 1 6 3 7 9 10 5 8 4 2
计算步骤:
1. 将前17位数字依次乘以对应加权系数,求和
2. 和值对11取模,得到余数(0-10)
3. 余数对应校验码:
余数 0 → X (注意:是字母X,不是数字)
余数 1 → 0
余数 2 → 9
余数 3 → 8
余数 4 → 7
余数 5 → 6
余数 6 → 5
余数 7 → 4
余数 8 → 3
余数 9 → 2
余数 10 → 1
4. 与第18位比对,不一致则校验码错误
第三步:出生日期验证
从第7-14位提取:YYYY MM DD
验证:
- 年份在 1900-当前年份 之间
- 月份在 01-12 之间
- 日期与月份匹配(注意闰年2月29日)
- 不能是未来日期
第四步:地区代码解析
省级代码(前2位)
11 北京市 12 天津市 13 河北省 14 山西省
15 内蒙古自治区 21 辽宁省 22 吉林省 23 黑龙江省
31 上海市 32 江苏省 33 浙江省 34 安徽省
35 福建省 36 江西省 37 山东省 41 河南省
42 湖北省 43 湖南省 44 广东省 45 广西壮族自治区
46 海南省 50 重庆市 51 四川省 52 贵州省
53 云南省 54 西藏自治区 61 陕西省 62 甘肃省
63 青海省 64 宁夏回族自治区 65 新疆维吾尔自治区
71 台湾省 81 香港特别行政区 82 澳门特别行政区
市级和县区代码(3-6位):告知用户所属省份后,说明市县代码可参考《GB/T 2260》国家标准,或告知前6位行政区划代码对应的具体地区名称(如有内置数据则直接给出,否则给出省级信息)。
常见行政区划代码示例
110100 北京市市辖区 110101 北京市东城区 110102 北京市西城区
110105 北京市朝阳区 110106 北京市丰台区 110107 北京市石景山区
110108 北京市海淀区 110111 北京市房山区 110112 北京市通州区
310100 上海市市辖区 310101 上海市黄浦区 310104 上海市徐汇区
310105 上海市长宁区 310106 上海市静安区 310107 上海市普陀区
310109 上海市虹口区 310110 上海市杨浦区 310112 上海市闵行区
440100 广州市 440101 广州市市辖区 440103 广州市荔湾区
440104 广州市越秀区 440105 广州市海珠区 440106 广州市天河区
440111 广州市白云区 440113 广州市番禺区 440300 深圳市
440301 深圳市市辖区 440303 深圳市罗湖区 440304 深圳市福田区
440305 深圳市南山区 440306 深圳市宝安区 440307 深圳市龙岗区
320100 南京市 320200 无锡市 320500 苏州市
330100 杭州市 330200 宁波市 330400 嘉兴市
500100 重庆市市辖区 510100 成都市 420100 武汉市
430100 长沙市 350200 厦门市 370100 济南市
370200 青岛市 610100 西安市 230100 哈尔滨市
第五步:性别判断
第17位(顺序码末位):
- 奇数(1,3,5,7,9)→ 男性
- 偶数(0,2,4,6,8)→ 女性
第六步:年龄计算
当前日期 - 出生日期 = 周岁年龄
注意:未过生日则年龄 = 当年年份 - 出生年份 - 1
格式化输出
验证通过
🪪 身份证解析结果
━━━━━━━━━━━━━━━━━━━━
号码:110105 19900315 001 X(已脱敏展示)
校验:✅ 合法
基本信息:
归属地:北京市 朝阳区
出生日期:1990年03月15日
性别:男
当前年龄:36岁(未过今年生日则35岁)
号码解析:
省级代码:11(北京市)
地区代码:110105(朝阳区)
顺序码:001(第1个登记)
校验码:X ✅
验证失败
🪪 身份证验证结果
━━━━━━━━━━━━━━━━━━━━
号码:xxxxxxxxxxxxxx(已脱敏)
校验:❌ 无效
原因:校验码错误(填写了5,计算应为X)
提示:请核对原始证件上的号码是否录入正确
常见错误类型
❌ 长度不是18位 → 提示正确长度
❌ 含非法字符 → 指出哪个字符不合法
❌ 省级代码不存在 → 提示前2位不在有效范围
❌ 出生日期无效 → 具体说明哪里不合理
❌ 校验码错误 → 给出正确校验码供核对
隐私处理规则
输出时对号码进行脱敏:
原始:110105199003150012
展示:1101051990****0012(中间出生日期后4位隐藏)
或按场景选择:110105 19900315 **1 2(顺序码隐藏)
重要:不得将完整身份证号原样输出,始终脱敏后展示。
特殊证件说明
遇到以下证件格式时,说明不适用本解析规则并提供对应说明:
港澳居民来往内地通行证(回乡证):
格式:H/M + 8位数字,H=香港,M=澳门
不含出生日期等信息,无法用本规则解析
台湾居民来往大陆通行证(台胞证):
格式:8位数字,或新版18位
新版18版可按身份证规则解析
外国人永久居留证:
格式:字母+数字组合,长度不固定
不适用本规则
护照:
中国护照:E + 8位数字
不含居住地信息,不适用本规则
注意事项
- 校验通过≠真实存在:号码格式合法不代表该身份证确实被签发
- 归属地是户籍登记地,不是用户当前居住地
- 部分旧版15位身份证需先转换为18位再解析(补充出生年份世纪位+重算校验码)
- 本 skill 仅做格式解析,不联网核验真实性
安全使用建议
This skill appears coherent and low-risk: it runs offline, needs no secrets, and instructs masking of ID numbers. Important practical notes before installing or using it: (1) ID numbers are sensitive personal data — avoid pasting real IDs unless you trust the execution environment and platform logging/retention policies; (2) verify whether the agent/runtime records or sends user inputs to logs or telemetry (the skill itself says 'offline' but the platform may capture inputs); (3) test with synthetic/example numbers first to confirm behavior and regional-code coverage; (4) if you need authoritative verification (issuance/validity), use an official government/API service, since format/ checksum validation does not prove a number was actually issued.
功能分析
Type: OpenClaw Skill
Name: china-idcard
Version: 1.0.0
The skill bundle provides instructions for an AI agent to parse and validate Chinese ID card numbers offline. It contains logic for checksum verification, region mapping, and age calculation, and includes explicit privacy instructions in SKILL.md to desensitize/mask sensitive data before displaying it to the user. No network access, data exfiltration, or malicious execution patterns were found.
能力评估
Purpose & Capability
Name/description (China ID card parser and validator) align with the SKILL.md. The skill asks for no credentials, binaries, or installs — all appropriate for a pure parsing/validation utility.
Instruction Scope
SKILL.md contains step-by-step, self-contained parsing and validation logic (format normalization, checksum calc, birthdate check, region code guidance, gender/age derivation). It explicitly states 'fully offline' and instructs desensitization of outputs; it does not direct reading unrelated files, environment variables, or network calls.
Install Mechanism
Instruction-only skill with no install spec and no code files — lowest-risk installation footprint (nothing written to disk by the skill itself).
Credentials
No required environment variables, credentials, or config paths. Requested access is proportionate to the stated parsing task.
Persistence & Privilege
always is false and the skill is user-invocable. It does not request persistent system privileges or modifications to other skills' configs.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install china-idcard - 安装完成后,直接呼叫该 Skill 的名称或使用
/china-idcard触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
- Initial release of the china-idcard skill.
- Provides fully offline parsing and verification for Chinese mainland ID card numbers.
- Extracts province, city, district, birthdate, gender, and age from ID numbers.
- Validates ID number format and checksum.
- Offers format hints and support notes for Hong Kong, Macau, Taiwan permits, and passport numbers.
- Ensures all outputs are privacy-conscious, with partial redaction of ID numbers.
元数据
常见问题
China Idcard 是什么?
中国居民身份证号码解析与验证。Use when the user provides a Chinese ID card number and wants to extract information (province, city, district, birthdate, gender, age) or val... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 149 次。
如何安装 China Idcard?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install china-idcard」即可一键安装,无需额外配置。
China Idcard 是免费的吗?
是的,China Idcard 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
China Idcard 支持哪些平台?
China Idcard 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 China Idcard?
由 ToBeWin(@tobewin)开发并维护,当前版本 v1.0.0。
推荐 Skills