From c5d4ed5e83d7bde6d2d337b043f93897f808b9ee Mon Sep 17 00:00:00 2001 From: Kenzie Davisson Date: Thu, 2 Apr 2026 12:27:15 -0700 Subject: [PATCH 1/2] Expand repo rules to include style guide and UI development guidelines --- AI_RULES.md | 34 ++++++++++++++++++++++++++++++++++ GEMINI.md | 23 +---------------------- 2 files changed, 35 insertions(+), 22 deletions(-) create mode 100644 AI_RULES.md diff --git a/AI_RULES.md b/AI_RULES.md new file mode 100644 index 00000000000..8da00e29f49 --- /dev/null +++ b/AI_RULES.md @@ -0,0 +1,34 @@ +# DevTools Repo Guidelines for AI Assistants + +Follow these rules when working in this repository. + +## Repository Rules + +### Dependencies +- **`packages/devtools_shared`**: Never introduce a Flutter dependency or a dependency on web-only Dart libraries. +- **Imports**: Never import `packages/devtools_app/lib/devtools_app.dart` in code under `packages/devtools_app/lib/src/`. It is acceptable in test code. + +### Code Style +- **Style Guide**: Follow the DevTools style guide in [STYLE.md](STYLE.md). +- **Formatting & Analysis**: Always ensure code is formatted properly and has no analysis errors or warnings before completing a task. + +## Running Tests + +- **Standard Packages**: Run tests with `flutter test`. +- **`packages/devtools_shared`**: Run tests with `dart test`. + +## Tooling Best Practices + +- **MCP Tools**: Prefer using MCP server tools over shell commands whenever possible. + +## UI Development Guidelines + +### Constants and Magic Values +- **Avoid Raw Values**: Avoid using raw strings or numbers in UI code. Use named constants instead. + +### Themes and Styles +- **Use Existing Themes**: Use existing theme values and text styles from `packages/devtools_app_shared/lib/src/ui/theme/theme.dart` (e.g., `Theme.of(context).regularTextStyle`). +- **Reuse Patterns**: Reuse common patterns and styles used in other UI code in the repository. + +### Code Reuse +- **Use Shared Components**: Prefer using reusable components from `shared/ui/` (such as `packages/devtools_app/lib/src/shared/ui/common_widgets.dart`) rather than creating UI elements from scratch. diff --git a/GEMINI.md b/GEMINI.md index 4cc9c4ca9e8..6efc612c6a2 100644 --- a/GEMINI.md +++ b/GEMINI.md @@ -1,24 +1,3 @@ -# Repository rules - -When making changes to this code base, follow these rules, which are listed -in no particular order: -- `packages/devtools_shared` should never introduce a Flutter dependency or a -dependency on web-only Dart libraries. -- never import the `packages/devtools_app/lib/devtools_app.dart` file in code -that lives under `packages/devtools_app/lib/src/`. This file is okay to import -in code that lives under `packages/devtools_app/test/`. - -# Running tests - -Unit test and widget tests are all contained under a package's `test/` -directory. These tests should be run with `flutter test` in all packages except -for `packages/devtools_shared`, whose tests should be run with `dart test`. - # Gemini Guidelines -- Prefer to use MCP server tools over shell commands whenever possible. -- When you are done making code changes, ensure the code does not have analysis -errors or warnings. Also ensure it is formatted properly. You should have MCP -server tools available to you to perform these tasks. If not, you can get -analysis errors and warnings by running the `dart analyze` shell command, and -you can perform Dart formatting with the `dart format` shell command. +Refer to the shared [AI Rules](AI_RULES.md) for guidelines when working in this repository. From af58db6b93993ffd43cb990799d19ff99fb297e6 Mon Sep 17 00:00:00 2001 From: Kenzie Davisson Date: Thu, 2 Apr 2026 12:32:59 -0700 Subject: [PATCH 2/2] include utils --- AI_RULES.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/AI_RULES.md b/AI_RULES.md index 8da00e29f49..03798cefeb5 100644 --- a/AI_RULES.md +++ b/AI_RULES.md @@ -31,4 +31,5 @@ Follow these rules when working in this repository. - **Reuse Patterns**: Reuse common patterns and styles used in other UI code in the repository. ### Code Reuse -- **Use Shared Components**: Prefer using reusable components from `shared/ui/` (such as `packages/devtools_app/lib/src/shared/ui/common_widgets.dart`) rather than creating UI elements from scratch. +- **Use Shared Components & Utils**: Prefer using reusable components from `shared/ui/` (such as `packages/devtools_app/lib/src/shared/ui/common_widgets.dart`), primitives from `shared/primitives/`, and utilities from `shared/utils/` rather than creating things from scratch. +