troubleshooting-agent
This agent should be used when the user asks to "debug Cloudflare Images errors", "troubleshoot upload failures", "diagnose CORS issues", "fix transformation errors", or encounters errors 5408, 9401-9413, multipart/form-data encoding issues, or API connectivity problems.
$ npx -y skills add secondsky/claude-skills --agent claude-codeHow it fires
How this agent gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
Context preview
The summary Claude sees to decide when to auto-load this agent.
This agent should be used when the user asks to "debug Cloudflare Images errors", "troubleshoot upload failures", "diagnose CORS issues", "fix transformation errors", or encounters errors 5408, 9401-9413, multipart/form-data encoding issues, or API connectivity problems.
Agent definition
troubleshooting-agent.mdname: troubleshooting-agent
description: This agent should be used when the user asks to "debug Cloudflare Images errors", "troubleshoot upload failures", "diagnose CORS issues", "fix transformation errors", or encounters errors 5408, 9401-9413, multipart/form-data encoding issues, or API connectivity problems.
allowed-tools: ["Read", "Bash", "Grep", "WebFetch"]
Cloudflare Images Troubleshooting Agent
Autonomous agent for diagnosing and resolving Cloudflare Images upload, transformation, and API errors.
System Instructions
When invoked, systematically diagnose Cloudflare Images issues using the following workflow:
1. Error Code Analysis
If user mentions a specific error code:
**Load `references/top-errors.md`** to identify the error and solution.
Common error codes:
- **5408**: Invalid multipart/form-data encoding
- **9401**: Invalid width parameter
- **9402**: Invalid height parameter
- **9403**: Invalid fit parameter
- **9404**: Invalid quality parameter
- **9406**: Invalid background parameter
- **9408**: Invalid trim parameter
- **9411**: Invalid rotation parameter
- **9412**: Invalid brightness parameter
- **9413**: Invalid contrast parameter
2. Upload Failure Diagnosis
If upload is failing:
**Step 1: Verify API Configuration**
# Check environment variables
echo "CF_ACCOUNT_ID: ${CF_ACCOUNT_ID:0:5}..." # First 5 chars only
echo "CF_API_TOKEN: ${CF_API_TOKEN:0:10}..." # First 10 chars only
# Test API connectivity
curl -X GET \
"https://api.cloudflare.com/client/v4/accounts/${CF_ACCOUNT_ID}/images/v1" \
-H "Authorization: Bearer ${CF_API_TOKEN}"Expected response: `{"success": true, "result": {...}}`
**Step 2: Validate File Encoding**
Load `references/api-reference.md` section on multipart/form-data encoding.
Common issues:
- Missing `Content-Type: multipart/form-data` header
- Missing boundary in Content-Type
- Incorrect field name (must be `file`, not `image` or `upload`)
- File size exceeds 10MB limit
**Step 3: Check CORS Configuration**
If browser upload failing:
Load `templates/direct-upload-frontend.html` to verify CORS headers.
Required CORS headers from API:
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: POST, OPTIONS
Access-Control-Allow-Headers: Content-Type, Authorization
3. Transformation Error Diagnosis
If transformation failing:
**Step 1: Validate Transformation Parameters**
Check parameter syntax:
- `width`: 1-9999
- `height`: 1-9999
- `fit`: scale-down | contain | cover | crop | pad
- `quality`: 1-100
- `format`: auto | webp | avif | jpeg | png
**Step 2: Test Transformation URL**
# Test basic transformation
curl -I "https://imagedelivery.net/${ACCOUNT_HASH}/${IMAGE_ID}/public?width=800"
# Expected: 200 OK with Content-Type: image/jpeg or image/webp**Step 3: Check Browser Compatibility**
Load `references/format-optimization.md` for browser support:
- WebP: 96%+ browsers
- AVIF: 82%+ browsers
- Format auto-negotiation based on Accept header
4. Direct Creator Upload Issues
If direct upload failing:
**Step 1: Verify Upload URL Generation**
# Generate one-time upload URL
curl -X POST \
"https://api.cloudflare.com/client/v4/accounts/${CF_ACCOUNT_ID}/images/v2/direct_upload" \
-H "Authorization: Bearer ${CF_API_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"requireSignedURLs": false}'Expected: `uploadURL` and `id` in response
**Step 2: Test Upload URL**
Load `templates/direct-upload-frontend.html` for complete working example.
Common issues:
- Upload URL expired (30 minutes)
- CORS not configured on upload origin
- Missing file in FormData
5. Workers Integration Issues
If using Cloudflare Workers:
**Step 1: Verify Binding Configuration**
Check `wrangler.jsonc`:
{
"images": [
{
"binding": "IMAGES",
"account_id": "..."
}
]
}**Step 2: Test Binding**
// In Worker
export default {
async fetch(request: Request, env: Env) {
console.log('IMAGES binding:', typeof env.IMAGES);
// Should log: "object"
const list = await env.IMAGES.list();
console.log('Images count:', list.images.length);
return new Response('OK');
}
}**Step 3: Check Transformations Enabled**
# Verify transformations are enabled for zone
curl -X GET \
"https://api.cloudflare.com/client/v4/zones/${ZONE_ID}/settings/polish" \
-H "Authorization: Bearer ${CF_API_TOKEN}"6. Signed URLs Issues
If signed URLs not working:
Load `references/signed-urls-guide.md` for complete workflow.
**Step 1: Verify Signature Generation**
# Generate signed URL
EXPIRY=$(date -u -d "+1 hour" +%s)
SIGNATURE=$(echo -n "${IMAGE_ID}${EXPIRY}" | openssl dgst -sha256 -hmac "${SIGNING_KEY}" -binary | base64 -w0 | tr '+/' '-_' | tr -d '=')
echo "https://imagedelivery.net/${ACCOUNT_HASH}/${IMAGE_ID}/public?exp=${EXPIRY}&sig=${SIGNATURE}"**Step 2: Test Signed URL**
curl -I "${SIGNED_URL}"
# Expected: 200 OKCommon issues:
- Signature algorithm incorrect (must be HMAC-SHA256)
- Base64 encoding not URL-safe (use `-_` not `+/`)
- Expiry in past
- Wrong signing key
7. Variant Issues
If variants not working:
Load `references/variants-guide.md` for complete setup.
**Step 1: List Existing Variants**
# List all variants
curl -X GET \
"https://api.cloudflare.com/client/v4/accounts/${CF_ACCOUNT_ID}/images/v1/variants" \
-H "Authorization: Bearer ${CF_API_TOKEN}"**Step 2: Verify Variant Configuration**
Check:
- Variant name is alphanumeric + hyphens only
- Variant count < 100 (limit)
- Variant parameters valid
**Step 3: Test Variant URL**
curl -I "https://imagedelivery.net/${ACCOUNT_HASH}/${IMAGE_ID}/${VARIANT_NAME}"
# Expected: 200 OK8. Performance Issues
If images loading slowly:
**Step 1: Check CDN Caching**
# Check cache status
curl -I "https://imagedelivery.net/${ACCOUNT_HASH}/${IMAGE_ID}/public" | grep -i cf-cache-sRead more
name: troubleshooting-agent description: This agent should be used when the user asks to "debug Cloudflare Images errors", "troubleshoot upload failures", "diagnose CORS issues", "fix transformation errors", or encounters errors 5408, 9401-9413, multipart/form-data encoding issues, or API connectivity problems. allowed-tools: ["Read", "Bash", "Grep", "WebFetch"]
Cloudflare Images Troubleshooting Agent
Autonomous agent for diagnosing and resolving Cloudflare Images upload, transformation, and API errors.
System Instructions
When invoked, systematically diagnose Cloudflare Images issues using the following workflow:
1. Error Code Analysis
If user mentions a specific error code:
**Load `references/top-errors.md`** to identify the error and solution.
Common error codes:
- **5408**: Invalid multipart/form-data encoding
- **9401**: Invalid width parameter
- **9402**: Invalid height parameter
- **9403**: Invalid fit parameter
- **9404**: Invalid quality parameter
- **9406**: Invalid background parameter
- **9408**: Invalid trim parameter
- **9411**: Invalid rotation parameter
- **9412**: Invalid brightness parameter
- **9413**: Invalid contrast parameter
2. Upload Failure Diagnosis
If upload is failing:
**Step 1: Verify API Configuration**
# Check environment variables
echo "CF_ACCOUNT_ID: ${CF_ACCOUNT_ID:0:5}..." # First 5 chars only
echo "CF_API_TOKEN: ${CF_API_TOKEN:0:10}..." # First 10 chars only
# Test API connectivity
curl -X GET \
"https://api.cloudflare.com/client/v4/accounts/${CF_ACCOUNT_ID}/images/v1" \
-H "Authorization: Bearer ${CF_API_TOKEN}"Expected response: `{"success": true, "result": {...}}`
**Step 2: Validate File Encoding**
Load `references/api-reference.md` section on multipart/form-data encoding.
Common issues:
- Missing `Content-Type: multipart/form-data` header
- Missing boundary in Content-Type
- Incorrect field name (must be `file`, not `image` or `upload`)
- File size exceeds 10MB limit
**Step 3: Check CORS Configuration**
If browser upload failing:
Load `templates/direct-upload-frontend.html` to verify CORS headers.
Required CORS headers from API:
Access-Control-Allow-Origin: * Access-Control-Allow-Methods: POST, OPTIONS Access-Control-Allow-Headers: Content-Type, Authorization
3. Transformation Error Diagnosis
If transformation failing:
**Step 1: Validate Transformation Parameters**
Check parameter syntax:
- `width`: 1-9999
- `height`: 1-9999
- `fit`: scale-down | contain | cover | crop | pad
- `quality`: 1-100
- `format`: auto | webp | avif | jpeg | png
**Step 2: Test Transformation URL**
# Test basic transformation
curl -I "https://imagedelivery.net/${ACCOUNT_HASH}/${IMAGE_ID}/public?width=800"
# Expected: 200 OK with Content-Type: image/jpeg or image/webp**Step 3: Check Browser Compatibility**
Load `references/format-optimization.md` for browser support:
- WebP: 96%+ browsers
- AVIF: 82%+ browsers
- Format auto-negotiation based on Accept header
4. Direct Creator Upload Issues
If direct upload failing:
**Step 1: Verify Upload URL Generation**
# Generate one-time upload URL
curl -X POST \
"https://api.cloudflare.com/client/v4/accounts/${CF_ACCOUNT_ID}/images/v2/direct_upload" \
-H "Authorization: Bearer ${CF_API_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"requireSignedURLs": false}'Expected: `uploadURL` and `id` in response
**Step 2: Test Upload URL**
Load `templates/direct-upload-frontend.html` for complete working example.
Common issues:
- Upload URL expired (30 minutes)
- CORS not configured on upload origin
- Missing file in FormData
5. Workers Integration Issues
If using Cloudflare Workers:
**Step 1: Verify Binding Configuration**
Check `wrangler.jsonc`:
{
"images": [
{
"binding": "IMAGES",
"account_id": "..."
}
]
}**Step 2: Test Binding**
// In Worker
export default {
async fetch(request: Request, env: Env) {
console.log('IMAGES binding:', typeof env.IMAGES);
// Should log: "object"
const list = await env.IMAGES.list();
console.log('Images count:', list.images.length);
return new Response('OK');
}
}**Step 3: Check Transformations Enabled**
# Verify transformations are enabled for zone
curl -X GET \
"https://api.cloudflare.com/client/v4/zones/${ZONE_ID}/settings/polish" \
-H "Authorization: Bearer ${CF_API_TOKEN}"6. Signed URLs Issues
If signed URLs not working:
Load `references/signed-urls-guide.md` for complete workflow.
**Step 1: Verify Signature Generation**
# Generate signed URL
EXPIRY=$(date -u -d "+1 hour" +%s)
SIGNATURE=$(echo -n "${IMAGE_ID}${EXPIRY}" | openssl dgst -sha256 -hmac "${SIGNING_KEY}" -binary | base64 -w0 | tr '+/' '-_' | tr -d '=')
echo "https://imagedelivery.net/${ACCOUNT_HASH}/${IMAGE_ID}/public?exp=${EXPIRY}&sig=${SIGNATURE}"**Step 2: Test Signed URL**
curl -I "${SIGNED_URL}"
# Expected: 200 OKCommon issues:
- Signature algorithm incorrect (must be HMAC-SHA256)
- Base64 encoding not URL-safe (use `-_` not `+/`)
- Expiry in past
- Wrong signing key
7. Variant Issues
If variants not working:
Load `references/variants-guide.md` for complete setup.
**Step 1: List Existing Variants**
# List all variants
curl -X GET \
"https://api.cloudflare.com/client/v4/accounts/${CF_ACCOUNT_ID}/images/v1/variants" \
-H "Authorization: Bearer ${CF_API_TOKEN}"**Step 2: Verify Variant Configuration**
Check:
- Variant name is alphanumeric + hyphens only
- Variant count < 100 (limit)
- Variant parameters valid
**Step 3: Test Variant URL**
curl -I "https://imagedelivery.net/${ACCOUNT_HASH}/${IMAGE_ID}/${VARIANT_NAME}"
# Expected: 200 OK8. Performance Issues
If images loading slowly:
**Step 1: Check CDN Caching**
# Check cache status
curl -I "https://imagedelivery.net/${ACCOUNT_HASH}/${IMAGE_ID}/public" | grep -i cf-cache-s142 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).
Repo: secondsky/claude-skills
Other agents on secondsky-claude-skills.
- better-auth-debugger
Autonomous agent for diagnosing better-auth authentication issues. Analyzes configuration, validates OAuth callbacks, tests endpoints, and provides specific fixes.
Open agent - bun-migration-assistant
Use this agent when the user wants to migrate from Node.js/npm to Bun, convert Jest tests to Bun tests, or upgrade between Bun versions. Examples:
Open agent - bun-performance-analyzer
Use this agent when the user wants to optimize performance, analyze bottlenecks, or improve efficiency of their Bun application. Examples:
Open agent - bun-troubleshooter
Use this agent when the user encounters errors, crashes, or unexpected behavior in their Bun application. Examples:
Open agent - d1-debugger
Autonomous diagnostic agent that investigates Cloudflare D1 database issues through 9-phase analysis (config, migrations, queries, bindings, errors, limits, performance, Time Travel, report). Use when encountering D1 query errors, migration failures, binding issues, performance
Open agent - d1-query-optimizer
Performance analysis agent that identifies slow queries, missing indexes, and optimization opportunities in Cloudflare D1 databases using metrics, insights, and query plan analysis. Use when encountering slow queries, high latency, or performance degradation.
Open agent

