# Meitu Beauty

> 对单人人像照片进行 AI 美颜处理（磨皮、美白、精修五官）。仅在用户明确要求单人人像美颜、磨皮、美白或人像精修，并已提供人像照片时触发；泛化的“让照片更好看”“修一下”不单独触发。

- **Type:** Skill
- **Install:** `agentstack add skill-meitu-meitu-skills-meitu-beauty`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [meitu](https://agentstack.voostack.com/s/meitu)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [meitu](https://github.com/meitu)
- **Source:** https://github.com/meitu/meitu-skills/tree/main/skills/meitu-beauty

## Install

```sh
agentstack add skill-meitu-meitu-skills-meitu-beauty
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Meitu Beauty

## Overview

一键 AI 人像精修：磨皮、美白、面部细节优化。基于 `meitu image-edit --model gummy_pro` 做写实人像修饰，仅支持单人人像照片。

执行前应让用户清楚知道：本 Skill 会读取 Meitu 凭证、调用本地 `meitu` CLI、将用户提供的人像图片与生成提示发送到 Meitu OpenAPI 处理，并把结果写入 `./output/` 或 `$VISUAL/output/meitu-beauty/`。人像照片属于敏感的个人外观数据，需确认用户对所处理照片具备使用和处理授权。

## Dependencies

- **meitu-cli** ≥ 2.0.6 — `npm install -g meitu-cli@latest`
- **凭证配置**: 首选环境变量 `MEITU_OPENAPI_ACCESS_KEY` / `MEITU_OPENAPI_SECRET_KEY`，或预置 `~/.meitu/credentials.json`；仅在用户明确要求写入本地凭证时，再执行 `meitu config set-ak --value "..."` + `meitu config set-sk --value "..."`

> **路径别名：** 下文中 `$VISUAL` = `{OPENCLAW_HOME}/workspace/visual/`

## Core Workflow

```
Preflight → [Context: 跳过（工具型美颜，无创意自由度）] → Execute → Deliver
```

### Preflight

1. `meitu --version` → 未安装则提示 `npm install -g meitu-cli@latest`
2. `meitu auth verify --json` → 凭证无效则引导配置
3. Detect mode: cwd has `openclaw.yaml` → project mode; else → one-off
   检查 `$VISUAL` 目录 → 确定 capabilities
4. output_dir 解析（Preflight 内 MUST 完成）：
   Resolve output_dir: openclaw.yaml → `./output/` | else → `$VISUAL/output/meitu-beauty/`
   `mkdir -p {output_dir}`

### Execute

**输入获取**

用户提供图片，接受以下形式：
- 本地文件路径 → 使用 `--image_list `
- 图片 URL → 使用 `--image_list `
- 对话中直接发送的图片 → 保存到临时文件后使用 `--image_list `

若用户未提供图片，主动询问："请提供需要美颜的人像照片（文件路径或 URL）。"

**人像校验（关键前置步骤）**

此工具仅支持单人人像。调用前 MUST 校验：

1. 读取用户提供的图片，目视检查：
   - 是否包含人脸 → 无人脸则拒绝："这张图片中没有检测到人像，美颜工具仅支持包含人脸的照片。"
   - 是否为单人 → 多人则拒绝："检测到多人，美颜工具仅支持单人照片。请裁剪为单人后重试。"
   - 人脸是否足够大且清晰 → 人脸过小/模糊则警告："人脸较小/模糊，美颜效果可能不明显，是否继续？"

2. 若无法预判（如 URL 无法预览），直接调用工具，根据返回错误处理。

**强度选择**

| 用户意图 | prompt 追加语句 | 说明 |
|----------|------------------|------|
| "自然美颜"、"轻微调整"、"稍微美化"、未指定强度 | `natural portrait retouch, keep facial structure unchanged` | 自然效果（默认） |
| "大力美颜"、"重度磨皮"、"效果强一点"、"狠狠美颜" | `strong but realistic skin smoothing, brighter complexion, keep facial structure unchanged` | 增强效果 |

**调用命令**

```bash
meitu image-edit \
  --skill_name skill_meitu-beauty \
  --image_list  \
  --prompt "" \
  --model gummy_pro \
  --json \
  --download-dir {output_dir}
```

> **注意**: `2.0.6` 已无 `image-beauty-enhance`。人像美颜、肤质优化、细节修饰统一通过 `image-edit --model gummy_pro` 完成。

**结果处理**

- `ok: true` → `--download-dir` 已指定，从 `downloaded_files[0].saved_path` 获取本地文件路径；若未使用 `--download-dir`，从 `media_urls[0]` 获取结果图片 URL
- `ok: false` → 进入错误降级

**错误降级**

先检查 CLI 原始错误字段 `code`、`hint`、`error_name`、`action_url`，再按 `meitu-tools` 规则归类为 `error_type` 后分流：

| error_type（由 CLI 原始字段归类） | 处理 | 可重试 |
|------------|------|--------|
| `CONTENT_REQUIREMENTS_UNMET`（或 CLI 原始错误 `code=98501` / `error_name=CONTENT_REQUIREMENTS_UNMET`） | 图片不含人脸或不符合单人要求。直接告知用户："该图片不符合美颜要求（需要单人人像照片），请更换图片。" 不重试。 | 否 |
| `ORDER_REQUIRED` | 余额不足，提示充值，展示 `action_url` | 否 |
| `CREDENTIALS_MISSING` | 提示配置 AK/SK | 否 |
| 其他错误 | 按以下级别降级 ↓ | 视情况 |

通用降级（仅 `retryable: true` 或未知错误时）：

| 级别 | 策略 | 操作 |
|------|------|------|
| L1 | 降低强度 | 将强修饰 prompt 收敛为 `natural portrait retouch, keep facial structure unchanged` 后重试 |
| L2 | 检查图片质量 | 提示用户更换更清晰、人脸更大的照片 |
| L3 | 检查图片格式 | 确认为 JPG/PNG/WEBP，非 GIF/BMP 等不支持格式 |
| L4 | 停止报错 | 连续 2 次失败 → 报告 code + hint，停止重试 |

### Deliver

直接使用 Preflight 解析的 output_dir。

`mv {file} {output_dir}/{date}_beauty_{original_name}.{ext}`

命名示例：`2026-03-23_beauty_portrait.jpg`

## Output

| 项目 | 规格 |
|------|------|
| 格式 | 与原图一致（通常 JPG） |
| 数量 | 单张 |
| 命名 | `{date}_beauty_{original_name}.{ext}` |
| 位置 | 由 Deliver 步骤解析 |

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [meitu](https://github.com/meitu)
- **Source:** [meitu/meitu-skills](https://github.com/meitu/meitu-skills)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-meitu-meitu-skills-meitu-beauty
- Seller: https://agentstack.voostack.com/s/meitu
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
