text-code
/text-code
使用 meitu-cli 从零生成 React/TSX 页面代码,支持素材参考与 prompt 扩写。仅当用户明确要求生成 React/TSX/HTML 前端代码文件时触发;普通页面设计讨论、产品方案、视觉设计需求不触发。
- Author
- meitu ↗
- Repository
- meitu-skills ↗
- Licence
- MIT
- Last repository change
- 28.08.2026
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 28.08.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
使用 meitu-cli 从零生成 React/TSX 页面代码,支持素材参考与 prompt 扩写。仅当用户明确要求生成 React/TSX/HTML 前端代码文件时触发;普通页面设计讨论、产品方案、视觉设计需求不触发。
Original author description
使用 meitu-cli 从零生成 React/TSX 页面代码,支持素材参考与 prompt 扩写。仅当用户明确要求生成 React/TSX/HTML 前端代码文件时触发;普通页面设计讨论、产品方案、视觉设计需求不触发。
How it works
- Overview
- API Mapping
- Dependencies
- Core Workflow
- Output
- 基线 Task ID
SKILL.md preview
---
name: text-code
description: "使用 meitu-cli 从零生成 React/TSX 页面代码,支持素材参考与 prompt 扩写。仅当用户明确要求生成 React/TSX/HTML 前端代码文件时触发;普通页面设计讨论、产品方案、视觉设计需求不触发。"
version: "1.0.0"
metadata: {"openclaw":{"requires":{"bins":["meitu"],"env":["MEITU_OPENAPI_ACCESS_KEY","MEITU_OPENAPI_SECRET_KEY","MEITU_OPENAPI_TOOL_TASK_MODE"],"paths":{"read":["~/.meitu/credentials.json","~/.meitu/tool-registry.json","~/.openclaw/workspace/visual/","./openclaw.yaml"],"write":["~/.openclaw/workspace/visual/","./output/"]}},"primaryEnv":"MEITU_OPENAPI_ACCESS_KEY","security":{"dataFlow":"Inputs, selected local context, and generated prompts may be sent to Meitu OpenAPI when used by the workflow.","credentials":"Credentials are used only for CLI authentication and must not be disclosed."}}}
security:
credential_use: "Uses Meitu OpenAPI credentials from env or ~/.meitu/credentials.json for CLI calls; credentials must not be echoed, logged, or embedded in prompts."
remote_processing: "Page prompts and referenced media may be sent to Meitu OpenAPI for code generation."
persistence: "Generated source files may be written to ./output/ in project mode or visual output directories in one-off mode."
requirements:
credentials:
- name: MEITU_OPENAPI_ACCESS_KEY
source: env | ~/.meitu/credentials.json
- name: MEITU_OPENAPI_SECRET_KEY
source: env | ~/.meitu/credentials.json
env:
MEITU_OPENAPI_TOOL_TASK_MODE: command
permissions:
- type: file_read
paths:
- ~/.meitu/credentials.json
- ~/.meitu/tool-registry.json
- ~/.openclaw/workspace/visual/
- ./openclaw.yaml
- type: file_write
paths:
- ~/.openclaw/workspace/visual/
- ./output/
- type: exec
commands:
- meitu
---
# Text Code(代码生成)
## Overview
从零生成 React/TSX 页面代码,支持素材参考(图片/视频)与 prompt 扩写。适用于落地页、活动页、数据可视化页面、界面原型、React 组件快速搭建。不处理:修改已有源码、非 React/HTML 框架、后端代码(Python/Java 等)、像素级还原设计稿、复杂后端对接。
## API Mapping
| 场景 | 后端 API |
|------|---------|
| React/TSX 页面代码生成 | `text_code` |
model 映射:
- `auto`(默认)/ 不传 → 按路由规则决策
- `pretzel_pro` / `pretzel_lite` → 直接指定模型
- 模型回退链:`pretzel_pro` → `pretzel_lite`
## Dependencies
- **meitu-cli**: `>=2.0.6`
- **凭证**:CONFIG AKSK → `meitu tools update`;EXEC AKSK → 跑命令(见根 `CONFIG.md`)
- **环境变量**:`MEITU_OPENAPI_TOOL_TASK_MODE=command`
## Core Workflow
```
Preflight → Execute → Deliver
```
### Preflight
1. `meitu --version` ≥ 2.0.6,未装则 `npm install -g meitu-cli@latest`
2. `meitu auth verify --json` → 凭证无效走 CONFIG.md SOP
3. 确认本地 `~/.meitu/tool-registry.json` 已包含 `text-code`,否则 `meitu tools update`
4. 解析 output_dir:`openclaw.yaml` → `./output/`;else → `~/.openclaw/workspace/visual/output/text-code/`;`mkdir -p {output_dir}`
### Execute
**触发信号 / 路由规则**
| 场景 | 判定关键词 | 路由 |
|------|-----------|------|
| 从零生成 React 页面 | 做个页面、生成网页、落地页、活动页、数据可视化、生成组件 | `text_code` |
| 简短 prompt + 有 prompt_name | `prompt` < 10 字符 | 自动扩写后调用 |
| 提供 source_code_url + 修改意图 | 改代码、加按钮、调样式 | 不属于本工具(走 text-code-edit) |
| 要求生成非 React/HTML 代码 | 后端、Python、Java | 告知仅支持 React/TSX |
**参数定义**
| 参数 | 类型 | 必填 | 范围 | 默认值 | 说明 |
|------|------|------|------|--------|------|
| `prompt` | STRING | 是 | -- | -- | 页面描述,尽量详细。缺失 → 追问 |
| `model` | ENUM | 否 | auto / pretzel_pro / pretzel_lite | pretzel_pro | 模型选择,非法值回退 pretzel_pro |
| `image_list` | ARRAY | 否 | -- | [] | 参考图片 URL 列表,无效项静默过滤 |
| `video_list` | ARRAY | 否 | -- | [] | 参考视频 URL 列表,无效项静默过滤 |
| `prompt_name` | STRING | 否 | -- | -- | 系统提示词名称 |
**工具调用**
基础生成:
```bash
meitu text-code --prompt "{page_description}" --json --download-dir {output_dir} --skill_name skill_text-code
```
指定模型 + 参考素材:
```bash
meitu text-code \
--skill_name skill_text-code \
--prompt "{page_description}" \
--model pretzel_pro \
--image_list "{url1}" --image_list "{url2}" \
--json --download-dir {output_dir}
```
简短 prompt + prompt_name(自动扩写):
```bash
meitu text-code --prompt "做个页面" --prompt_name "{template_name}" --json --download-dir {output_dir} --skill_name skill_text-code
```
**错误降级**
| 场景 | 处理方式 |
|------|---------|
| `prompt` 缺失 | 提示"请描述你想生成的网页" |
| `prompt` < 10 字符 + 有 `prompt_name` | 自动扩写 |
| `prompt` < 10 字符 + 无 `prompt_name` | 原样传入 |
| `model` 非法值 | 回退至 `pretzel_pro` |
| `image_list` 全部无效但用户有参考意图 | 提示"请提供有效的图片链接" |
| 请求非 React/HTML 代码 | 告知仅支持 React/TSX |
| 超时 | 沿 `pretzel_pro → pretzel_lite` 重试,链尽返回错误 |
| 代码不完整 | 原模型重试 1 次 → 返回错误 |
| 内容合规拦截 | 直接返回合规提示,不重试 |
### Deliver
解析 `--json`:
- `ok: true` → `downloaded_files[0].saved_path` 为本地 `.tsx` 源码;或 `media_urls[0]` 为 code_url
- `ok: false` → 输出 `code` + `hint`
落盘:`mv {file} {output_dir}/{YYYY-MM-DD}_{descriptive-name}.tsx`,记录 `code_url` 以便后续 `text-code-edit` 自动引用。
## Output
- **格式**: `.tsx` / `.jsx` 源码文件
- **命名**: `{YYYY-MM-DD}_{descriptive-name}.tsx`
- **位置**: 由 Deliver 步骤决定(项目 → `./output/`,一次性 → `~/.openclaw/workspace/visual/output/text-code/`)
## 基线 Task ID
见根目录 `references/task-id-baseline.md` 中 `text-code` 条目。
Versions
The database has no other skills named text-code.
Identical content appears in 1 other GitHub folders. We show one copy with the highest score.
Database snapshot: 13.11.2026 · package version 8a677c2d821c (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100text-code-edit
使用 meitu-cli 对已有 React/TSX/JSX 源码做编辑修改,支持多轮迭代。当用户提到改代码、修改页面、调整样式、换颜色、加按钮、删组件、改布局、改刚才的代码时触发。 - 100react-best-practices
Use when reading or writing React components (.tsx, .jsx files with React imports). - 100react
React 18+ framework guardrails, patterns, and best practices for AI-assisted development. Use when working with React projects (.jsx/.tsx files), or when the user mentions React. Provides component patterns, hooks, state management, testing, and performance guidelines. - 100typescript
This skill should be used when writing or reviewing TypeScript or TSX code, or when the project uses "TypeScript", "React", "tsx", "SWR", "Vite", "Next.js", or TypeScript type patterns. Provides TypeScript coding conventions, React patterns, and best practices. Project-specific… - 100react-developer
Implement or fix small-to-medium React features without full SDD (hooks, TSX, RTL). Use for isolated React work or when invoking /react-developer. - 100react
React component development guide. Use when working with React components (.tsx files), creating UI, using @lobehub/ui components, implementing routing, or building frontend features. Triggers on React component creation, modification, layout implementation, or navigation tasks.