/netlify-skills:netlify-image-cdnfrom netlify-skills
Transforms, resizes, crops, and converts images on demand via Netlify Image CDN. Covers URL construction, format negotiation, remote image allowlisting, and framework-specific configuration for Angular, Astro, Gatsby, Next.js, and Nuxt.
Ships in netlify-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
// USE: build the URL on the site's own domain; url is required, the rest optional
const src = `/.netlify/images?url=${encodeURIComponent(remoteOrPath)}&w=400&h=300&fit=cover&fm=webp&q=75`;
# USE: single-quoted literal regex in netlify.toml
[images]
remote_images = ['https://my-images\.com/.*']
Avoid:
_headers / [[headers]] rules targeting a path that rewrites to /.netlify/images (including /_next/image). They are silently ignored. Use an edge function instead.headers() in next.config.js for next/image. It is ignored for the same reason.fit=cover with only w or only h. Cover requires both./.netlify/images URLs in Angular, Astro, Gatsby, Next.js, or Nuxt. Use the framework's image component, which already uses Image CDN (see Frameworks)./.netlify/images?url=<source>[&w=<int>][&h=<int>][&fit=contain|cover|fill][&position=top|bottom|left|right|center][&fm=avif|jpg|png|webp|gif|blurhash][&q=1-100]
| Param | Values | Default | Notes |
|---|---|---|---|
url | relative (/owl.jpeg) or absolute remote URL | required | Remote URLs must match remote_images |
w, h | integer px | — | Applied according to fit |
fit | contain / cover / fill | contain | Same semantics as CSS object-fit |
position | top / bottom / left / right / center | center | The part of the image retained when fit=cover |
fm | avif jpg png webp gif blurhash | negotiated | webp and gif may be animated |
q | integer 1–100 | 75 | Lossy quality for avif, jpg, gif, webp |
Format negotiation when fm is omitted (from the Accept header): webp if accepted, else avif, else the original format. A url-only request keeps the image's dimensions but still converts the format.
Response codes:
200: new transformation, with the correct content-type (for example image/png for fm=png).304: previously transformed image.404: any invalid parameter value. Check the parameters before suspecting the source.fit behavior (400×310 source)| fit | Aspect ratio kept | Crops | Exact dims returned | Example |
|---|---|---|---|---|
contain | yes | no | no | w=600&h=600 → 600×465. Upscaling is allowed. One dimension alone derives the other. |
cover | yes (scales, then crops) | yes | yes | w=150&h=150 → resized to height 150, then left/right cropped |
fill | no (stretches) | no | yes | w=300&h=100 → squished vertically |
S=https://mysitename.netlify.app
curl -vs "$S/.netlify/images?url=/owl.jpeg" # format negotiation only
curl -vs "$S/.netlify/images?url=/owl.jpeg&w=50" # resize width
curl -vs "$S/.netlify/images?url=/owl.jpeg&fit=cover&w=50&h=50" # square crop
curl -vs "$S/.netlify/images?url=/owl.jpeg&fit=cover&w=50&h=50&position=left" # keep left side
curl -vs "$S/.netlify/images?url=/owl.jpeg&fm=png" # -> content-type: image/png
curl -vs "$S/.netlify/images?url=/owl.jpeg&fm=avif&q=50" # avif, medium quality
curl -vs "$S/.netlify/images?url=https%3A%2F%2Fmy-images.com%2Fowl.jpeg" # remote (allowlisted)
Interactive parameter playground: https://image-cdn-playground.netlify.app/
[images]
remote_images = [
'https://my-images\.com/.*',
'https://animals\.more-images\.com/[bcr]at/.*',
]
remote_images is an array of regexes. Anchor patterns to specific subdomains or directories.Footgun:
Authorization,Cookie, and other credential-bearing headers are not forwarded to remote origins. Private buckets fail. Use self-authorizing URLs, such as S3 presigned URLs, and make sure the patterns match them.
Netlify-CDN-Cache-Control → CDN-Cache-Control → Cache-Control. You cannot set site headers on remote sources._redirects:
/transform-small/* /.netlify/images?url=/:splat&w=50&h=50 200
netlify.toml:
[[redirects]]
from = "/transform-small/*"
to = "/.netlify/images?url=/:splat&w=50&h=50"
status = 200
Request /transform-small/owl.jpeg. Avoid cross-site redirects for transformations, because they hurt performance. Redirect docs: https://docs.netlify.com/manage/routing/redirects/overview
| Goal | How |
|---|---|
| Browser/downstream caching, site-domain source | Header rule on the source path. It carries over to the transformed image. |
| Netlify cache duration, remote source | Cache headers on the remote origin (precedence above) |
| CORS or other headers on a rewritten path | Edge function on that path |
Headers on next/image | Edge function on /_next/image, or add /_next/image to the middleware matcher |
Site-domain sources carry over only Cache-Control, X-Nf-Cache-Control, and Content-Security-Policy. Headers such as Access-Control-Allow-Origin and CDN-Cache-Control are dropped. Site-domain Cache-Control affects browsers and CDNs in front of Netlify, not the Netlify cache. Atomic deploys handle invalidation: a changed source re-transforms on the next request.
[[headers]]
for = "/source-images/*"
[headers.values]
Cache-Control = "public, max-age=604800, must-revalidate"
# applies to /.netlify/images?url=/source-images/owl.jpeg
// netlify/edge-functions/image-headers.ts
import type { Config, Context } from "@netlify/edge-functions";
export default async (request: Request, context: Context) => {
const response = await context.next();
response.headers.set("Access-Control-Allow-Origin", "*");
return response;
};
export const config: Config = { path: "/_next/image" };
Footgun (cost): edge functions and middleware run on every image request, including cache hits. They do not change the Netlify cache duration.
Docs: https://docs.netlify.com/manage/routing/headers and https://docs.netlify.com/build/edge-functions/overview
Use the framework's own image syntax. Allowlist remote domains where the framework expects them:
| Framework | Prerequisite | Remote allowlist |
|---|---|---|
| Angular | none (NgOptimizedImage) | [images] remote_images |
| Astro | none (<Image />) | image.domains / image.remotePatterns in astro.config.mjs |
| Gatsby | env NETLIFY_IMAGE_CDN=true plus the Contentful, Drupal, or WordPress source plugin | [images] remote_images |
| Next.js | Next.js 13.5+ with Next.js adapter v5 | remotePatterns in next.config.js |
| Nuxt | none (nuxt/image) | image.domains in nuxt.config.ts |
Setup guides:
Run Netlify Dev to get the endpoint locally: https://docs.netlify.com/api-and-cli-guides/cli-guides/local-development
These are org conventions, not docs facts — merged into the rendered skill by ctx-gen and never generated. Owned by the skills maintainer.
references/user-uploads.md in this skill — an authored
guide with no single docs source.url
parameter (encodeURIComponent) — URLs containing ? or & break
otherwise.fm=blurhash returns a BlurHash TEXT string, not image bytes. Pointing an
<img src> (or CSS background) at it renders nothing — fetch the string
ahead of time, decode it client-side with a BlurHash library, and load the
real image as a separate request without fm=blurhash./.netlify/images almost always means a framework dev
server (vite, next dev, astro dev) is running instead of
netlify dev — the endpoint, [images] allowlisting, and image redirects
only exist under netlify dev. The URL itself is usually fine.remote_images patterns, the meaningful regex escape is the dot;
forward slashes are not metacharacters — do not write https:\/\/.
In netlify.toml, use a single-quoted literal string
('https://example\.com/.*') or double the backslash in a
double-quoted string ("https://example\\.com/.*") — a bare \.
inside double quotes is invalid TOML.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
16 skills in this plugin
/netlify-access-controlPicks the right Netlify site-protection layer and disambiguates the three unrelated "auth" concepts users conflate — app-user login (Netlify Identity), site-load gating (Password Protection / project visibility), and dashboard SAML SSO. Use it when asked to password-protect a site or Deploy Preview, make a project private/public, restrict a site to your team, require SSO to view a site, set up company-wide or internal-app SSO, invite users to a private project, or know which team member made a request to a private site. Also use it for SSO-session symptoms on protected sites: "logged out mid-session", 401s after about an hour, or token expiry/refresh questions. Not for wiring auth code — route app-login setup to netlify-identity./netlify-agent-runnerRun AI agent tasks remotely on Netlify using Claude, Codex, or Gemini. Use when the user wants to run an AI agent on their site, get a second opinion from another model, or delegate development tasks to run remotely against their repo./netlify-ai-gatewayUse Netlify AI Gateway to call OpenAI, Anthropic Claude, Google Gemini, Meta, TypeSafe (Jev), or OpenRouter-hosted models (xAI/DeepSeek/Mistral/Qwen) from Netlify Functions or Edge Functions without managing provider accounts or API keys. Reach for this when adding an AI feature to a Netlify app — a chatbot, text summarizer, image generator, joke/content generator, form-submission routing or analysis, or any LLM call — or when wiring the OpenAI/Anthropic/Gemini/TypeSafe/OpenRouter SDK into a Netlify Function, choosing which env vars to use, streaming long generations, or debugging why gateway calls fail at build time or return 401./netlify-blobsStore and retrieve unstructured objects, files, and cache-like state on Netlify with the @netlify/blobs module. Use when persisting user file uploads (images/documents), caching computed output from functions or Background Functions, serving downloadable assets, storing JSON blobs keyed by ID, or seeding deploy-specific data. Reach for this for key/value or object storage from Functions, Edge Functions, or Build Plugins — not for per-user, transactional, or relational data (use Netlify DB for that). Triggers include "save an uploaded file", "cache API results", "store generated site map", "key/value store for a function", or "file uploads without a database"./netlify-cachingCache dynamic and static responses on Netlify's CDN from Functions, Edge Functions, Netlify Server, and proxies. Use when you add caching or cache-control headers to a function or server response, tune cache TTL or stale-while-revalidate, set up the durable cache, vary a cache key by query/header/cookie/country/language, purge or invalidate the cache by site or cache tag, use the programmatic Cache API (caches.open/match/put) or @netlify/cache helpers (fetchWithCache/cacheHeaders/getCacheStatus/purgeCache), speed up an expensive API call, add ISR or on-demand revalidation, or debug why a response is or isn't cached via the Cache-Status header./netlify-configConfigure Netlify builds and routing via netlify.toml, _redirects, and _headers. Use when setting a build command or publish directory, validating netlify.toml against its JSON schema, adding redirects/rewrites/proxies or an SPA fallback rewrite, or setting custom response headers or basic auth. Also use when managing environment variables and secrets, scoping vars per deploy context, marking a var as secret or disabling secret scanning, handling sensitive vars in fork Deploy Previews, configuring functions bundling or the Netlify Server region/size, ignoring builds, or wiring up a monorepo or JavaScript SPA on Netlify.Other plugins' skills for the same job
npx claudepluginhub netlify/context-and-tools --plugin netlify-skills