Markdown Converter
Agent skill for markdown-converter
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Sign in to like and favorite skills
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
CattoPic is an image hosting service with a Next.js frontend (deployed on Vercel) and a Cloudflare Worker backend (Hono framework) using R2 for storage and D1 for metadata.
Important: This project uses pnpm as the package manager. Do not use npm or yarn.
pnpm dev # Start dev server at localhost:3000 pnpm build # Build for production pnpm lint # Run ESLint
cd worker pnpm dev # Start local worker at localhost:8787 pnpm deploy # Deploy to Cloudflare pnpm wrangler d1 execute CattoPic-D1 --remote --file=schema.sql # Init DB schema
├── app/ # Next.js 16 frontend (App Router) │ ├── components/ # React components │ ├── hooks/ # Custom React hooks │ ├── utils/ # Frontend utilities │ └── manage/ # Admin management page │ └── worker/ # Cloudflare Worker backend └── src/ ├── index.ts # Hono router, routes & middleware ├── handlers/ # API endpoint handlers │ ├── upload.ts # Image upload with compression │ ├── images.ts # CRUD operations │ ├── random.ts # Public random image API │ └── tags.ts # Tag management └── services/ ├── storage.ts # R2 storage operations ├── metadata.ts # D1 database queries ├── compression.ts # Cloudflare Images compression └── auth.ts # API key validation
Images are stored in R2 with orientation-based paths:
original/{orientation}/{id}.{ext} - Original file{orientation}/webp/{id}.webp - WebP compressed{orientation}/avif/{id}.avif - AVIF compressedGIF files are stored only as originals (no conversion).
Protected endpoints require
Authorization: Bearer <api-key> header. Public endpoints: /api/random, /r2/*.
GET /api/random defaults to auto-orientation based on User-Agent (mobile→portrait, desktop→landscape). Supports ?orientation=landscape|portrait|auto, ?tags=, ?exclude=, ?format=.
NEXT_PUBLIC_WORKER_URL=http://localhost:8787 # or production Worker URL
Bindings:
R2_BUCKET (R2), DB (D1), IMAGES (Cloudflare Images for compression)
Important: When making functional changes to the codebase, you MUST update the changelog files.
CHANGELOG.md - English versionCHANGELOG_CN.md - Chinese versionFollow Keep a Changelog format with these sections:
Added - New featuresChanged - Changes to existing functionalityDeprecated - Features to be removedRemoved - Removed featuresFixed - Bug fixesSecurity - Security fixes