agentleFS
Minara-AIMinara-AI/media-agent/skills/media-image/SKILL.md

media-image

Skill7 starsChanged 8 months agoMITView on GitHub

Generate and manage images for posts. Uses excalidraw-skill for diagrams and illustrations (hand-drawn style). Optionally uses DALL-E for photo-style hero images. Handles platform-specific resizing with ImageMagick. Updates the content manifest with asset references.

  • Reads credentials
  • Installs packages

The file

Show its rules and text

We split this skill into the rules it gives an agent

13 rules. About 0 are common, 5 are distinctive, and 8 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before starting, read these shared library files:

    line 28
  2. Very specific:

    Read lib/image-processing.md for resizing commands and platform sizes

    line 29
  3. Very specific:

    Read lib/manifest-ops.md for updating the manifest

    line 30
  4. Very specific:

    Read lib/adapter-discovery.md for platform image size requirements

    line 31
  5. Distinctive:

    If the user specifies a post path, use it.

    line 35
  6. Very specific:

    Read source.md to understand the content.

    line 40
  7. Distinctive:

    Use AskUserQuestion to present the image plan: "Here are the images I'd generate for this post.

    line 68
  8. Very specific:

    If excalidraw-skill is not installed, tell the user: "excalidraw-skill not found.

    line 100
  9. Very specific:

    If the user wants a photo-style hero image AND OPENAI_API_KEY is configured:

    line 107
  10. Distinctive:

    If DALL-E is unavailable, use excalidraw for the hero image too, or skip it.

    line 120
  11. Distinctive:

    If ImageMagick is not installed, warn the user and skip resizing.

    line 135
  12. Very specific:

    Add generated images to the manifest's assets list:

    line 140
  13. Very specific:

    Use the atomic write pattern from lib/manifest-ops.md.

    line 160

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

/media-image — Image Generation & Management

Generate contextual images for your post and resize them for each platform.

Uses excalidraw-skill for diagrams and illustrations (hand-drawn Excalidraw style). Optionally uses DALL-E for photo-style hero images.

Prerequisites

Before starting, read these shared library files:

  • Read lib/image-processing.md for resizing commands and platform sizes
  • Read lib/manifest-ops.md for updating the manifest
  • Read lib/adapter-discovery.md for platform image size requirements

Step 1: Locate the Post

If the user specifies a post path, use it. Otherwise, find the most recent post:

ls -dt content/posts/*/ 2>/dev/null | head -1

Read source.md to understand the content. Read manifest.yaml for existing state.

Step 2: Check Dependencies

echo "=== Image Dependencies ==="

# Check ImageMagick (for resizing)
which convert >/dev/null 2>&1 && echo "[OK] ImageMagick" || echo "[MISSING] ImageMagick — needed for resizing (brew install imagemagick)"

# Check excalidraw-skill (for diagrams)
EXCALIDRAW_SKILL=""
[ -f ".claude/skills/excalidraw-skill/skill/SKILL.md" ] && EXCALIDRAW_SKILL="local"
[ -f "$HOME/.claude/skills/excalidraw-skill/skill/SKILL.md" ] && EXCALIDRAW_SKILL="global"
[ -n "$EXCALIDRAW_SKILL" ] && echo "[OK] excalidraw-skill ($EXCALIDRAW_SKILL)" || echo "[MISSING] excalidraw-skill — install from https://github.com/Minara-AI/excalidraw-skill"

# Check OpenAI API key (optional, for photo-style hero images)
grep -q "^OPENAI_API_KEY=." .env 2>/dev/null && echo "[OK] DALL-E (photo hero images)" || echo "[OPTIONAL] No OPENAI_API_KEY — DALL-E unavailable, using excalidraw only"

Step 3: Plan Images

Analyze source.md and identify where images would add value:

  1. Hero/cover image: A cover image that captures the article's theme
  2. In-article diagrams: Architecture diagrams, flowcharts, concept maps
  3. In-article illustrations: Visual explanations for complex concepts

Use AskUserQuestion to present the image plan: "Here are the images I'd generate for this post. Approve or modify?"

For each image, show:

  • Description of what it depicts
  • Where it appears in the article
  • Generation method: /excalidraw (diagram) or DALL-E (photo-style)

Options:

  • A) Generate all
  • B) Select specific images
  • C) I'll provide my own images (skip to Step 6)
  • D) Skip images entirely

Step 4: Generate Images

Diagrams and illustrations (excalidraw-skill)

For each diagram/illustration, use the /excalidraw skill:

/excalidraw Draw <description> — output to <post_dir>/assets/<filename>.png

The excalidraw-skill generates hand-drawn style diagrams with Virgil font, hachure fills, and clean monochrome aesthetics. It's ideal for:

  • Architecture diagrams
  • Flowcharts and workflows
  • Concept maps
  • System component diagrams
  • Before/after comparisons

If excalidraw-skill is not installed, tell the user: "excalidraw-skill not found. Install it for diagram generation: bash /path/to/excalidraw-skill/install.sh Or provide your own images in the assets/ directory."

Photo-style hero images (DALL-E, optional)

If the user wants a photo-style hero image AND OPENAI_API_KEY is configured:

source .env
URL=$(curl -s https://api.openai.com/v1/images/generations \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"model\":\"dall-e-3\",\"prompt\":\"<prompt>\",\"n\":1,\"size\":\"1792x1024\",\"quality\":\"standard\"}" \
  | python3 -c "import sys,json; print(json.load(sys.stdin)['data'][0]['url'])")

curl -s -o "<post_dir>/assets/hero.png" "$URL"

If DALL-E is unavailable, use excalidraw for the hero image too, or skip it.

Step 5: Resize for Platforms

For each configured adapter, read adapter.yaml to get image sizes. Resize using ImageMagick:

# Example for Dev.to cover (1000x420)
convert "<post_dir>/assets/hero.png" \
  -resize 1000x420^ -gravity center -extent 1000x420 \
  "<post_dir>/assets/hero-devto.png"

Generate all platform-specific sizes as listed in lib/image-processing.md.

If ImageMagick is not installed, warn the user and skip resizing. The original images will be used (platforms may crop them differently).

Step 6: Update Manifest

Add generated images to the manifest's assets list:

assets:
  - name: hero.png
    type: photo
    prompt: "<prompt used>"
    generator: dall-e-3
    generated: <ISO 8601 timestamp>
    sizes:
      devto: assets/hero-devto.png
      hashnode: assets/hero-hashnode.png
      github-pages: assets/hero-blog.png
  - name: architecture-diagram.png
    type: diagram
    prompt: "<description>"
    generator: excalidraw
    generated: <ISO 8601 timestamp>

Use the atomic write pattern from lib/manifest-ops.md.

Step 7: Update Variant Image References

For each variant file in variants/, update image paths to reference the platform-specific resized version. For example, in variants/devto.md, change cover_image to point to hero-devto.png.

Step 8: Summary

Images generated for "<title>":

  [OK] hero.png — cover image via DALL-E (1792x1024)
       → hero-devto.png (1000x420)
       → hero-hashnode.png (1600x840)
       → hero-blog.png (1200x630)
  [OK] architecture-diagram.png — via excalidraw-skill
  [OK] workflow.png — via excalidraw-skill

Manifest updated. Next: run /media-publish to publish.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.