feat: add skill

This commit is contained in:
2026-02-24 22:53:32 +07:00
parent 24cec4d4e0
commit 1826c23826
7 changed files with 1230 additions and 35 deletions
+3 -32
View File
@@ -15,12 +15,7 @@ pnpm pdf -- <file> # Convert HTML file to PDF
pnpm remove-bg -- <file|dir> # Remove white background from PNG icons
```
Generate images via Banatie API:
```bash
node src/scripts/banatie.mjs --prompt "forest theme" --output assets/backgrounds/forest.png --aspect-ratio 9:16
node src/scripts/banatie.mjs --prompt "golden star" --output assets/icons/star.png
node src/scripts/banatie.mjs --prompt "similar gem" --output assets/icons/gem.png --ref assets/icons/sample.png
```
Generate images via `/gen-image` skill (uses Banatie API, reads `BANATIE_KEY` from `.env`).
## Directory Structure
@@ -31,7 +26,6 @@ src/
examples/space-worksheet2.html — Finished 3-page example (output reference)
scripts/
generate-pdf.mjs — HTML → PDF via Puppeteer
banatie.mjs — Banatie API client for image generation
remove-bg.mjs — Remove white background from PNGs (flood fill)
tasks/ — JSON task definition files
assets/
@@ -149,32 +143,9 @@ When generating HTML worksheets:
- **Images in PDF:** Use local file paths (not URLs). Puppeteer resolves `file://` protocol
- **Embed images** as base64 data URIs when possible for reliable PDF rendering
## Banatie API
## Image Generation
REST API at `https://api.banatie.app` for generating images. Auth via `X-API-Key` header (reads `BANATIE_KEY` from `.env`).
**POST `/api/v1/generations`** — create generation:
- `prompt` (string, required) — image description
- `aspectRatio` — `1:1`, `16:9`, `9:16`, `3:2`, `4:3`, `3:4`, `21:9` (default: `1:1`)
- `referenceImages` (string[]) — `@alias` names of reference images
- `flowId` (string) — associate with a flow (for flow-scoped alias resolution)
- `autoEnhance` (boolean) — prompt enhancement (default: true)
**POST `/api/v1/images/upload`** — upload image (for use as reference):
- Multipart form data: `file` (up to 5MB, JPEG/PNG/WebP), `alias` (@name), `flowId`
- Auto-creates a flow, returns `flowId` in response
Response returns JSON with `data.outputImage.storageUrl` (CDN URL to download).
Script `src/scripts/banatie.mjs` CLI:
```bash
node src/scripts/banatie.mjs --prompt "description" --output path.png [--aspect-ratio 1:1] [--ref file.png]...
```
- `--ref` accepts local file paths or `@alias`. Can be repeated
- Local files are uploaded with auto-generated `@alias` into a shared flow
- The flow's `flowId` is passed to generation for alias resolution
Rate limit: 100 requests/hour per API key.
Use the `/gen-image` skill to generate images via the Banatie API. The skill has its own script and full API documentation in `.claude/skills/gen-image/`. Auth via `BANATIE_KEY` in `.env`. Rate limit: 100 requests/hour.
## Background Removal