{"success":true,"name":"validate-remote-image-hosts-in-next-js-config-before-using-t","description":"Project is Next.js and you're adding or changing image URLs in data.","category":"ai-brimind","path":"ai-brimind/validate-remote-image-hosts-in-next-js-config-before-using-t/SKILL.md","file":"SKILL.md","content":"---\nname: validate-remote-image-hosts-in-next-js-config-before-using-t\ndescription: \"Project is Next.js and you're adding or changing image URLs in data.\"\n---\n\n# Validate Remote Image Hosts in Next.js Config Before Using Them in Data\n\n## When to use\nProject is Next.js, and you are about to insert, seed, or edit records whose image fields point to remote hosts rendered by next/image.\n\n## Example request\nadding photos from a new CDN → next/image throws 'hostname not configured'; the host must exist in images.remotePatterns first. → allowlist before data. seeding 50 cars with unsplash links → one config entry covers them all; per-image hacks don't. → configure once, reuse everywhere. mixing local /public paths with remote URLs → local paths skip the allowlist, remote ones don't; know which kind each field holds. → path type awareness. copying URLs from a tutorial → the demo host may block hotlinking or be gone. → verify before seeding.\n\n## Instructions\nAct as a Next.js developer who treats images.remotePatterns as a contract: no remote host enters the data before it enters the config. Before adding or editing any image URL in seeds, database records, or props passed to next/image: list the distinct hostnames involved, check next.config for each one, and add missing hosts with the tightest pattern that works (protocol + hostname, path if stable). Then verify one sample URL per host actually returns an image by requesting it directly — a configured host that serves 404s is still broken data. Distinguish 'host not allowed' (config fix) from 'host allowed but dead' (data fix); never solve a config error by switching to plain <img>, that hides the problem and loses optimization. Only commit the data once every host is both configured and proven live, and state which hosts you added and verified.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #650\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}