Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion skills/frontend-dev/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,14 @@ project/
2. Plan motion sequences following performance guardrails

### Phase 3: Asset Generation
Generate all image/video/audio assets using `scripts/`. NEVER use placeholder URLs (unsplash, picsum, placeholder.com, via.placeholder, placehold.co, etc.) or external URLs.

Set an absolute skill path once per session:

```bash
export SKILL_DIR="/absolute/path/to/minimax-skills/skills/frontend-dev"
```

Generate all image/video/audio assets using `SKILL_DIR/scripts/`. NEVER use placeholder URLs (unsplash, picsum, placeholder.com, via.placeholder, placehold.co, etc.) or external URLs.

1. Parse asset requirements (type, style, spec, usage)
2. Craft optimized prompts, show to user, confirm before generating
Expand Down
30 changes: 18 additions & 12 deletions skills/gif-sticker-maker/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ metadata:

Convert user photos into 4 animated GIF stickers (Funko Pop / Pop Mart style).

Set an absolute skill path once per session:

```bash
export SKILL_DIR="/absolute/path/to/minimax-skills/skills/gif-sticker-maker"
```

## Style Spec

- Funko Pop / Pop Mart blind box 3D figurine
Expand Down Expand Up @@ -50,44 +56,44 @@ Ask user (in their language):

### Step 1: Generate 4 Static Sticker Images

**Tool**: `scripts/minimax_image.py`
**Tool**: `SKILL_DIR/scripts/minimax_image.py`

1. Analyze the user's photo — identify subject type (person / animal / object / logo).
2. For each of the 4 stickers, build a prompt from [image-prompt-template.txt](assets/image-prompt-template.txt) by filling `{action}` and `{caption}`.
3. **If subject is a person**: pass `--subject-ref <user_photo_path>` so the generated figurine preserves the person's actual facial likeness.
4. Generate (all 4 are independent — **run concurrently**):

```bash
python3 scripts/minimax_image.py "<prompt>" -o output/sticker_hi.png --ratio 1:1 --subject-ref <photo>
python3 scripts/minimax_image.py "<prompt>" -o output/sticker_laugh.png --ratio 1:1 --subject-ref <photo>
python3 scripts/minimax_image.py "<prompt>" -o output/sticker_cry.png --ratio 1:1 --subject-ref <photo>
python3 scripts/minimax_image.py "<prompt>" -o output/sticker_love.png --ratio 1:1 --subject-ref <photo>
python3 "$SKILL_DIR"/scripts/minimax_image.py "<prompt>" -o output/sticker_hi.png --ratio 1:1 --subject-ref <photo>
python3 "$SKILL_DIR"/scripts/minimax_image.py "<prompt>" -o output/sticker_laugh.png --ratio 1:1 --subject-ref <photo>
python3 "$SKILL_DIR"/scripts/minimax_image.py "<prompt>" -o output/sticker_cry.png --ratio 1:1 --subject-ref <photo>
python3 "$SKILL_DIR"/scripts/minimax_image.py "<prompt>" -o output/sticker_love.png --ratio 1:1 --subject-ref <photo>
```

> `--subject-ref` only works for person subjects (API limitation: type=character).
> For animals/objects/logos, omit the flag and rely on text description.

### Step 2: Animate Each Image → Video

**Tool**: `scripts/minimax_video.py` with `--image` flag (image-to-video mode)
**Tool**: `SKILL_DIR/scripts/minimax_video.py` with `--image` flag (image-to-video mode)

For each sticker image, build a prompt from [video-prompt-template.txt](assets/video-prompt-template.txt), then:

```bash
python3 scripts/minimax_video.py "<prompt>" --image output/sticker_hi.png -o output/sticker_hi.mp4
python3 scripts/minimax_video.py "<prompt>" --image output/sticker_laugh.png -o output/sticker_laugh.mp4
python3 scripts/minimax_video.py "<prompt>" --image output/sticker_cry.png -o output/sticker_cry.mp4
python3 scripts/minimax_video.py "<prompt>" --image output/sticker_love.png -o output/sticker_love.mp4
python3 "$SKILL_DIR"/scripts/minimax_video.py "<prompt>" --image output/sticker_hi.png -o output/sticker_hi.mp4
python3 "$SKILL_DIR"/scripts/minimax_video.py "<prompt>" --image output/sticker_laugh.png -o output/sticker_laugh.mp4
python3 "$SKILL_DIR"/scripts/minimax_video.py "<prompt>" --image output/sticker_cry.png -o output/sticker_cry.mp4
python3 "$SKILL_DIR"/scripts/minimax_video.py "<prompt>" --image output/sticker_love.png -o output/sticker_love.mp4
```

All 4 calls are independent — **run concurrently**.

### Step 3: Convert Videos → GIF

**Tool**: `scripts/convert_mp4_to_gif.py`
**Tool**: `SKILL_DIR/scripts/convert_mp4_to_gif.py`

```bash
python3 scripts/convert_mp4_to_gif.py output/sticker_hi.mp4 output/sticker_laugh.mp4 output/sticker_cry.mp4 output/sticker_love.mp4
python3 "$SKILL_DIR"/scripts/convert_mp4_to_gif.py output/sticker_hi.mp4 output/sticker_laugh.mp4 output/sticker_cry.mp4 output/sticker_love.mp4
```

Outputs GIF files alongside each MP4 (e.g. `sticker_hi.gif`).
Expand Down
27 changes: 18 additions & 9 deletions skills/minimax-docx/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,23 @@ Create, edit, and format DOCX documents via CLI tools or direct C# scripts built

## Setup

**First time:** `bash scripts/setup.sh` (or `powershell scripts/setup.ps1` on Windows, `--minimal` to skip optional deps).
Set an absolute skill path once per session:

**First operation in session:** `scripts/env_check.sh` — do not proceed if `NOT READY`. (Skip on subsequent operations within the same session.)
```bash
export SKILL_DIR="/absolute/path/to/minimax-skills/skills/minimax-docx"
```

**First time:** `bash "$SKILL_DIR"/scripts/setup.sh` (or `powershell "$env:SKILL_DIR"/scripts/setup.ps1` on Windows, `--minimal` to skip optional deps).

**First operation in session:** `bash "$SKILL_DIR"/scripts/env_check.sh` — do not proceed if `NOT READY`. (Skip on subsequent operations within the same session.)

## Quick Start: Direct C# Path

When the task requires structural document manipulation (custom styles, complex tables, multi-section layouts, headers/footers, TOC, images), write C# directly instead of wrestling with CLI limitations. Use this scaffold:

```csharp
// File: scripts/dotnet/task.csx (or a new .cs in a Console project)
// dotnet run --project scripts/dotnet/MiniMaxAIDocx.Cli -- run-script task.csx
// File: SKILL_DIR/scripts/dotnet/task.csx (or a new .cs in a Console project)
// dotnet run --project SKILL_DIR/scripts/dotnet/MiniMaxAIDocx.Cli -- run-script task.csx
#r "nuget: DocumentFormat.OpenXml, 3.2.0"

using DocumentFormat.OpenXml;
Expand All @@ -69,8 +75,9 @@ mainPart.Document = new Document(new Body());
## CLI shorthand

All CLI commands below use `$CLI` as shorthand for:

```bash
dotnet run --project scripts/dotnet/MiniMaxAIDocx.Cli --
dotnet run --project "$SKILL_DIR"/scripts/dotnet/MiniMaxAIDocx.Cli --
```

## Pipeline routing
Expand Down Expand Up @@ -100,9 +107,9 @@ If the request spans multiple pipelines, run them sequentially (e.g., Create the

## Pre-processing

Convert `.doc` → `.docx` if needed: `scripts/doc_to_docx.sh input.doc output_dir/`
Convert `.doc` → `.docx` if needed: `SKILL_DIR/scripts/doc_to_docx.sh input.doc output_dir/`

Preview before editing (avoids reading raw XML): `scripts/docx_preview.sh document.docx`
Preview before editing (avoids reading raw XML): `SKILL_DIR/scripts/docx_preview.sh document.docx`

Analyze structure for editing scenarios: `$CLI analyze --input document.docx`

Expand Down Expand Up @@ -171,19 +178,21 @@ $CLI validate --input doc.docx --business # 3. busines
```

If XSD fails, auto-repair and retry:

```bash
$CLI fix-order --input doc.docx
$CLI validate --input doc.docx --xsd assets/xsd/wml-subset.xsd
```

If XSD still fails, fall back to business rules + preview:

```bash
$CLI validate --input doc.docx --business
scripts/docx_preview.sh doc.docx
bash "$SKILL_DIR"/scripts/docx_preview.sh doc.docx
# Verify: font contamination=0, table count correct, drawing count correct, sectPr count correct
```

Final preview: `scripts/docx_preview.sh doc.docx`
Final preview: `SKILL_DIR/scripts/docx_preview.sh doc.docx`

## Critical rules

Expand Down
65 changes: 48 additions & 17 deletions skills/minimax-docx/scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,33 @@ fail() { echo -e "${RED}[FAIL]${NC} $*"; }
info() { echo -e "${BLUE}[INFO]${NC} $*"; }
step() { echo -e "\n${BLUE}=== $* ===${NC}"; }

SUDO_CMD=""

init_privilege_cmd() {
# If already root, run package commands directly.
if [ "$(id -u)" -eq 0 ]; then
SUDO_CMD=""
return 0
fi

if command -v sudo &>/dev/null; then
SUDO_CMD="sudo"
return 0
fi

fail "This script needs elevated privileges for package installation, but sudo is not available."
fail "Run as root or install sudo, then re-run the script."
return 1
}

run_as_root() {
if [ -n "$SUDO_CMD" ]; then
"$SUDO_CMD" "$@"
else
"$@"
fi
}

# --- Detect OS & Package Manager ---
detect_platform() {
OS="unknown"
Expand Down Expand Up @@ -104,8 +131,8 @@ install_dotnet() {
# Microsoft package repo for Ubuntu/Debian
if ! dpkg -l dotnet-sdk-8.0 &>/dev/null 2>&1; then
info "Adding Microsoft package repository..."
sudo apt-get update -qq
sudo apt-get install -y -qq wget apt-transport-https
run_as_root apt-get update -qq
run_as_root apt-get install -y -qq wget apt-transport-https
wget -q "https://dot.net/v1/dotnet-install.sh" -O /tmp/dotnet-install.sh
chmod +x /tmp/dotnet-install.sh
/tmp/dotnet-install.sh --channel 8.0 --install-dir "$HOME/.dotnet"
Expand All @@ -114,13 +141,13 @@ install_dotnet() {
fi
;;
dnf)
sudo dnf install -y dotnet-sdk-8.0
run_as_root dnf install -y dotnet-sdk-8.0
;;
pacman)
sudo pacman -S --noconfirm dotnet-sdk
run_as_root pacman -S --noconfirm dotnet-sdk
;;
zypper)
sudo zypper install -y dotnet-sdk-8.0
run_as_root zypper install -y dotnet-sdk-8.0
;;
apk)
apk add --no-cache dotnet8-sdk
Expand Down Expand Up @@ -167,10 +194,10 @@ install_pandoc() {
info "Installing pandoc..."
case "$PKG_MGR" in
brew) brew install pandoc ;;
apt) sudo apt-get install -y -qq pandoc ;;
dnf) sudo dnf install -y pandoc ;;
pacman) sudo pacman -S --noconfirm pandoc ;;
zypper) sudo zypper install -y pandoc ;;
apt) run_as_root apt-get install -y -qq pandoc ;;
dnf) run_as_root dnf install -y pandoc ;;
pacman) run_as_root pacman -S --noconfirm pandoc ;;
zypper) run_as_root zypper install -y pandoc ;;
apk) apk add --no-cache pandoc ;;
*)
warn "Cannot auto-install pandoc. Install manually: https://pandoc.org/installing.html"
Expand Down Expand Up @@ -215,10 +242,10 @@ install_soffice() {
info "Installing LibreOffice (this may take a while)..."
case "$PKG_MGR" in
brew) brew install --cask libreoffice ;;
apt) sudo apt-get install -y -qq libreoffice-core ;;
dnf) sudo dnf install -y libreoffice-core ;;
pacman) sudo pacman -S --noconfirm libreoffice-still ;;
zypper) sudo zypper install -y libreoffice ;;
apt) run_as_root apt-get install -y -qq libreoffice-core ;;
dnf) run_as_root dnf install -y libreoffice-core ;;
pacman) run_as_root pacman -S --noconfirm libreoffice-still ;;
zypper) run_as_root zypper install -y libreoffice ;;
apk) apk add --no-cache libreoffice ;;
*)
warn "Cannot auto-install LibreOffice. Install manually: https://www.libreoffice.org/download/"
Expand Down Expand Up @@ -248,10 +275,10 @@ install_zip_tools() {
info "Installing zip/unzip..."
case "$PKG_MGR" in
brew) brew install zip unzip 2>/dev/null || true ;;
apt) sudo apt-get install -y -qq zip unzip ;;
dnf) sudo dnf install -y zip unzip ;;
pacman) sudo pacman -S --noconfirm zip unzip ;;
zypper) sudo zypper install -y zip unzip ;;
apt) run_as_root apt-get install -y -qq zip unzip ;;
dnf) run_as_root dnf install -y zip unzip ;;
pacman) run_as_root pacman -S --noconfirm zip unzip ;;
zypper) run_as_root zypper install -y zip unzip ;;
apk) apk add --no-cache zip unzip ;;
*) warn "Install zip/unzip manually (optional, .NET handles DOCX natively)" ;;
esac
Expand Down Expand Up @@ -463,6 +490,10 @@ main() {

detect_platform

if [ "$OS" = "linux" ] || [ "$OS" = "wsl" ]; then
init_privilege_cmd || return 1
fi

# Parse arguments
local SKIP_OPTIONAL=false
local SKIP_VERIFY=false
Expand Down
Loading