Xpersona
D

Document Sanitizer

CLAWHUB · Unverified

Batch desensitize docx/xlsx files via keyword and regex rules, with one-click reversible restoration. Replace sensitive terms (company names, personal info,... Skill: Document Sanitizer Owner: longjf25 Summary: Batch desensitize docx/xlsx files via keyword and regex rules, with one-click reversible restoration. Replace sensitive terms (company names, personal info,... Tags: latest:1.5.1, latest utility document security:1.2.1 Version history: v1.5.1 | 2026-04-09T04:13:40.485Z | user 只扫描 raw 文件夹,修复子目录文件名恢复问题 / Scan only raw folder, fix filename restore in subdirectories v1.5

62
Rank
84
Safety
1.0k
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 1K downloads reported by the source. Last updated 10/11/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s171gz7gmrefdayrd3gs39znf583tmf4:document-sanitizer
  1. Setup complexity is classified as HIGH. You must provision dedicated cloud infrastructure or an isolated VM. Do not run this directly on your local workstation.
  2. Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-longjf25-document-sanitizer/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

67,955 characters of source documentation, loaded on request.

Extracted files

4 files captured from the source.

SKILL.md

---
name: document-sanitizer
description: >
  Batch desensitize docx/xlsx files via keyword and regex rules, with one-click reversible restoration.
  Replace sensitive terms (company names, personal info, phone numbers, IDs, emails) with safe placeholders,
  then restore originals anytime using the unified mapping record.
description_zh: "批量对 docx/xlsx 文件执行关键字和正则脱敏替换,支持一键反向恢复"
description_en: "Batch desensitize docx/xlsx files via keyword and regex rules, with one-click reversible restoration"
license: MIT
metadata:
  version: "1.5.1"
  category: document-processing
  author: longjf25
  platform: Cross-platform
  requirements:
    - Python 3.8+
    - python-docx
    - openpyxl
    - (Optional) pywin32 + Microsoft Word for .doc auto-conversion on Windows
    - (Optional) xlrd for .xls auto-conversion
triggers:
  - desensitize documents
  - sanitize docx xlsx
  - 文档脱敏
  - 批量脱敏
  - 敏感词替换
  - 脱敏恢复
  - document sanitization
  - redact sensitive data
---

# document-sanitizer

## 技能说明 / Skill Description

### 概述 / Overview

本技能用于批量对 Word (.docx) 和 Excel (.xlsx) 文件执行脱敏处理,支持关键字精确替换和正则表达式动态替换,并提供一键恢复功能。

This skill batch-desensitizes Word (.docx) and Excel (.xlsx) files using keyword exact-match and regex dynamic replacement, with one-click reversible restoration.

### 核心特性 / Key Features

| 特性 | 说明 / Description |
|------|-------------------|
| 关键字精确替换 / Exact Match | 配置关键字对,替换为带 `[]` 标记的占位符(如"白云"→`[黑水]`)|
| 正则动态替换 / Regex Dynamic | 匹配手机号、身份证号、邮箱等,自动生成占位符如 `[RED_手机号_1]` |
| 文件名脱敏 / Filename Sanitization | 默认开启,输出文件自动使用脱敏后的文件名 |
| 统一脱敏记录 / Unified Record | 所有映射累积到 `_sanitize_record.json`,无论文档如何修改都能恢复 |
| 一键恢复 / One-Click Restore | 读取记录反向替换,还原文件名和内容,校验残留占位符 |
| 旧格式自动转换 / Legacy Format Conversion | 检测到 .doc/.xls 时提示自动转换为 .docx/.xlsx |

---

## 前置依赖 / Prerequisites

### Python 包依赖 / Python Dependencies

```bash
pip install python-docx openpyxl
```

### 可选依赖(旧格式转换)/ Optional (Legacy Format Conversion)

```bash
pip install xlrd pywin32
```

- `.doc → .docx` 转换需要 Windows + Microsoft Word(使用 Word COM 自动化)
- `.xls → .xlsx` 转换使用 xlrd + openpyxl(跨平台)

---

## 使用方法 / Usage

### 1. 准备配置文件 / Prepare Config File

在工作目录下创建 `_sanitize_config.json`:

Create `_sanitize_config.json` in your workspace:

```json
{
  "exact_rules": [
    {"pattern": "白云", "replacement": "黑水"},
    {"pattern": "南方", "replacement": "北风"},
    {"pattern": "广州", "replacement": "镇北"}
  ],
  "regex_rules": [
    {"pattern": "1[3-9]\\d{9}", "label": "手机号"},
    {"pattern": "\\d{6}(?:19|20)\\d{2}(?:0[1-9]|1[0-2])(?:0[1-9]|[12]\\d|3[01])\\d{3}[\\dXx]", "label": "身份证号"},
    {"pattern": "[a-zA-Z0-9._%+\\-]+@[a-zA-Z0-9.\\-]+\\.[a-zA-Z]{2,}", "label": "邮箱"}
  ]
}
```

### 2. 执行脱敏 / Run Sanitization

```bash
# 基本脱敏(默认脱敏文件名)
python <skill_dir>/scripts/sanitize.py sanitize <工作目录>

# 不脱敏文件名
python <skill_dir>/scripts/sanitize.py sanitize <工作目录> --no-rename

# 自动转换 .doc/.xls 旧格式文件
python <skill_dir>/script

_meta.json

{
  "ownerId": "kn747z60pfarj1jd6chhcttzan81yj7n",
  "slug": "document-sanitizer",
  "version": "1.5.1",
  "publishedAt": 1775708020485
}

scripts/_sanitize_config_example.json

{
  "exact_rules": [
    {"pattern": "白云", "replacement": "黑水"},
    {"pattern": "南方", "replacement": "北风"},
    {"pattern": "南航", "replacement": "北辰"},
    {"pattern": "国际货站", "replacement": "超级货站"},
    {"pattern": "进港室", "replacement": "进口室"},
    {"pattern": "广州", "replacement": "镇北"}
  ],
  "regex_rules": [
    {"pattern": "1[3-9]\\d{9}", "label": "手机号"},
    {"pattern": "\\d{6}(?:19|20)\\d{2}(?:0[1-9]|1[0-2])(?:0[1-9]|[12]\\d|3[01])\\d{3}[\\dXx]", "label": "身份证号"},
    {"pattern": "[a-zA-Z0-9._%+\\-]+@[a-zA-Z0-9.\\-]+\\.[a-zA-Z]{2,}", "label": "邮箱"}
  ]
}

skill-card.md

## Description:

Batch desensitize docx/xlsx files via keyword and regex rules, with one-click reversible restoration.

This skill is ready for commercial/non-commercial use.

## Publisher:

[longjf25](https://clawhub.ai/user/longjf25)

### License/Terms of Use:

MIT

## Use Case:

Developers and document operators use this skill to sanitize Word and Excel workspaces by replacing configured sensitive terms, regex matches, and filenames with placeholders, then restore originals from the generated mapping record when needed.

### Deployment Geography for Use:

Global

## Known Risks and Mitigations:

Risk: The restoration record can expose original sensitive values needed to undo redaction.

Mitigation: Keep _sanitize_record.json out of source control and shared folders, review it before use, and delete it when restoration is no longer needed.

Risk: File-writing and conversion behavior can affect workspace outputs or invoke external converters.

Mitigation: Run only in a controlled workspace, review _sanitize_config.json before execution, and avoid --auto-convert unless the external converter skill is trusted and unchanged.

## Reference(s):

- [Document Sanitizer ClawHub release](https://clawhub.ai/longjf25/skills/document-sanitizer)

## Skill Output:

**Output Type(s):** [text, markdown, code, shell commands, configuration, guidance]

**Output Format:** [Markdown guidance with JSON configuration examples and shell commands]

**Output Parameters:** [1D]

**Other Properties Related to Output:** [Produces guidance for running a sanitizer script that writes sanitized files, restored files, and a sensitive mapping record in the target workspace.]

## Skill Version(s):

1.5.1 (source: server release metadata and skill frontmatter)

## Ethical Considerations:

Users should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.

Sponsored

Ads related to Document Sanitizer and adjacent AI workflows.