yacosta738/yacosta738.github.io / .agents/skills/cloudflare
cloudflare
FlaggedComprehensive Cloudflare platform skill covering Workers, Pages, storage (KV, D1, R2), AI (Workers AI, Vectorize, Agents SDK), networking (Tunnel, Spectrum), security (WAF, DDoS), and infrastructure-as-code (Terraform, Pulumi). Use for any Cloudflare development task. Biases towards retrieval from Cloudflare docs over pre-trained knowledge.
references/images/api.md
View on GitHub# API Reference
## Workers Binding API
```toml
# wrangler.toml
[images]
binding = "IMAGES"
```
### Transform Images
```typescript
const imageResponse = await env.IMAGES
.input(fileBuffer)
.transform({ width: 800, height: 600, fit: "cover", quality: 85, format: "avif" })
.output();
return imageResponse.response();
```
### Transform Options
```typescript
interface TransformOptions {
width?: number; height?: number;
fit?: "scale-down" | "contain" | "cover" | "crop" | "pad";
quality?: number; // 1-100
format?: "avif" | "webp" | "jpeg" | "png";
dpr?: number; // 1-3
gravity?: "auto" | "left" | "right" | "top" | "bottom" | "face" | string;
sharpen?: number; // 0-10
blur?: number; // 1-250
rotate?: 90 | 180 | 270;
background?: string; // CSS color for pad
metadata?: "none" | "copyright" | "keep";
brightness?: number; contrast?: number; gamma?: number; // 0-2
}
```
### Draw/Watermark
```typescript
await env.IMAGES.input(baseImage)
.draw(env.IMAGES.input(watermark).transform({ width: 100 }), { top: 10, left: 10, opacity: 0.8 })
.output();
```
## REST API
### Upload Image
```bash
curl -X POST https://api.cloudflare.com/client/v4/accounts/{account_id}/images/v1 \
-H "Authorization: Bearer {token}" -F file=@image.jpg -F metadata='{"key":"value"}'
```
### Other Operations
```bash
GET /accounts/{account_id}/images/v1/{image_id} # Get details
DELETE /accounts/{account_id}/images/v1/{image_id} # Delete
GET /accounts/{account_id}/images/v1?page=1 # List
```
## URL Transform API
```
https://imagedelivery.net/{hash}/{id}/width=800,height=600,fit=cover,format=avif
```
**Params:** `w=`, `h=`, `fit=`, `q=`, `f=`, `dpr=`, `gravity=`, `sharpen=`, `blur=`, `rotate=`, `background=`, `metadata=`
## Direct Creator Upload
```typescript
// 1. Get upload URL (backend)
const { result } = await fetch(
`https://api.cloudflare.com/client/v4/accounts/${accountId}/images/v2/direct_upload`,
{ method: 'POST', headers: { 'Authorization': `Bearer ${token}` },
body: JSON.stringify({ requireSignedURLs: false }) }
).then(r => r.json());
// 2. Client uploads to result.uploadURL
const formData = new FormData();
formData.append('file', file);
await fetch(result.uploadURL, { method: 'POST', body: formData });
```
## Error Codes
| Code | Message | Solution |
|------|---------|----------|
| 5400 | Invalid format | Use JPEG, PNG, GIF, WebP |
| 5401 | Too large | Max 100MB |
| 5403 | Invalid transform | Check params |
| 9413 | Rate limit | Implement backoff |
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |