moonlight-lupin/agent-skills / creative/image-studio
image-studio
VerifiedUse when the user wants image generation or editing through the local fal.ai three-stage studio workflow — brainstorm a strong prompt, prototype cheaply and iterate on feedback, then produce a finalised image. Covers "generate an image", "make an image/picture/illustration/graphic of…", "create an AI image", "edit/change this image", "make a variation", "upscale this", a "production-ready image", "clean up / enhance a photo", "make this phone shot look professional", imagery "for the deck/post/website/newsletter", or explicit mentions of fal.ai or nano-banana. Do not use for Canva template designs, branded PowerPoint decks, data charts/dashboards, or flowcharts/diagrams. Video generation is out of scope.
| File | Kind | Size |
|---|---|---|
| README.md | markdown | 1.5 KB |
| SKILL.md | skill md | 28.8 KB |
| examples/example-run.md | markdown | 3.4 KB |
| references/cleanup-checklist.md | markdown | 6.8 KB |
| references/fal-models.md | markdown | 10.3 KB |
| references/moss-layout.md | markdown | 4.2 KB |
| scripts/LICENSE-APACHE-2.0 | other | 11.1 KB |
| scripts/falgen.py | script | 28.0 KB |
| scripts/moss_compile_prompt.py | script | 5.9 KB |
| tests/test_falgen.py | script | 28.8 KB |
| tests/test_moss_compile_prompt.py | script | 6.2 KB |
scripts/moss_compile_prompt.py
View on GitHub#!/usr/bin/env python3
# Vendored from OpenMOSS/MOSS-Image skills/moss-image-prompt-enhancer/scripts/compile_prompt.py
# (Apache-2.0, copyright OpenMOSS/MOSI.AI). Verbatim copy + this header; usage under the
# MIT image-studio skill remains Apache-2.0 for this file. See references/moss-layout.md.
"""Compile a caption or absolute-pixel Layout draft into a MOSS-Image prompt."""
import argparse
import json
import math
import sys
from pathlib import Path
def require(condition, message):
if not condition:
raise ValueError(message)
def fields(value, allowed, required, location):
require(isinstance(value, dict), f"{location} must be an object")
unknown = value.keys() - allowed
missing = required - value.keys()
require(not unknown, f"{location}: unknown fields {sorted(unknown)}")
require(not missing, f"{location}: missing fields {sorted(missing)}")
def text(value, location):
require(isinstance(value, str) and bool(value.strip()), f"{location} must be nonempty text")
def strings(value, location):
require(isinstance(value, list), f"{location} must be an array")
for index, item in enumerate(value):
text(item, f"{location}[{index}]")
def centered_box(box, width, height, location):
require(isinstance(box, list) and len(box) == 4, f"{location} must be [x1,y1,x2,y2]")
require(
all(type(v) in (int, float) and math.isfinite(v) for v in box),
f"{location} must contain four finite numbers",
)
x1, y1, x2, y2 = box
require(x1 < x2 and y1 < y2, f"{location} must have positive width and height")
require(
0 <= x1 < x2 <= width and 0 <= y1 < y2 <= height,
f"{location} exceeds the {width}x{height} canvas",
)
# Enclose in pixel edges before centering, as in Echidna generation export.
result = [
math.floor(round(y1, 9)) - height // 2,
math.floor(round(x1, 9)) - width // 2,
math.ceil(round(y2, 9)) - height // 2,
math.ceil(round(x2, 9)) - width // 2,
]
require(result[0] < result[2] and result[1] < result[3],
f"{location} is too small at export precision")
return result
def compile_prompt(draft):
require(isinstance(draft, dict), "Draft must be a JSON object")
if "caption" in draft:
fields(draft, {"caption"}, {"caption"}, "Caption draft")
text(draft["caption"], "caption")
return draft["caption"]
root_fields = {"width", "height", "bbox_coord_space", "bbox_format", "summary", "items"}
fields(draft, root_fields, root_fields, "Layout draft")
width, height = draft["width"], draft["height"]
for name, value in (("width", width), ("height", height)):
require(type(value) is int and value > 0 and value % 16 == 0,
f"{name} must be a positive integer multiple of 16")
require(draft["bbox_coord_space"] == "abs", "Draft bbox_coord_space must be abs")
require(draft["bbox_format"] == "xyxy", "Draft bbox_format must be xyxy")
summary = draft["summary"]
fields(summary, {"caption", "meta", "canvas", "palette"}, {"caption"}, "summary")
text(summary["caption"], "summary.caption")
if "canvas" in summary:
require(summary["canvas"] in ("single", "multi_panel", "collage"),
"summary.canvas must be single, multi_panel or collage")
for key in ("meta", "palette"):
if key in summary:
strings(summary[key], f"summary.{key}")
items = draft["items"]
require(isinstance(items, list) and bool(items), "items must be a nonempty flat array")
compiled_items = []
for index, item in enumerate(items):
location = f"items[{index}]"
fields(item, {"label", "caption", "bbox", "text", "tags", "palette"},
{"label", "caption", "bbox"}, location)
require(item["label"] in ("object", "character", "text"),
f"{location}.label must be object, character or text")
text(item["caption"], f"{location}.caption")
if item["label"] == "text":
require("text" in item, f"{location}: text items require literal text")
if "text" in item:
text(item["text"], f"{location}.text")
for key in ("tags", "palette"):
if key in item:
strings(item[key], f"{location}.{key}")
compiled_items.append({
key: centered_box(value, width, height, f"{location}.bbox") if key == "bbox" else value
for key, value in item.items()
})
result = {"summary": summary, "items": compiled_items,
"bbox_coord_space": "abs_centralized", "bbox_format": "yxyx"}
return json.dumps(result, ensure_ascii=False, separators=(",", ":"), allow_nan=False)
def unique_object(pairs):
result = {}
for key, value in pairs:
require(key not in result, f"Duplicate JSON key: {key}")
result[key] = value
return result
def reject_constant(value):
raise ValueError(f"Invalid JSON number: {value}")
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("draft", type=Path, help="UTF-8 caption or Layout JSON draft")
parser.add_argument("--output", type=Path, help="Write prompt to a file instead of stdout")
args = parser.parse_args()
try:
if args.output:
require(args.output.resolve() != args.draft.resolve(),
"Output must be separate from the editable draft")
draft = json.loads(args.draft.read_text(encoding="utf-8"),
object_pairs_hook=unique_object, parse_constant=reject_constant)
prompt = compile_prompt(draft)
if args.output:
args.output.parent.mkdir(parents=True, exist_ok=True)
args.output.write_text(prompt + "\n", encoding="utf-8")
print(f"Wrote {args.output}", file=sys.stderr)
else:
print(prompt)
except (OSError, ValueError, OverflowError) as error:
parser.exit(2, f"Error: {error}\n")
if __name__ == "__main__":
main()
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| canvas-designanthropics/skillsCreate beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| docxanthropics/skillsUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', '.dotx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx or .dotx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| pdfanthropics/skillsUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| pptxanthropics/skillsUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions "deck," "slides," "presentation," or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |