AgentSkillsCN

placeholder-images

生成SVG占位符图片用于原型。当为布局、原型或开发添加占位符图片时使用。支持简单、带标签和品牌意识的类型。

SKILL.md
--- frontmatter
name: placeholder-images
description: Generate SVG placeholder images for prototypes. Use when adding placeholder images for layouts, mockups, or development. Supports simple, labeled, and brand-aware types.
allowed-tools: Read, Write, Edit, Bash

Placeholder Images Skill

Generate SVG placeholder images for HTML prototypes and layouts.

Placeholder Types

TypeDescriptionUse Case
simpleGrey box with diagonal XBasic layout placeholder
labeledGrey box with text labelDescribe image purpose
brandUses design token colorsPolished prototypes

Size Presets

PresetDimensionsCommon Use
avatar-sm48x48User list avatars
avatar-lg128x128Profile avatars
thumbnail150x150Grid thumbnails
product400x400Product cards
card400x225Blog/article cards (16:9)
hero1200x400Hero banners
og1200x630Open Graph images

Custom sizes: Use WxH format (e.g., 800x600).


Simple Placeholder

Grey background with diagonal X lines:

html
<img src="/.assets/images/placeholder/simple-400x400.svg"
     alt="Placeholder image"
     width="400"
     height="400"/>

SVG Pattern:

xml
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 400"
     role="img" aria-label="Placeholder image">
  <title>Placeholder image</title>
  <rect width="400" height="400" fill="#f3f4f6"/>
  <line x1="0" y1="0" x2="400" y2="400" stroke="#d1d5db" stroke-width="1"/>
  <line x1="400" y1="0" x2="0" y2="400" stroke="#d1d5db" stroke-width="1"/>
</svg>

Labeled Placeholder

Grey background with descriptive text:

html
<img src="/.assets/images/placeholder/hero-1200x400.svg"
     alt="Hero banner placeholder"
     width="1200"
     height="400"/>

SVG Pattern:

xml
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 400"
     role="img" aria-label="Hero Image placeholder">
  <title>Hero Image placeholder</title>
  <rect width="1200" height="400" fill="#f3f4f6"/>
  <line x1="0" y1="0" x2="1200" y2="400" stroke="#d1d5db" stroke-width="1"/>
  <line x1="1200" y1="0" x2="0" y2="400" stroke="#d1d5db" stroke-width="1"/>
  <text x="600" y="200" text-anchor="middle" dominant-baseline="middle"
        font-family="system-ui, -apple-system, sans-serif"
        font-size="24" fill="#6b7280">
    Hero Image
  </text>
</svg>

Brand Placeholder

Uses design tokens for brand-consistent placeholders. The script automatically looks for CSS files in common locations and extracts color tokens.

Token Mapping:

Placeholder ColorTokens Searched
Background--background-alt, --background-main, --surface-color
Stroke--border-color, --border-light
Text--text-muted, --text-color
Accent--primary-color, --primary, --accent-color
Accent Text--text-inverted, --primary-text

Auto-detection paths:

  • src/styles/main.css
  • src/styles/_tokens.css
  • .assets/styles/main.css
  • .claude/styles/main.css
bash
# Auto-detect CSS file
node .claude/scripts/generate-placeholder.js --type brand --label "Product" --preset product

# Specify CSS file explicitly
node .claude/scripts/generate-placeholder.js --type brand --label "Hero" --size 1200x400 --tokens src/styles/main.css

Example output:

xml
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 400"
     role="img" aria-label="Product Shot placeholder">
  <title>Product Shot placeholder</title>
  <rect width="400" height="400" fill="#f8fafc"/>
  <line x1="0" y1="0" x2="400" y2="400" stroke="#e2e8f0" stroke-width="1"/>
  <line x1="400" y1="0" x2="0" y2="400" stroke="#e2e8f0" stroke-width="1"/>
  <rect x="125" y="175" width="150" height="50" rx="4" fill="#2563eb"/>
  <text x="200" y="205" text-anchor="middle" dominant-baseline="middle"
        font-family="system-ui, -apple-system, sans-serif"
        font-size="14" fill="#ffffff">
    Product Shot
  </text>
</svg>

Common Image Types

Use these labels for semantic clarity:

LabelTypical SizeDescription
Hero Image1200x400Page header banner
Product Shot400x400E-commerce product
Team Photo300x300Staff headshot
Thumbnail150x150Grid/list preview
Logo200x50Brand logo
Icon48x48UI icon
Banner728x90Ad banner
Card Image400x225Blog/article card
Gallery800x600Photo gallery
Avatar64x64User profile

File Organization

code
.assets/images/placeholder/
├── simple-400x400.svg
├── simple-800x600.svg
├── hero-1200x400.svg
├── product-400x400.svg
├── avatar-128x128.svg
└── card-400x225.svg

Generate with Script

bash
# Simple placeholder
node .claude/scripts/generate-placeholder.js --type simple --size 400x400

# Labeled placeholder
node .claude/scripts/generate-placeholder.js --type labeled --label "Hero Image" --size 1200x400

# Brand placeholder (auto-detects CSS tokens)
node .claude/scripts/generate-placeholder.js --type brand --label "Product" --preset product

# Brand placeholder with specific CSS file
node .claude/scripts/generate-placeholder.js --type brand --label "Hero" --size 1200x400 \
  --tokens src/styles/main.css

# Output to file
node .claude/scripts/generate-placeholder.js --type labeled --label "Product" --size 400x400 \
  --output .assets/images/placeholder/product-400x400.svg

# Generate preset
node .claude/scripts/generate-placeholder.js --preset product
node .claude/scripts/generate-placeholder.js --preset hero --label "Welcome Banner"

Inline Data URI

For quick prototyping, use inline data URIs:

html
<img src="data:image/svg+xml,..." alt="Placeholder"/>

Generate with:

bash
node .claude/scripts/generate-placeholder.js --type simple --size 200x200 --inline

Accessibility

All placeholders MUST include:

  1. role="img" on the SVG element
  2. aria-label describing the placeholder
  3. <title> element as first child of SVG
  4. Meaningful alt text on the <img> element

Checklist

When adding placeholder images:

  • Use appropriate preset or custom size
  • Add descriptive label for labeled/brand types
  • Include meaningful alt text
  • Place in .assets/images/placeholder/ directory
  • Use consistent naming: {type}-{width}x{height}.svg

Related Skills

  • images - Umbrella coordinator for image handling with automation
  • responsive-images - Modern responsive image techniques using picture element
  • fake-content - Generate realistic fake content for HTML prototypes
  • xhtml-author - Write valid XHTML-strict HTML5 markup
  • performance - Write performance-friendly HTML pages