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".
58
73%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
Fix and improve this skill with Tessl
tessl review fix ./plugins/cloudflare-images/skills/cloudflare-images/SKILL.mdStatus: 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/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
secondsky/claude-skills
8837836
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.