open-carrusel
CLAUDE.md474 starsChanged 8 months agoMITView on GitHub
AI-powered Instagram carousel builder. Next.js 16 + React 19 + TypeScript + Tailwind v4. All at localhost:3000: Slides store body-level HTML only (no <html>, <head>, <!DOCTYPE>). The wrapSlideHtml() function adds the full document structure, font loading, and dimension constraints. Slides should:
In this repositoryOne other file it gives its agents.
- AGENTS.mdAGENTS.md
The file
We split this CLAUDE.md into the rules it gives an agent
5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 41
Use cn() from src/lib/utils.ts for class merging
- Very specific: line 43
All data mutations go through src/lib/data.ts (never direct fs writes for JSON)
- Very specific: line 58
Use inline styles or <style> tags
- Distinctive: line 60
Use Google Font family names in font-family declarations
- Very specific: line 61
NOT contain <script> tags (enforced by iframe sandbox)
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Open Carrusel
AI-powered Instagram carousel builder. Next.js 16 + React 19 + TypeScript + Tailwind v4.
Architecture
- Frontend: React app at localhost:3000 with chat panel (left), carousel preview (center), slide filmstrip (bottom)
- AI Agent: Claude CLI spawned as subprocess via
/api/chat, communicates through SSE streaming - Storage: JSON files in
/data/with async-mutex locking and atomic writes - Export: Puppeteer screenshots HTML slides to PNG at exact Instagram dimensions
- Slides: Full HTML documents rendered in sandboxed iframes.
wrapSlideHtml()insrc/lib/slide-html.tsis the shared rendering contract between preview and export.
Key Files
src/lib/chat-system-prompt.ts— Dynamic system prompt (injects brand config + carousel context)src/lib/slide-html.ts—wrapSlideHtml()wraps slide body HTML into full documentssrc/lib/data.ts— JSON storage with proper async-mutex and atomic writessrc/lib/carousels.ts— Carousel and slide CRUD with version historysrc/lib/claude-path.ts— Portable Claude CLI discovery
API Routes
All at localhost:3000:
POST /api/chat— Claude CLI subprocess + SSE streamingGET/POST /api/carousels— List/create carouselsGET/PUT/DELETE /api/carousels/[id]— Single carouselPOST /api/carousels/[id]/slides— Add slidePUT/DELETE /api/carousels/[id]/slides/[slideId]— Update/delete slidePUT /api/carousels/[id]/slides— Reorder slides (body: { slideIds: [...] })POST /api/carousels/[id]/slides/[slideId]/undo— Undo slide changePOST /api/carousels/[id]/export— Export all slides to PNG ZIPGET/PUT /api/brand— Brand configurationGET/POST /api/templates— TemplatesPOST /api/upload— Image upload (PNG/JPG/WebP only, max 10MB)GET /api/fonts— Google Fonts list
Conventions
- Components max ~300 lines per file
- Use
cn()fromsrc/lib/utils.tsfor class merging - Types in
src/types/, libs insrc/lib/, components insrc/components/ - All data mutations go through
src/lib/data.ts(never direct fs writes for JSON) - iframe slides always use
sandbox=""attribute (no JavaScript execution) - The Claude subprocess gets
--allowedTools Bash WebFetchand uses curl to call local API routes
Instagram Dimensions
- 1:1 = 1080x1080 (square)
- 4:5 = 1080x1350 (portrait, recommended)
- 9:16 = 1080x1920 (story)
- Max 10 slides per carousel
Slide HTML Rules
Slides store body-level HTML only (no <html>, <head>, <!DOCTYPE>). The wrapSlideHtml() function adds the full document structure, font loading, and dimension constraints. Slides should:
- Use inline styles or
<style>tags - Reference images as
/uploads/{filename}paths - Use Google Font family names in font-family declarations
- NOT contain
<script>tags (enforced by iframe sandbox) - Target the carousel's aspect ratio dimensions
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

