Skip to content

Add flutter-app-runtime rule for proactive hot reload - #220

Open
jwren wants to merge 2 commits into
mainfrom
rule-flutter-app-runtime
Open

Add flutter-app-runtime rule for proactive hot reload#220
jwren wants to merge 2 commits into
mainfrom
rule-flutter-app-runtime

Conversation

@jwren

@jwren jwren commented Aug 17, 2026

Copy link
Copy Markdown
Member

dart-lang/ai#498

Add proactive Flutter hot reload rules (flutter-app-runtime.md and flutter-app-runtime.mdc) to automate the hot reload and runtime error verification loop when editing Dart and Flutter files. Problem:
The sub-second Stateful Hot Reload cycle is the cornerstone of the Flutter development experience. However, during AI-driven workflows:

  • Out-of-Sync Execution: Agents modify source code on disk but fail to update the active session, leaving the simulator/device screen stale.
  • Friction in Context Switching: Users must exit the chat interface to manually initiate a reload via the CLI ('r') or IDE tooling.
  • Latent Feedback on Regressions: Build failures and layout issues (e.g., RenderFlex overflows) are only revealed after manual intervention, leading to fragmented multi-turn debugging sessions.

@jwren jwren changed the title feat(rules): add flutter-app-runtime rule for proactive hot reload Add flutter-app-runtime rule for proactive hot reload Aug 17, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request replaces the old hot reload rules with new proactive Flutter hot reload rules in rules/flutter-app-runtime.md and rules/flutter-app-runtime.mdc. The feedback suggests retaining the trigger: glob field in the frontmatter of the new rule file, and points out that the referenced flutter-app-runtime skill needs to be defined in resources/flutter_skills.yaml to ensure it can be resolved properly.

Comment on lines +1 to +4
---
description: Proactively connect to running Dart/Flutter apps and trigger hot reload using the flutter-app-runtime skill workflows upon editing .dart files.
globs: "**/*.dart"
---

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The previous rule file rules/hot_reload.md included trigger: glob in its frontmatter. If the rule parser requires this field to trigger the rule on glob matches, it should be retained in the new rules/flutter-app-runtime.md file.

Suggested change
---
description: Proactively connect to running Dart/Flutter apps and trigger hot reload using the flutter-app-runtime skill workflows upon editing .dart files.
globs: "**/*.dart"
---
---
trigger: glob
description: Proactively connect to running Dart/Flutter apps and trigger hot reload using the flutter-app-runtime skill workflows upon editing .dart files.
globs: "**/*.dart"
---

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines +8 to +11
Whenever you edit or modify any `.dart` file in this project, adhere to the runtime management procedures in the `flutter-app-runtime` skill:

1. **Refer to Skill**:
- Activate and follow the `flutter-app-runtime` skill workflows for Dart Tooling Daemon (`dtd`), hot reloading, hot restarting, and runtime error inspection.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The rule references the flutter-app-runtime skill, but this skill is currently not defined in resources/flutter_skills.yaml. Please make sure to define the flutter-app-runtime skill in resources/flutter_skills.yaml so that the skill can be generated and successfully resolved by the agent.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skill will be added in #221

Comment on lines +9 to +12
Whenever you edit or modify any `.dart` file in this project, adhere to the runtime management procedures in the `flutter-app-runtime` skill:

1. **Refer to Skill**:
- Activate and follow the `flutter-app-runtime` skill workflows for Dart Tooling Daemon (`dtd`), hot reloading, hot restarting, and runtime error inspection.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The rule references the flutter-app-runtime skill, but this skill is currently not defined in resources/flutter_skills.yaml. Please make sure to define the flutter-app-runtime skill in resources/flutter_skills.yaml so that the skill can be generated and successfully resolved by the agent.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, will be added

Comment thread rules/flutter-app-runtime.md Outdated

3. **Trigger Hot Reload / Hot Restart**:
- Execute `hot_reload` immediately after making changes to UI widgets or simple methods.
- Execute `hot_restart` if fundamental logic, state initialization, or `main()` was modified.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not just state initialization, but also any stateful widgets or logic affecting variables that stateful widgets use

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modified, thanks.

Comment thread rules/flutter-app-runtime.mdc Outdated
@@ -0,0 +1,25 @@
---
description: Proactively connect to running Dart/Flutter apps and trigger hot reload using the flutter-app-runtime skill workflows upon editing .dart files.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hot reload or hot restart

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@jwren
jwren requested a review from kenzieschmoll August 25, 2026 18:00
jwren added 2 commits August 25, 2026 11:22
dart-lang/ai#498

Add proactive Flutter hot reload rules (flutter-app-runtime.md and
flutter-app-runtime.mdc) to automate the hot reload and runtime error
verification loop when editing Dart and Flutter files.
Problem:
The sub-second Stateful Hot Reload cycle is the cornerstone of the
Flutter development experience. However, during AI-driven workflows:
- Out-of-Sync Execution: Agents modify source code on disk but fail to
  update the active session, leaving the simulator/device screen stale.
- Friction in Context Switching: Users must exit the chat interface to
  manually initiate a reload via the CLI ('r') or IDE tooling.
- Latent Feedback on Regressions: Build failures and layout issues
  (e.g., RenderFlex overflows) are only revealed after manual
  intervention, leading to fragmented multi-turn debugging sessions.
@jwren
jwren force-pushed the rule-flutter-app-runtime branch from 77e2dea to db5ff55 Compare August 25, 2026 18:25
Comment on lines +21 to +22
4. **Verify Runtime Stability**:
- Run `get_runtime_errors` via `dart-mcp-server` to confirm that the hot reload/restart did not introduce new exceptions.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be part of this rule IMO. This is expensive to run after each hot reload / hot restart and is a bit of scope creep. Debugging runtime errors is a separate user journey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants