<!--
  AGENTS.md template for a Flutter app.
  Replace every <…> placeholder and delete sections that don't apply.
  Or let your agent do it: "Read this repo and fill in AGENTS.md. Only write what you can confirm from the code."
  Keep it short and true. An agent follows what's written here over what it guesses, so a wrong line costs more
  than a missing one.
-->

# AGENTS.md: <App name>

Guide for AI coding agents (Claude Code, Codex, Cursor and others) working in this repo.
<If you also keep a `CLAUDE.md`, put `@AGENTS.md` in it so Claude Code reads these same rules. Otherwise delete this line.>

<One or two sentences: what the app does, who uses it, and which platforms ship (iOS, Android, web, macOS, …).>

## Project map

| Path | What lives there |
|---|---|
| `lib/main.dart` | <Bootstrap order, e.g. `Firebase.initializeApp` → DI setup → `runApp(App)`> |
| `lib/<state folder>/` | <Where state lives: blocs, providers, controllers, notifiers> |
| `lib/<data folder>/` | <Repositories, API clients, models with `fromJson`/`toJson`> |
| `lib/<ui folder>/` | <Screens and widgets, and how they're grouped (by feature or by type)> |
| `lib/<routing file>` | <Router config> |
| `test/` | <What the tests cover and what they need (fakes, emulators, nothing)> |

**Not in this repo:** <backend, security rules, infrastructure, design files. Say where they live, or "none".>

## Architecture rules

**State: <Riverpod | Bloc | Provider | GetX | Signals | setState only>.** Don't add a second state library.
- <How a new feature's state is created and disposed.>
- <Where side effects (network, storage, analytics) are allowed to run.>

**Navigation: <go_router | auto_route | Navigator 2 | named routes | other>.**
- <How to add a route, and the file(s) that must change together.>

**Data.**
- <Where field and collection names come from (constants, generated code). Never inline string keys if that's the rule.>
- <Serialization: hand-written `fromJson`/`toJson`, `json_serializable`, `freezed`.>
- <Timestamps, IDs, null handling conventions.>

**UI.**
- Colors come from `Theme.of(context).colorScheme` and text styles from `Theme.of(context).textTheme`. Don't hard-code colors.
- <Breakpoints for phone / tablet / desktop, if the app is responsive.>
- <Localization: `gen-l10n` with ARB files in `lib/l10n/`, or "none: strings are hard-coded English".>

## Commands

Run from the repo root. Tested with Flutter <version> (Dart <version>).

```bash
flutter pub get
dart run build_runner build --delete-conflicting-outputs   # <only if the repo uses code generation>
flutter analyze                                           # compare issue counts before and after
dart format lib test
flutter test
flutter run -d <chrome | macos | device id>
```

<Anything the app needs before it runs: an `.env` copied from `.env.example`, `flutterfire configure`, emulators.>

## Generated and machine-owned files: don't hand-edit

- <`lib/firebase_options.dart` (FlutterFire CLI)>
- <`*.g.dart`, `*.freezed.dart`, `*.gr.dart`, `*.mocks.dart` (build_runner: json_serializable, freezed, auto_route, mockito)>
- <`app_localizations*.dart` (gen-l10n, from the ARB files)>
- <`GeneratedPluginRegistrant.*` under android/, ios/ and macos/, `ios/Flutter/Generated.xcconfig`, `.flutter-plugins-dependencies`, and `linux/flutter/generated_*`, `windows/flutter/generated_*` (rewritten by `flutter pub get` and builds)>

## Never do

- Never commit secrets: `.env`, service-account JSON, keystores (`*.jks`, `key.properties`), App Store Connect keys (`*.p8`), API secret keys.
- Never put a server-side secret in the Flutter app. Everything in `lib/` and in bundled assets ships to users.
- Never deploy, publish or change remote state without explicit approval: <`firebase deploy`, store uploads, `git push`, …>. Prepare the change and tell the human what to run.
- Never hand-edit the generated files listed above.
- Don't bump major dependency versions or restructure folders unless the task asks for it.
- <Project-specific rules: keys you must never rename, files owned by another team, …>

## Definition of done

1. Every touched `.dart` file passes `dart format --output=none --set-exit-if-changed`.
2. `flutter analyze` reports no new issues compared with before the change. Say both counts.
3. `flutter test` passes. New logic that doesn't need a device or backend has a unit test.
4. New UI works at phone and desktop widths, in light and dark mode.
5. The summary lists the files changed and every manual step left for the human (consoles, deploys, store settings).

## Known issues (as of <date>; update this list when fixed)

- <Baseline: `flutter analyze` reports <n> issues on Flutter <version>.>
- <Anything rough that an agent should work around rather than "fix" unasked.>
