Skip to content

Commit a5edb16

Browse files
Expand repo rules to include style guide and UI development guidelines (#9754)
* Expand repo rules to include style guide and UI development guidelines * include utils * add guidance for integration tests
1 parent fa063f3 commit a5edb16

File tree

2 files changed

+37
-22
lines changed

2 files changed

+37
-22
lines changed

AI_RULES.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# DevTools Repo Guidelines for AI Assistants
2+
3+
Follow these rules when working in this repository.
4+
5+
## Repository Rules
6+
7+
### Dependencies
8+
- **`packages/devtools_shared`**: Never introduce a Flutter dependency or a dependency on web-only Dart libraries.
9+
- **Imports**: Never import `packages/devtools_app/lib/devtools_app.dart` in code under `packages/devtools_app/lib/src/`. It is acceptable in test code.
10+
11+
### Code Style
12+
- **Style Guide**: Follow the DevTools style guide in [STYLE.md](STYLE.md).
13+
- **Formatting & Analysis**: Always ensure code is formatted properly and has no analysis errors or warnings before completing a task.
14+
15+
## Running Tests
16+
17+
- **Standard Packages**: Run unit and widget tests with `flutter test`.
18+
- **`packages/devtools_shared`**: Run tests with `dart test`.
19+
- **Integration Tests**: Refer to the [Integration Test README](packages/devtools_app/integration_test/README.md) for instructions on running integration tests.
20+
21+
## Tooling Best Practices
22+
23+
- **MCP Tools**: Prefer using MCP server tools over shell commands whenever possible.
24+
25+
## UI Development Guidelines
26+
27+
### Constants and Magic Values
28+
- **Avoid Raw Values**: Avoid using raw strings or numbers in UI code. Use named constants instead.
29+
30+
### Themes and Styles
31+
- **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`).
32+
- **Reuse Patterns**: Reuse common patterns and styles used in other UI code in the repository.
33+
34+
### Code Reuse
35+
- **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.
36+

GEMINI.md

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,3 @@
1-
# Repository rules
2-
3-
When making changes to this code base, follow these rules, which are listed
4-
in no particular order:
5-
- `packages/devtools_shared` should never introduce a Flutter dependency or a
6-
dependency on web-only Dart libraries.
7-
- never import the `packages/devtools_app/lib/devtools_app.dart` file in code
8-
that lives under `packages/devtools_app/lib/src/`. This file is okay to import
9-
in code that lives under `packages/devtools_app/test/`.
10-
11-
# Running tests
12-
13-
Unit test and widget tests are all contained under a package's `test/`
14-
directory. These tests should be run with `flutter test` in all packages except
15-
for `packages/devtools_shared`, whose tests should be run with `dart test`.
16-
171
# Gemini Guidelines
182

19-
- Prefer to use MCP server tools over shell commands whenever possible.
20-
- When you are done making code changes, ensure the code does not have analysis
21-
errors or warnings. Also ensure it is formatted properly. You should have MCP
22-
server tools available to you to perform these tasks. If not, you can get
23-
analysis errors and warnings by running the `dart analyze` shell command, and
24-
you can perform Dart formatting with the `dart format` shell command.
3+
Refer to the shared [AI Rules](AI_RULES.md) for guidelines when working in this repository.

0 commit comments

Comments
 (0)