Files
thrillwiki_django_no_react/.clinerules/thrillwiki-context.xml
pacnpal 41fb41838c feat: Implement enhanced park list template with improved layout and accessibility features
- Created a new enhanced park list template with a responsive design.
- Added skip navigation links for better accessibility.
- Introduced an enhanced header section with park statistics overview.
- Developed a sidebar for advanced filters and a search section.
- Implemented loading overlay and error handling for HTMX requests.
- Enhanced park results display with animations and improved empty states.
- Added pagination controls with improved UX for navigating park listings.
2025-09-23 20:35:44 -04:00

265 lines
11 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<thrillwiki_context version="1.0">
<!-- Core Project Information -->
<project_overview>
<name>ThrillWiki</name>
<description>Comprehensive theme park database platform with user-generated content, expert moderation, and rich media support</description>
<framework>Django REST Framework</framework>
<api_endpoints>120+</api_endpoints>
<primary_entities>
<entity>Parks</entity>
<entity>Rides</entity>
<entity>Companies</entity>
<entity>Users</entity>
</primary_entities>
</project_overview>
<!-- Technology Stack -->
<tech_stack>
<backend>
<framework>Django 5.0+</framework>
<api>Django REST Framework</api>
<database>PostgreSQL with PostGIS</database>
<caching>Redis</caching>
<task_queue>Celery</task_queue>
</backend>
<frontend>
<constraint>NO React/Vue/Angular allowed</constraint>
<technologies>
<tech name="HTMX" purpose="Dynamic updates"/>
<tech name="AlpineJS" purpose="Client-side state management"/>
<tech name="Tailwind CSS" purpose="Styling"/>
<tech name="Django-Cotton" purpose="Component system"/>
</technologies>
</frontend>
<media>
<service>Cloudflare Images</service>
<method>Direct Upload with variants and transformations</method>
</media>
<tracking>
<system>pghistory for all model changes</system>
<base_class>TrackedModel</base_class>
</tracking>
</tech_stack>
<!-- Domain Architecture -->
<domain_structure>
<domain name="parks">
<path>parks/</path>
<companies>
<allowed_roles>
<role>OPERATOR</role>
<role>PROPERTY_OWNER</role>
</allowed_roles>
</companies>
</domain>
<domain name="rides">
<path>rides/</path>
<companies>
<allowed_roles>
<role>MANUFACTURER</role>
<role>DESIGNER</role>
</allowed_roles>
</companies>
</domain>
<core_apps>
<app>accounts/</app>
<app>media/</app>
<app>moderation/</app>
<app>core/</app>
</core_apps>
<critical_rules>
<rule>NEVER mix park/ride company roles - fundamental business rule</rule>
</critical_rules>
</domain_structure>
<!-- Development Patterns -->
<development_patterns>
<models>
<base_class>TrackedModel (all models inherit)</base_class>
<slug_handling>SluggedModel for slugs with history</slug_handling>
</models>
<api_design>
<url_structure>Nested URLs (/parks/{slug}/rides/{slug}/)</url_structure>
<trailing_slash>Mandatory trailing slashes</trailing_slash>
</api_design>
<choices>
<system>RichChoiceField with metadata</system>
<metadata>color, icon, description, css_class</metadata>
<forbidden>NEVER use Django tuple choices</forbidden>
</choices>
<media_handling>
<field_type>CloudflareImagesField</field_type>
<features>photo types and attribution</features>
</media_handling>
<location>
<system>PostGIS for geographic data</system>
<structure>separate location models</structure>
</location>
</development_patterns>
<!-- Development Commands -->
<commands>
<server>
<command>uv run manage.py runserver_plus</command>
<forbidden>python manage.py</forbidden>
</server>
<migrations>
<make>uv run manage.py makemigrations</make>
<apply>uv run manage.py migrate</apply>
</migrations>
<packages>
<install>uv add &lt;package&gt;</install>
<forbidden>pip install</forbidden>
</packages>
<management>
<pattern>Always use `uv run manage.py &lt;command&gt;`</pattern>
</management>
</commands>
<!-- API Rules and Standards -->
<api_standards>
<authentication>
<type>Token-based</type>
<role_hierarchy>
<role level="1">USER</role>
<role level="2">MODERATOR</role>
<role level="3">ADMIN</role>
<role level="4">SUPERUSER</role>
</role_hierarchy>
</authentication>
<filtering>
<rides>25+ parameters</rides>
<parks>15+ parameters</parks>
</filtering>
<responses>
<pagination>Standard DRF pagination</pagination>
<errors>Rich error responses with details</errors>
</responses>
<caching>
<levels>Multi-level (Redis, CDN, browser)</levels>
<invalidation>Signal-based invalidation</invalidation>
</caching>
<data_policy>
<rule>NEVER MOCK DATA - All responses must use real database queries</rule>
</data_policy>
</api_standards>
<!-- Rich Choice Objects System (MANDATORY) -->
<rich_choices>
<implementation>
<field_usage>RichChoiceField(choice_group="group_name", domain="domain_name")</field_usage>
<definition_location>domain-specific choices.py using RichChoice dataclass</definition_location>
<registration>register_choices() function in domain __init__.py</registration>
</implementation>
<required_metadata>
<metadata>color</metadata>
<metadata>icon</metadata>
<metadata>description</metadata>
<metadata>css_class</metadata>
</required_metadata>
<forbidden>
<rule>NO tuple-based choices allowed anywhere in codebase</rule>
</forbidden>
</rich_choices>
<!-- Frontend Constraints -->
<frontend_constraints>
<architecture>
<htmx>Dynamic updates</htmx>
<alpinejs>Client state management</alpinejs>
<tailwind>Styling framework</tailwind>
</architecture>
<approach>Progressive enhancement required</approach>
<browser_support>Latest 2 versions of major browsers</browser_support>
<performance_targets>
<fcp>First Contentful Paint &lt; 1.5s</fcp>
<tti>Time to Interactive &lt; 2s</tti>
<compliance>Core Web Vitals compliance</compliance>
</performance_targets>
</frontend_constraints>
<!-- Code Quality Standards -->
<code_standards>
<model_inheritance>All models must inherit from TrackedModel</model_inheritance>
<slug_management>Use SluggedModel for entities with slugs and history tracking</slug_management>
<choice_fields>Always use RichChoiceField instead of Django choices</choice_fields>
<api_urls>Must include trailing slashes and follow nested pattern</api_urls>
<media_fields>Use CloudflareImagesField for all image handling</media_fields>
<geographic_data>Use PostGIS fields and separate location models</geographic_data>
</code_standards>
<!-- Business Rules -->
<business_rules>
<company_roles>
<rule>Parks domain: Only OPERATOR and PROPERTY_OWNER roles</rule>
<rule>Rides domain: Only MANUFACTURER and DESIGNER roles</rule>
<rule>CRITICAL: Never allow cross-domain company roles</rule>
</company_roles>
<data_integrity>
<rule>All model changes must be tracked via pghistory</rule>
<rule>All API responses must use real database data</rule>
<rule>Geographic data must use PostGIS for accuracy</rule>
</data_integrity>
</business_rules>
<!-- Development Workflow -->
<workflow>
<package_management>Use uv for all Python package operations</package_management>
<server_management>Use runserver_plus for enhanced development server</server_management>
<database_management>Always use uv run for Django management commands</database_management>
<testing>All functionality must work with progressive enhancement</testing>
</workflow>
<!-- Context7 MCP Integration (MANDATORY) -->
<context7_usage>
<requirement>ALWAYS use Context7 MCP for documentation lookups before making changes</requirement>
<libraries_requiring_context7>
<library name="tailwindcss">Use for CSS utility classes, responsive design, and component styling</library>
<library name="django">Use for models, views, forms, URL patterns, and Django-specific patterns</library>
<library name="django-cotton">Use for component creation, template organization, and Cotton-specific syntax</library>
<library name="htmx">Use for dynamic updates, form handling, and AJAX interactions</library>
<library name="alpinejs">Use for client-side state management, reactive data, and JavaScript interactions</library>
<library name="django-rest-framework">Use for API design, serializers, viewsets, and DRF patterns</library>
<library name="postgresql">Use for database queries, PostGIS functions, and advanced SQL features</library>
<library name="postgis">Use for geographic data handling and spatial queries</library>
<library name="redis">Use for caching strategies, session management, and performance optimization</library>
</libraries_requiring_context7>
<workflow_steps>
<step order="1">Before editing/creating code: Query Context7 for relevant library documentation</step>
<step order="2">During debugging: Use Context7 to verify syntax, patterns, and best practices</step>
<step order="3">When implementing new features: Reference Context7 for current API and method signatures</step>
<step order="4">For performance issues: Consult Context7 for optimization techniques and patterns</step>
<step order="5">For geographic data handling: Use Context7 for PostGIS functions and best practices</step>
<step order="6">For caching strategies: Refer to Context7 for Redis patterns and best practices</step>
<step order="7">For database queries: Utilize Context7 for PostgreSQL best practices and advanced SQL features</step>
</workflow_steps>
<mandatory_scenarios>
<scenario>Creating new Django models or API endpoints</scenario>
<scenario>Implementing HTMX dynamic functionality</scenario>
<scenario>Writing AlpineJS reactive components</scenario>
<scenario>Designing responsive layouts with Tailwind CSS</scenario>
<scenario>Creating Django-Cotton components</scenario>
<scenario>Debugging CSS, JavaScript, or Django issues</scenario>
<scenario>Implementing caching or database optimizations</scenario>
<scenario>Handling geographic data with PostGIS</scenario>
<scenario>Utilizing Redis for session management</scenario>
<scenario>Implementing real-time features with WebSockets</scenario>
</mandatory_scenarios>
<context7_commands>
<resolve_library>Always call Context7:resolve-library-id first to get correct library ID</resolve_library>
<get_docs>Then use Context7:get-library-docs with appropriate topic parameter</get_docs>
<example_topics>
<topic library="tailwindcss">responsive design, flexbox, grid, animations</topic>
<topic library="django">models, views, forms, admin, signals</topic>
<topic library="django-cotton">components, templates, slots, props</topic>
<topic library="htmx">hx-get, hx-post, hx-swap, hx-trigger, hx-target</topic>
<topic library="alpinejs">x-data, x-show, x-if, x-for, x-model</topic>
<topic library="django-rest-framework">serializers, viewsets, routers, permissions</topic>
<topic library="postgresql">joins, indexes, transactions, window functions</topic>
<topic library="postgis">geospatial queries, distance calculations, spatial indexes</topic>
<topic library="redis">caching strategies, pub/sub, data structures</topic>
</example_topics>
</context7_commands>
</context7_usage>
</thrillwiki_context>