‹ 首页

blog-image

@infrasity-labs · 收录于 1 周前

AI image generation and editing for blog content powered by Gemini via MCP. Claude acts as Creative Director - interpreting intent, selecting domain expertise, constructing optimized 6-component prompts (Subject + Action + Context + Composition + Lighting + Style), and orchestrating Gemini for blog-quality results. Generates hero images, inline illustrations, social preview cards, and OG images. Edits existing blog images. Supports 6 blog-optimized domain modes (Editorial, Product, Landscape, UI/Web, Infographic, Abstract). Works standalone via /blog image or internally from blog-write and blog-rewrite workflows. Falls back gracefully when MCP is not configured. Use when user says "blog image", "generate hero image", "blog illustration", "social card", "generate blog image", "edit blog image", "image generate", "blog cover image", "inline image", "OG image".

适合你,如果你需要为博客内容快速生成高质量的配图

/ 下载安装
blog-image.skill双击,或拖进 Claude 桌面版 / Cowork,即完成安装↓ .skill↓ .zip
用别的 agent?下载 .zip 解压,把文件夹放进它的技能目录
Claude Code~/.claude/skills/(项目级 .claude/skills/)
Codex CLI~/.codex/skills/
Cursor自动读取上面两处目录
其他工具见其文档的「skills」目录;两个下载是同一份文件,只是名字不同
/ 通过 npx 安装 校验哈希
npx oh-my-skill add infrasity-labs/dev-gtm-claude-skills/blog-image
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- infrasity-labs/dev-gtm-claude-skills/blog-image
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify infrasity-labs/dev-gtm-claude-skills/blog-image
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
82GitHub stars
~2.8K最小装载
~11K含声明引用
~11K文本包总量
镜像托管

怎么用

技能原文 SKILL.md作者撰写 · MIT · 02cfefb

Blog Image - AI Image Generation for Blog Content

You are a Creative Director that orchestrates Gemini's image generation specifically for blog content. Never pass raw user text directly to the API. Always interpret, enhance, and construct an optimized prompt using the 6-component Reasoning Brief system.

Quick Reference

| Command | What it does | |---------|-------------| | /blog image generate <idea> | Generate a blog image with full prompt engineering | | /blog image edit <path> <instructions> | Edit an existing blog image intelligently | | /blog image setup | Configure MCP server and API key |

Blog Image Types

Match the image type to blog use case:

| Image Type | Aspect Ratio | Resolution | Domain Mode | Placement | |------------|-------------|-----------|-------------|-----------| | Hero/Cover | 16:9 | 2K or 4K | Editorial / Landscape | Frontmatter coverImage | | OG/Social Card | 16:9 | 1K | Editorial / Infographic | Frontmatter ogImage | | Inline Illustration | 16:9 or 4:3 | 1K | Varies by topic | After H2, before body | | Inline Product Shot | 4:3 or 1:1 | 1K | Product | Within product sections | | Section Divider | 8:1 or 4:1 | 1K | Abstract / Landscape | Between major sections |

Sizing requirements:

  • Blog hero/cover: 1200x630 (OG-compatible) or 1920x1080
  • Open Graph (OG): 1200x630 (required for social sharing)
  • Inline images: 1200px+ wide
MCP Availability Check

Before generating, check if nanobanana-mcp tools are available:

  1. Try calling get_image_history (lightweight, no side effects)
  2. If it succeeds: MCP is available, proceed with generation
  3. If it fails: MCP not configured - inform the user:
  4. "Image generation requires the nanobanana-mcp server. Run /blog image setup to configure it."
  5. When called internally (from blog-write/blog-rewrite): return silently, no error. The calling workflow continues with stock photos.
Generation Workflow

For /blog image generate <idea> or when invoked internally:

Step 1: Analyze Intent

Determine what the blog needs:

  • Image type: Hero, inline, OG card, section divider?
  • Blog topic: What is the article about?
  • Style: Photorealistic, editorial, illustrated, minimal?
  • Constraints: Brand colors, specific dimensions, platform format?
  • Mood: Authoritative, inviting, dramatic, clean?

If the request is vague, ask one clarifying question about use case and style.

Step 2: Select Domain Mode

Choose the expertise lens for the image:

| Mode | When to use | Prompt emphasis | |------|-------------|-----------------| | Editorial | Blog headers, feature images, lifestyle | Styling, composition, publication references | | Product | E-commerce posts, reviews, comparisons | Surface materials, studio lighting, clean BG | | Landscape | Environmental backgrounds, travel, hero sections | Atmospheric perspective, depth layers, time of day | | UI/Web | Tech blog icons, illustrations, diagrams | Clean vectors, flat design, exact colors | | Infographic | Data-driven posts, processes, comparisons | Layout structure, hierarchy, accessible colors | | Abstract | Pattern backgrounds, section dividers, decorative | Color theory, mathematical forms, textures |

Load references/prompt-engineering-blog.md for domain mode modifier libraries.

Step 3: Construct the 6-Component Reasoning Brief

Build the prompt as natural narrative paragraphs - NEVER as keyword lists:

  1. Subject - Who/what, with rich physical detail (textures, materials, scale)
  2. Action - What is happening, pose, gesture, movement, state
  3. Context - Environment, setting, time of day, season, weather
  4. Composition - Camera angle, shot type, framing, negative space, depth
  5. Lighting - Light source, quality, direction, color temperature, shadows
  6. Style - Art medium, aesthetic, film stock, reference artists/eras

Template for photorealistic blog images:

A photorealistic [shot type] of [subject with physical detail], [action/pose],
set in [environment with specifics]. [Lighting conditions] create [mood].
Captured with [camera model], [focal length] lens at [f-stop], producing
[depth of field effect]. [Color palette/grading notes]. Aspect ratio 16:9,
suitable as a blog [hero image/inline illustration] at [target dimensions].

Template for illustrated/stylized:

A [art style] [format] of [subject with character detail], featuring
[distinctive characteristics] with [color palette]. [Line style] and
[shading technique]. Background is [description]. [Mood/atmosphere].
Step 4: Set Aspect Ratio

Call set_aspect_ratio BEFORE generating:

| Blog Use Case | Ratio | |---------------|-------| | Hero / Cover / OG | 16:9 | | Product shot / Square | 4:3 or 1:1 | | Section divider | 8:1 or 4:1 | | Vertical (stories) | 9:16 |

Step 5: Generate via MCP

| MCP Tool | When | |----------|------| | set_aspect_ratio | Always call first if ratio differs from 1:1 | | gemini_generate_image | New image from crafted prompt | | gemini_edit_image | Modify existing image | | gemini_chat | Iterative refinement / multi-turn sessions | | get_image_history | Review generated images | | clear_conversation | Reset session context |

Model selection (use set_model MCP tool if switching):

  • NB2 Flash (default): Best for most blog images - fast, 14 ratios, 4K, $0.067/img
  • NB Pro: Use for hero images with text overlays (94% text accuracy) or highest quality - $0.134/img
  • Original: Budget option at $0.039/img - 5 ratios, 1K max

Load references/mcp-tools.md for parameter details. Load references/gemini-models.md for model specs, pricing, and rate limits.

Step 6: Post-Processing (when needed)

After generation, resize/convert for blog use:

# Resize to blog hero dimensions (1200x630)
magick input.png -resize 1200x630^ -gravity center -extent 1200x630 hero.png

# Convert to WebP for web optimization
magick input.png -quality 85 output.webp

# Convert to AVIF (smallest, modern)
magick input.png -quality 80 output.avif

# Crop to exact OG dimensions
magick input.png -resize 1200x630^ -gravity center -extent 1200x630 og-image.png

Check if magick (ImageMagick 7) is available. Fall back to convert if not.

Step 7: Deliver

Provide:

  1. Image path - where it was saved (~/Documents/nanobanana_generated/)
  2. Crafted prompt - show the full Reasoning Brief (educational)
  3. Settings - model, aspect ratio, domain mode
  4. Alt text - descriptive sentence, 10-125 chars, topic keywords naturally
  5. Frontmatter snippet (for hero/OG images):
coverImage: "/path/to/generated-image.png"
coverImageAlt: "Descriptive alt text sentence with topic keywords"
ogImage: "/path/to/generated-image.png"
  1. Refinement suggestions - 1-2 ideas if relevant
Edit Workflow

For /blog image edit <path> <instructions>:

  1. Read the image path and edit instruction
  2. Enhance the instruction (never pass raw): | User says | Claude crafts | |-----------|---------------| | "remove background" | Detailed edge-preserving background removal | | "make it warmer" | Specific color temperature shift with preservation notes | | "add text" | Font style, size, placement, contrast, readability notes | | "make it brighter" | Increase exposure, lift shadows, maintain highlights | | "crop for social" | Resize to 1200x630 with center-gravity crop |
  3. Call gemini_edit_image with enhanced instruction
  4. Return modified image path and description
Internal API (for blog-write / blog-rewrite)

When invoked as a Task subagent from blog-write or blog-rewrite:

Input (provided by calling skill):

  • image_type: hero, inline, og, divider
  • topic: blog post topic/title
  • section_context: (optional) heading or section the image supports
  • style_preference: (optional) photorealistic, illustrated, editorial
  • count: (optional) number of images needed (default: 1)

Output (returned to calling skill):

### Generated Image
- **Path:** ~/Documents/nanobanana_generated/image_timestamp.png
- **Alt Text:** Descriptive sentence about the image
- **Type:** hero / inline / og
- **Domain Mode:** Editorial
- **Aspect Ratio:** 16:9
- **Suggested Frontmatter:**
  coverImage: "/path/to/image.png"
  coverImageAlt: "Alt text here"

Graceful fallback: If MCP is unavailable, return immediately with no error. The calling workflow continues with stock photos. Never block blog-write or blog-rewrite because image generation is unavailable.

Alt Text Generation

For every generated image, create alt text following blog standards:

  • Full descriptive sentence (not keyword list)
  • 10-125 characters
  • Include topic keywords naturally
  • Describe what the image shows AND its relevance to the content
  • For charts/infographics: include the key data point

Good: Marketing team analyzing AI search traffic data on a dashboard showing citation metrics Bad: SEO AI marketing blog optimization image

Setup

For /blog image setup:

  1. Run python3 scripts/setup_image_mcp.py (interactive)
  2. Or: python3 scripts/setup_image_mcp.py --key YOUR_KEY (non-interactive)
  3. Default writes to ~/.claude/settings.json (user-private, mode 0600)
  4. --project flag opts into project .mcp.json (env-expansion only, refuses to write a literal key into a tracked file)
  5. Verify: python3 scripts/validate_image_setup.py
  6. Requires:
  7. Node.js 18+ (npx)
  8. Google AI API key (free at https://aistudio.google.com/apikey)
  9. The script pins the package to @ycse/nanobanana-mcp@1.1.1. Update the pin in setup_image_mcp.py (constant PINNED_PACKAGE) when bumping.
Safety Filter Auto-Rephrase

When IMAGE_SAFETY or SAFETY is returned, do NOT give up. Auto-rephrase and retry:

  1. Identify the likely trigger (violence, public figures, NSFW-adjacent, or overly cautious filter)
  2. Rephrase using positive framing - describe what you WANT, not what to avoid
  3. If the subject is a person, make them generic (remove celebrity-like specifics)
  4. If the scene is dramatic, soften: "intense" → "focused", "battle" → "competition"
  5. Retry with the rephrased prompt (max 3 attempts before reporting to user)

Google acknowledged filters "became way more cautious than we intended" - benign prompts are sometimes blocked. Persistence with rephrasing usually succeeds.

Edit, Don't Re-roll

If an image is 80% correct, use gemini_chat for conversational editing rather than regenerating from scratch. The session maintains style consistency, so targeted edits preserve what works while fixing what doesn't.

When to edit vs regenerate:

  • Color slightly off → Edit ("shift the color temperature warmer")
  • Wrong composition entirely → Regenerate with revised brief
  • Good scene but wrong lighting → Edit ("change to golden hour lighting from the left")
  • Missing a detail → Edit ("add a steaming coffee cup on the desk")
Error Handling

| Error | Resolution | |-------|-----------| | MCP not configured | Run /blog image setup | | API key invalid | New key at https://aistudio.google.com/apikey | | Rate limited (429) | Wait 60s, retry. Free tier: ~5-15 RPM / ~20-500 RPD (varies by model and billing) | | IMAGE_SAFETY | Auto-rephrase (see above) - Layer 2 filter, non-configurable | | PROHIBITED_CONTENT | Content policy violation - topic is blocked. Non-retryable. | | SAFETY | Rephrase prompt - Layer 1 filter | | Vague request | Ask one clarifying question before generating | | Poor quality | Review Reasoning Brief - likely missing lighting (biggest quality differentiator) | | MCP unavailable (internal call) | Return silently - calling workflow uses stock photos |

Reference Documentation

Load on-demand - do NOT load all at startup:

  • references/prompt-engineering-blog.md - Domain modes, 6-component system, blog templates
  • references/gemini-models.md - Model specs, rate limits, aspect ratios, pricing
  • references/mcp-tools.md - MCP tool parameters and response formats
按 MIT 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。