# Send File Compression to your agent
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
## Fast path
- Download the package from Yavira.
- Extract it into a folder your agent can access.
- Paste one of the prompts below and point your agent at the extracted folder.
## Suggested prompts
### New install

```text
I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete.
```
### Upgrade existing

```text
I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run.
```
## Machine-readable fields
```json
{
  "schemaVersion": "1.0",
  "item": {
    "slug": "file-compression",
    "name": "File Compression",
    "source": "tencent",
    "type": "skill",
    "category": "效率提升",
    "sourceUrl": "https://clawhub.ai/HeXavi8/file-compression",
    "canonicalUrl": "https://clawhub.ai/HeXavi8/file-compression",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadUrl": "/downloads/file-compression",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=file-compression",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "packageFormat": "ZIP package",
    "primaryDoc": "SKILL.md",
    "includedAssets": [
      "SKILL.md",
      "package.json",
      "requirements.txt",
      "scripts/compress_image.py",
      "scripts/compress_image_node.mjs",
      "scripts/compress_pdf.py"
    ],
    "downloadMode": "redirect",
    "sourceHealth": {
      "source": "tencent",
      "slug": "file-compression",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-29T23:13:29.841Z",
      "expiresAt": "2026-05-06T23:13:29.841Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=file-compression",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=file-compression",
        "contentDisposition": "attachment; filename=\"file-compression-1.0.1.zip\"",
        "redirectLocation": null,
        "bodySnippet": null,
        "slug": "file-compression"
      },
      "scope": "item",
      "summary": "Item download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this item.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/file-compression"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    }
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/file-compression",
    "downloadUrl": "https://openagent3.xyz/downloads/file-compression",
    "agentUrl": "https://openagent3.xyz/skills/file-compression/agent",
    "manifestUrl": "https://openagent3.xyz/skills/file-compression/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/file-compression/agent.md"
  }
}
```
## Documentation

### File Compression

Compress files with Python-first workflows and Node.js fallback workflows.

### Supported File Types

PDF: .pdf
Image: .jpg, .jpeg, .png, .webp

### What This Skill Can Do

Compress PDF with preset quality levels.
Compress image with quality/resize/format controls.
Switch backend automatically when dependencies are missing.
Detect bad compression results and retry with better strategy.

### Installation Spec (Before Running)

Required binaries:

python3 (recommended >= 3.8)
node
gs (Ghostscript, required for PDF Ghostscript paths)

Python install spec:

python3 -m pip install -r {baseDir}/requirements.txt

Node install spec:

cd {baseDir}
npm install

Ghostscript install examples:

macOS: brew install ghostscript
Ubuntu/Debian: sudo apt-get update && sudo apt-get install -y ghostscript

Safety note:

Explain to the user before each install command that third-party packages are being installed.
If installation fails, report the failing command and switch to available fallback backend.

### CLI Options Cheat Sheet

PDF (scripts/compress_pdf.py):

--preset screen|ebook|printer|prepress
--strategy auto|ghostscript|pikepdf
--remove-metadata
--no-linearize
--overwrite

PDF Node (scripts/compress_pdf_node.mjs):

--preset screen|ebook|printer|prepress

Image (scripts/compress_image.py):

--quality <1-100>
--format keep|jpeg|png|webp
--max-width <n>
--max-height <n>
--strategy auto|pillow|node
--overwrite

Image Node (scripts/compress_image_node.mjs):

--quality <1-100>
--format keep|jpeg|png|webp
--max-width <n>
--max-height <n>

### Example Set (Python + Node)

PDF default:

python {baseDir}/scripts/compress_pdf.py in.pdf out.pdf

PDF aggressive:

python {baseDir}/scripts/compress_pdf.py in.pdf out.pdf --preset screen --strategy ghostscript

PDF with pikepdf:

python {baseDir}/scripts/compress_pdf.py in.pdf out.pdf --strategy pikepdf --remove-metadata

PDF via Node:

node {baseDir}/scripts/compress_pdf_node.mjs in.pdf out.pdf --preset ebook

Image default:

python {baseDir}/scripts/compress_image.py in.jpg out.jpg --quality 75

Image convert + resize:

python {baseDir}/scripts/compress_image.py in.png out.webp --format webp --quality 72 --max-width 1920

Image force Node backend:

python {baseDir}/scripts/compress_image.py in.jpg out.jpg --strategy node --quality 70

Image direct Node:

node {baseDir}/scripts/compress_image_node.mjs in.jpg out.jpg --quality 70 --max-width 1600

### Environment and Fallback

Check and install in this order:

Python: python3 --version (fallback: python --version)
Node: node --version
Ghostscript: gs --version (required for PDF Ghostscript paths)
Python deps when needed:

pip install pikepdf
pip install pillow


Node deps when needed:

npm install

Fallback policy:

PDF: ghostscript -> pikepdf -> node-ghostscript
Image: pillow -> node-sharp

If python3.8+ is unavailable, try python3.11/3.10/3.9/3.8; if still blocked, use Node flow when possible.

### Execution Transparency

Always communicate each step:

Tell user what you are checking or running.
Show the exact command before execution.
For slow steps (pip install, npm install, large Ghostscript jobs), say you are waiting.
After each step, report result and next action.

### Bad Result Recovery

When output_size >= input_size, do not stop:

Report exact from/to numbers and compression ratio.
Explain likely cause:

PDF: already optimized, scanned-image content, metadata overhead, unsuitable preset.
Image: unsuitable format conversion, quality too high, small-file overhead.


Retry with alternate strategy:

PDF: ebook -> screen, then switch backend.
Image: lower quality, switch backend, convert to webp, optionally resize.


Return the best attempt and state which command produced it.

### Agent Response Contract

After every compression task, always return:

Output absolute path.
from <before_size> to <after_size>.
saved <delta_size> (<ratio>%).
Backend used.
## Trust
- Source: tencent
- Verification: Indexed source record
- Publisher: HeXavi8
- Version: 1.0.1
## Source health
- Status: healthy
- Item download looks usable.
- Yavira can redirect you to the upstream package for this item.
- Health scope: item
- Reason: direct_download_ok
- Checked at: 2026-04-29T23:13:29.841Z
- Expires at: 2026-05-06T23:13:29.841Z
- Recommended action: Download for OpenClaw
## Links
- [Detail page](https://openagent3.xyz/skills/file-compression)
- [Send to Agent page](https://openagent3.xyz/skills/file-compression/agent)
- [JSON manifest](https://openagent3.xyz/skills/file-compression/agent.json)
- [Markdown brief](https://openagent3.xyz/skills/file-compression/agent.md)
- [Download page](https://openagent3.xyz/downloads/file-compression)