graphic-recording
// Graphic recording style image generation skill. Takes slide text or screenshots as input, generates a hand-drawn visual note illustration that follows the deck's theme colors, saves it to the deck's assets directory, and inserts it into the MDX file. Uses Gemini API (gemini-3.1-flash-image-preview).
Prerequisites
GEMINI_API_KEYset in.env.local
Workflow
Step 1: Identify Target Slide
Determine from user request:
- Target deck: directory name under
decks/ - Source slide: which MDX file's content to visualize
- Insertion target: same slide or a different one
Ask if unclear.
Step 2: Extract Slide Content
Method A: Text-based (preferred) Read the target MDX file and extract text content.
Method B: Screenshot-based If dev server is running, capture the slide and analyze visually:
npx tsx .claude/skills/nanobanana-image/scripts/capture-slide.ts \
--deck <deck-name> \
--slide <0-indexed> \
--output /tmp/slide-capture.png
Step 3: Extract Theme Colors
Read the deck's deck.config.ts and extract:
primary— main color (headings, emphasis borders)accent— accent color (highlights, arrows)background— background colortext— body text colorsurface— surface color (card backgrounds)
Step 4: Build Prompt
Combine slide text content and theme colors into a graphic recording style prompt.
See references/prompt-guide.md for prompt construction guidelines.
Always present the prompt to the user for confirmation before generating.
Step 5: Generate Image
Use the nanobanana-image generation script:
npx tsx .claude/skills/nanobanana-image/scripts/generate-image.ts \
--prompt "<constructed prompt>" \
--output "decks/<deck>/assets/<filename>.png" \
--aspect-ratio 16:9 \
--resolution 2K
- Default aspect ratio:
16:9(full-width slide usage) - Filename:
graphic-recording-<topic>.png(kebab-case English)
Step 6: Insert into MDX
<img src="./assets/<filename>.png" alt="..." style={{ width: "100%", borderRadius: "0.8rem" }} />
- Use relative path
./assets/(resolveAssetPaths()auto-converts) - Adjust
widthand placement based on slide layout
Step 7: Report Results
- Generated image file path
- Prompt used
- How to verify on dev server
Examples
Example 1: Graphic recording from text content
- User says: "Create a graphic recording for slide 05 of my product-launch deck"
- Actions:
- Read
decks/product-launch/05-features.mdxto extract text content. - Read
decks/product-launch/deck.config.tsto extract theme colors. - Build a graphic recording prompt combining the feature list with theme colors. Present to user for confirmation.
- Generate the image with
generate-image.tsat 16:9, 2K resolution. - Insert
<img>tag into the MDX file.
- Read
- Result:
decks/product-launch/assets/graphic-recording-features.pnginserted into slide 05.
Example 2: Screenshot-based graphic recording
- User says: "グラレコ風にスライド3を可視化して (sample-deck)"
- Actions:
- Capture slide 3 via
capture-slide.ts. - Analyze the screenshot to extract visual content and layout.
- Extract theme colors from
deck.config.ts. - Build and confirm the prompt with the user.
- Generate and insert the graphic recording image.
- Capture slide 3 via
- Result: Hand-drawn visual note illustration matching the deck's color scheme.
Troubleshooting
Error: GEMINI_API_KEY not found
- Cause: The
.env.localfile does not containGEMINI_API_KEY. - Fix: Add
GEMINI_API_KEY=<your-key>to.env.localin the project root.
Generated image does not match theme colors
- Cause: Theme colors were not correctly extracted or included in the prompt.
- Fix: Verify the theme colors in
deck.config.ts. Ensure the prompt explicitly specifies HEX color values (e.g., "use #3B82F6 as the main accent color"). Regenerate after adjusting the prompt.
Image appears distorted or cropped in slide
- Cause: Aspect ratio mismatch between the generated image and the slide layout.
- Fix: Use
--aspect-ratio 16:9for full-width placement. For half-width column layouts, use--aspect-ratio 1:1or--aspect-ratio 4:3and adjust thewidthstyle in the MDX<img>tag.