Skip to content
Development
Command

/check-images

Run comprehensive health check and configuration validation for Cloudflare Images. Tests API connectivity, verifies authentication, checks transformations enabled, lists variants, and shows quota usage.

From plugin
secondsky-claude-skills
20466 skills46 agents66 commands
Install
$ npx -y skills add secondsky/claude-skills --agent claude-code

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/check-images

Context preview

What this command does when you run it.

Run comprehensive health check and configuration validation for Cloudflare Images. Tests API connectivity, verifies authentication, checks transformations enabled, lists variants, and shows quota usage.

Command definition

check-images.md
name: cloudflare-images:check
description: Run comprehensive health check and configuration validation for Cloudflare Images. Tests API connectivity, verifies authentication, checks transformations enabled, lists variants, and shows quota usage.

Check Cloudflare Images Configuration

Run a complete health check of your Cloudflare Images setup including API connectivity, authentication, transformations, variants, and quota.

What This Command Does

When you run `/check-images`, Claude will: 1. Verify environment variables are set correctly 2. Test API connectivity 3. Validate authentication (account ID + API token) 4. Check if transformations are enabled for zone 5. List all configured variants 6. Show storage quota and usage 7. Display recent images 8. Verify CDN caching status

Usage

/check-images

No arguments required - the command will automatically discover configuration from environment variables.

Implementation

Run the following checks in sequence:

1. Verify Environment Variables

echo "๐Ÿ“‹ Checking environment variables..."

if [ -z "$CF_ACCOUNT_ID" ]; then
  echo "โŒ CF_ACCOUNT_ID not set"
  echo "   Set in .env: CF_ACCOUNT_ID=your_account_id"
  exit 1
else
  echo "โœ… CF_ACCOUNT_ID: ${CF_ACCOUNT_ID:0:8}..."
fi

if [ -z "$CF_API_TOKEN" ]; then
  echo "โŒ CF_API_TOKEN not set"
  echo "   Set in .env: CF_API_TOKEN=your_api_token"
  exit 1
else
  echo "โœ… CF_API_TOKEN: ${CF_API_TOKEN:0:10}..."
fi

if [ -z "$CF_ACCOUNT_HASH" ]; then
  echo "โš ๏ธ  CF_ACCOUNT_HASH not set (optional for delivery URLs)"
else
  echo "โœ… CF_ACCOUNT_HASH: ${CF_ACCOUNT_HASH}"
fi

echo ""

2. Test API Connectivity

echo "๐Ÿ”Œ Testing API connectivity..."

API_RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" \
  "https://api.cloudflare.com/client/v4/accounts/${CF_ACCOUNT_ID}/images/v1" \
  -H "Authorization: Bearer ${CF_API_TOKEN}")

if [ "$API_RESPONSE" = "200" ]; then
  echo "โœ… API connectivity: OK"
else
  echo "โŒ API connectivity failed (HTTP $API_RESPONSE)"
  echo "   Verify CF_ACCOUNT_ID and CF_API_TOKEN are correct"
  exit 1
fi

echo ""

3. Validate Authentication

echo "๐Ÿ”‘ Validating authentication..."

AUTH_RESULT=$(curl -s \
  "https://api.cloudflare.com/client/v4/accounts/${CF_ACCOUNT_ID}/images/v1" \
  -H "Authorization: Bearer ${CF_API_TOKEN}")

AUTH_SUCCESS=$(echo "$AUTH_RESULT" | jq -r '.success')

if [ "$AUTH_SUCCESS" = "true" ]; then
  echo "โœ… Authentication: Valid"

  # Check permissions
  IMAGES_COUNT=$(echo "$AUTH_RESULT" | jq -r '.result.images | length')
  echo "   Images accessible: $IMAGES_COUNT"
else
  echo "โŒ Authentication failed"
  ERRORS=$(echo "$AUTH_RESULT" | jq -r '.errors[].message')
  echo "   Error: $ERRORS"
  exit 1
fi

echo ""

4. Check Transformations Status

echo "๐ŸŽจ Checking transformations..."

# Note: Transformations are always enabled for Cloudflare Images
# This checks if zone-based transformations are available

if [ ! -z "$CF_ZONE_ID" ]; then
  POLISH_STATUS=$(curl -s \
    "https://api.cloudflare.com/client/v4/zones/${CF_ZONE_ID}/settings/polish" \
    -H "Authorization: Bearer ${CF_API_TOKEN}" \
    | jq -r '.result.value')

  echo "โœ… Zone Polish: $POLISH_STATUS"
else
  echo "โ„น๏ธ  Zone transformations: Not configured (CF_ZONE_ID not set)"
  echo "   Cloudflare Images transformations are always available"
fi

echo ""

5. List Variants

echo "๐Ÿ“ Listing configured variants..."

VARIANTS=$(curl -s \
  "https://api.cloudflare.com/client/v4/accounts/${CF_ACCOUNT_ID}/images/v1/variants" \
  -H "Authorization: Bearer ${CF_API_TOKEN}")

VARIANTS_SUCCESS=$(echo "$VARIANTS" | jq -r '.success')

if [ "$VARIANTS_SUCCESS" = "true" ]; then
  VARIANT_COUNT=$(echo "$VARIANTS" | jq -r '.result.variants | length')
  echo "โœ… Variants configured: $VARIANT_COUNT/100"

  if [ "$VARIANT_COUNT" -gt 0 ]; then
    echo ""
    echo "   Configured variants:"
    echo "$VARIANTS" | jq -r '.result.variants[] | "   โ€ข \(.id): \(.options.width // "auto")x\(.options.height // "auto") (\(.options.fit // "scale-down"))"'
  else
    echo "   No custom variants configured (using flexible transformations)"
  fi
else
  echo "โš ๏ธ  Could not list variants"
fi

echo ""

6. Show Storage Quota and Usage

echo "๐Ÿ’พ Checking storage quota..."

STATS=$(curl -s \
  "https://api.cloudflare.com/client/v4/accounts/${CF_ACCOUNT_ID}/images/v1/stats" \
  -H "Authorization: Bearer ${CF_API_TOKEN}")

STATS_SUCCESS=$(echo "$STATS" | jq -r '.success')

if [ "$STATS_SUCCESS" = "true" ]; then
  IMAGES_COUNT=$(echo "$STATS" | jq -r '.result.count.current')
  IMAGES_ALLOWED=$(echo "$STATS" | jq -r '.result.count.allowed')

  echo "โœ… Storage usage:"
  echo "   Images stored: $IMAGES_COUNT"

  if [ "$IMAGES_ALLOWED" != "null" ]; then
    PERCENT_USED=$(echo "scale=1; $IMAGES_COUNT * 100 / $IMAGES_ALLOWED" | bc)
    echo "   Quota: $IMAGES_COUNT / $IMAGES_ALLOWED ($PERCENT_USED%)"
  else
    echo "   Quota: Unlimited (paid plan)"
  fi
else
  echo "โš ๏ธ  Could not retrieve storage stats"
fi

echo ""

7. Display Recent Images

echo "๐Ÿ–ผ๏ธ  Recent images..."

RECENT=$(curl -s \
  "https://api.cloudflare.com/client/v4/accounts/${CF_ACCOUNT_ID}/images/v1?per_page=5" \
  -H "Authorization: Bearer ${CF_API_TOKEN}")

RECENT_SUCCESS=$(echo "$RECENT" | jq -r '.success')

if [ "$RECENT_SUCCESS" = "true" ]; then
  IMAGE_COUNT=$(echo "$RECENT" | jq -r '.result.images | length')

  if [ "$IMAGE_COUNT" -gt 0 ]; then
    echo "โœ… Last $IMAGE_COUNT uploaded images:"
    echo ""
    echo "$RECENT" | jq -r '.result.images[] | "   ID: \(.id)\n   Uploaded: \(.uploaded)\n   Filename: \(.filename)\n   Variants: \(.variants | length)\n"'
  else
    echo "โ„น๏ธ  No images uploaded yet"
  fi
else
  echo "โš ๏ธ  Could not retrieve recent images"
fi

echo ""

8. Test Image Delivery (If Images Exist)

echo "๐ŸŒ Testing image delivery..."

if [ "$IMAGE_COUNT" -gt 0 ] && [ ! -z "$CF_ACCOUNT_HASH" ]; then
  # Get first image ID
Read more
Ships withsecondsky-claude-skills

142 production-ready skills for Claude Code CLI ๐Ÿ”Œ Platform / Harness Support These plugins ship as Claude Code marketplace plugins (.claude-plugin/ manifests) and Codex CLI plugins (.codex-plugin/ manifests).

Get the whole plugin, auto-invoked