# pgLabII AI Assistant Guidelines ## Project Context This is a .NET 9/C# 14 Avalonia cross-platform application for querying and inspecting postgresql databases. It should also be a good editor for SQL files. ### Architecture Overview - **Main Project**: pgLabII (Avalonia UI) - **Platform Projects**: pgLabII.Desktop - **Utility Project**: pgLabII.PgUtils - **Core Components**: DocumentSession, DocumentSessionFactory, LocalDb ## Coding Standards ### C# Guidelines - Use C# 14 features and modern .NET patterns - Prefer primary constructors for dependency injection - Use `var` for obvious types, explicit types for clarity - Implement proper async/await patterns for I/O operations - Use nullable reference types consistently - Prefer "target-typed new" - Prefer "list initializer" over new - Package versions are managed centrally in Directory.Packages.props ### Avalonia-Specific - Follow MVVM pattern strictly - x:Name does work for making components accessible in code-behind - ViewModels should inherit from appropriate base classes - Use ReactiveUI patterns where applicable - Make use of annotations to generate bindable properties - Implement proper data binding - Consider cross-platform UI constraints ### Project Patterns - Services should use dependency injection - Use the DocumentSession pattern for data operations - Integrate with LocalDb for persistence - Implement proper error handling and logging - Consider performance for document operations - Use FluentResults.Result for expected errors ### Architecture Rules - Keep platform-specific code in respective platform projects - Shared business logic in main pgLabII project - Utilities in pgLabII.PgUtils - Follow clean architecture principles ## Code Review Focus Areas 1. Memory management for document operations 2. Cross-platform compatibility 3. Proper async patterns 4. Error handling and user feedback 5. Performance considerations for large documents 6. UI responsiveness