# chongdashu/cc-skills-nanobananapro architecture

> Architecture diagram of the GitHub repository chongdashu/cc-skills-nanobananapro, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/chongdashu/cc-skills-nanobananapro
- Repository: https://github.com/chongdashu/cc-skills-nanobananapro

## Overview

#### Purpose and Deliverables

This repository is both a distributable Claude Code skill collection and a Next.js demo application. The app demonstrates a Chinese New Year card workflow: accept a selfie, generate a two-panel festive image through Google Gemini, and present it as an interactive fold-out 3D card. The reusable skill definitions live under `.claude/skills/`; the staged build prompts are in `prompts/`.

#### Application Entry and UI Shell

Next.js App Router supplies the runtime boundary. `app/layout.tsx` defines the shared document/layout shell and `app/globals.css` provides global presentation. `app/page.tsx` is the primary client-facing entry page: it owns the user workflow and composes generation and preview UI.

- `app/page.tsx`
- `app/layout.tsx`
- `app/globals.css`

#### Image Generation Server Boundary

Generation is isolated behind a Next.js server action rather than exposing the Gemini credential to the browser. `app/actions/generate.ts` receives user-provided image/prompt inputs, calls Google’s Generative AI image-generation capability, and returns generation output or failure information to the page. The API key is supplied through the local environment, with `.env.example` documenting the required variable.

- `app/actions/generate.ts`
- `.env.example`

#### User Workflow and State Flow

The page coordinates the main control flow: selfie selection/upload, generation submission and loading/error state, receipt of the generated card image, preview rendering, and download. Generated image data crosses from the server action back into the browser, where it becomes both a conventional image/download asset and input to the 3D renderer.

- `app/page.tsx`
- `app/actions/generate.ts`

#### Interactive 3D Card Preview

`Card3DPreview.tsx` encapsulates the browser-only Three.js presentation layer. It maps the generated two-panel artwork onto a fold-out card scene and supports interactive viewing, keeping WebGL/scene lifecycle concerns separate from the page’s form and generation state. This is a client rendering boundary: Gemini produces a flat image; Three.js turns it into an inspectable card model.

- `app/components/Card3DPreview.tsx`
- `app/page.tsx`

#### Skill Package Architecture

The repository’s primary reusable product is the Claude Code skill package. Each skill is invoked by Claude Code and provides domain-specific implementation guidance rather than app runtime code. `nano-banana-builder` covers Gemini image application patterns; `threejs-builder` covers modern Three.js scene construction; `frontend-design` guides UI design. Supporting reference documents extend the first two skills.

- `.claude/skills/nano-banana-builder/SKILL.md`
- `.claude/skills/threejs-builder/SKILL.md`
- `.claude/skills/frontend-design/SKILL.md`

#### Build Provenance and Runtime Dependencies

The prompts document the intended evolution of the demo: image-generation MVP, 3D preview addition, then UI polish. The material runtime is Node.js with Next.js, TypeScript, React, Tailwind/PostCSS styling, Google Gemini APIs, and browser WebGL/Three.js. No persistence, authentication, or external storage layer is represented in the tree.

- `prompts/01-nanobanana.txt`
- `prompts/02-threejs.txt`
- `prompts/03-frontend-design.txt`

Main entry points: [`app/page.tsx`](https://github.com/chongdashu/cc-skills-nanobananapro/blob/main/app/page.tsx) (Card workflow page), [`app/actions/generate.ts`](https://github.com/chongdashu/cc-skills-nanobananapro/blob/main/app/actions/generate.ts) (Generate card action), [`app/components/Card3DPreview.tsx`](https://github.com/chongdashu/cc-skills-nanobananapro/blob/main/app/components/Card3DPreview.tsx) (3D card preview), [`app/layout.tsx`](https://github.com/chongdashu/cc-skills-nanobananapro/blob/main/app/layout.tsx) (App layout)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_next_app["Next.js demo app"]
  node_page["Card workflow page<br/>Next.js client page<br/>[page.tsx]"]
  node_layout["App layout<br/>Next.js layout<br/>[layout.tsx]"]
  node_styles["Global styles<br/>CSS<br/>[globals.css]"]
  node_generate_action{{"Generate card action<br/>Next.js server action<br/>[generate.ts]"}}
  node_environment["API key environment<br/>environment contract<br/>[.env.example]"]
  node_card_preview["3D card preview<br/>Three.js client component<br/>[Card3DPreview.tsx]"]
end

subgraph group_skills["Claude Code skills"]
  node_nano_skill["Nano Banana Builder<br/>Claude Code skill<br/>[SKILL.md]"]
  node_threejs_skill["Three.js Builder<br/>Claude Code skill<br/>[SKILL.md]"]
  node_frontend_skill["Frontend Design<br/>Claude Code skill<br/>[SKILL.md]"]
end

subgraph group_provenance["Build prompts"]
  node_prompt_1["Image MVP prompt<br/>build prompt<br/>[01-nanobanana.txt]"]
  node_prompt_2["3D preview prompt<br/>build prompt<br/>[02-threejs.txt]"]
  node_prompt_3["UI polish prompt<br/>build prompt"]
end

node_gemini(("Google Gemini<br/>image generation API"))
node_browser_webgl(("Browser WebGL<br/>rendering runtime"))

node_layout -->|"hosts"| node_page
node_layout -->|"applies"| node_styles
node_page -->|"submits selfie and prompt"| node_generate_action
node_generate_action -->|"generates artwork"| node_gemini
node_environment -.->|"supplies API key"| node_generate_action
node_generate_action -->|"returns image or error"| node_page
node_page -->|"passes generated image"| node_card_preview
node_card_preview -->|"renders scene with"| node_browser_webgl
node_prompt_1 -.->|"informs"| node_nano_skill
node_prompt_2 -.->|"informs"| node_threejs_skill
node_prompt_3 -.->|"informs"| node_frontend_skill
node_nano_skill -.->|"guides implementation"| node_generate_action
node_threejs_skill -.->|"guides implementation"| node_card_preview
node_frontend_skill -.->|"guides implementation"| node_page

click node_page "https://github.com/chongdashu/cc-skills-nanobananapro/blob/main/app/page.tsx"
click node_layout "https://github.com/chongdashu/cc-skills-nanobananapro/blob/main/app/layout.tsx"
click node_styles "https://github.com/chongdashu/cc-skills-nanobananapro/blob/main/app/globals.css"
click node_generate_action "https://github.com/chongdashu/cc-skills-nanobananapro/blob/main/app/actions/generate.ts"
click node_environment "https://github.com/chongdashu/cc-skills-nanobananapro/blob/main/.env.example"
click node_card_preview "https://github.com/chongdashu/cc-skills-nanobananapro/blob/main/app/components/Card3DPreview.tsx"
click node_nano_skill "https://github.com/chongdashu/cc-skills-nanobananapro/blob/main/.claude/skills/nano-banana-builder/SKILL.md"
click node_threejs_skill "https://github.com/chongdashu/cc-skills-nanobananapro/blob/main/.claude/skills/threejs-builder/SKILL.md"
click node_frontend_skill "https://github.com/chongdashu/cc-skills-nanobananapro/blob/main/.claude/skills/frontend-design/SKILL.md"
click node_prompt_1 "https://github.com/chongdashu/cc-skills-nanobananapro/blob/main/prompts/01-nanobanana.txt"
click node_prompt_2 "https://github.com/chongdashu/cc-skills-nanobananapro/blob/main/prompts/02-threejs.txt"
click node_prompt_3 "https://github.com/chongdashu/cc-skills-nanobananapro/blob/main/prompts/03-frontend-design.txt"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_page,node_layout,node_styles,node_generate_action,node_environment,node_card_preview toneBlue
class node_nano_skill,node_threejs_skill,node_frontend_skill toneAmber
class node_prompt_1,node_prompt_2,node_prompt_3 toneMint
class node_gemini,node_browser_webgl toneNeutral
```

## Components

### Next.js demo app

Chinese New Year card generation and preview workflow.

- [Card workflow page](https://github.com/chongdashu/cc-skills-nanobananapro/blob/main/app/page.tsx): Next.js client page · Owns upload, generation state, preview, and download. · `app/page.tsx`
- [App layout](https://github.com/chongdashu/cc-skills-nanobananapro/blob/main/app/layout.tsx): Next.js layout · Shared document shell. · `app/layout.tsx`
- [Global styles](https://github.com/chongdashu/cc-skills-nanobananapro/blob/main/app/globals.css): CSS · `app/globals.css`
- [Generate card action](https://github.com/chongdashu/cc-skills-nanobananapro/blob/main/app/actions/generate.ts): Next.js server action · Keeps Gemini calls and credentials off the browser. · `app/actions/generate.ts`
- [API key environment](https://github.com/chongdashu/cc-skills-nanobananapro/blob/main/.env.example): environment contract · Documents the required Gemini API key. · `.env.example`
- [3D card preview](https://github.com/chongdashu/cc-skills-nanobananapro/blob/main/app/components/Card3DPreview.tsx): Three.js client component · Maps generated artwork onto an interactive fold-out card. · `app/components/Card3DPreview.tsx`

### Claude Code skills

Reusable implementation guidance distributed with the repository.

- [Nano Banana Builder](https://github.com/chongdashu/cc-skills-nanobananapro/blob/main/.claude/skills/nano-banana-builder/SKILL.md): Claude Code skill · Guidance for Gemini image applications. · `.claude/skills/nano-banana-builder/SKILL.md`
- [Three.js Builder](https://github.com/chongdashu/cc-skills-nanobananapro/blob/main/.claude/skills/threejs-builder/SKILL.md): Claude Code skill · Guidance for modern Three.js scenes. · `.claude/skills/threejs-builder/SKILL.md`
- [Frontend Design](https://github.com/chongdashu/cc-skills-nanobananapro/blob/main/.claude/skills/frontend-design/SKILL.md): Claude Code skill · Guidance for UI design. · `.claude/skills/frontend-design/SKILL.md`

### Build prompts

Staged prompts documenting the demo's evolution.

- [Image MVP prompt](https://github.com/chongdashu/cc-skills-nanobananapro/blob/main/prompts/01-nanobanana.txt): build prompt · `prompts/01-nanobanana.txt`
- [3D preview prompt](https://github.com/chongdashu/cc-skills-nanobananapro/blob/main/prompts/02-threejs.txt): build prompt · `prompts/02-threejs.txt`
- [UI polish prompt](https://github.com/chongdashu/cc-skills-nanobananapro/blob/main/prompts/03-frontend-design.txt): build prompt · `prompts/03-frontend-design.txt`

### Other components

- **Google Gemini**: image generation API · Produces the two-panel festive artwork.
- **Browser WebGL**: rendering runtime

## Connections

- App layout → Card workflow page: hosts
- App layout → Global styles: applies
- Card workflow page → Generate card action: submits selfie and prompt
- Generate card action → Google Gemini: generates artwork
- API key environment → Generate card action: supplies API key
- Generate card action → Card workflow page: returns image or error
- Card workflow page → 3D card preview: passes generated image
- 3D card preview → Browser WebGL: renders scene with
- Image MVP prompt → Nano Banana Builder: informs
- 3D preview prompt → Three.js Builder: informs
- UI polish prompt → Frontend Design: informs
- Nano Banana Builder → Generate card action: guides implementation
- Three.js Builder → 3D card preview: guides implementation
- Frontend Design → Card workflow page: guides implementation
