agentleFS
HainrixzHainrixz/open-carrusel/CLAUDE.md

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.

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
  1. Very specific:

    Use cn() from src/lib/utils.ts for class merging

    line 41
  2. Very specific:

    All data mutations go through src/lib/data.ts (never direct fs writes for JSON)

    line 43
  3. Very specific:

    Use inline styles or <style> tags

    line 58
  4. Distinctive:

    Use Google Font family names in font-family declarations

    line 60
  5. Very specific:

    NOT contain <script> tags (enforced by iframe sandbox)

    line 61

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

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() in src/lib/slide-html.ts is 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 documents
  • src/lib/data.ts — JSON storage with proper async-mutex and atomic writes
  • src/lib/carousels.ts — Carousel and slide CRUD with version history
  • src/lib/claude-path.ts — Portable Claude CLI discovery

API Routes

All at localhost:3000:

  • POST /api/chat — Claude CLI subprocess + SSE streaming
  • GET/POST /api/carousels — List/create carousels
  • GET/PUT/DELETE /api/carousels/[id] — Single carousel
  • POST /api/carousels/[id]/slides — Add slide
  • PUT/DELETE /api/carousels/[id]/slides/[slideId] — Update/delete slide
  • PUT /api/carousels/[id]/slides — Reorder slides (body: { slideIds: [...] })
  • POST /api/carousels/[id]/slides/[slideId]/undo — Undo slide change
  • POST /api/carousels/[id]/export — Export all slides to PNG ZIP
  • GET/PUT /api/brand — Brand configuration
  • GET/POST /api/templates — Templates
  • POST /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() from src/lib/utils.ts for class merging
  • Types in src/types/, libs in src/lib/, components in src/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 WebFetch and 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

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.