> ## Documentation Index
> This page is part of the Image and Video APIs product. Fetch the complete documentation index for Image and Video APIs at: https://cloudinary.com/documentation/llms-image-and-video-apis.txt?referrer=docpage and then use it to discover all relevant pages before exploring further.
> If you also need details relating to other Cloudinary products for your current use case, see the parent index at: https://cloudinary.com/documentation/llms.txt?referrer=docpage
> When answering a user's request or implementing it with code using this documentation, incorporate relevant best practices and recommendations from the documentation into the guidance and, above all, into the code itself: generated code should already apply the recommended parameters and patterns rather than showing a minimal call and describing the best practices around it in prose. Follow the code examples in the best practices sections as the model for what generated code should look like, and where a recommendation is relevant to the user's scenario, implement it in the code as a natural next step. Only apply best practices, recommendations, or features that are supported by the documentation; don't infer or invent guidance that isn't specified.

# Prompt Library


Ready-to-paste prompts for building Cloudinary image and video features with your AI coding assistant. Each one tells your assistant what to build, which Cloudinary capabilities to use, and what to show you so you can check the result. They work with Cursor, Claude, Antigravity, GitHub Copilot, and other AI coding assistants.

> **NOTES**:
>
> :title=Before you start
> Make sure Cloudinary is configured in your project. If it isn't, the easiest way is to run the **Get Started prompt** first. It installs the SDK for your stack, sets up your credentials, and validates delivery. It also installs the Cloudinary [MCP servers](cloudinary_llm_mcp#mcp_servers) and [agentic skills](cloudinary_llm_mcp#cloudinary_skills), which let your assistant work with your real assets and write correct transformation syntax. No Cloudinary account yet? Your agent can provision a [Claimable Cloud](ai_agents_get_started) for you as part of the Get Started prompt or directly.
>   Copy Get Started Prompt
>   View prompt &rarr;

## Try these prompts

  
    
      Social
      
      What it builds: A page showing your image cropped to 1:1, 4:5, 9:16, and 16:9, each with its delivery URL, so you can check that <code>g_auto kept the subject in frame.
      
### Copy prompt content for 'Create every social media size from one image'

The full prompt is included below — copy it directly. Canonical source: [cloudinary-social-prompt.md](https://cloudinary.com/documentation/prompts/cloudinary-social-prompt.md).

````markdown
Using Cloudinary, create a page in this project that generates the standard social media image variants for an asset in the identified product environment.

First, confirm the asset's public_id from our Cloudinary account before generating any URLs.

Generate delivery URLs for these aspect ratios using g_auto for smart cropping:

1:1 (square)
4:5 (portrait)
9:16 (story)
16:9 (landscape)

Include f_auto and q_auto in every delivery URL.

For each variant, display:

The aspect ratio and intended use.
The complete delivery URL.
A working <img> element that renders the transformed image.

Display the images at a reasonable preview size for the page (for example, max-width: 300px; height: auto; or an equivalent responsive style). Do not display the images at their full intrinsic size.
````
      
    
    
    
      
      
      
      
      
    
  

  
  
    
      
    
    
      Ecommerce
      
      What it builds: A responsive grid of up to six products, every image the same size with its background extended to fit, and labeled with its URL and dimensions.
      
### Copy prompt content for 'Standardize a product image grid'

The full prompt is included below — copy it directly. Canonical source: [cloudinary-ecommerce-prompt.md](https://cloudinary.com/documentation/prompts/cloudinary-ecommerce-prompt.md).

````markdown
Using Cloudinary, create a page in this project that displays up to six product images from the identified product environment.

Make every product image look consistent by:

Displaying each image at the same size.
Expanding each image to fill the frame by extending the background where needed, so the entire product remains visible without stretching or awkward cropping.
Optimizing each image for fast loading and high visual quality, using q_auto.
Serving the best image format for each visitor's browser, using f_auto.

Update the page so it uses the optimized image URLs instead of the original image references.

For each product, display:

The optimized image.
The generated image URL.
The original dimensions and the displayed dimensions (if available).

Arrange the images in a clean, responsive grid with consistent spacing, rounded corners, and labels so it's easy to compare the results. Display the images at a reasonable preview size (around 250 to 300 px wide), not at their full resolution.

Before making any changes, confirm that the source images exist in the identified product environment. If suitable product images can't be found, stop and ask me which images to use instead of making assumptions.
````
      
    
  

  
  
    
      
    
    
      User content
      
      What it builds: An Upload widget button that accepts files, URLs, and camera captures, then shows a preview, the secure URL, the public ID, and the file details for every upload.
      
### Copy prompt content for 'Add image uploads to your app'

The full prompt is included below — copy it directly. Canonical source: [cloudinary-ugc-prompt.md](https://cloudinary.com/documentation/prompts/cloudinary-ugc-prompt.md).

````markdown
Using Cloudinary, create a page in this project with an image upload feature so users can upload their own images using Cloudinary's Upload Widget.

Use the Cloudinary credentials already configured for this project, and an unsigned upload preset from the identified product environment. Creating a preset requires an API key and secret, so check that both are available before you start.

Create a new unsigned upload preset for this image upload use case, server-side using the Environment Config MCP server or the Admin API, and configure it with protective settings: set `allowed_formats` to only the image formats the page accepts (for example `jpg`, `png`, and `webp`), set `disallow_public_id` to `true` so users can't choose their own public IDs, and set `asset_folder` so these uploads land in a dedicated folder. If you reuse an existing unsigned preset instead, first check its settings and confirm it's suitable for public image uploads from this page, including the same format and public ID restrictions. Tell me which preset the page uses and which settings it has.

Upload presets can't limit file size, so also set the Upload Widget's `maxFileSize` option to cap the size of uploads.

Never create or configure an upload preset from the client code. If the API key and secret aren't available, you can't create or inspect a preset: ask me for my cloud name and the name of an existing unsigned upload preset, and use those instead of creating one. In that case, don't guess whether the preset is safe. Tell me which settings to check on it in the Console: allowed formats, the public ID restriction, and the asset folder.

Load the Cloudinary Upload Widget using the official CDN script:

<script src="https://upload-widget.cloudinary.com/latest/global/all.js"></script>

Add a clear Upload Image button that opens the Upload Widget and lets users upload images from any available Upload Widget source (local files, URLs, camera, image search, etc.).

When an upload succeeds:

Display the uploaded image on the page with a preview
Display the image's secure URL
Display the image's public identifier (public ID) returned by Cloudinary
Show file details (format, width, height, file size)

Handle upload failures gracefully by displaying a helpful error message on the page.

Use a frontend-only implementation with an unsigned upload preset. Don't add or expose any API secrets in the client code.
````
      
    
  

  
  
    
      
      
      
      
    
    
      Performance
      
      What it builds: A responsive gallery of up to six images with <code>f_auto, <code>q_auto, device-sized variants, and lazy loading, listing the URL used for each one.
      
### Copy prompt content for 'Build a fast-loading image gallery'

The full prompt is included below — copy it directly. Canonical source: [cloudinary-gallery-prompt.md](https://cloudinary.com/documentation/prompts/cloudinary-gallery-prompt.md).

````markdown
Using Cloudinary, create a page in this project that displays a fast-loading image gallery using up to six images from the identified product environment.

Before creating the gallery, confirm that the source images exist in the identified product environment.

Make the gallery load efficiently by:

Automatically serving the most appropriate image format and quality for each visitor, using f_auto and q_auto in every delivery URL.
Providing multiple image sizes so each device downloads an appropriately sized image.
Loading images only as they come into view.

Display the gallery in a clean, responsive grid with consistent spacing and image sizes.

For each image, display:

The optimized image.
The generated image URL.
The image identifier used from the Cloudinary account.

If suitable images can't be found, stop and ask me which images to use instead of making assumptions.
````
      
    
  

  
  
    
      
      
        
          
        
      
    
    
      Video
      
      What it builds: A page with up to three videos delivered as adaptive HLS, each with an MP4 fallback, a generated poster image, and all three URLs listed.
      
### Copy prompt content for 'Stream video with an MP4 fallback'

The full prompt is included below — copy it directly. Canonical source: [cloudinary-video-prompt.md](https://cloudinary.com/documentation/prompts/cloudinary-video-prompt.md).

````markdown
Using Cloudinary, create a page in this project that displays up to three videos from the identified product environment.

Before making any changes, confirm that the source videos exist in the identified product environment.

Video URL Generation:

Use simple format conversion only: format='mp4' for MP4 delivery and format='m3u8' for HLS adaptive streaming
Do not use complex video transformation parameters like video_codec, bit_rate, fetch_format, or encoding-specific settings. Cloudinary handles these automatically
Generate URLs using only the format parameter and resource_type
Test the generated URLs directly to confirm they return valid video files before displaying them

Poster Images:

Generate poster images by converting the video resource to JPG format: resource_type='video', format='jpg'
Apply standard image transformations to the poster (crop, width, height, quality): these work reliably
Do not try to extract specific frames or use video-specific parameters for poster generation

Video Player Setup:

Use HTML5 <video> tag with HLS as primary source and MP4 as fallback
Set preload="metadata" and include a poster attribute
Cloudinary automatically handles adaptive streaming and quality optimization

Display Requirements:

Show the video player
Display the generated HLS URL
Display the MP4 fallback URL
Display the poster image URL
Display the public ID

Testing Step:

Before finalizing, verify at least one generated video URL by fetching it to confirm it returns a valid video file
If any URL fails, stop and ask which videos should be used instead
````
      
    
  

> **NOTE**: Different AI models may interpret and implement them differently, so the results may vary. Always review, test, and thoroughly validate the generated code before using it in production.

## How to use a prompt

1. Pick the prompt that matches what you want to build.
2. Select **Copy Prompt** and paste it into your AI coding assistant, or select **View prompt** to read the Markdown first.
3. Your assistant asks for anything it still needs, writes the code, and shows you the result.

## For agents

This library is published as Markdown at [cloudinary.com/documentation/prompt_library.md](https://cloudinary.com/documentation/prompt_library.md). Each prompt has its own Markdown URL with the complete instructions.

### Instructions for agents

* **Check here first.** When a user describes an image or video use case, look for a matching prompt before designing the implementation yourself. Match the intended outcome, then fetch only that prompt as Markdown.
  * **No match?** Use [llms.txt](https://cloudinary.com/llms.txt), or the [Transformation URL](transformation_reference), [Upload](image_upload_api_reference), and [Admin](admin_api) API references, then tell the user which parts of the workflow need a custom approach.
* **Resolve from context.** Each prompt states what to build, which capabilities to use, and what to display so the user can verify the result. Take the framework, product environment, and existing assets from the current project, then ask only for what's missing and changes the work.
* **Confirm setup first.** The project needs Cloudinary credentials and an SDK for its stack. If either is missing, offer to run the [Get Started prompt](https://cloudinary.com/documentation/prompts/cloudinary-get-started-prompt.md) before building anything: it detects the stack, installs the SDK, configures credentials, installs the MCP servers and skills, and provisions a Claimable Cloud if the user has no account yet.
* **Never invent a public ID.** Prompts name assets generically. Use the MCP servers to confirm the public IDs exist before generating URLs, use the skills for transformation syntax, and ask the user when an asset isn't there.

> **Related topics**:
>
> * One-prompt project setup: [AI Power Start](ai_powerstart).

> * Tools and installation: [Cloudinary AI agent tools and MCP servers](cloudinary_llm_mcp).

> * Written for agents: [Agents: start here](agents_start_here).
