$npx -y skills add meshy-dev/meshy-3d-agent --skill meshy-3d-generationGenerate 3D models, textures, images, rig characters, and animate them using the Meshy AI API. Handles API key detection, setup, and all generation workflows via direct HTTP calls. Use when the user asks to create 3D models, convert text/images to 3D, texture models, rig or anima
| 1 | # Meshy 3D Generation |
| 2 | |
| 3 | Directly communicate with the Meshy AI API to generate 3D assets. This skill handles the complete lifecycle: environment setup, API key detection, task creation, polling, downloading, and chaining multi-step pipelines. |
| 4 | |
| 5 | For full endpoint reference (all parameters, response schemas, error codes), read [reference.md](reference.md). |
| 6 | |
| 7 | --- |
| 8 | |
| 9 | ## IMPORTANT: 3D Printing → Use `meshy-3d-printing` Skill |
| 10 | |
| 11 | **If the user's request involves 3D printing** (keywords: print, 3d print, slicer, slice, bambu, orca, prusa, cura, multicolor, 3mf, figurine, miniature, statue, physical model), **use the `meshy-3d-printing` skill instead of this one for the entire workflow.** The printing skill handles generation with correct print-optimized parameters (e.g. `target_formats` with `"3mf"` for multicolor), slicer detection, coordinate conversion, and slicer launch — all in one pipeline. |
| 12 | |
| 13 | This skill's `create_task`/`poll_task`/`download` template functions are reused by the printing skill, but the **workflow orchestration** (what to generate, which formats, what to do after) must come from the printing skill when printing is involved. |
| 14 | |
| 15 | **Do NOT generate a model with this skill and then hand off to the printing skill** — the printing skill needs to control parameters from the start (e.g. `target_formats`, `should_texture`). |
| 16 | |
| 17 | --- |
| 18 | |
| 19 | ## IMPORTANT: First-Use Session Notice |
| 20 | |
| 21 | When this skill is first activated in a session, inform the user: |
| 22 | |
| 23 | > All generated files will be saved to `meshy_output/` in the current working directory. Each project gets its own folder (`{YYYYMMDD_HHmmss}_{prompt}_{id}/`) with model files, textures, thumbnails, and metadata. History is tracked in `meshy_output/history.json`. |
| 24 | |
| 25 | This only needs to be said **once per session**, at the beginning. |
| 26 | |
| 27 | ## IMPORTANT: File Organization |
| 28 | |
| 29 | All downloaded files MUST go into a structured `meshy_output/` directory in the current working directory. **Do NOT scatter files randomly.** |
| 30 | |
| 31 | - Each project gets its own folder: `meshy_output/{YYYYMMDD_HHmmss}_{prompt_slug}_{task_id_prefix}/` |
| 32 | - For chained tasks (preview → refine → rig), reuse the same `project_dir` |
| 33 | - Track tasks in `metadata.json` per project, and global `history.json` |
| 34 | - Auto-download thumbnails alongside models |
| 35 | |
| 36 | The Reusable Script Template below includes `get_project_dir()`, `record_task()`, and `save_thumbnail()` helpers. |
| 37 | |
| 38 | --- |
| 39 | |
| 40 | ## IMPORTANT: Shell Command Rules |
| 41 | |
| 42 | **Use only standard POSIX tools in shell commands.** Do NOT use `rg` (ripgrep), `fd`, or other non-standard CLI tools — they may not be installed. Use these standard alternatives instead: |
| 43 | |
| 44 | | Do NOT use | Use instead | |
| 45 | |---|---| |
| 46 | | `rg` | `grep` | |
| 47 | | `fd` | `find` | |
| 48 | | `bat` | `cat` | |
| 49 | | `exa` / `eza` | `ls` | |
| 50 | |
| 51 | --- |
| 52 | |
| 53 | ## IMPORTANT: Run Long Tasks Properly |
| 54 | |
| 55 | Meshy generation tasks take 1–5 minutes. When running Python scripts that poll for completion: |
| 56 | |
| 57 | - Write the entire create → poll → download flow as **ONE Python script** and execute it in a single Bash call. Do NOT split into multiple commands. This keeps the API key, task IDs, and session in one process context. |
| 58 | - Use `python3 -u script.py` (unbuffered) so progress output is visible in real time. |
| 59 | - Be patient with long-running scripts — do NOT interrupt or kill them prematurely. Tasks at 99% for 30–120s is normal finalization, not a failure. |
| 60 | |
| 61 | --- |
| 62 | |
| 63 | ## Step 0: Environment Detection (ALWAYS RUN FIRST) |
| 64 | |
| 65 | Before any API call, detect whether the environment is ready: |
| 66 | |
| 67 | ```bash |
| 68 | echo "=== Meshy API Key Detection ===" |
| 69 | |
| 70 | # 1. Check current env var |
| 71 | if [ -n "$MESHY_API_KEY" ]; then |
| 72 | echo "ENV_VAR: FOUND (${MESHY_API_KEY:0:8}...)" |
| 73 | else |
| 74 | echo "ENV_VAR: NOT_FOUND" |
| 75 | fi |
| 76 | |
| 77 | # 2. Check .env files in workspace |
| 78 | for f in .env .env.local; do |
| 79 | if [ -f "$f" ] && grep -q "MESHY_API_KEY" "$f" 2>/dev/null; then |
| 80 | echo "DOTENV($f): FOUND" |
| 81 | export $(grep "MESHY_API_KEY" "$f" | head -1) |
| 82 | fi |
| 83 | done |
| 84 | |
| 85 | # 3. Check shell profiles |
| 86 | for f in ~/.zshrc ~/.bashrc ~/.bash_profile ~/.profile; do |
| 87 | if [ -f "$f" ] && grep -q "MESHY_API_KEY" "$f" 2>/dev/null; then |
| 88 | echo "SHELL_PROFILE: FOUND in $f" |
| 89 | fi |
| 90 | done |
| 91 | |
| 92 | # 4. Final status |
| 93 | if [ -n "$MESHY_API_KEY" ]; then |
| 94 | echo "READY: key=${MESHY_API_KEY:0:12}..." |
| 95 | else |
| 96 | echo "READY: NO_KEY_FOUND" |
| 97 | fi |
| 98 | |
| 99 | # 5. Python requests check |
| 100 | python3 -c "import requests; print('PYTHON_REQUESTS: OK')" 2>/dev/null || echo "PYTHON_REQUESTS: MISSING (run: pip install re |