xiaohongshu
xiaohongshu
cloudflare-r2-bucket-management-and-access
Use this skill to configure Cloudflare R2 buckets, access control, lifecycle policies, public/private assets, and integration with Hono Workers using read/write/delete/list operations and signed-access patterns.
Full skill instructions
You are the assistant responsible for managing R2 storage in production including:
Use this skill when handling Cloudflare R2 + Hono Worker integration beyond basic uploads.
Do not use this skill for:
cloudflare-d1-migrations-and-production-seedinghono-app-scaffoldhono-authenticationThis skill knows how to structure R2 per environment:
[[r2_buckets]]
binding = "BUCKET"
bucket_name = "my-bucket-dev"
preview_bucket_name = "my-bucket-dev"
[env.staging]
[[env.staging.r2_buckets]]
binding = "BUCKET"
bucket_name = "my-bucket-staging"
[env.production]
[[env.production.r2_buckets]]
binding = "BUCKET"
bucket_name = "my-bucket-prod"
Claude should:
R2 can be accessed in multiple ways — this skill helps choose between:
| Mode | Use Case |
|---|---|
| Private (default) | User uploads, internal assets |
| Public Read | Images, static assets, public files |
| Signed-access URLs | Limited-time external file sharing |
| Proxy download route via Hono | Controlled rule-based access |
This skill selects approach based on context.
Best practice: Keep buckets private, expose objects through Worker/Routes or signed URLs.
Use Cloudflare Worker as controlled access:
app.get("/file/:key", async (c) => {
const key = decodeURIComponent(c.req.param("key"));
const obj = await c.env.BUCKET.get(key);
if (!obj) return c.notFound();
return new Response(obj.body, {
headers: { "Content-Type": obj.httpMetadata?.contentType ?? "application/octet-stream" }
});
});
This enables auth-check:
if (!c.get("user")) return c.json({ auth: false }, 401);
Enable public read with bucket policy:
wrangler r2 bucket policy put BUCKET << 'EOF'
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": "*",
"Action": "r2:GetObject",
"Resource": "BUCKET/*"
}
]
}
EOF
Use only for assets intended to be publicly hosted (CDN optimized).
const file = await c.req.formData().then(f => f.get("file") as File);
const key = `users/${c.get("user")?.id}/${Date.now()}-${file.name}`;
await c.env.BUCKET.put(key, await file.arrayBuffer(), {
httpMetadata: { contentType: file.type }
});
return c.json({ key, url: `/file/${encodeURIComponent(key)}` });
The skill ensures safe naming conventions:
Claude may apply retention or expiration policy suggestions:
| Policy | Benefit |
|---|---|
| Auto-delete after X days | Temporary file cleanup |
| Move to cold storage after X | Cost reduction |
| Prevent overwrite unless flagged | Audit safety |
Example JSON policy reference:
{
"Rules": [
{
"ID": "auto-expire-temp",
"Filter": { "Prefix": "temp/" },
"Expiration": { "Days": 30 }
}
]
}
Cloudflare does not sign natively — we generate JWT-contained key + expiry:
import { SignJWT, jwtVerify } from "jose";
export async function createSignedURL(key: string, expSec: number, secret: string) {
const token = await new SignJWT({ key })
.setProtectedHeader({ alg: "HS256" })
.setExpirationTime(Math.floor(Date.now()/1000) + expSec)
.sign(new TextEncoder().encode(secret));
return `/download/${token}`;
}
app.get("/download/:token", async (c) => {
const secret = c.env.JWT_SECRET;
const { payload } = await jwtVerify(c.req.param("token"), new TextEncoder().encode(secret));
const obj = await c.env.BUCKET.get(payload.key);
if(!obj) return c.notFound();
return new Response(obj.body);
});
This simulates presigned URLs safely.
Claude may suggest folder-style structure for organization:
/public/assets/*
/users/[id]/uploads/*
/tenants/[id]/invoices/*
/tmp/uploads/*
Naming rules enforced by this skill:
v1/avatars) for migrationsconst result = await c.env.BUCKET.list({ prefix: `users/${id}/` });
return c.json(result.objects.map(o => ({ key: o.key, size: o.size, date: o.uploaded })));
Skill advises pagination if results exceed limits.
This skill suggests combining with future CI/CD workflow:
wrangler deploy --env production
Then apply bucket policy or migration tasks post-deploy.
For automation:
| Skill | How it connects |
|---|---|
hono-r2-integration | This skill expands it with policy, access control, public/private modes |
cloudflare-worker-deployment | Ensures R2 bindings are correctly mapped across envs |
cloudflare-d1-migrations-and-production-seeding | Not DB schema — but both require env-controlled versioning |
hono-authentication | User-based folder ownership, signed URL verification |
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience