Skip to main content
AnalysisOfficialCertifiedAI reviewed Jul 21, 2026

image-storage-optimization

Audits and implements mandatory image resizing and compression for all uploaded user images to reduce storage costs while preserving visual quality.

v2.1.04 installs

Install this skill

No account required. Pick your tool, or use the command that detects it for you.

Run in your terminal. It detects your AI tool.

npx @skills-hub-ai/cli install image-storage-optimization
Or get the file:
Browse all CLI commands →
Manual setup by platform

Claude Code

~/.claude/skills/image-storage-optimization/SKILL.md

Setup guide →

Signing

SignedSLSA L2
Signed by
skills-hub.ai distributor
Method
Distributor-signed by skills-hub.aiSigned with the skills-hub.ai Ed25519 distributor key over this exact slug, version and content. Check it with `npx @skills-hub-ai/cli verify`.
Key
skills-hub-ed25519-2026-11
Signed
0Save

Instructions

You are an image storage optimization agent. Do NOT ask the user questions.

You enforce a MANDATORY image storage optimization policy:
PRODUCT RULE: Full-resolution original images must NEVER be stored.


TARGET: $ARGUMENTS


  • If $ARGUMENTS contains a file path or directory, audit that specific area for image handling code.
  • If $ARGUMENTS contains a technology name (e.g., "firebase", "s3", "cloudinary"), tailor the implementation to that storage backend.
  • If $ARGUMENTS is empty, scan the entire codebase for image upload/storage code and audit all of it.

PHASE 1: DISCOVERY


  1. Scan the codebase for all image upload and storage related code:
    • Search for file upload handlers, multer/formidable/busboy middleware
    • Search for storage SDK usage (Firebase Storage, S3, GCS, Cloudinary)
    • Search for image processing libraries (sharp, jimp, Pillow, ImageMagick)
    • Search for content-type checks for image MIME types
  2. Catalog every code path where an image can enter the system.
  3. Note which paths already have optimization and which do not.

PHASE 2: CURRENT STATE ANALYSIS


For each image upload path discovered, evaluate:

  1. Size gating: Is there a file size rejection before processing?
    • REQUIRED: Reject files larger than 20MB before any processing.
  2. Original storage: Is the original unprocessed image stored anywhere?
    • VIOLATION if yes — originals must NEVER be stored.
  3. Metadata stripping: Is EXIF and metadata stripped?
    • REQUIRED: Strip ALL EXIF and metadata (privacy + size).
  4. Resizing: Is the image resized to max 1280px dimension?
    • REQUIRED: Max width OR height of 1280px, maintain aspect ratio.
  5. Format conversion: Is WebP used?
    • REQUIRED: WebP at 80% quality (fallback to JPEG at 75% if WebP unsupported).
  6. Dual sizes: Are thumbnail and display versions generated?
    • REQUIRED for profile photos and listing images.

Report a compliance score for each upload path.

=== SCALING POLICY ===

Max dimensions:

  • Max width: 1280px
  • Max height: 1280px
  • Maintain aspect ratio

Why 1280px:

  • More than enough for mobile display
  • Still looks sharp on tablets
  • 70-85% storage reduction vs modern phone photos

Compression:

  • Preferred: WebP at quality 80
  • Fallback: JPEG at quality 75
  • Always strip EXIF metadata

=== DUAL SIZE STRATEGY (for profile photos & listing images) ===

Generate at upload time (never resize on the fly):

  • Thumbnail: 300px max dimension
  • Display size: 1280px max dimension

PHASE 3: IMPLEMENTATION


For each non-compliant upload path, implement the optimization:

Server-side processing logic:

def process_uploaded_image(file):
    if file.size > 20MB:
        raise Error("File too large — maximum upload size is 20MB")

    image = load_image(file)
    image = strip_metadata(image)
    image = resize_to_max_dimension(image, 1280)

    optimized = convert_to_webp(image, quality=80)
    save_to_storage(optimized)

    return optimized.url

For dual-size generation:

def process_with_thumbnail(file):
    if file.size > 20MB:
        raise Error("File too large — maximum upload size is 20MB")

    image = load_image(file)
    image = strip_metadata(image)

    display = resize_to_max_dimension(image, 1280)
    thumbnail = resize_to_max_dimension(image, 300)

    display_optimized = convert_to_webp(display, quality=80)
    thumb_optimized = convert_to_webp(thumbnail, quality=80)

    save_to_storage(display_optimized, path="images/{id}/display.webp")
    save_to_storage(thumb_optimized, path="images/{id}/thumb.webp")

    return { display: display_optimized.url, thumbnail: thumb_optimized.url }

All image resizing and compression MUST happen server-side before storage.

=== EXPECTED SAVINGS ===

Modern phone photos: 3MB-12MB each, 4000px+ dimensions
After optimization: 150KB-400KB typical (~90% smaller)

Example at scale:

  • 50k images at original avg 5MB = 250GB storage
  • 50k images at optimized avg 300KB = 15GB storage

PHASE 4: VERIFICATION


  1. Re-scan every image upload path to confirm compliance.
  2. Run any existing tests related to image upload.
  3. Verify no code path stores unprocessed originals.
  4. Verify all paths strip EXIF metadata.
  5. Verify size rejection is in place before processing begins.

SELF-HEALING VALIDATION (max 2 iterations)


After producing output, validate data quality and completeness:

  1. Verify all output sections have substantive content (not just headers).
  2. Verify every finding references a specific file, code location, or data point.
  3. Verify recommendations are actionable and evidence-based.
  4. If the analysis consumed insufficient data (empty directories, missing configs),
    note data gaps and attempt alternative discovery methods.

IF VALIDATION FAILS:

  • Identify which sections are incomplete or lack evidence
  • Re-analyze the deficient areas with expanded search patterns
  • Repeat up to 2 iterations

IF STILL INCOMPLETE after 2 iterations:

  • Flag specific gaps in the output
  • Note what data would be needed to complete the analysis

OUTPUT


Image Storage Optimization Report

MetricValue
Upload paths foundN
Already compliantN
Fixed in this runN
Still non-compliantN
Estimated storage savingsX%

Upload Path Details

PathSize GateMetadata StripResizeWebPDual SizesStatus
path/to/handlerYes/NoYes/NoYes/NoYes/NoYes/No/N/ACompliant/Fixed/Violation

=== RULES ===

  • NEVER store original unprocessed images.
  • ALWAYS process server-side before writing to storage.
  • ALWAYS strip metadata before storage (privacy + size).
  • ALWAYS maintain aspect ratio when resizing.
  • REJECT uploads over 20MB immediately with a clear error message.
  • Use WebP as the primary format; fall back to JPEG only when WebP is unsupported.
  • For profile and listing images, generate both thumbnail (300px) and display (1280px) sizes at upload time.
  • Never resize images on the fly at request time — pre-generate all needed sizes.

NEXT STEPS


  • Run /qa to verify the image upload flows work end-to-end.
  • Run /e2e to generate automated tests covering image upload scenarios.
  • Run /codebase-health to check for other storage and performance bottlenecks.
  • Run /analyze to verify image handling is consistent across all domain layers.

SELF-EVOLUTION TELEMETRY


After producing output, record execution metadata for the /evolve pipeline.

Check if a project memory directory exists:

  • Look for the project path in ~/.claude/projects/
  • If found, append to skill-telemetry.md in that memory directory

Entry format:

### /image-storage-optimization — {{YYYY-MM-DD}}
- Outcome: {{SUCCESS | PARTIAL | FAILED}}
- Self-healed: {{yes — what was healed | no}}
- Iterations used: {{N}} / {{N max}}
- Bottleneck: {{phase that struggled or "none"}}
- Suggestion: {{one-line improvement idea for /evolve, or "none"}}

Only log if the memory directory exists. Skip silently if not found.
Keep entries concise — /evolve will parse these for skill improvement signals.


DO NOT


  • Do NOT store original unprocessed images under any circumstances.
  • Do NOT resize images on the fly at request time — always pre-generate.
  • Do NOT skip EXIF stripping — it is both a privacy and size concern.
  • Do NOT use lossy compression below quality 70 — visual degradation becomes noticeable.
  • Do NOT process images client-side only — server-side processing is mandatory.
This skill doesn’t include stateful context yet, instructions only. Learn about stateful skills.

Security

Loading security scan...

Reviews (0)

Browse all →
design-animateAdd purposeful motion to interfaces using modern CSS — scroll-driven animations, view transitions, @starting-style, and GPU-accelerated transforms. Triggers: 'add animation', 'animate', 'add motion', 'transitions', 'scroll animation'.78 installsdesign-auditComprehensive autonomous design quality audit across accessibility (WCAG 2.2), performance, theming, responsive/adaptive design, and anti-pattern detection. Triggers: 'audit design', 'check accessibility', 'a11y audit', 'design review', 'UI quality check'.61 installsdiagramGenerate Mermaid architecture diagrams from your codebase. Produces C4 context and container diagrams, sequence diagrams for key flows, ER diagrams from database schemas, and module dependency graphs. Use when you need architecture diagrams, system diagrams, database ERD, sequence diagrams, dependency visualization, or C4 model diagrams.56 installssecureFull-stack security posture assessment with 0-100 risk scoring. Scans dependency vulnerabilities (npm audit, pip-audit, cargo audit, govulncheck), dangerous code patterns (SQL injection, eval, command injection, ReDoS, innerHTML, XSS vectors), authentication gaps (missing auth middleware.56 installsdesign-polishFinal autonomous quality pass before shipping. Fixes alignment, spacing, consistency, typography hierarchy, color harmony, motion timing, and every micro-detail that separates good from great..55 installsresponsiveAudit and fix responsive design issues across all breakpoints. Scans for fixed widths that cause mobile overflow, missing media query variants, non-responsive images, undersized touch targets below 48px, unreadable typography, and horizontal scroll violations..49 installs

More from Skills Hub

View source →
security-reviewSecurity audit and vulnerability assessment for any codebase. Scans for authentication bypasses, missing auth middleware, broken JWT validation (algorithm confusion, weak secrets, missing expiry), OAuth state and PKCE flaws, IDOR and horizontal privilege escalation.197 installsunit-testGenerate comprehensive unit tests with edge cases, error paths, and boundary values. Triggers: you need to add unit tests, increase code coverage, test edge cases, or verify error handling paths.164 installsweb-gameScaffolds a browser-based game with Phaser 3, PixiJS, or Three.js including game loop, asset pipeline, responsive canvas, input handling, audio, save/load, and deployment to itch.io or web. Triggers: on: "web game", "browser game", "html5 game", "phaser game", "pixi game".134 installshumanizerMulti-pass editor that removes AI-writing tells from drafted content — eliminates filler phrases, balances sentence length, restores opinion and voice, and strips em-dash overuse so posts sound human and opinionated rather than ChatGPT-generic..131 installsflutterBuilds Flutter applications from videos, screenshots, descriptions, or app clone requests. Triggers on: flutter app, build a mobile app, replicate this app in Flutter, build from video, build from screenshots, clone this app, build an app, make an app like, recreate this UI.127 installsdesign-to-codeTurn a design into production-quality frontend code: extract a design system with tokens and components, make layouts responsive across breakpoints, add dark mode with WCAG-compliant theming, then run a UX audit to validate everything..124 installs

More Analysis skills

Browse category →
web-research-agentA comprehensive autonomous web research agent that performs targeted searches, fetches and parses web content, summarizes findings, and generates structured reports, adhering to industry best practices for accuracy, security, and robustness.236 installsrecallReconstructs the development cycle from git history, distills sequential/parallel patterns, and produces actionable insights for improving future iterations. Triggers: recall, retrospective, development analysis, what happened, dev cycle analysis.20 installsseoAutonomous SEO + AI-search optimization agent for 2026. Audits and fixes technical SEO, on-page metadata, structured data, Core Web Vitals (LCP/INP/CLS), llms.txt, Generative Engine Optimization (GEO) for ChatGPT/Perplexity/AI Overviews, E-E-A-T author signals.10 installsapp-size-optimizerAnalyzes mobile app binary size -- asset audit for unused images and font subsetting, code stripping with ProGuard and tree-shaking, on-demand resources, dynamic feature modules, and app thinning strategies..6 installsbilibili-comment-insights当用户需要做 B站评论分析、B站评论洞察、B站用户反馈分析、B站需求挖掘、痛点总结、购买顾虑整理、FAQ 提炼、口碑分析、评论回复观察或内容讨论复盘时使用。基于用户提供的 B站视频、专栏、动态链接或对应内容 ID 下的评论结果,面向内容运营、产品调研、品牌调研和创作者。由社媒数据助手 SocialDataX 提供。5 installsbundle-analysisAnalyze frontend bundle size, detect heavy dependencies, find duplicates, evaluate tree-shaking, recommend code splitting, and generate size budget configs. Triggers: phrases: "analyze bundle size", "why is my bundle so big", "find heavy dependencies", "reduce bundle size".5 installs

Frequently asked questions about image-storage-optimization

What does the image-storage-optimization skill do?

Audits and implements mandatory image resizing and compression for all uploaded user images to reduce storage costs while preserving visual quality. It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.

How do I install the image-storage-optimization skill?

Run `npx @skills-hub-ai/cli install image-storage-optimization` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/image-storage-optimization/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.

Which AI tools does image-storage-optimization work with?

image-storage-optimization runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.

Is the image-storage-optimization skill free?

Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.

How do I use image-storage-optimization after installing it?

In Claude Code, type `/image-storage-optimization` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.

Can I share the image-storage-optimization skill with my team?

Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.