Agent skill · software engineering · aiskillstore

image-compress

自动化图片压缩工作流,通过服务端智能压缩实现图片优化。支持本地路径、文件夹和远程 URL,返回 CDN 地址和压缩率。Use when compressing images, reducing file size, or optimizing photos.

Why this skill is useful

Adds an executable Node.js script for image compression using a remote API that the AI can't generate on its own.

What it needs

Requires node installed locally. Requires nx-mcp-server account access. About 2k tokens when loaded. Last updated 2026-08-07. 405 stars on the source repository.

What this skill does

图片压缩 通过 nx-mcp-server 远程压缩服务对图片进行智能压缩。 配置 在项目根目录创建 .mcp.json: 查找顺序:项目根目录 → 用户家目录。提取 url → MCPURL,env.NXAPIKEY → APIKEY。 Skill 直连 MCP 端点,无需重启 Claude Code。 没有 API Key? 联系微信 zhjian2026 获取。 压缩流程 步骤 1:检查配置 找到 → 记录 url 和 NXAPIKEY,继续步骤 2 找不到 → 询问用户是否已有 API Key: 有 Key:帮用户创建 ~/.mcp.json,全局和项目安装都通用 没有 Key:告知联系微信 zhjian2026 获取 ⚠️ 配置缺失时不要继续后续步骤。 步骤 2:执行压缩(一次 Bash 调用,纯内存,零文件) 替换 PICDIR、MCPURL、APIKEY、QUALITY 后,heredoc 直接通过 stdin 喂给 node: 压缩参数:quality 默认 90(1-100),无需本地 sharp,直传服务端压缩。 步骤 3:下载到本地(如用户需要) 不要重新运行压缩!压缩结果中的 CDN URL 已在控制台输出,直接用 curl 下载: ✅ 成功:压缩后的 CDN URL 可直接使用 ⚠️ 超 5MB:文件超过服务端限制,需手动处理 ❌ 失败:重试一次 --- 返回字段速查 字段 类型 说明 ------ ------ ------ originalSize number 原始大小(bytes) compressedSize number 压缩后大小(bytes) ratio string 压缩率,如 "71.5%" compressedUrl string CDN 地址 常见错误速查 错误现象 原因 正确做法 ------ ------ ------ MISSINGAPIKEY 没传 apiKey 必须传 APIAUTHFAILED API Key 无效 检查 .mcp.json 中的 Key -32602 Invalid request parameters 未发送 notifications/initialized 必须三步:init → notified → call 406 Not Acceptable 缺少 Accept 头 同时声明 application/json 和 text/event-stream 文件超过 5MB 被跳过 服务端限制 提示用户手动处理 禁止事项 ❌ 不要本地压缩(服务端智能压缩,本地 sharp 多余) ❌ 不要传 output 参数(不存在) ❌ 不要省略 apiKey 参数 ❌ 不要省略 notifications/initialized 步骤 ❌ 不要写任何临时文件(heredoc 直接 stdin,纯内存执行) ❌ 不要把流程拆成多次 Bash 调用(一次 node << 'COMPRESSEOF' 搞定) ❌ 不要使用反斜杠路径,一律用正斜杠(d:/path)

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills aiskillstore/image-compress

View the source on GitHub

Browse the @skills marketplace