# Project rules

> Starter rules file for a Flutter semester project.
> Change every line that does not match your project. Keep the file short.

## Read first
- Read every file in `docs/` before you start a task: `mvp.md`, `product.md`, `tech-stack.md`, `design.md`, `plan.md`.
- The approved HTML design is `design/index.html`. Follow it exactly. Do not invent screens.
- If two files contradict each other, stop and ask me.

## Stack
- Flutter (stable channel) and Dart, with null safety.
- Follow `docs/tech-stack.md` for state management, networking and backend. Do not switch libraries.
- Ask before you add a package. Tell me why it is needed.

## Structure
- Feature-based clean architecture: `lib/core` and `lib/features/<feature>/{data,domain,presentation}`.
- Presentation does not talk to the data layer directly. Go through the domain layer.
- Keep widgets small and reusable. Move a widget to its own file when it grows past about 80 lines.

## Code style
- No hardcoded colors, font sizes or texts. Use the theme and constants.
- Use `const` constructors wherever possible.
- Never use `print`. Use the project logger.
- Every screen that loads data handles loading, empty and error states.
- Use clear names. No unexplained abbreviations.

## Security
- Never put API keys, tokens or passwords in code or in Git. Use environment config.
- Never use a Supabase `service_role` key or any admin secret inside the app.
- With Supabase, turn on Row Level Security for every table.

## How to work
- Work on one phase of `docs/plan.md` at a time. Do not start the next phase.
- Before you write code, tell me your plan in 3 to 5 lines.
- After you finish, list every file you created, changed or deleted.
- Do not change files outside the task. Do not delete anything without asking me.
- Run `flutter analyze` and `flutter test` before you say a task is done.
- Report the real result. Never say tests pass if you did not run them.
- If you are not sure about an API, check the docs. Do not guess.

## Commands
- Run: `flutter run`
- Analyze: `flutter analyze`
- Test: `flutter test`
- Format: `dart format .`
