agentleFS
ArenukvernArenukvern/mcp_flutter/.cursor/rules/app_architecture.guide.mdc

mcp_flutter / rules

Cursor rule385 starsChanged 5 months agoMITView on GitHub

This document provides a condensed, unified overview of the application's architecture. It is designed to be a primary reference for understanding the core concepts, structure, and development patterns. The application follows a standard layered architecture, separating concerns into distinct layers and directories. A Workspace is composed of several key file types, each serving a distinct purpose. All file contents are parsed into immutable extension type models located in lib/data_models/. See dart_extension_type_const_models.guide.mdc for more details. Services in lib/services/ contain isolated, high-level…

The file

We split this app_architecture.guide.mdc into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Should contain isolated game logic.

    line 51
  2. Very specific:

    Use useLocale() and AppStrings.{key}.getValue(locale) to get the current locale and strings.

    line 73

≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
app_architecture.guide.mdc
---
description:
globs:
alwaysApply: true
---

# Application Architecture Overview

This document provides a condensed, unified overview of the application's architecture. It is designed to be a primary reference for understanding the core concepts, structure, and development patterns.

## 1. High-Level Architecture & Directory Structure

The application follows a standard layered architecture, separating concerns into distinct layers and directories.

```
lib/
  ├── core/                # Core abstractions & shared utilities
  ├── components/          # Shared UI components in atom design style. See
  ├── data_models/         # Immutable data models based on extension types. See `[dart_extension_type_const_models.mdc](mdc:.cursor/rules/dart_extension_type_const_models.mdc)` for more details.
  ├── data_resources/      # UI state holders (Resources) See `[command_resource_pattern.guide.mdc](mdc:.cursor/rules/command_resource_pattern.guide.mdc)` for more details.
  ├── data_commands/       # Logic to update Resources (Commands) See `[command_resource_pattern.guide.mdc](mdc:.cursor/rules/command_resource_pattern.guide.mdc)` for more details.
  ├── data_api/            # Data access layer (file I/O, parsing)
  ├── data_services/       # Data services (file I/O, parsing)
  ├── mechanics/           # Mechanics (game mechanics)
  ├── di/                  # Dependency injection setup See `[di_usage.guide.mdc](mdc:.cursor/rules/di_usage.guide.mdc)` for more details.
  ├── services/            # Isolated Application-level business logic
  ├── {ui_domain}/         # Domain or Feature-specific screens and widgets, like ui_vitamin_selection, ui_info etc..
  ├── theme/               # Context based Theme
  └── main.dart            # Application entry point
```

- **Data Layer:** `data_models/` & `data_api/` handle the representation of and interaction with the data.
- **State & Service Layer:** `data_resources/` & `data_commands/` & `data_services/` manage application state and orchestrate business logic.
- **UI Layer:** `{ui_domain}/` contains all Flutter widgets, organized by domain and then by feature.

## 2. The Data Layer: Workspace File Structure

A Workspace is composed of several key file types, each serving a distinct purpose. All file contents are parsed into immutable **`extension type`** models located in `lib/data_models/`.
See `[dart_extension_type_const_models.guide.mdc](mdc:.cursor/rules/dart_extension_type_const_models.guide.mdc)` for more details.

## 3. Data Service Layer

Services in `lib/services/` contain isolated, high-level data related business logic that orchestrates data flow and complex operations. They provide reusable **capabilities** (e.g., file writing, data parsing) and are consumed by Commands to perform actions.

They can be used by commands, mechanics.

## 4. Mechanics Layer: Game Mechanics

Mechanics in `lib/mechanics/` contain the game mechanics, they can be consumed by commands, and may modify resources.

Should contain isolated game logic.

## 5. UI & State Management: The Command-Resource Pattern

The application uses the **Command-Resource pattern** for a clear separation between UI state and business logic. Commands are triggered by the UI to execute atomic **transactions** (e.g., "save this character"), using Services to perform the work and updating Resources with the result.

See `[command_resource_pattern.guide.mdc](mdc:.cursor/rules/command_resource_pattern.guide.mdc)` for more details.

## 6. Dependency Injection (DI)

The application uses the `get_it` package for service location. The setup is centralized in `lib/di/dependency_injector.dart`. See `[di_usage.guide.mdc](mdc:.cursor/rules/di_usage.guide.mdc)` for more details.

See `[di_creation.guide.mdc](mdc:.cursor/rules/di_creation.guide.mdc)` for more details.

For how to use DI, see more in `[di_usage.guide.mdc](mdc:.cursor/rules/di_usage.guide.mdc)`

For how to create DI, see more in `[di_creation.guide.mdc](mdc:.cursor/rules/di_creation.guide.mdc)`

## 7. Localization

The application supports dynamic, user-switchable localization for multiple languages. This is achieved by centralizing all user-facing strings and using a reactive architecture to update the UI when the language changes.

Use `useLocale()` and `AppStrings.{key}.getValue(locale)` to get the current locale and strings.

For how to use localization, see more in `[locale_usage.guide.mdc](mdc:.cursor/rules/locale_usage.guide.mdc)`

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.