Skip to content
Development
Command

/validate-config

Validate wrangler.jsonc configuration, verify Cloudflare Images bindings, check environment variables, and test Workers integration. Ensures correct setup for using Cloudflare Images with Cloudflare Workers.

From plugin
secondsky-claude-skills
20466 skills46 agents66 commands2 MCP
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/validate-config

Context preview

What this command does when you run it.

Validate wrangler.jsonc configuration, verify Cloudflare Images bindings, check environment variables, and test Workers integration. Ensures correct setup for using Cloudflare Images with Cloudflare Workers.

Command definition

validate-config.md
name: cloudflare-images:validate-config
description: Validate wrangler.jsonc configuration, verify Cloudflare Images bindings, check environment variables, and test Workers integration. Ensures correct setup for using Cloudflare Images with Cloudflare Workers.

Validate Cloudflare Images Configuration

Comprehensive validation of `wrangler.jsonc`, environment variables, and Cloudflare Images bindings for Workers integration.

What This Command Does

When you run `/validate-config`, Claude will: 1. Check if `wrangler.jsonc` exists and has valid JSON 2. Verify images binding configuration 3. Validate environment variables (`.env`, `.dev.vars`) 4. Test API token permissions 5. Check account ID matches binding 6. Verify Worker can access IMAGES binding 7. Validate transformation endpoints 8. Check for common configuration issues

Usage

/validate-config

Run from your Cloudflare Worker project root (where `wrangler.jsonc` is located).

Implementation

Run the following validation checks:

1. Check wrangler.jsonc Exists

echo "๐Ÿ“ Checking project structure..."

if [ ! -f "wrangler.jsonc" ]; then
  echo "โŒ wrangler.jsonc not found"
  echo "   Run: wrangler init"
  exit 1
else
  echo "โœ… wrangler.jsonc found"
fi

echo ""

2. Validate wrangler.jsonc Syntax

echo "๐Ÿ“ Validating wrangler.jsonc syntax..."

# Check if valid JSON (with comments allowed for JSONC)
if jq empty wrangler.jsonc 2>/dev/null; then
  echo "โœ… Valid JSON syntax"
else
  # Try stripping comments and validating
  if grep -v '^\s*//' wrangler.jsonc | jq empty 2>/dev/null; then
    echo "โœ… Valid JSONC syntax (with comments)"
  else
    echo "โŒ Invalid JSON syntax in wrangler.jsonc"
    echo "   Check for trailing commas, missing quotes, etc."
    exit 1
  fi
fi

echo ""

3. Verify Images Binding Configuration

echo "๐Ÿ”— Checking images binding..."

BINDING_EXISTS=$(jq -r 'has("images")' wrangler.jsonc 2>/dev/null)

if [ "$BINDING_EXISTS" = "true" ]; then
  echo "โœ… images binding configured"

  # Validate binding structure
  BINDING_COUNT=$(jq -r '.images | length' wrangler.jsonc)
  echo "   Bindings configured: $BINDING_COUNT"

  # Check each binding
  for i in $(seq 0 $(($BINDING_COUNT - 1))); do
    BINDING_NAME=$(jq -r ".images[$i].binding" wrangler.jsonc)
    BINDING_ACCOUNT=$(jq -r ".images[$i].account_id" wrangler.jsonc)

    if [ "$BINDING_NAME" != "null" ]; then
      echo "   โ€ข Binding: $BINDING_NAME"
    else
      echo "   โš ๏ธ  Binding $i missing 'binding' field (default: IMAGES)"
    fi

    if [ "$BINDING_ACCOUNT" != "null" ]; then
      echo "     Account: ${BINDING_ACCOUNT:0:8}..."
    else
      echo "     โš ๏ธ  No account_id specified (will use account from wrangler auth)"
    fi
  done
else
  echo "โŒ No images binding configured"
  echo ""
  echo "   Add to wrangler.jsonc:"
  echo '   {
     "images": [
       {
         "binding": "IMAGES",
         "account_id": "your_account_id"
       }
     ]
   }'
  exit 1
fi

echo ""

4. Validate Environment Variables

echo "๐Ÿ” Checking environment variables..."

# Check .env file
if [ -f ".env" ]; then
  echo "โœ… .env file found"

  if grep -q "CF_ACCOUNT_ID" .env; then
    ACCOUNT_ID=$(grep "CF_ACCOUNT_ID" .env | cut -d '=' -f2)
    echo "   CF_ACCOUNT_ID: ${ACCOUNT_ID:0:8}..."
  else
    echo "   โš ๏ธ  CF_ACCOUNT_ID not set in .env"
  fi

  if grep -q "CF_API_TOKEN" .env; then
    API_TOKEN=$(grep "CF_API_TOKEN" .env | cut -d '=' -f2)
    echo "   CF_API_TOKEN: ${API_TOKEN:0:10}..."
  else
    echo "   โš ๏ธ  CF_API_TOKEN not set in .env"
  fi

  if grep -q "CF_ACCOUNT_HASH" .env; then
    ACCOUNT_HASH=$(grep "CF_ACCOUNT_HASH" .env | cut -d '=' -f2)
    echo "   CF_ACCOUNT_HASH: $ACCOUNT_HASH"
  else
    echo "   โ„น๏ธ  CF_ACCOUNT_HASH not set (optional for delivery URLs)"
  fi
else
  echo "โš ๏ธ  .env file not found"
  echo "   Create .env with:"
  echo "   CF_ACCOUNT_ID=your_account_id"
  echo "   CF_API_TOKEN=your_api_token"
fi

# Check .dev.vars file (for wrangler dev)
echo ""
if [ -f ".dev.vars" ]; then
  echo "โœ… .dev.vars file found (for local development)"
else
  echo "โ„น๏ธ  .dev.vars not found (optional - for wrangler dev)"
  echo "   Create .dev.vars for local secrets"
fi

echo ""

5. Verify Account ID Matches

echo "๐Ÿ” Verifying account ID consistency..."

# Get account ID from wrangler.jsonc
WRANGLER_ACCOUNT=$(jq -r '.images[0].account_id // empty' wrangler.jsonc)

# Get account ID from .env
if [ -f ".env" ]; then
  ENV_ACCOUNT=$(grep "CF_ACCOUNT_ID" .env | cut -d '=' -f2 | tr -d '"' | tr -d "'")
fi

if [ ! -z "$WRANGLER_ACCOUNT" ] && [ ! -z "$ENV_ACCOUNT" ]; then
  if [ "$WRANGLER_ACCOUNT" = "$ENV_ACCOUNT" ]; then
    echo "โœ… Account IDs match"
    echo "   wrangler.jsonc: ${WRANGLER_ACCOUNT:0:8}..."
    echo "   .env: ${ENV_ACCOUNT:0:8}..."
  else
    echo "โŒ Account ID mismatch!"
    echo "   wrangler.jsonc: ${WRANGLER_ACCOUNT:0:8}..."
    echo "   .env: ${ENV_ACCOUNT:0:8}..."
    echo "   These should match for consistent behavior"
  fi
elif [ -z "$WRANGLER_ACCOUNT" ]; then
  echo "โ„น๏ธ  No account_id in wrangler.jsonc (using default account)"
elif [ -z "$ENV_ACCOUNT" ]; then
  echo "โ„น๏ธ  CF_ACCOUNT_ID not set in .env"
fi

echo ""

6. Test API Token Permissions

echo "๐Ÿ”‘ Testing API token permissions..."

if [ -f ".env" ] && grep -q "CF_API_TOKEN" .env && grep -q "CF_ACCOUNT_ID" .env; then
  source .env

  # Test Images API access
  IMAGES_TEST=$(curl -s \
    "https://api.cloudflare.com/client/v4/accounts/${CF_ACCOUNT_ID}/images/v1?per_page=1" \
    -H "Authorization: Bearer ${CF_API_TOKEN}")

  IMAGES_SUCCESS=$(echo "$IMAGES_TEST" | jq -r '.success')

  if [ "$IMAGES_SUCCESS" = "true" ]; then
    echo "โœ… API token has Images:Read permission"

    # Test if can list variants (requires Edit permission)
    VARIANTS_TEST=$(curl -s \
      "https://api.cloudflare.com/client/v4/accounts/${CF_ACCOUNT_ID}/images/v1/variants" \
      -H "Authorization: Bearer ${CF_AP
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