Materials CLI
Use this skill when the user wants to render JSON schemas to images (PNG/JPG), validate render-data schemas, or generate schemas from natural-language prompts and then render them.
Commands
- render — Render a JSON schema file to an image.
- generate — Use AI (OpenAI) to generate a schema from a prompt, then render it.
- validate — Validate a JSON schema against the declare-render data schema.
When to use
- User asks to "render a schema to image", "turn JSON into a picture", or "draw from schema".
- User wants to "generate an image from a description" or "create a schema from a prompt" and render it.
- User wants to "validate" a JSON file against the render data schema.
Usage
Run via Node (from the project or after npm install -g materials-cli):
materials render <schema-path> [options]
materials generate "<prompt>" [options]
materials validate <schema-path> [options]
Render
materials render schema.json -o output.png
- Options:
-s, --schema <path>, -o, --output <path> (default ./output.png), -f, --format <png|jpg>, -w, --width, -h, --height, --output-schema <path>, -i, --interactive
Generate (AI)
materials generate "A red circle with text Hello" -o out.png
- Options:
-o, --output, -f, --format, -w, --width, -h, --height, --output-schema, --model, --api-key, --base-url, -i, --interactive
- Uses
OPENAI_API_KEY (and optionally OPENAI_MODEL, OPENAI_BASE_URL) if not passed via flags.
Validate
materials validate schema.json
- Options:
-s, --schema <path>, -i, --interactive
CLI help
Usage: materials <command> [options]
Commands:
render <schema> Render a JSON schema file to an image
generate <prompt> Use AI to generate a schema, then render
validate <schema> Validate a schema against the render data schema
Examples:
materials render schema.json -o output.png
materials generate "A red circle with text Hello"
materials validate schema.json
Schema format
The JSON schema follows the declare-render format: root has id, width, height, and layers. Layer types include text, image, container, shape, etc. Use materials validate <file> to check a schema before rendering.
1---
2name: materials-cli
3description: Render JSON schemas to images and generate schemas from prompts using declare-render and AI.
4version: 1.0.7
5metadata:
6 source: https://skillmd.com/skills/modbender/materials-cli
7 clawdbot:
8 requires:
9 env:
10 - OPENAI_API_KEY
11 bins:
12 - node
13 primaryEnv: OPENAI_API_KEY
14---
15
16# Materials CLI
17
18Use this skill when the user wants to render JSON schemas to images (PNG/JPG), validate render-data schemas, or generate schemas from natural-language prompts and then render them.
19
20## Commands
21
22- **render** — Render a JSON schema file to an image.
23- **generate** — Use AI (OpenAI) to generate a schema from a prompt, then render it.
24- **validate** — Validate a JSON schema against the declare-render data schema.
25
26## When to use
27
28- User asks to "render a schema to image", "turn JSON into a picture", or "draw from schema".
29- User wants to "generate an image from a description" or "create a schema from a prompt" and render it.
30- User wants to "validate" a JSON file against the render data schema.
31
32## Usage
33
34Run via Node (from the project or after `npm install -g materials-cli`):
35
36```bash
37materials render <schema-path> [options]
38materials generate "<prompt>" [options]
39materials validate <schema-path> [options]
40```
41
42### Render
43
44- `materials render schema.json -o output.png`
45- Options: `-s, --schema <path>`, `-o, --output <path>` (default `./output.png`), `-f, --format <png|jpg>`, `-w, --width`, `-h, --height`, `--output-schema <path>`, `-i, --interactive`
46
47### Generate (AI)
48
49- `materials generate "A red circle with text Hello" -o out.png`
50- Options: `-o, --output`, `-f, --format`, `-w, --width`, `-h, --height`, `--output-schema`, `--model`, `--api-key`, `--base-url`, `-i, --interactive`
51- Uses `OPENAI_API_KEY` (and optionally `OPENAI_MODEL`, `OPENAI_BASE_URL`) if not passed via flags.
52
53### Validate
54
55- `materials validate schema.json`
56- Options: `-s, --schema <path>`, `-i, --interactive`
57
58## CLI help
59
60```
61Usage: materials <command> [options]
62
63Commands:
64 render <schema> Render a JSON schema file to an image
65 generate <prompt> Use AI to generate a schema, then render
66 validate <schema> Validate a schema against the render data schema
67
68Examples:
69 materials render schema.json -o output.png
70 materials generate "A red circle with text Hello"
71 materials validate schema.json
72```
73
74## Schema format
75
76The JSON schema follows the declare-render format: root has `id`, `width`, `height`, and `layers`. Layer types include text, image, container, shape, etc. Use `materials validate <file>` to check a schema before rendering.