FamilyNido — a self-hosted PWA for a single household: shared calendar, chores, meals, school agenda, health records and a family wall. One instance per family, deployable with `docker compose` on any home server. Stack: .NET 10 (ASP.NET Core Minimal APIs) + EF Core 10 + PostgreSQL 16 on the backend, Angular 21 (standalone, signals, zoneless) + Tailwind CSS v4 on the frontend, SignalR for realtime, optional OIDC alongside local credentials, integration via a versioned `/api/v1/**` public API. See README.md for the module overview and how to deploy.
8.4 KiB
8.4 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
C# Development SECTION START
description: 'Guidelines for building C# applications' applyTo: '**/*.cs'
C# Instructions
- Always use the latest version C#, currently C# 14 features.
- Write clear and concise comments for each function.
General Instructions
- Make only high confidence suggestions when reviewing code changes.
- Write code with good maintainability practices, including comments on why certain design decisions were made.
- Handle edge cases and write clear exception handling.
- For libraries or external dependencies, mention their usage and purpose in comments.
Naming Conventions
- Follow PascalCase for component names, method names, and public members.
- Use camelCase for private fields and local variables.
- Prefix interface names with "I" (e.g., IUserService).
Formatting
- Apply code-formatting style defined in
.editorconfig. - Prefer file-scoped namespace declarations and single-line using directives.
- Insert a newline before the opening curly brace of any code block (e.g., after
if,for,while,foreach,using,try, etc.). - Ensure that the final return statement of a method is on its own line.
- Use pattern matching and switch expressions wherever possible.
- Use
nameofinstead of string literals when referring to member names. - Ensure that XML doc comments are created for any public APIs. When applicable, include
<example>and<code>documentation in the comments.
Project Setup and Structure
- Guide users through creating a new .NET project with the appropriate templates.
- Explain the purpose of each generated file and folder to build understanding of the project structure.
- Demonstrate how to organize code using feature folders or domain-driven design principles.
- Show proper separation of concerns with models, services, and data access layers.
- Explain the Program.cs and configuration system in ASP.NET Core 10 including environment-specific settings.
Nullable Reference Types
- Declare variables non-nullable, and check for
nullat entry points. - Always use
is nulloris not nullinstead of== nullor!= null. - Trust the C# null annotations and don't add null checks when the type system says a value cannot be null.
C# Development SECTION END
Angular Development Instructions SECTION START
description: 'Angular-specific coding standards and best practices' applyTo: '**/.ts, **/.html, **/.scss, **/.css'
Instructions for generating high-quality Angular applications with TypeScript, using Angular Signals for state management, adhering to Angular best practices as outlined at https://angular.dev.
Project Context
- Latest Angular version (use standalone components by default)
- TypeScript for type safety
- Angular CLI for project setup and scaffolding
- Follow Angular Style Guide (https://angular.dev/style-guide)
Development Standards
Architecture
- Use standalone components unless modules are explicitly required
- Organize code by standalone feature modules or domains for scalability
- Implement lazy loading for feature modules to optimize performance
- Use Angular's built-in dependency injection system effectively
- Structure components with a clear separation of concerns (smart vs. presentational components)
TypeScript
- Enable strict mode in
tsconfig.jsonfor type safety - Define clear interfaces and types for components, services, and models
- Use type guards and union types for robust type checking
- Implement proper error handling with RxJS operators (e.g.,
catchError) - Use typed forms (e.g.,
FormGroup,FormControl) for reactive forms
Component Design
- Follow Angular's component lifecycle hooks best practices
- When using Angular >= 19, Use
input()output(),viewChild(),viewChildren(),contentChild()andcontentChildren()functions instead of decorators; otherwise use decorators - Leverage Angular's change detection strategy (default or
OnPushfor performance) - Keep templates clean and logic in component classes or services
- Use Angular directives and pipes for reusable functionality
Styling
- Use Angular's component-level CSS encapsulation (default: ViewEncapsulation.Emulated)
- Prefer SCSS for styling with consistent theming
- Implement responsive design using CSS Grid, Flexbox, or Angular CDK Layout utilities
- Follow Angular Material's theming guidelines if used
- Maintain accessibility (a11y) with ARIA attributes and semantic HTML
State Management
- Use Angular Signals for reactive state management in components and services
- Leverage
signal(),computed(), andeffect()for reactive state updates - Use writable signals for mutable state and computed signals for derived state
- Handle loading and error states with signals and proper UI feedback
- Use Angular's
AsyncPipeto handle observables in templates when combining signals with RxJS
Data Fetching
- Use Angular's
HttpClientfor API calls with proper typing - Implement RxJS operators for data transformation and error handling
- Use Angular's
inject()function for dependency injection in standalone components - Implement caching strategies (e.g.,
shareReplayfor observables) - Store API response data in signals for reactive updates
- Handle API errors with global interceptors for consistent error handling
Security
- Sanitize user inputs using Angular's built-in sanitization
- Implement route guards for authentication and authorization
- Use Angular's
HttpInterceptorfor CSRF protection and API authentication headers - Validate form inputs with Angular's reactive forms and custom validators
- Follow Angular's security best practices (e.g., avoid direct DOM manipulation)
Performance
- Enable production builds with
ng build --prodfor optimization - Use lazy loading for routes to reduce initial bundle size
- Optimize change detection with
OnPushstrategy and signals for fine-grained reactivity - Use trackBy in
ngForloops to improve rendering performance - Implement server-side rendering (SSR) or static site generation (SSG) with Angular Universal (if specified)
Testing
- Write unit tests for components, services, and pipes using Jasmine and Karma
- Use Angular's
TestBedfor component testing with mocked dependencies - Test signal-based state updates using Angular's testing utilities
- Write end-to-end tests with Cypress or Playwright (if specified)
- Mock HTTP requests using
provideHttpClientTesting - Ensure high test coverage for critical functionality
Additional Guidelines
- File naming (classic Angular convention, project-wide): each Angular
@Componentlives in its own folder with three separated files —feature.component.ts(logic),feature.component.html(template) andfeature.component.css(component-scoped styles, created even if empty so the structure is uniform). The exported class must carry theComponentsuffix, e.g.export class FeatureComponent { … }. Services keep thefeature.service.tsconvention, guardsfeature.guard.ts, interceptorsfeature.interceptor.ts, models no suffix. The Angular CLI schematics inangular.jsonare already configured to produce this layout — always generate new components withng generate component <name>. - Use Angular CLI commands for generating boilerplate code
- Document components and services with clear JSDoc comments
- Ensure accessibility compliance (WCAG 2.1) where applicable
- Use Angular's built-in i18n for internationalization (if specified)
- Keep code DRY by creating reusable utilities and shared modules
- Use signals consistently for state management to ensure reactive updates
Angular Development Instructions SECTION END
Code Intelligence
Prefer LSP over Grep/Glob/Read for code navigation:
goToDefinition/goToImplementationto jump to sourcefindReferencesto see all usages across the codebaseworkspaceSymbolto find where something is defineddocumentSymbolto list all symbols in a filehoverfor type info without reading the fileincomingCalls/outgoingCallsfor call hierarchy
Before renaming or changing a function signature, use
findReferences to find all call sites first.
Use Grep/Glob only for text/pattern searches (comments, strings, config values) where LSP doesn't help.
After writing or editing code, check LSP diagnostics before moving on. Fix any type errors or missing imports immediately.
.NET Instructions
Use a Vertical Slice Architecture.