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 full-stack Croatian events platform ("Kružna Karta Hrvatska") built as a monorepo with:
frontend-new/)The platform aggregates events from 14+ Croatian websites through intelligent web scraping, provides real-time geocoding for venues, and features an advanced map system with clustering capabilities powered by Mapbox GL JS.
frontend-new/ - React 19 TypeScript application with advanced mappingbackend/ - FastAPI Python application with geocoding and scraping servicesdocker/ - Docker configurations and infrastructureMakefile with 40+ development commandsThe project uses a comprehensive Makefile with 40+ commands. Key commands:
make setup # Initial project setup make dev # Start full development environment make frontend-dev # Frontend only make backend-dev # Backend only
make logs # View all logs make frontend-logs # Frontend logs only make backend-logs # Backend logs only make db-shell # PostgreSQL shell access make redis-shell # Redis CLI access
make lint # Run all linters make test # Run all tests make frontend-test # Frontend tests only make backend-test # Backend tests with coverage
make migrate # Run database migrations make migration # Create new migration make db-reset # Reset database with sample data
Multi-Source Event Scraping:
Supported Event Sources:
croatia_scraper.py - Croatia.hr official tourism events (Vue.js-based)entrio_scraper.py - Entrio ticketing platforminfozagreb_scraper.py - Zagreb city eventsulaznice_scraper.py - Ulaznice.hr ticketing platformReal-time Geocoding Service:
Croatian Geographic Coverage:
Type-Safe Configuration Management:
backend/config.yaml with environment variable expansion (${VAR:default})Configuration Components:
# Access via centralized CONFIG object from app.config.components import get_settings CONFIG = get_settings() # Type-safe access to all settings database_url = CONFIG.database.url scraping_config = CONFIG.scraping geocoding_provider = CONFIG.services.geocoding.provider
frontend-new/src/locales/Enhanced Event Schema:
latitude, longitude) with decimal precisionlocation, venue_id relationships)source, external_id, scrape_hash, last_scraped_at)New Tables:
venue_coordinates - Geocoding cache with confidence scoring and multiple data sourcesGeographic Extensions:
src/components/ with feature-based organizationuseEventClustering, useThrottledMapUpdates)src/utils/ for clustering and geo calculationstranslateZ(0) and will-change optimizationsapp/config/components.py with environment expansionapp/scraping/ with base scraper inheritancefrontend-new/.env (Mapbox tokens, API endpoints)backend/.env (database, Redis, geocoding services, scraper config)docker/.env (ports, volumes, service configuration)make test for full test suitemake migration name="description" to create migrationsmake migrate to apply pending migrationsbackend/app/scraping/scrapers/make scrape-testbackend/app/api/routes/backend/app/schemas/Enhanced Event API:
GET /events - Advanced filtering by location, date range, coordinates, radiusGET /events/search - Full-text search with geographic constraintsGET /events/{id} - Event details with venue coordinates and directionslatitude, longitude, radius_kmVenue Management API:
GET /venues - Venue listing with coordinate dataGET /venues/search - Geographic venue searchScraping Management:
frontend-new/src/components/map/EventMap component for full-featured map display with clusteringEnhanced Patterns:
CONFIG object from app.config.componentsFile Organization:
backend/app/ ├── config/components.py # Centralized configuration ├── core/geocoding_service.py # Geocoding and location services ├── core/croatian_geo_db.py # Croatian geographic database ├── scraping/base_scraper.py # Base scraper architecture ├── scraping/*_scraper.py # 14+ specialized scrapers ├── models/schemas.py # Enhanced Pydantic schemas └── migrations/versions/ # Database schema evolution
docker/.env and root package.json for port assignmentsfrontend-new/.envmake help # Show all 40+ available commands make dev # Start full development environment make frontend-dev # Frontend only with Mapbox (runs on port 3001) make backend-dev # Backend with geocoding services make logs # All service logs make db-shell # PostgreSQL with geocoding tables make lint # Frontend + backend linting make test # Comprehensive test suite
MUST use appropriate AI libraries and avoid deprecated dependencies
MUST put all the imports at the top of the file, and group them by standard library, third-party libraries, and local imports
MUST include static code analysis using tools like pylint, flake8, or mypy
MUST implement robust error handling, input validation, and fallback mechanisms for failures
MUST implement proper data validation and preprocessing pipelines
MUST choose efficient data structures (e.g. pandas DataFrames for tabular data, NumPy/PyTorch tensors for numerical data) to optimize AI workload performance and memory use.
MUST follow PEP 8 style guidelines strictly
MUST use type hints for all function parameters and return values
MUST implement proper docstrings using Google or NumPy style
MUST keep functions small and focused (single responsibility principle)
MUST implement proper logging with appropriate log levels
MUST implement efficient data loading and preprocessing
MUST implement proper memory management for large datasets
MUST avoid unnecessary computational overhead
MUST profile AI code performance and identify bottlenecks
MUST use Pydantic for data validation and serialization, which provides type safety, automatic validation, and easy serialization to JSON.
MUST use Pydantic Settings which provide type-safe configuration management with automatic validation. Benefits: Type safety with automatic validation, Environment variable support with prefixes, Default values and required fields.
MUST use Pydantic BaseModel for data validation and serialization, which provides type safety, automatic validation, and easy serialization to JSON.
MUST use Pydantic Field for defining fields with validation rules, which provides type safety, automatic validation, and easy serialization to JSON.
MUST use Pydantic Config for configuring Pydantic models, which provides type safety, automatic validation, and easy serialization to JSON.
MUST use Pydantic BaseSettings for managing application settings, which provides type-safe configuration management with automatic validation.
MUST use Pydantic for data validation and configuration (e.g. BaseModel for schemas, Field for validation, BaseSettings for config). Pydantic ensures type safety, automatic validation, environment variable support, and easy JSON serialization.
SHOULD retrieve every configuration value exclusively through the CONFIG object defined in components.py to ensure type-safe, centralized access and avoid direct environment or file lookups.
SHOULD implement proper GPU memory management for deep learning models
SHOULD use meaningful variable and function names
SHOULD use appropriate optimization techniques for AI workloads
SHOULD provide meaningful error messages for debugging
SHOULD log errors with sufficient context for troubleshooting
SHOULD implement proper model serialization and deserialization
SHOULD create reproducible development environments using Docker
SHOULD implement proper model monitoring and logging when explicitly needed
SHOULD consider parallel processing and distributed computing when appropriate
SUGGEST proper caching mechanisms for expensive operations
FOLLOW the RESTAPI code structuring examples
DO NOT use DEAFULT calls like: legal_bert_config = CONFIG.get("models", {}).get("legal_bert", {})
DO NOT use load_dotenv, loading env file inside of the project, we always get the env file from the config file
DO NOT use emojis in any part of the code
DO NOT use print statements in the code, we use logging instead
DO NOT put any code inside of the init.py file, unless there is a specific reason to do so
DO NOT use global variables, we use class variables
DO NOT use magic methods like
__call__, __getattr__, __setattr__, etc. unless there is a specific reason to do so
DO NOT use format in the code, we use f-strings method instead
DO NOT use relative imports in the code, we use absolute imports instead
DO NOT import os, unless there is a specific reason to do so
DO NOT "git add" or "git commit", just propose the commit message after a big update
DO NOT hardcode credentials, API keys, passwords, or sensitive information in any code
DO NOT create code that compiles but contains subtle logical errors
DO NOT generate functions that handle most cases but fail on edge cases
DO NOT produce code with off-by-one errors or boundary condition mistakes
DO NOT create algorithms that work for simple inputs but fail for complex ones
DO NOT generate code that lacks proper error checking or validation for edge cases.
DO NOT create functions that miss essential validation steps
DO NOT generate code based on assumptions about unclear specifications
DO NOT create conditional logic that misaligns with stated requirements
DO NOT implement features that contradict the intended business logic
DO NOT generate code that solves a different problem than what was asked
DO NOT suggest inappropriate data structures for the given use case
DO NOT generate regex patterns that match different strings than intended
DO NOT create sorting or searching algorithms with incorrect complexity
DO NOT use synchronous operations where asynchronous ones are required
DO NOT continue generating "fixes" after 3 failed attempts without changing approach
DO NOT keep apologizing and making similar mistakes repeatedly
DO NOT generate increasingly complex solutions when simple ones would work
DO NOT create functions that are impossible to unit test
DO NOT generate code that requires specific system states to function
DO NOT create tightly coupled code that cannot be tested in isolation
DO NOT create complex algorithms without explaining the approach
DO NOT generate code with magic numbers or unexplained constants
DO NOT create functions with unclear parameter requirements
DO NOT generate code that future developers cannot understand or modify
DO NOT create functions that violate the single responsibility principle
DO NOT generate code with poor variable naming conventions
DO NOT create tight coupling between unrelated components
DO NOT present generated code as definitively correct without caveats
DO NOT ignore potential edge cases or limitations in the solution
DO NOT generate code without acknowledging areas of uncertainty
DO NOT claim the code is production-ready without proper testing
DO NOT generate code with unnecessary deeply nested conditions, loops or inefficient algorithms
DO NOT create memory leaks or resource management issues
DO NOT generate code that blocks threads unnecessarily
DO NOT create database queries that could cause performance problems at scale
DO NOT create code that uses excessive memory for simple operations
DO NOT generate solutions that require unnecessary external dependencies
DO NOT create code that makes redundant network calls or file operations
DO NOT generate CPU-intensive operations without considering alternatives
DO NOT generate code that assumes specific libraries without mentioning them
DO NOT create functions that depend on undefined variables or imports
DO NOT generate code that conflicts with existing codebase patterns
DO NOT ignore version compatibility issues with dependencies
DO NOT create new bugs while trying to fix existing ones
AUDIO ALERT: Run
afplay /System/Library/Sounds/Glass.aiff at the end of tasks or when input is needed
Scope
These rules govern all web-frontend code in this repository. They apply to React 19+, Vite 7+, TailwindCSS 3.4+, and TypeScript 5.8+.
Animations must follow the GSAP (Tween / Timeline) guidelines below; when other motion libraries are used, apply comparable constraints.
"strict": true and all noUnchecked flags in tsconfig.json.@typescript-eslint + Prettier; run in pre-commit and CI.class components.PascalCase.tsx (UserCard.tsx)useDescriptiveThing.tscamelCase.ts/features/user/UserCard.tsx).content paths correctly in tailwind.config.js to purge unused styles.@apply; avoid long inline class strings in JSX.theme.extend (colors, spacing, typography); never modify Tailwind core.prefers-reduced-motion by disabling or simplifying animations.aria-* attributes and labels to interactive elements.useLayoutEffect or custom hooks.useRef; never query DOM with document.querySelector.ScrollTrigger or requestAnimationFrame).ctx.revert() or gsap.killTweensOf).react, tsconfig-paths, and tailwindcss plugins.build.rollupOptions → manualChunks.vite --https --open).React.memo, useMemo, useCallback).React.lazy + Suspense) and large assets (import.meta.glob in Vite).react-refresh and vite-plugin-inspect for dev-time diagnostics.motionTokens.ts file.useNavigationType + GSAP context.vite-plugin-csp.dompurify).@apply..env or secret keys.dist/ or .turbo/ artefacts.git add / git commit; output proposed messages only.Play a chime when long‐running front-end build or test tasks finish:
afplay /System/Library/Sounds/Glass.aiff
Mapbox documentation:
Pydantic documentation:
BrightData documentation:
This project maintains a comprehensive changelog to track all modifications, improvements, and fixes. This ensures transparency, facilitates debugging, and provides context for future development decisions.
Primary Documentation:
- Complete history of all changes following Keep a Changelog format.CHANGELOG.md
Change Categories:
When Claude Code makes ANY changes to the project:
CHANGELOG.md immediately after implementing changes### [Category] - **Component/Feature Name**: - Specific change description with technical details - Impact on functionality and user experience - Files affected: `path/to/file.py`, `path/to/component.tsx` - Migration notes (if applicable)
Good Change Entries:
### Added - **Croatia.hr Scraper Enhancements**: - Vue.js dynamic content handling with Playwright browser automation - Event categorization system using Croatian keywords (10+ categories) - Files affected: `backend/app/scraping/croatia_scraper.py` - Breaking change: Removed BASE_URL constant, requires configuration update ### Fixed - **Map Performance Issues**: - Resolved layout thrashing during marker positioning operations - Implemented RAF-throttled batch calculations for smooth 60fps updates - Files affected: `frontend-new/src/components/map/EventMap.tsx` - Performance improvement: 40% reduction in render time for large datasets
The following significant enhancements have been implemented (see
for complete details):CHANGELOG.md
2024-08-03 - Croatia Scraper Enhancement Release:
Key Files Modified:
backend/app/scraping/croatia_scraper.py - Complete scraper rewritebackend/app/core/geocoding_service.py - Enhanced geocoding capabilitiesbackend/app/core/croatian_geo_db.py - New Croatian geographic databasefrontend-new/src/components/map/* - Advanced clustering systemfrontend-new/src/hooks/useEventClustering.ts - Performance optimization hooksBefore Starting Work:
CHANGELOG.md to understand current stateDuring Development:
After Completing Work:
CHANGELOG.md with comprehensive change documentationFor All Code Modifications:
CHANGELOG.md before making changes to understand project stateChange Documentation Priority:
When investigating issues:
Before Release/Deployment:
CHANGELOG.md accurately reflects all changes since last releaseThis change management system ensures that every modification to the Croatian Events Platform is properly tracked, documented, and understood by all team members and future developers.