This skill should be used when the user asks to \"upload images to Cloudflare\", \"implement direct creator upload\", \"configure image transformations\", \"optimize WebP/AVIF\", \"create image variants\", \"generate signed URLs\", \"add image watermarks\", \"integrate with Next.js/Remix\", \"configure webhooks\", \"debug CORS errors\", \"troubleshoot error 5408/9401-9413\", or \"build responsive images with Cloudflare Images API\".
npx skills add https://github.com/secondsky/claude-skills --skill cloudflare-images
Status: Production Ready ✅ | Version: 3.0.0 | Last Verified: 2025-12-27
Two powerful features:
Key benefits:
Dashboard → Images → Enable
Get your Account ID and create API token (Cloudflare Images: Edit permission)
curl --request POST \
--url https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/images/v1 \
--header 'Authorization: Bearer <API_TOKEN>' \
--header 'Content-Type: multipart/form-data' \
--form 'file=@./image.jpg'
CRITICAL: Use multipart/form-data, not JSON
<img src="https://imagedelivery.net/<ACCOUNT_HASH>/<IMAGE_ID>/public" />
Dashboard → Images → Transformations → Enable for zone
Transform ANY image:
<img src="/cdn-cgi/image/width=800,quality=85/uploads/photo.jpg" />
export default {
async fetch(request: Request): Promise<Response> {
return fetch("https://example.com/image.jpg", {
cf: {
image: {
width: 800,
quality: 85,
format: "auto" // WebP/AVIF
}
}
});
}
};
Load references/setup-guide.md for complete walkthrough.
Upload methods:
Load templates/upload-api-basic.ts for file upload example.
Load references/direct-upload-complete-workflow.md for user uploads.
Optimize ANY image (uploaded or external).
Methods:
/cdn-cgi/image/width=800,quality=85/path/to/image.jpgcf.image fetch optionLoad references/transformation-options.md for all options.
Load templates/transform-via-workers.ts for Workers example.
Predefined transformations (up to 100).
Examples:
thumbnail: 200x200, fit=coverhero: 1920x1080, quality=90mobile: 640, quality=75Load references/variants-guide.md for complete guide.
/cdn-cgi/image/10. Use fit=cover for consistent aspect ratios
10. Never use transformations on non-proxied requests
Direct creator upload pattern for user-uploaded images:
// Backend: Generate upload URL
const response = await fetch(
`https://api.cloudflare.com/client/v4/accounts/${ACCOUNT_ID}/images/v2/direct_upload`,
{ method: 'POST', headers: { 'Authorization': `Bearer ${API_TOKEN}` } }
);
const { result } = await response.json();
return Response.json({ uploadURL: result.uploadURL });
// Frontend: Upload file
const formData = new FormData();
formData.append('file', file);
await fetch(uploadURL, { method: 'POST', body: formData });
Load templates/direct-creator-upload-backend.ts for complete example.
See examples/basic-upload/ for complete working project.
Responsive images with srcset for optimal performance:
<img
srcset="
https://imagedelivery.net/abc/xyz/width=400 400w,
https://imagedelivery.net/abc/xyz/width=800 800w,
https://imagedelivery.net/abc/xyz/width=1200 1200w
"
sizes="(max-width: 600px) 400px, (max-width: 1000px) 800px, 1200px"
src="https://imagedelivery.net/abc/xyz/width=800"
/>
Load templates/responsive-images-srcset.html for complete example.
See examples/responsive-gallery/ for complete working project.
Additional Use Cases:
references/transformation-options.mdreferences/signed-urls-guide.md or see examples/private-images/templates/batch-upload.tsreferences/framework-integration.md for Next.js, Remix, Astroreferences/overlays-watermarks.md and templates/overlay-watermark.tsreferences/custom-domains.mdreferences/webhooks-guide.md and templates/webhook-handler.tsProblem: Browser blocks direct upload from your domain.
Solution: Configure CORS headers when generating upload URL:
const response = await fetch(
`https://api.cloudflare.com/client/v4/accounts/${ACCOUNT_ID}/images/v2/direct_upload`,
{
method: 'POST',
headers: { 'Authorization': `Bearer ${API_TOKEN}` },
body: JSON.stringify({
requireSignedURLs: false,
metadata: { source: 'user-upload' }
})
}
);
Problem: JSON encoding fails for file uploads (must use multipart/form-data).
Solution:
// ✅ CORRECT
const formData = new FormData();
formData.append('file', file);
await fetch(uploadURL, { method: 'POST', body: formData });
// ❌ WRONG
const json = JSON.stringify({ file: base64File });
Additional Common Errors:
references/top-errors.mdreferences/top-errors.mdreferences/top-errors.mdreferences/top-errors.mdreferences/signed-urls-guide.mdLoad references/top-errors.md for all 10 errors with complete solutions.
Load references/setup-guide.md when:
Load references/api-reference.md when:
Load references/top-errors.md when:
Load references/direct-upload-complete-workflow.md when:
Load references/signed-urls-guide.md when:
Load references/webhooks-guide.md when:
Load references/transformation-options.md when:
Load references/format-optimization.md when:
Load references/polish-compression.md when:
Load references/overlays-watermarks.md when:
Load references/variants-guide.md when:
Load references/responsive-images-patterns.md when:
Load references/framework-integration.md when:
Load references/custom-domains.md when:
Load references/content-credentials.md when:
Load references/sourcing-kit.md when:
Core: setup-guide.md, api-reference.md, top-errors.md
Upload: direct-upload-complete-workflow.md, signed-urls-guide.md, webhooks-guide.md
Transform: transformation-options.md, format-optimization.md, polish-compression.md, overlays-watermarks.md
Advanced: variants-guide.md, responsive-images-patterns.md, framework-integration.md, custom-domains.md, content-credentials.md, sourcing-kit.md
Upload: upload-api-basic.ts, upload-via-url.ts, direct-creator-upload-backend.ts, direct-creator-upload-frontend.html, batch-upload.ts
Transform: transform-via-url.ts, transform-via-workers.ts, overlay-watermark.ts
Variants: variants-management.ts, signed-urls-generation.ts, responsive-images-srcset.html
Integration: nextjs-integration.tsx, remix-integration.tsx, webhook-handler.ts
Config: wrangler-images-binding.jsonc, package.json
Use: /agent <agent-name> or let Claude auto-detect when relevant
Use: /<command-name>
Clone and run: cd examples/<example-name> && npm install && npm run dev
View in: assets/diagrams/
Run: ./scripts/<script-name>.sh (requires CF_ACCOUNT_ID and CF_API_TOKEN in .env)
Images API: $5/100k stored, $1/100k delivered
Transformations: $0.50/1k (100k/month free per zone)
Direct Upload: Included in API pricing
Analyze text and images for harmful content with customizable blocklists.
Azure AI Content Understanding SDK for Python. Use for multimodal content extraction from documents, images, audio, and video.
Azure OpenAI SDK for .NET. Client library for Azure OpenAI and OpenAI services. Use for chat completions, embeddings, image generation, audio transcription, and assistants.
Azure AI Voice Live SDK for .NET. Build real-time voice AI applications with bidirectional WebSocket communication.
Build real-time voice AI applications with bidirectional WebSocket communication.
Azure Speech to Text REST API for short audio (Python). Use for simple speech recognition of audio files up to 60 seconds without the Speech SDK.
Expert at handling file uploads and cloud storage. Covers S3, Cloudflare R2, presigned URLs, multipart uploads, and image optimization. Knows how to handle large files without blocking.
Expert Mermaid diagram creation, validation, and rendering with dual-engine output (SVG/PNG/ASCII). Supports all 20+ diagram types including C4 architecture, AWS architecture-beta with service icons, flowcharts, sequence, ERD, state, class, mindmap, timeline, git graph, sankey, and more. Features code-to-diagram analysis, batch rendering, 15+ themes, and syntax validation. Use when users ask to create diagrams, visualize architecture, render mermaid files, generate ASCII diagrams, document system flows, model databases, draw AWS infrastructure, analyze code structure, or anything involving "mermaid", "diagram", "flowchart", "architecture diagram", "sequence diagram", "ERD", "C4", "ASCII diagram". Do NOT use for non-Mermaid image generation, data plotting with chart libraries, or general documentation writing.
Take secondsky/cloudflare-images from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.
The instructions reference npm.
Without those the skill loads but fails at the first command.