Skip to content
Skills Library
Security · Automation

data-masking

/data-masking

AI 脱敏技能。当用户需要对文档或数据中的个人敏感信息(PII)进行全量、不可逆脱敏时使用。

Licence
MIT
Last repository change
11.08.2026

Assessment and security

96/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability21 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
3
Scripts
1
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 11.08.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What to check before installing
  • 1 scripts in this package. Review them before installing, as Claude may execute them.

Scripts: scripts/mask.py

What it does and when to use it

AI 脱敏技能。当用户需要对文档或数据中的个人敏感信息(PII)进行全量、不可逆脱敏时使用。

Original author description

AI 脱敏技能。当用户需要对文档或数据中的个人敏感信息(PII)进行全量、不可逆脱敏时使用。

How it works

  1. 适用场景
  2. 脱敏范围(全量)
  3. 脱敏方式(不可逆)
  4. 脱敏规则示例
  5. 处理流程
  6. 正则 / 工具建议
  7. 重要声明与合规边界
  8. 脚本说明
Original SKILL.md headings · 96 lines, 312 words
SKILL.md preview
---
name: data-masking
description: AI 脱敏技能。当用户需要对文档或数据中的个人敏感信息(PII)进行全量、不可逆脱敏时使用。
---

# AI 脱敏技能(Data Masking)

## 适用场景

对含个人敏感信息(PII)的文档、文本或数据集进行脱敏处理,使其可在不暴露个人隐私的前提下用于分析、共享、训练或归档。

## 脱敏范围(全量)

本技能对以下敏感字段进行**全量**识别与脱敏:

| 类别 | 示例 |
| --- | --- |
| 身份证号 | 18 位 / 15 位居民身份证 |
| 手机号 | 11 位中国大陆手机号 |
| 银行卡号 | 16~19 位卡号 |
| 姓名 | 中文姓名 / 英文姓名 |
| 地址 | 详细居住 / 通讯地址 |
| 邮箱 | 电子邮箱地址 |
| 护照号 | 护照号码 |
| 车牌号 | 机动车牌照 |
| IP 地址 | IPv4 / IPv6 |
| 其他 | 社保号、驾驶证号、微信号等可按需扩展 |

## 脱敏方式(不可逆)

本技能采用**不可逆**脱敏,**不生成、不保留任何还原映射表**:

- **掩码替换**:保留少量前后缀,中间以 `*` 替换(默认方式)
- **哈希**:对字段做单向哈希(如 SHA-256),输出定长摘要
- **删除**:直接移除敏感内容或以通用占位符替换(如 `[REDACTED]`)

> ⚠️ 不可逆意味着脱敏后**无法还原**原始数据。如需可逆脱敏,请勿使用本技能。

## 脱敏规则示例

| 字段 | 规则 | 示例输入 → 输出 |
| --- | --- | --- |
| 身份证号 | 保留前 6 后 4 | `110101199001011234` → `110101********1234` |
| 手机号 | 保留前 3 后 4 | `13812345678` → `138****5678` |
| 银行卡号 | 保留后 4 | `6222021234567890` → `************7890` |
| 姓名 | 保留姓 | `张三丰` → `张**` |
| 邮箱 | 保留首字符与域名 | `zhangsan@example.com` → `z***@example.com` |
| IP 地址 | 末段掩码 | `192.168.1.100` → `192.168.1.*` |

## 处理流程

1. **扫描识别**:按字段类型用正则 / 规则 / 模型扫描全部文本
2. **分类匹配**:将命中文本归类到对应敏感字段类型
3. **替换脱敏**:按规则做不可逆替换(掩码 / 哈希 / 删除)
4. **校验覆盖**:复核是否仍有残留敏感信息,确保无遗漏

## 正则 / 工具建议

- **正则匹配**:身份证、手机、银行卡、邮箱、IP 等均可由正则覆盖(注意边界与误判)
- **姓名 / 地址**:正则难以精准,建议结合 NER 模型(如人名、地名识别)或词表
- **批量处理**:对结构化数据可用 pandas 向量化替换;对文档文本可逐段扫描

> 脱敏需平衡**召回**(不漏)与**精度**(不误伤),关键场景应人工抽检。

## 重要声明与合规边界

- **不可逆**:脱敏后无法还原,处理前**务必做好原始数据备份**。
- **本地优先**:敏感数据建议在本地 / 受控环境处理,避免上传至外部服务。
- **合规**:脱敏不等同于匿名化,仍需结合《个人信息保护法》等法规要求评估再识别风险。
- **范围确认**:处理前应与用户确认脱敏字段范围与规则,避免过度或不足。

## 脚本说明

本工具自带脚本,位于 `scripts/` 下,可单独运行(仅依赖 Python 标准库):

| 文件 | 作用 |
| --- | --- |
| `scripts/mask.py` | 脱敏主脚本:正则识别身份证、银行卡、手机号、邮箱、IP,支持掩码/哈希/删除三种模式 |
| `scripts/requirements.txt` | 依赖清单(当前仅用标准库;预留 NER 扩展位) |

### 安装与用法

```bash
# 无需额外安装(纯标准库);如未来扩展 NER 再 pip install -r scripts/requirements.txt

# 脱敏文件(默认 mask 掩码模式)
python scripts/mask.py --input 敏感数据.txt --output 已脱敏.txt

# 哈希模式(输出 SHA-256 摘要前 16 位)
python scripts/mask.py --input 敏感数据.txt --mode hash

# 删除模式(统一替换为 [REDACTED])
python scripts/mask.py --input 敏感数据.txt --mode redact

# 管道方式
cat 敏感数据.txt | python scripts/mask.py > 已脱敏.txt
```

运行后会在 stderr 输出各类字段命中数量,便于核对覆盖情况。脱敏规则与字段类型对应关系见上方"脱敏规则示例"。
Files in this package (3)
  • SKILL.md 4 KB
  • scripts/mask.py 4 KB
  • scripts/requirements.txt 1 KB

Versions

RepositoryScoreLicence
This page · auditaih/audit-tool-skills96MIT
TerminalSkills/skills100Apache-2.0

Database snapshot: 13.11.2026 · package version 614b796d27a8 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 4 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 86sordino-openai
    Use when working in a Codex project that routes OpenAI traffic through Sordino for local PII masking.
  • 90backend-data-masking
    Use this skill when the user says 'data masking', 'PII', 'personally identifiable information', 'encryption', 'anonymization', 'GDPR', 'CCPA', 'data privacy', 'field-level encryption', 'tokenization', 'redaction', 'data classification'. This skill masks, encrypts, and anonymizes…
  • 100masking-pii-data
    Protect personally identifiable information in data pipelines — classifying PII, choosing masking vs tokenization vs hashing vs encryption, dynamic data masking and column-level access control, and handling deletion/right-to-be-forgotten. Use when handling sensitive data,…
  • 100platform-datamask-run
    Data Mask end-to-end operation on a sandbox: configure a masking policy over PII, run the masking job, poll it to completion, report masked-record results, and abort an in-progress run. Use when the user needs to run, monitor, or cancel a Salesforce Data Mask job, mask…
  • 100sensitive-data-protection
    OWASP A03 - Sensitive Data Exposure Prevention. Use this skill when handling PII, passwords, credit cards, API keys, or any sensitive information. Activate when: encryption, PII, personal data, credit card, SSN, password storage, HTTPS, TLS, data at rest, data in transit, GDPR,…
  • 100safe-handling-of-personally-identifiable-information
    Use this skill when protecting personally identifiable information (PII) using data masking, tokenization, hashing, and field-level encryption.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.