360 Secure SkillHub
360 安全技能中心

Text Compressor

该 Skill 提供基于 Python 脚本的文本压缩能力:按 1-3 级对文本文件执行空白清理、行尾规范、短语缩写与激进缩写,输出压缩后文件并显示节省字节数与压缩比例。压缩默认为单向操作,--decompress 仅能近似还原;级别越高对可读性影响越大,换行结构始终保留。

fuzzyb33s
fuzzyb33s
热度 44.59
最近更新 2026-06-20 07:28:53
分类:效率依赖:代码执行 / 读写文件应用场景:文件转换 / 工作流

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add text-compressor
Metadata
name
text-compressor
description
Compress and decompress text files using smart abbreviation and whitespace normalization. Use when user asks to compress, shrink, reduce, or optimize text file size while preserving readability. Also use for batch text processing, file size reduction, or text cleanup.

Text Compressor Skill

Compress text files using configurable levels of text abbreviation while keeping content readable.

Usage

Basic Compression

python scripts/compress.py <input_file> [output_file] [--level 1-3]

Decompress (restore approximation)

python scripts/compress.py <input_file> [output_file] --decompress [--level 1-3]

Levels

  • Level 1 — Clean whitespace, normalize line breaks, preserve all words
  • Level 2 — + Smart phrase contractions (that is -> that's, you are -> ur, etc.)
  • Level 3 — + Aggressive abbreviations (because -> bc, through -> thru, etc.)

Examples

  • compress.py report.txt — compress report.txt → report.txt.compressed
  • compress.py input.txt output.txt --level 2 — medium compression to specific output
  • compress.py compressed.txt --decompress — attempt to restore (approximate)

Output

Shows bytes saved and percentage reduction.

Notes

  • Compression is one-way by default. Use --decompress to attempt restoration (approximate only).
  • Level 1 is safe for all content. Higher levels may affect readability.
  • Always preserves line break structure.