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.
BTINV is a private internal inventory management system for small businesses focused on COGS (Cost of Goods Sold) tracking. Built with Next.js 15, React 19, TypeScript, Tailwind CSS, and Supabase.
Key Business Focus: Small business operations with statement-based bookkeeping, flexible data entry, and a two-mode inventory tracking system.
# Development: pnpm dev|build|lint|type-check|format # Database: pnpm db:generate|db:start|db:stop # Testing: pnpm test|test:ui # Playwright: npx playwright test [file] [--ui] [--project=browser]
The central business logic of BTINV is the two-mode tracking system:
This system allows businesses to focus detailed tracking on high-impact items while still managing lower-priority inventory.
Core Tables:
items - Central inventory items with tracking_mode fieldsuppliers - Vendor management with email fieldpurchases - Purchase orders with draft/finalized workflowpurchase_line_items - Individual items within purchasestransactions - All inventory movements (mutable for corrections)recipes & batches - Production managementsales_periods - Sales data importKey Database Functions:
calculate_wac() - Weighted Average Cost calculationfinalize_draft_purchase() - Purchase completion with cost allocationchange_item_tracking_mode() - Mode switching with audit trailget_cycle_count_alerts() - Intelligent inventory checkingget_two_mode_alerts() - Mode-specific alert systemuse-items.ts, use-purchases.ts, use-suppliers.ts) for data fetchingsrc/ āāā app/ # Next.js 15 App Router ā āāā actions/ # Server Actions (database operations) ā āāā [pages]/ # Route handlers āāā components/ ā āāā dashboard/ # Dashboard widgets ā āāā items/ # Items management UI ā āāā purchases/ # Purchase workflow UI ā āāā suppliers/ # Supplier management UI ā āāā layout/ # App shell components ā āāā ui/ # Base Radix UI components āāā hooks/ # Custom React hooks for data & behavior āāā lib/ # Utilities and configurations ā āāā supabase/ # Database client setup ā āāā utils/ # Business logic utilities ā āāā validations/ # Zod schemas āāā types/ # TypeScript definitions
items.weightedaveragecost fieldPO-YYYYMMDD-XXX for purchases, BATCH-YYYYMMDD-XXX for batchesBased on
.cursorrules:
CRITICAL: Always maintain documentation consistency with code changes.
Before starting any significant task:
docs/ folder for contextAfter completing any task that changes:
docs/developer-guide.mddocs/technical-reference.mddocs/product-specification.mdCLAUDE.mddocs/developer-guide.mdā
Read - Review affected documentation before changes
ā
Code - Implement the requested changes
ā
Update - Modify documentation to reflect changes
ā
Verify - Ensure no contradictions between docs and code
ā
Date - Update
last_updated dates in YAML frontmatter
.cursorrules)CRITICAL: Distinguish between analysis requests and implementation requests:
š Analysis Mode (NO CODE CHANGES):
š§ Implementation Mode (CODE CHANGES ALLOWED):
ā When In Doubt: Ask "Would you like me to implement these suggestions or just provide the analysis?"
Special Case - SuppliersTable: This is the strategic blueprint component. Treat all requests about it as analysis/planning unless implementation is explicitly requested.
ALWAYS read relevant documentation before starting any task to understand context and identify what needs updating.
docs/product-specification.md - Business requirements authoritydocs/technical-reference.md - Database schema and APIsdocs/developer-guide.md - Technical patterns and standardsdocs/tasks.md - Current work and roadmapsrc/types/database.ts - Generated Supabase types (DO NOT EDIT)src/types/index.ts - Application types and interfacessrc/app/actions/items.ts - Items CRUD with tracking mode logicsrc/app/actions/purchases.ts - Purchase workflow and cost allocationsrc/lib/utils/business.ts - Business logic utilitiessrc/hooks/use-items.ts - Items state management patternsrc/config/app-config.ts - Single configuration file with all app settingssrc/components/items/items-table.tsx - Complex table with inline editingsrc/components/suppliers/modern-data-table.tsx - Advanced data table patternssrc/components/layout/app-layout-server.tsx - App shell architecture# Supabase: jjpklpivpvywagmjjwpu (btinv-beetech, us-east-2) # Test port: 3001 (not 3000) # Required: NEXT_PUBLIC_SUPABASE_URL, NEXT_PUBLIC_SUPABASE_ANON_KEY
The application uses a single configuration file (
src/config/app-config.ts) for all settings:
import { getTableConfig, businessRules, displaySettings } from '@/config/app-config'; // Table configurations const suppliersConfig = getTableConfig('suppliers'); const defaultColumnVisibility = getDefaultColumnVisibility('suppliers'); // Business rules const defaultLeadTime = businessRules.inventory.defaultLeadTimeDays; const trackingMode = businessRules.inventory.defaultTrackingMode; // Display settings const densityMode = displaySettings.defaults.densityMode; const pageSize = paginationSettings.pageSizes.tables.default;
IMPORTANT: When adding new config values, always update the configuration documentation in
docs/developer-guide.md to maintain consistency.
import { handleError, handleSuccess } from '@/lib/error-handling'; // In server actions try { const result = await someOperation(); return handleSuccess(result); } catch (error) { return handleError(error, 'operationName'); }
// Query keys pattern export const itemsKeys = { all: ['items'] as const, lists: () => [...itemsKeys.all, 'list'] as const, list: (filters) => [...itemsKeys.lists(), filters] as const, }; // Hook pattern export function useItems(searchQuery = '', typeFilter = 'all') { return useQuery({ queryKey: itemsKeys.list({ searchQuery, typeFilter }), queryFn: () => getItems(), staleTime: 5 * 60 * 1000, }); }
import { z } from 'zod'; const CreateItemSchema = z.object({ name: z.string().min(1, 'Name is required'), sku: z.string().min(1, 'SKU is required'), type: z.enum(['ingredient', 'packaging', 'product']), });
This CLAUDE.md provides the essential context for understanding BTINV's unique two-mode inventory tracking system, technical architecture, and development patterns. The documentation in
docs/ provides comprehensive details for specific areas.