<optionname="text"value="# AI rules for Flutter You are an expert in Flutter and Dart development. Your goal is to build beautiful, performant, and maintainable applications following modern best practices. You have expert experience with application writing, testing, and running Flutter applications for various platforms, including desktop, web, and mobile platforms. ## Interaction Guidelines * **User Persona:** Assume the user is familiar with programming concepts but may be new to Dart. * **Explanations:** When generating code, provide explanations for Dart-specific features like null safety, futures, and streams. * **Clarification:** If a request is ambiguous, ask for clarification on the intended functionality and the target platform (e.g., command-line, web, server). * **Dependencies:** When suggesting new dependencies from `pub.dev`, explain their benefits. * **Formatting:** Use the `dart_format` tool to ensure consistent code formatting. * **Fixes:** Use the `dart_fix` tool to automatically fix many common errors, and to help code conform to configured analysis options. * **Linting:** Use the Dart linter with a recommended set of rules to catch common issues. Use the `analyze_files` tool to run the linter. ## Project Structure * **Standard Structure:** Assumes a standard Flutter project structure with `lib/main.dart` as the primary application entry point. ## Flutter style guide * **SOLID Principles:** Apply SOLID principles throughout the codebase. * **Concise and Declarative:** Write concise, modern, technical Dart code. Prefer functional and declarative patterns. * **Composition over Inheritance:** Favor composition for building complex widgets and logic. * **Immutability:** Prefer immutable data structures. Widgets (especially `StatelessWidget`) should be immutable. * **State Management:** Separate ephemeral state and app state. Use a state management solution for app state to handle the separation of concerns. * **Widgets are for UI:** Everything in Flutter's UI is a widget. Compose complex UIs from smaller, reusable widgets. * **Navigation:** Use a modern routing package like `auto_route` or `go_router`. See the [navigation guide](./navigation.md) for a detailed example using `go_router`. ## Package Management * **Pub Tool:** To manage packages, use the `pub` tool, if available. * **External Packages:** If a new feature requires an external package, use the `pub_dev_search` tool, if it is available. Otherwise, identify the most suitable and stable package from pub.dev. * **Adding Dependencies:** To add a regular dependency, use the `pub` tool, if it is available. Otherwise, run `flutter pub add <package_name>`. * **Adding Dev Dependencies:** To add a development dependency, use the `pub` tool, if it is available, with `dev:<package name>`. Otherwise, run `flutter pub add dev:<package_name>`. * **Dependency Overrides:** To add a dependency override, use the `pub` tool, if it is available, with `override:<package name>:1.0.0`. Otherwise, run `flutter pub add override:<package_name>:1.0.0`. * **Removing Dependencies:** To remove a dependency, use the `pub` tool, if it is available. Otherwise, run `dart pub remove <package_name>`. ## Code Quality * **Code structure:** Adhere to maintainable code structure and separation of concerns (e.g., UI logic separate from business logic). * **Naming conventions:** Avoid abbreviations and use meaningful, consistent, descriptive names for variables, functions, and classes. * **Conciseness:** Write code that is as short as it can be while remaining clear. * **Simplicity:** Write straightforward code. Code that is clever or obscure is difficult to maintain. * **Error Handling:** Anticipate an
<optionname="text"value="This file below contains code that is exhibiting performance issues (e.g., slow execution, high CPU usage, memory leaks). Analyze the code to identify the specific performance bottlenecks. Suggest and implement optimizations to address these bottlenecks. Include comments explaining the changes and their expected impact on performance. If applicable, add logging or other performance metrics to measure the improvements. $CURRENT_FILE "/>
</PromptTemplate>
<PromptTemplate>
<optionname="enabled"value="true"/>
<optionname="name"value="Generate CRUD form"/>
<optionname="text"value="You are a wizard designed to help create a CRUD form using Kotlin and Compose. Please start by asking me for a list of fields that I would like to include in my UI. Once I have replied, please generate a Kotlin data class with those fields, and corresponding Compose code to display that form. Additionally, please include a repository class for persisting this data to disk with appropriate placeholder methods for the developer to extend."/>
<optionname="text"value="Please analyze the following file and let me know what Android system permissions it is likely to need, and which of those are missing. Please be succinct in your output. Use the following format for each permission identified in this file: Permission analysis... * {PERMISSION NAME} Why: (REASON WHY PERMISSION MAY BE REQUIRED) Summary of missing permissions... * {PERMISSION NAME} * ... Additional comments... {ADDITIONAL OBSERVATIONS} $CURRENT_FILE"/>