Skip to content
Merged
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ Core skills are grouped under [skills/workflows/](skills/workflows), [skills/too
| DevEx | [semantic-commit](./skills/tools/devex/semantic-commit/) | Commit staged changes using Semantic Commit format |
| DevEx | [open-changed-files-review](./skills/tools/devex/open-changed-files-review/) | Open files edited by Codex in VSCode after making changes (silent no-op when unavailable) |
| DevEx | [desktop-notify](./skills/tools/devex/desktop-notify/) | Send desktop notifications via terminal-notifier (macOS) or notify-send (Linux) |
| Media | [image-processing](./skills/tools/media/image-processing/) | Process images (convert/resize/crop/optimize) via ImageMagick |
| Media | [image-processing](./skills/tools/media/image-processing/) | Convert `svg/png/jpg/jpeg/webp` inputs to `png/webp/jpg` and validate SVGs via `image-processing` |
| Media | [screen-record](./skills/tools/media/screen-record/) | Record a single window or full display to a video file via the screen-record CLI (macOS 12+ and Linux) |
| Media | [screenshot](./skills/tools/media/screenshot/) | Capture screenshots via screen-record on macOS and Linux, with optional macOS desktop capture via screencapture |
| SQL | [sql-postgres](./skills/tools/sql/sql-postgres/) | Run PostgreSQL queries via psql using a prefix + env file convention |
Expand Down
27 changes: 16 additions & 11 deletions skills/tools/media/image-processing/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: image-processing
description: Validate SVG inputs and convert trusted SVG to png/webp/svg
description: Validate SVG inputs and convert svg/png/jpg/jpeg/webp inputs to png/webp/jpg
---

# Image Processing
Expand All @@ -19,7 +19,7 @@ Inputs:

- Natural-language user intent (assistant translates into a command).
- Exactly one operation:
- `convert`: `--from-svg <path>` + `--to png|webp|svg` + `--out <file>`
- `convert`: `--in <path>` + `--to png|webp|jpg` + `--out <file>`; accepts `svg|png|jpg|jpeg|webp` inputs
- `svg-validate`: exactly one `--in <path>` + `--out <file.svg>`
- Optional sizing for raster convert output: `--width` / `--height`.
- Optional output controls: `--overwrite`, `--dry-run`, `--json`, `--report`.
Expand All @@ -31,7 +31,7 @@ Outputs:
- `summary.json` (when `--json` or `--report` is used)
- `report.md` (when `--report` is used)
- Assistant response (outside the script) must include:
- Output file/folder paths as clickable links (inline code)
- Output file/folder paths as clickable markdown file links
- A suggested “next time” prompt to repeat the same task

Exit codes:
Expand All @@ -46,10 +46,12 @@ Failure modes:
- Invalid or ambiguous flags (missing required params, unsupported combinations).
- Output already exists without `--overwrite`.
- Invalid convert contract:
- missing `--from-svg` / `--to` / `--out`
- `--in` used with `convert`
- `--out` extension mismatch vs `--to`
- `--to svg` with `--width`/`--height`
- missing `--in` / `--to` / `--out`
- repeated `--in`
- `--out` extension mismatch vs `--to` (`.jpeg` is valid for `--to jpg`)
- unsupported target format
- unsupported input format
- invalid `--width` / `--height` values
- Invalid `svg-validate` contract:
- missing or repeated `--in`
- missing `--out`
Expand All @@ -60,9 +62,11 @@ Failure modes:
### Preferences (optional; honor when provided)

- Operation: `convert` or `svg-validate`.
- Target format (for `convert`): `png` / `webp` / `svg`.
- Raster sizing (for `convert --to png|webp`): `--width`, `--height`.
- Target format (for `convert`): `png` / `webp` / `jpg`.
- Raster sizing (for `convert`): `--width`, `--height`.
- Reproducibility/audit flags: `--dry-run`, `--json`, `--report`, `--overwrite`.
- Output extension detail (for `--to jpg`): `.jpg` or `.jpeg`.
- JPG background behavior: transparent pixels are flattened onto white.

### Policies (must-follow per request)

Expand All @@ -76,13 +80,14 @@ Failure modes:
- Do not call ImageMagick binaries directly unless debugging the `image-processing` CLI itself.

3. Contract gate (exactly one operation path)
- `convert`: require `--from-svg`, `--to`, `--out`; forbid `--in`.
- `convert`: require exactly one `--in`, plus `--to` and `--out`.
- `convert`: accept `svg|png|jpg|jpeg|webp` inputs; require `--out` extension to match `--to` (`.jpeg` allowed for `--to jpg`).
- `svg-validate`: require exactly one `--in` and `--out`; forbid `--to`/`--width`/`--height`.

4. Completion response (fixed)
- After a successful run, respond using:
- `skills/tools/media/image-processing/references/ASSISTANT_RESPONSE_TEMPLATE.md`
- Include clickable output path(s) and a one-sentence “next prompt” that repeats the same task with concrete paths/options.
- Include clickable markdown file links and a one-sentence “next prompt” that repeats the same task with concrete paths/options.

## References

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

Use this template after a successful image-processing run.

```text
```md
Output:
- `<output file or folder path>`
- [<output file or folder name>](/absolute/path/to/output)

Next prompt:
- "<a single-sentence prompt that repeats the same task with concrete paths/options>"

Notes:
- Report (if used): `<out/image-processing/runs/<run_id>/report.md>`
- Summary (if `--json`/`--report` used): `<out/image-processing/runs/<run_id>/summary.json>`
- Report (if used): [report.md](/absolute/path/to/out/image-processing/runs/<run_id>/report.md)
- Summary (if `--json`/`--report` used): [summary.json](/absolute/path/to/out/image-processing/runs/<run_id>/summary.json)
- Warnings (if any): <short list>
```

Expand All @@ -20,8 +20,9 @@ Notes:
A good “next prompt” should include:

- The subcommand (`convert` or `svg-validate`)
- Exact input path(s) (`--from-svg` for convert, `--in` for svg-validate)
- Exact input path (`--in`)
- Exact output path (`--out`)
- Exact convert target (`--to png|webp|jpg`) when using `convert`
- Any non-default flags (e.g., `--width`, `--height`, `--overwrite`, `--report`, `--dry-run`)

Example:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,56 +10,57 @@ image-processing --help

- The CLI has exactly two subcommands: `convert` and `svg-validate`.
- By default, the CLI refuses to overwrite outputs. Use `--overwrite` to replace.
- `convert` is SVG-first: it requires `--from-svg` and does not accept `--in`.
- `convert` requires exactly one `--in` and accepts `svg|png|jpg|jpeg|webp` inputs.
- `convert` requires `--to png|webp|jpg`, and `--out` must match that target (`.jpeg` is accepted for `--to jpg`).
- `svg-validate` requires exactly one `--in` and an explicit `--out` ending in `.svg`.
- When `--json` is used, stdout is JSON only (logs go to stderr).
- JSON/report output includes `source.input_path` and `source.input_format`.

## Common flags

- Inputs:
- `convert`: `--from-svg <path>`
- `convert`: `--in <path>` (exactly one)
- `svg-validate`: `--in <path>` (exactly one)
- Output:
- `--out <file>` (required)
- `--overwrite` (optional)
- Convert target:
- `--to png|webp|svg` (required for `convert`)
- `--to png|webp|jpg` (required for `convert`)
- `--width`, `--height` (optional, raster targets only)
- Reproducibility:
- `--dry-run` (no image outputs written)
- `--json` (machine summary)
- `--report` (writes `report.md` under `out/image-processing/runs/<run_id>/`)
- `--json` (machine summary to stdout, plus `summary.json` under `out/image-processing/runs/<run_id>/`)
- `--report` (writes `report.md` and `summary.json` under `out/image-processing/runs/<run_id>/`)

## Subcommands

### `convert`

Render trusted SVG input to `png`, `webp`, or `svg`.
Convert `svg|png|jpg|jpeg|webp` input to `png`, `webp`, or `jpg`.

```bash
image-processing \
convert \
--from-svg path/to/icon.svg \
--in path/to/icon.svg \
--to webp \
--out out/icon.webp \
--json

image-processing \
convert \
--from-svg path/to/icon.svg \
--to png \
--out out/icon@2x.png \
--in path/to/photo.png \
--to jpg \
--out out/photo.jpg \
--width 512 \
--height 512 \
--json
```

Rules:

- Must include `--from-svg`, `--to`, and `--out`.
- Must not include `--in`.
- `--out` extension must match `--to`.
- `--to svg` does not support `--width`/`--height`.
- Must include exactly one `--in`, plus `--to` and `--out`.
- `--out` extension must match `--to` (`.jpeg` is accepted for `--to jpg`).
- `--to jpg` flattens alpha onto a white background.

### `svg-validate`

Expand All @@ -77,12 +78,13 @@ Rules:

- Requires exactly one `--in`.
- Requires `--out`, and output must be `.svg`.
- Does not support convert-only flags (`--from-svg`, `--to`, `--width`, `--height`).
- Does not support convert-only flags (`--to`, `--width`, `--height`).

## Known removed subcommands

The following legacy subcommands are no longer supported and now return usage errors:

- `generate`
- `info`
- `auto-orient`
- `resize`
Expand Down
Loading
Loading