Nano Banana Pro
Agent skill for nano-banana-pro
This file provides guidance to AGENTS when working with code in this repository.
Sign in to like and favorite skills
This file provides guidance to AGENTS when working with code in this repository. docs: https://agents.md
# Install dependencies npm install # Start development server (runs on port 3000) npm run dev # Build for production npm run build # Preview production build npm run preview # Use correct Node.js version nvm use # Uses Node.js v24.9.0 from .nvmrc
# Run ESLint (max warnings: 0) npm run lint # Fix ESLint issues automatically npm run lint:fix # Format code with Prettier npm run format # Check code formatting without modifying files npm run format:check # Run TypeScript type checking npm run tsc:check
# Unit Tests (Vitest) - run automatically on pre-commit hook npm run test:unit # Run unit tests npm run test:coverage # Generate coverage report # E2E Tests (Playwright) - Page Object Model pattern, tests/e2e/ directory npm run test:e2e # Run E2E tests (headless) npm run test:e2e:ui # Interactive UI mode npm run test:e2e:headed # Visible browser npm run test:e2e:debug # Debug mode
E2E Setup: Install Playwright browsers with
npx playwright install chromium, configure test user in .env.test
For detailed testing guidelines, see:
.cursor/rules/vitest-unit-testing.mdc.cursor/rules/playwright-e2e-testing.mdcsrc/ ├── layouts/ # Astro layouts (Layout.astro) ├── pages/ # Astro pages (routes) │ ├── index.astro # Homepage │ └── api/ # REST API endpoints (SSR) │ ├── ai/ # AI generation endpoints │ │ └── generate.ts │ ├── notes/ # Notes CRUD endpoints │ │ ├── index.ts │ │ ├── [id].ts │ │ └── [id]/ │ │ └── public-link/ │ │ ├── index.ts │ │ └── rotate.ts │ ├── tags/ # Tags CRUD endpoints │ │ ├── index.ts │ │ ├── [id].ts │ │ └── [id]/ │ │ └── access/ │ │ ├── index.ts │ │ └── [recipient_id].ts │ ├── user/ # User management endpoints │ │ ├── profile.ts │ │ ├── stats.ts │ │ └── account.ts │ └── share/ # Public shared notes endpoints (anonymous) │ └── [token].ts ├── components/ # UI components │ └── ui/ # Shadcn/ui components ├── lib/ # Business logic & utilities │ ├── services/ # Business logic layer │ │ ├── openrouter.service.ts # OpenRouter API communication (reusable) │ │ ├── ai-generation.service.ts │ │ ├── notes.service.ts │ │ ├── tags.service.ts │ │ ├── tag-access.service.ts │ │ ├── public-links.service.ts │ │ └── user.service.ts │ ├── errors/ # Domain error classes │ │ └── openrouter.errors.ts # OpenRouter error hierarchy │ ├── types/ # Type definitions │ │ └── openrouter.types.ts # OpenRouter contracts & schemas │ ├── validators/ # Zod schemas for input validation │ │ ├── ai.schemas.ts │ │ ├── notes.schemas.ts │ │ ├── tags.schemas.ts │ │ ├── public-links.schemas.ts │ │ ├── user.schemas.ts │ │ └── shared.schemas.ts │ ├── middleware/ # API middleware │ │ ├── auth.middleware.ts │ │ └── rate-limit.middleware.ts │ └── utils/ # Helper functions │ ├── pagination.utils.ts │ └── token.utils.ts ├── middleware/ # Astro middleware │ └── index.ts # Supabase client injection ├── db/ # Database layer │ ├── database.types.ts # Auto-generated Supabase types │ └── supabase.client.ts # Supabase client configuration ├── types.ts # Shared TypeScript types & DTOs └── styles/ # Global CSS files supabase/ └── migrations/ # SQL migration files ├── 20251015211900_create_10xnotes_schema.sql ├── 20251015212000_seed_sample_data.sql ├── 20251015234737_optimize_rls_policies_performance.sql ├── 20251015235116_drop_legacy_owner_policies.sql ├── 20251015235340_add_fk_indexes.sql ├── 20251021000000_add_get_tag_access_list_function.sql ├── 20251021000001_add_grant_tag_access_function.sql ├── 20251021120000_allow_anon_insert_llm_generations.sql ├── 20251021120100_allow_anon_read_public_notes.sql ├── 20251021120200_create_delete_user_account_function.sql ├── 20251021120300_fix_function_search_path_security.sql ├── 20251023170600_split_tags_select_policy.sql ├── 20251023171000_final_fix_tags_recursion.sql ├── 20251026000000_fix_llm_generations_authenticated_insert.sql ├── 20251029000002_complete_rls_rebuild.sql ├── 20251029000003_fix_tag_access_delete_policy.sql ├── 20251029000004_create_revoke_tag_access_function.sql └── 20251029000005_create_get_tags_shared_counts_function.sql
astro.config.mjs - Astro configuration with:
@astrojs/sitemap)tsconfig.json - TypeScript config extending Astro strict presets with @/* path aliasescomponents.json - Shadcn/ui configuration with New York style, Lucide icons, and path aliaseseslint.config.js - ESLint 9 flat config with TypeScript, React (including React Compiler plugin), and Astro support.prettierrc.json - Prettier formatting configuration with Astro plugin supportpackage.json - Scripts and dependencies with lint-staged configuration.nvmrc - Node.js version specification (v24.9.0)src/components/ui/Tech Stack - Backend:
Database Schema:
tags, notes, tag_access, public_links, llm_generationsuser_generation_stats (aggregated AI usage)get_tag_access_list(), grant_tag_access(), revoke_tag_access(), get_tags_shared_counts(), delete_user_account()API Request Flow:
HTTP Request → Astro Middleware (inject Supabase client) → API Route (src/pages/api/) → Auth Middleware (requireAuth/optionalAuth) → Input Validation (Zod schemas) → Service Layer (business logic) → Database (Supabase with RLS) → Response (DTO format)
Security Model:
requireAuth middleware)search_path = '' to prevent SQL injectionOpenRouter Service (AI Generation):
OpenRouterService provides secure, type-safe communication with OpenRouter API for LLM generation:
x-ai/grok-4-fast (configurable per request)llm_generations table (non-blocking)OpenRouterValidationError, OpenRouterTimeoutError, etc.)Usage Example:
const service = new OpenRouterService(supabase, { defaultModel: "x-ai/grok-4-fast", timeoutMs: 60000, retryAttempts: 2, }); const response = await service.generate<MyType>({ systemMessage: "You are a helpful assistant", userMessage: "Analyze this data...", responseSchema: MY_JSON_SCHEMA, parameters: { temperature: 0.3 }, });
For detailed implementation guidelines, see:
.cursor/rules/backend.mdc and .cursor/rules/db-supabase-migrations.mdc
src/pages/api/ (directory will be created when needed)export async function GET(), export async function POST()export const prerender = false for dynamic API routessrc/lib/cn() utility from src/lib/utils.ts for conditional classesdark: variant@/* for imports from src directorysrc/middleware/ (directory will be created when needed).env.exampleREADME.mdRequired environment variables (see
.env.example):
# Supabase Configuration SUPABASE_URL=https://xxx.supabase.co SUPABASE_KEY=xxx # Anon key (public) # AI Configuration OPENROUTER_API_KEY=xxx # For AI text generation
src/db/supabase.client.ts)SUPABASE_SERVICE_ROLE_KEY is optional and should only be provided locally (e.g., .env.test) for E2E fixtures that need to create isolated users via the Supabase admin API. Never expose it to client runtime..husky/ directory)@typescript-eslint)jsx-a11y).ts, .tsx, .astro files.js, .json, .css, .md filespackage.json lint-staged section and .husky/pre-commitA simple, file-based feature flag system is implemented to decouple deployments from releases.
Configuration:
src/lib/feature-flags.ts
How to Add a Flag:
Feature type in the config file.local and production environments in the featureFlagsConfig object.How to Use:
import { isFeatureEnabled } from "@/lib/feature-flags"; if (isFeatureEnabled("my_feature")) { // ... show component or run logic }
Note: The system automatically detects the environment.
npm run dev uses the local config, while a production build (npm run build) uses the production config via import.meta.env.PROD.
Testing Production Config: To test the
production settings locally, first build the app (npm run build), then serve the result (npm run preview).
This project uses unified AI context management with symbolic links:
AGENTS.md - Single source of truth for AI agent instructions (this file)CLAUDE.md, GEMINI.md, CURSOR.md, CLINE.md, COPILOT.md, AGENT.md, WARP.md all point to AGENTS.md.cursor/rules, .clinerules/rules, .roorules/rules contain symlinks to AGENTS.mdAGENTS.md, changes apply to all AI tools automaticallyAI_CONTEXT.md for full documentation on the symlink systemThis project contains detailed, context-specific guidelines in
.cursor/rules/*.mdc files.
IMPORTANT for AI Agents: When working with specific technologies or tasks, READ the relevant file first using the Read tool before making changes:
.cursor/rules/astro.mdc.cursor/rules/react.mdc.cursor/rules/frontend.mdc.cursor/rules/backend.mdc.cursor/rules/api-supabase-astro-init.mdc.cursor/rules/db-supabase-migrations.mdc.cursor/rules/ui-shadcn-helper.mdc.cursor/rules/shared.mdcThese files contain detailed best practices, patterns, and implementation guidelines that supplement this file.
.ai/ - Directory for AI-related project documentation (e.g., PRD documents).env.example - Environment variables templateREADME.md - Project documentation and setup instructionsAI_CONTEXT.md - Documentation for AI context management system.vscode/ - VS Code workspace settings, recommended extensions, and debug configurations.gitignore - Git ignore rules including AI context symlinks and build artifacts