Source profileQuality 92/100

agents-inc/skills/src/skills/ai-provider-claude-vision/SKILL.md

ai-provider-claude-vision

Image understanding and document analysis with Claude's multimodal capabilities -- image input formats, PDF processing, multi-image patterns, structured extraction, and token cost estimation

Source repository stars
21
Declared platforms
0
Static risk flags
2
Last source update
2026-08-09
Source checked
2026-08-25

Decision brief

What it does: where it fits

Quick Guide: Use type: "image" content blocks for images (base64, URL, or fileid) and type: "document" content blocks for PDFs. Supported image formats: JPEG, PNG, GIF, WebP. Images before text in the content array improves results. Token cost formula: tokens = (width height) /…

Best for

    Not for

    • Tasks that require unconfirmed production actions or broad system permissions.
    • Environments where the pinned source and install steps cannot be inspected.

    Compatibility matrix

    Platform support, with evidence labels

    PlatformStatusEvidenceWhat to check
    CodexNot declaredNo explicit evidencePortability before use
    Claude CodeNot declaredNo explicit evidencePortability before use
    CursorNot declaredNo explicit evidencePortability before use
    Gemini CLINot declaredNo explicit evidencePortability before use
    Open the compatibility checker

    Installation

    Inspect first. Install second.

    The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.

    Source-detected install commandSource
    npx skills add https://github.com/agents-inc/skills --skill "src/skills/ai-provider-claude-vision"
    Safe inspection promptEditorial

    Inspect the Agent Skill "ai-provider-claude-vision" from https://github.com/agents-inc/skills/blob/81d43a51211aca12c85dcc16085fa99014ec548e/src/skills/ai-provider-claude-vision/SKILL.md at commit 81d43a51211aca12c85dcc16085fa99014ec548e. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.

    Workflow

    What the source asks the agent to do

    1. 01

      CRITICAL: Before Using This Skill

      All code must follow project conventions in CLAUDE.md (kebab-case, named exports, import ordering, import type, named constants)

      Sending images to Claude for analysis, description, or data extractionProcessing PDF documents for text extraction, chart analysis, or summarizationComparing multiple images in a single request
    2. 02

      Examples Index

      Core: Image & PDF Input -- Base64, URL, fileid, PDF input, multi-image, token estimation

      Core: Image & PDF Input -- Base64, URL, fileid, PDF input, multi-image, token estimationExtraction & Prompting -- Structured extraction, comparison, prompting best practices, cachingQuick API Reference -- Content block types, supported formats, size limits, token formula
    3. 03

      Philosophy

      Claude's vision capabilities treat images and documents as first-class content blocks alongside text. There is no separate "vision API" -- you add image or document blocks to the same Messages API you already use for text.

      Images are content blocks, not attachments -- Images and PDFs are content blocks in the messages array, interleaved with text. They are not uploaded separately or referenced by URL-only.Image-first ordering -- Place images before text in the content array. This mirrors how documents first, query last improves text prompts. Claude processes visual content better when it sees the image before the questio…No OCR needed -- Claude reads text directly from images and PDFs. You do not need to pre-extract text with an OCR library. For PDFs, Claude processes both the extracted text and a rendered image of each page.
    4. 04

      Core Patterns

      Read a local file, encode to base64, send as type: "image" content block. Image block before text block.

      Read a local file, encode to base64, send as type: "image" content block. Image block before text block.Why good: Image before text improves results, explicit mediatype, structured content blocksWhy bad: Passing base64 as text string instead of image content block, Claude cannot interpret raw base64 text as an image
    5. 05

      Pattern 1: Base64 Image Input

      Read a local file, encode to base64, send as type: "image" content block. Image block before text block.

      Read a local file, encode to base64, send as type: "image" content block. Image block before text block.Why good: Image before text improves results, explicit mediatype, structured content blocksWhy bad: Passing base64 as text string instead of image content block, Claude cannot interpret raw base64 text as an image

    Permission review

    Static risk signals and limitations

    Reads files

    low · line 105

    The documentation asks the agent to read local files, directories, or repositories.

    Read a local file, encode to base64, send as `type: "image"` content block. Image block before text block.

    Network access

    medium · line 137

    The documentation includes network, browsing, or remote request actions.

    source: { type: "url", url: "https://example.com/chart.png" }

    Reads files

    low · line 335

    The documentation asks the agent to read local files, directories, or repositories.

    -- Local file -> Base64 encode with readFileSync().toString("base64")

    Evidence record

    Why each signal appears

    EvidenceSourceComputedTestedEditorial
    SignalValueEvidence typeMeaning
    Quality score92/100ComputedDocumentation, specificity, maintenance, and trust rules
    Repository stars21SourceRepository attention, not individual Skill quality
    Compatibility0 platformsSourceDeclared in the catalog source record
    Usage guideautomated source guideEditorialGenerated or reviewed according to the visible evidence level

    Pinned source

    Provenance and original SKILL.md

    Repository
    agents-inc/skills
    Skill path
    src/skills/ai-provider-claude-vision/SKILL.md
    Commit
    81d43a51211aca12c85dcc16085fa99014ec548e
    License
    MIT
    Collected
    2026-08-25
    Default branch
    main
    View the original SKILL.md

    Claude Vision Patterns

    Quick Guide: Use type: "image" content blocks for images (base64, URL, or file_id) and type: "document" content blocks for PDFs. Supported image formats: JPEG, PNG, GIF, WebP. Images before text in the content array improves results. Token cost formula: tokens = (width * height) / 750. Images are auto-resized if the long edge exceeds 1568px or exceeds ~1600 tokens. PDFs use type: "document" with media_type: "application/pdf". No OCR library needed -- Claude reads text directly from images and PDFs.


    <critical_requirements>

    CRITICAL: Before Using This Skill

    All code must follow project conventions in CLAUDE.md (kebab-case, named exports, import ordering, import type, named constants)

    (You MUST use type: "image" for images and type: "document" for PDFs -- they are different content block types)

    (You MUST place images and documents BEFORE text in the content array -- Claude performs better with visual content first)

    (You MUST always provide max_tokens in every request -- it is required and has no default)

    (You MUST iterate over response.content blocks -- never assume a single text block in the response)

    (You MUST use named constants for max_tokens, token budgets, and pixel limits -- no magic numbers)

    </critical_requirements>


    Auto-detection: Claude vision, image analysis, image input, base64 image, URL image, type image, type document, media_type image/jpeg, media_type image/png, image/webp, image/gif, application/pdf, PDF processing, document extraction, multimodal, multi-image, image comparison, chart analysis, screenshot analysis, image understanding, visual content, vision API

    When to use:

    • Sending images to Claude for analysis, description, or data extraction
    • Processing PDF documents for text extraction, chart analysis, or summarization
    • Comparing multiple images in a single request
    • Extracting structured data from screenshots, receipts, charts, or forms
    • Building document processing pipelines with Claude
    • Estimating token costs for image-heavy workloads

    Key patterns covered:

    • Image input via base64, URL, and Files API
    • PDF document input and processing
    • Multi-image requests and comparison patterns
    • Image + text prompting best practices
    • Token cost estimation and image sizing
    • Structured data extraction from visual content
    • Multi-turn vision conversations
    • Prompt caching with images and PDFs

    When NOT to use:

    • General Claude API usage without images or documents -- use the general Anthropic SDK patterns instead
    • Image generation or editing -- Claude is understanding-only, it cannot create or modify images
    • Identifying specific people in images -- Claude refuses to name people (Anthropic policy)
    • Medical diagnostic imaging (CTs, MRIs) -- not designed for clinical diagnosis

    Examples Index


    Philosophy

    Claude's vision capabilities treat images and documents as first-class content blocks alongside text. There is no separate "vision API" -- you add image or document blocks to the same Messages API you already use for text.

    Core principles:

    1. Images are content blocks, not attachments -- Images and PDFs are content blocks in the messages array, interleaved with text. They are not uploaded separately or referenced by URL-only.
    2. Image-first ordering -- Place images before text in the content array. This mirrors how documents first, query last improves text prompts. Claude processes visual content better when it sees the image before the question.
    3. No OCR needed -- Claude reads text directly from images and PDFs. You do not need to pre-extract text with an OCR library. For PDFs, Claude processes both the extracted text and a rendered image of each page.
    4. Token costs scale with pixels -- Image tokens are proportional to resolution: tokens = (width * height) / 750. Downsizing images before sending saves tokens without losing meaningful detail for most use cases.
    5. PDFs are dual-processed -- Each PDF page is converted to an image AND has its text extracted. Claude sees both, giving it access to visual layout and textual content.

    When to use vision:

    • Analyzing screenshots, photos, charts, diagrams, or infographics
    • Extracting data from forms, receipts, invoices, or tables
    • Processing PDF documents for summarization, extraction, or analysis
    • Comparing multiple images (before/after, A/B testing, design review)
    • Understanding visual context that text alone cannot capture

    When NOT to use:

    • Pure text tasks with no visual component -- vision adds unnecessary token cost
    • Tasks requiring pixel-perfect spatial precision -- Claude's spatial reasoning is approximate
    • Identifying specific people -- Claude refuses to name individuals (Anthropic policy)
    • Replacing professional medical imaging analysis (CTs, MRIs, X-rays)

    Core Patterns

    Pattern 1: Base64 Image Input

    Read a local file, encode to base64, send as type: "image" content block. Image block before text block.

    // Image block first, text prompt second, iterate response content blocks
    content: [
      {
        type: "image",
        source: { type: "base64", media_type: "image/png", data: imageData },
      },
      { type: "text", text: "Describe what you see in this image." },
    ];
    

    Why good: Image before text improves results, explicit media_type, structured content blocks

    // BAD: base64 as text string -- Claude cannot interpret raw base64
    content: "What's in this image? " + imageData;
    

    Why bad: Passing base64 as text string instead of image content block, Claude cannot interpret raw base64 text as an image

    See: examples/core.md for full runnable examples with base64, URL, and Files API


    Pattern 2: URL vs Base64 vs Files API

    Three source types for images. Choose based on where your image lives.

    // URL source -- simplest, smallest payload
    source: { type: "url", url: "https://example.com/chart.png" }
    
    // Base64 source -- local files
    source: { type: "base64", media_type: "image/jpeg", data: base64String }
    
    // Files API source (beta) -- upload once, reuse across requests
    source: { type: "file", file_id: "file_abc123" }
    

    When to use: URL for hosted images, base64 for local files, Files API for multi-turn or repeated use

    See: examples/core.md for full examples of each source type


    Pattern 3: PDF Document Input

    PDFs use type: "document" -- different from type: "image". This is the most common mistake.

    // Correct: type "document" for PDFs
    { type: "document", source: { type: "base64", media_type: "application/pdf", data: pdfData } }
    
    // WRONG: type "image" for PDFs -- causes API errors
    { type: "image", source: { type: "base64", media_type: "application/pdf", data: pdfData } }
    

    Why good: type: "document" enables dual processing (text extraction + page rendering)

    Why bad: Using type: "image" for PDFs causes API errors. PDFs require type: "document".

    See: examples/core.md for base64 and URL PDF examples, examples/extraction.md for PDF caching


    Pattern 4: Multiple Images with Labels

    Label images with text blocks so Claude can reference them clearly.

    content: [
      { type: "text", text: "Image 1:" },
      {
        type: "image",
        source: { type: "base64", media_type: "image/jpeg", data: image1 },
      },
      { type: "text", text: "Image 2:" },
      {
        type: "image",
        source: { type: "base64", media_type: "image/jpeg", data: image2 },
      },
      {
        type: "text",
        text: "Compare these two images and describe the differences.",
      },
    ];
    

    Why good: Labels let Claude reference specific images unambiguously

    Why bad (without labels): Claude may confuse which image is which when no labels are provided

    See: examples/core.md for full multi-image example


    Pattern 5: Token Cost Estimation

    Token formula: tokens = (width * height) / 750. Auto-resize triggers at 1568px long edge or ~1.15 megapixels.

    const TOKENS_PER_PIXEL_DIVISOR = 750;
    const MAX_LONG_EDGE_PX = 1568;
    const MAX_MEGAPIXELS = 1.15;
    
    function estimateImageTokens(width: number, height: number): number {
      let w = width,
        h = height;
      const longEdge = Math.max(w, h);
      const mp = (w * h) / 1_000_000;
      if (longEdge > MAX_LONG_EDGE_PX || mp > MAX_MEGAPIXELS) {
        const scale = Math.min(
          MAX_LONG_EDGE_PX / longEdge,
          Math.sqrt(MAX_MEGAPIXELS / mp),
        );
        w = Math.round(width * scale);
        h = Math.round(height * scale);
      }
      return Math.ceil((w * h) / TOKENS_PER_PIXEL_DIVISOR);
    }
    // 200x200: ~54 tokens | 1000x1000: ~1334 | 4000x3000: ~1590 (auto-resized)
    

    Why good: Named constants, accounts for auto-resize, documents the formula

    See: examples/core.md for full estimateImageTokens() utility and countTokens() usage, reference.md for the complete size/token/cost table


    Pattern 6: Structured Data Extraction

    Combine vision with messages.parse() and Zod schemas for typed extraction.

    import { zodOutputFormat } from "@anthropic-ai/sdk/helpers/zod";
    import { z } from "zod";
    
    const ReceiptData = z.object({
      merchant: z.string(),
      date: z.string(),
      items: z.array(
        z.object({ name: z.string(), quantity: z.number(), price: z.number() }),
      ),
      total: z.number(),
      currency: z.string(),
    });
    
    const response = await client.messages.parse({
      model: "claude-sonnet-4-6",
      max_tokens: MAX_TOKENS,
      messages: [
        {
          role: "user",
          content: [
            {
              type: "image",
              source: {
                type: "base64",
                media_type: "image/jpeg",
                data: receiptImage,
              },
            },
            {
              type: "text",
              text: "Extract all receipt information from this image.",
            },
          ],
        },
      ],
      output_config: { format: zodOutputFormat(ReceiptData) },
    });
    
    const receipt = response.parsed_output; // fully typed
    

    Why good: Zod schema for type-safe extraction, messages.parse() for auto-validation, image before text

    See: examples/extraction.md for receipt, chart, form, comparison, and multi-document extraction patterns


    Performance Optimization

    Image Sizing Strategy

    Image resolution vs token cost:
    200x200   -> ~54 tokens    ($0.00016/image at Sonnet 4.6 pricing)
    1000x1000 -> ~1334 tokens  ($0.004/image)
    1092x1092 -> ~1590 tokens  ($0.0048/image) -- max 1:1 without auto-resize
    4000x3000 -> ~1590 tokens  (auto-resized to fit 1568px long edge)
    
    • Pre-resize images to no more than 1568px on the long edge and 1.15 megapixels to avoid auto-resize latency
    • Small images under 200px on any edge may degrade output quality
    • Images over 8000x8000px are rejected outright
    • 20+ images in one request limits each image to 2000x2000px max

    Cost Reduction Techniques

    • Resize before sending -- A 4000x3000 image is auto-resized to the same tokens as 1092x1092, but adds latency. Pre-resize to save time.
    • Use URL sources when images are already hosted -- avoids encoding overhead and reduces request payload size
    • Use the Files API for images used across multiple requests -- upload once, reference by file_id
    • Cache PDFs with cache_control: { type: "ephemeral" } when asking multiple questions about the same document
    • Use token counting (client.messages.countTokens()) before expensive requests to estimate costs

    PDF Token Costs

    • Text extraction: ~1,500-3,000 tokens per page depending on density
    • Image rendering: Each page also incurs image token costs (same formula)
    • Total per page: text tokens + image tokens (dual processing)

    <decision_framework>

    Decision Framework

    Image Source Type

    Where is your image?
    +-- Local file        -> Base64 encode with readFileSync().toString("base64")
    +-- Public URL        -> Use type: "url" source (simplest, smallest payload)
    +-- Already uploaded  -> Use type: "file" source with file_id (Files API, beta)
    +-- Multiple requests -> Upload once via Files API, reuse file_id
    

    Image vs Document Block

    What type of file?
    +-- JPEG, PNG, GIF, WebP -> type: "image"
    +-- PDF                  -> type: "document" with media_type: "application/pdf"
    +-- Other formats        -> Convert to a supported format first
    

    Token Budget for max_tokens

    What kind of analysis?
    +-- Brief description    -> 256-512 max_tokens
    +-- Detailed analysis    -> 1024-2048 max_tokens
    +-- Document summarization -> 2048-4096 max_tokens
    +-- Structured extraction  -> 1024 max_tokens (JSON output is compact)
    

    </decision_framework>


    <red_flags>

    RED FLAGS

    High Priority Issues:

    • Using type: "image" for PDFs -- PDFs require type: "document" with media_type: "application/pdf"
    • Passing base64 data as a text string instead of an image content block -- Claude cannot interpret raw base64 text
    • Not providing max_tokens -- required on every request, no default
    • Images larger than 8000x8000px -- rejected by the API
    • API file size limit is 5MB per image (10MB on claude.ai)

    Medium Priority Issues:

    • Placing text before images in the content array -- Claude performs better with images first
    • Not labeling multiple images -- Claude may confuse which image is which without "Image 1:", "Image 2:" labels
    • Sending full-resolution images when a smaller version would suffice -- wastes tokens and adds latency from auto-resizing
    • Using base64 for publicly available images -- URL source is simpler and reduces payload
    • Not using cache_control when asking multiple questions about the same PDF -- each request re-processes the full document

    Common Mistakes:

    • Expecting Claude to generate or edit images -- it is understanding-only
    • Using vision for tasks requiring precise spatial reasoning (exact pixel coordinates, analog clock reading) -- Claude's spatial abilities are approximate
    • Relying on Claude to identify specific people -- it refuses to name individuals per Anthropic policy
    • Assuming exact object counts -- Claude gives approximate counts, especially for many small objects
    • Forgetting that PDF pages are dual-processed (text + image) -- token costs are higher than text-only

    Gotchas & Edge Cases:

    • Images under 200px on any edge may produce lower quality analysis
    • When sending 20+ images in a single request, each image is limited to 2000x2000px max
    • API supports up to 600 images per request (100 for 200k context window models), but request size limits (32MB) are often reached first
    • Claude does not read image EXIF metadata -- orientation, camera info, GPS data are not accessible
    • PDFs with passwords or encryption are not supported -- only standard PDFs
    • The Files API for images and documents is currently in beta (betas: ["files-api-2025-04-14"])
    • Multi-turn vision conversations do not require re-sending the image -- it persists in conversation history
    • For PDFs, dense pages with complex tables or heavy graphics can fill the context window before reaching the 600-page limit

    </red_flags>


    <critical_reminders>

    CRITICAL REMINDERS

    All code must follow project conventions in CLAUDE.md (kebab-case, named exports, import ordering, import type, named constants)

    (You MUST use type: "image" for images and type: "document" for PDFs -- they are different content block types)

    (You MUST place images and documents BEFORE text in the content array -- Claude performs better with visual content first)

    (You MUST always provide max_tokens in every request -- it is required and has no default)

    (You MUST iterate over response.content blocks -- never assume a single text block in the response)

    (You MUST use named constants for max_tokens, token budgets, and pixel limits -- no magic numbers)

    Failure to follow these rules will produce API errors, degraded vision quality, unexpected token costs, or runtime crashes from untyped content blocks.

    </critical_reminders>

    Frequently asked questions

    What to verify before installation and use

    What does the ai-provider-claude-vision source document cover?

    Quick Guide: Use type: "image" content blocks for images (base64, URL, or fileid) and type: "document" content blocks for PDFs. Supported image formats: JPEG, PNG, GIF, WebP. Images before text in the content array improves results. Token cost formula: tokens = (width height) /…

    How do I install ai-provider-claude-vision?

    The source record exposes this install command: npx skills add https://github.com/agents-inc/skills --skill "src/skills/ai-provider-claude-vision". Inspect the command and pinned source before running it.

    Which permission-related actions were detected?

    Static rules flagged read-files, network in the source; the page lists the matching lines and excerpts.

    Alternatives

    Compare before choosing

    Computed 10045,511

    coreyhaines31/marketingskills

    ab-testing

    When the user wants to plan, design, or implement an A/B test or experiment, or build a growth experimentation program. Also use when the user mentions "A/B test," "split test," "experiment," "test this change," "variant copy," "multivariate test," "hypothesis," "should I test this," "which version is better," "test two versions," "statistical significance," "how long should I run this test," "growth experiments," "experiment velocity," "experiment backlog," "ICE score," "experimentation program

    Computed 10024,921

    alirezarezvani/claude-skills

    app-store-optimization

    App Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store. Use when the user asks about ASO, app store rankings, app metadata, app titles and descriptions, app store listings, app visibility, or mobile app marketing on iOS or Android. Supports keyword research and scoring, competitor keyword analysis, metadata optimization, A/B test planning, launch checklist

    Computed 100152

    JasonColapietro/suede-creator-skills

    suede-ab-testing

    Suede-owned experimentation discipline for hypotheses, sample sizing, test duration, significance, and repeatable experiment programs. Use when comparing variants, deciding whether a result is reliable, or building an experiment backlog and cadence. NOT FOR: analytics instrumentation (use suede-analytics), post-click conversion diagnosis (use suede-site-alchemy), or writing the variant copy itself (use suede-copy).

    Computed 10035

    tenequm/skills

    founder-playbook

    Decision validation and thinking frameworks for startup founders. Use when you need to pressure-test a decision, validate your next steps, think through strategic options, or sanity-check your approach. Triggers on phrases like "should I", "help me think through", "is this the right move", "validate my thinking", "what am I missing". Covers fundraising, customer development, runway management, prioritization, and crypto/web3 founder challenges.