Nano Banana Pro
Agent skill for nano-banana-pro
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.
This is a Next.js 14 application that provides a web-based chat interface to interact with Claude AI (Sonnet 3.5), designed to be deployed on Vercel. The application implements strict security controls including API key authentication, rate limiting, and hardcoded model parameters to prevent abuse.
Local Development:
npm run dev # Start development server on localhost:3000 npm run build # Build production bundle npm start # Start production server
Environment Setup: Create
.env.local with:
ANTHROPIC_API_KEY=<your_anthropic_api_key> ALLOWED_API_KEYS=<comma_separated_client_keys>
Deployment:
vercel # Deploy to preview vercel --prod # Deploy to production
After deployment, set environment variables:
vercel env add ANTHROPIC_API_KEY vercel env add ALLOWED_API_KEYS
The app follows Next.js 14 App Router architecture:
- API endpoint handling all Claude AI interactionsapp/api/chat/route.ts
- Client-side chat interfaceapp/page.tsx
- Root layout with metadataapp/layout.tsx
- Next.js configuration with security headersnext.config.js
The application has layered security controls that are intentionally restrictive:
Authentication Layer (app/api/chat/route.ts:20-33)
X-API-Key headerALLOWED_API_KEYS environment variableRate Limiting (app/api/chat/route.ts:9-67)
Input Validation (app/api/chat/route.ts:105-128)
Parameter Hardcoding (app/api/chat/route.ts:14-56)
claude-3-5-sonnet-20241022 (cannot be changed by clients)Security Headers (next.config.js:4-32)
app/page.tsx/api/chat with X-API-Key header and messages arrayThe
/api/chat endpoint uses a defense-in-depth approach with sequential validation:
// Order matters - authentication before rate limiting before processing authenticateRequest() → checkRateLimit() → validateInput() → callAnthropicAPI()
If modifying the API route, maintain this order and never expose detailed errors to clients (app/api/chat/route.ts:150-154).
The chat interface (app/page.tsx) maintains conversation state entirely in local React state - there is no backend session storage. The entire message history is sent with each request. This means:
The current rate limiting implementation uses an in-memory Map (app/api/chat/route.ts:10), which means:
Both
ANTHROPIC_API_KEY and ALLOWED_API_KEYS must be set in production:
ANTHROPIC_API_KEY - Your Anthropic API key for server-side API callsALLOWED_API_KEYS - Comma-separated list of authorized client API keys (trimmed automatically)Missing either variable will cause runtime failures.
To change Claude model or parameters: Modify constants in app/api/chat/route.ts:14-56. Note: These are intentionally hardcoded for security - client requests cannot override them.
To customize the system prompt: The agent currently specializes in helping users create Claude Code skills. To change this specialization or revert to a general-purpose assistant, modify
HARDCODED_SYSTEM_PROMPT in app/api/chat/route.ts:18-56. The current system prompt includes comprehensive knowledge about skill structure, creation process, and best practices.
To adjust rate limits: Modify constants in app/api/chat/route.ts:11-12 (
RATE_LIMIT_WINDOW and RATE_LIMIT_MAX_REQUESTS).
To add more security headers: Edit the headers array in next.config.js:4-32.
To change input validation limits: Modify validation logic in app/api/chat/route.ts:113-128.