Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ npx skills update flutter/skills
|---|---|
| [flutter-adding-home-screen-widgets](skills/flutter-adding-home-screen-widgets/SKILL.md) | Adds home screen widgets to a Flutter app for Android and iOS. Use when providing glanceable app information or quick actions on the device home screen. |
| [flutter-animating-apps](skills/flutter-animating-apps/SKILL.md) | Implements animated effects, transitions, and motion in a Flutter app. Use when adding visual feedback, shared element transitions, or physics-based animations. |
| [flutter-app-runtime](skills/flutter-app-runtime/SKILL.md) | Interacts with running Dart and Flutter applications via the Dart MCP server to enable hot reload, hot restart, widget inspection, and error fetching. Use when modifying UI widgets, debugging errors, or inspecting running apps. Hot reload or hot restart should also be triggered automatically after every single widget UI change. |
| [flutter-architecting-apps](skills/flutter-architecting-apps/SKILL.md) | Architects a Flutter application using the recommended layered approach (UI, Logic, Data). Use when structuring a new project or refactoring for scalability. |
| [flutter-building-forms](skills/flutter-building-forms/SKILL.md) | Builds Flutter forms with validation and user input handling. Use when creating login screens, data entry forms, or any multi-field user input. |
| [flutter-building-layouts](skills/flutter-building-layouts/SKILL.md) | Builds Flutter layouts using the constraint system and layout widgets. Use when creating or refining the UI structure of a Flutter application. |
Expand All @@ -40,6 +41,7 @@ npx skills update flutter/skills
| [flutter-localizing-apps](skills/flutter-localizing-apps/SKILL.md) | Configures a Flutter app to support multiple languages and regions. Use when preparing an application for international markets and diverse user locales. |
| [flutter-managing-state](skills/flutter-managing-state/SKILL.md) | Manages application and ephemeral state in a Flutter app. Use when sharing data between widgets or handling complex UI state transitions. |
| [flutter-reducing-app-size](skills/flutter-reducing-app-size/SKILL.md) | Measures and optimizes the size of Flutter application bundles for deployment. Use when minimizing download size or meeting app store package constraints. |
| [flutter-setting-up-mcp](skills/flutter-setting-up-mcp/SKILL.md) | Sets up the Dart and Flutter MCP server to enable AI assistants to interact with Dart and Flutter tools. Use when configuring an MCP client (like Antigravity, Claude Code, or Cursor) to use the Dart and Flutter MCP server. |
| [flutter-setting-up-on-linux](skills/flutter-setting-up-on-linux/SKILL.md) | Sets up a Linux environment for Flutter development. Use when configuring a Linux machine to run, build, or deploy Flutter applications. |
| [flutter-setting-up-on-macos](skills/flutter-setting-up-on-macos/SKILL.md) | Sets up a macOS environment for Flutter development. Use when configuring a macOS machine to run, build, or deploy Flutter applications for iOS or macOS. |
| [flutter-setting-up-on-windows](skills/flutter-setting-up-on-windows/SKILL.md) | Sets up a Windows environment for Flutter development. Use when configuring a Windows machine to run, build, or deploy Flutter applications for Windows desktop or Android. |
Expand Down
83 changes: 82 additions & 1 deletion resources/flutter_skills.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1441,4 +1441,85 @@
rendering Flutter widgets as images for display in the native widget UI.
resources:
- https://codelabs.developers.google.com/flutter-home-screen-widgets#0
- https://pub.dev/packages/home_widget
- https://pub.dev/packages/home_widget
- name: flutter-app-runtime
description: Interacts with running Dart and Flutter applications via the Dart MCP server to enable hot reload, hot restart, widget inspection, and error fetching. Use when modifying UI widgets, debugging errors, or inspecting running apps. Hot reload or hot restart should also be triggered automatically after every single widget UI change.

instructions: |
This skill enables zero-configuration interaction with running Dart and Flutter
applications. The Dart MCP server manages the underlying connection to the
application's VM service, allowing the agent to focus on high-level runtime
operations.

Pre-requisite:
The Dart and Flutter MCP server must be configured and active. If it is not,
refer to the `flutter-setting-up-mcp` skill for setup instructions.


Core capabilities include:
- Hot Reload: Fast feedback loop for UI updates and simple logic changes.
- Hot Restart: Reset the app state for deep non-widget changes or clean resets.
- Widget Inspection: Query tree structures and identify UI hierarchy names.
- Error Fetching: Retrieve live runtime exceptions and trace pointers live.

Decision workflow:
1. Identify Targets: Use the Dart MCP server to list all active application
instances in the current workspace. Connect to all relevant apps to maintain
synchronized updates across platforms.
2. Verify Connection: Ensure the required appUri or device identifier is
active and matches the project's workspace. Re-sync if necessary.
3. Perform Automated Ops: Trigger hot_reload across all targeted instances for
visual consistency. For diagnosis, query live logs with get_runtime_errors
first. Use hot_restart to reset state across all devices when debugging
foundational logic.

Sample scenarios include autonomous bug fixing by fetching exceptions,
inspecting and modifying UI using the widget inspector, and multi-device
synchronization for global changes like themes.
resources:
- https://docs.flutter.dev/ai/mcp-server
- name: flutter-setting-up-mcp
description: Sets up the Dart and Flutter MCP server to enable AI assistants to interact with Dart and Flutter tools. Use when configuring an MCP client (like Antigravity, Claude Code, or Cursor) to use the Dart and Flutter MCP server.
instructions: |
The Dart and Flutter MCP server allows AI assistants to analyze code,
interact with running applications, and manage dependencies.

Before proceeding with setup, determine if the MCP server is already
configured and active. If your current environment already provides access
to tools like `analyze_code`, `hot_reload`, or `get_runtime_errors`, the
server is likely already running. Only follow these setup instructions if
these tools are unavailable or if you are specifically asked to configure
a new environment.

General Setup:
The server is started using the `dart mcp-server` command. Some clients may
require the `--force-roots-fallback` flag if they do not correctly set project
roots.

Antigravity Setup:
1. Open the Agent side panel (Cmd/Ctrl + L).
2. Click the Additional options (...) menu and select "MCP Servers".
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

How will the agent click on these options?

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.

The agent can't in VS Code or AGY to the best of my knowledge, these steps are articulated back to the user to do.

3. Click "Manage MCP Servers".
4. You can search for "Dart" in the list and click "Install", or "View raw
config" and add:
```json
"dart-mcp-server": {
"command": "dart",
"args": ["mcp-server"],
"env": {}
}
```

Claude Code Setup:
Run the following command in your terminal:
`claude mcp add --transport stdio dart -- dart mcp-server`

Codex CLI Setup:
Run the following command in your terminal:
`codex mcp add dart -- dart mcp-server --force-roots-fallback`

Cursor / VS Code / Other Clients:
Configure a new MCP server with the command `dart` and the argument
`mcp-server`. Ensure the Dart SDK is in your system PATH.
resources:
- https://docs.flutter.dev/ai/mcp-server
74 changes: 74 additions & 0 deletions skills/flutter-app-runtime/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
name: "flutter-app-runtime"
description: "Interacts with running Dart and Flutter applications via the Dart MCP server to enable hot reload, hot restart, widget inspection, and error fetching. Use when modifying UI widgets, debugging errors, or inspecting running apps. Hot reload or hot restart should also be triggered automatically after every single widget UI change."
metadata:
model: "models/gemini-3.1-pro-preview"
last_modified: "Wed, 18 Mar 2026 21:51:38 GMT"

---
# Interacting with Dart and Flutter Applications via MCP

## Contents
- [Prerequisites](#prerequisites)
- [Core Capabilities](#core-capabilities)
- [Workflow: Target Identification and Connection](#workflow-target-identification-and-connection)
- [Workflow: Automated Operations and Debugging](#workflow-automated-operations-and-debugging)
- [Workflow: Adding New Functionality](#workflow-adding-new-functionality)
- [Examples](#examples)

## Prerequisites
Ensure the Dart and Flutter MCP server is configured and active. If it is inactive or missing, immediately refer to the `flutter-setting-up-mcp` skill for setup instructions before proceeding.

## Core Capabilities
Leverage the Dart MCP server to manage the underlying connection to the application's VM service. This enables zero-configuration interaction with running applications.
- **Hot Reload:** Execute for fast feedback loops on UI updates and simple logic changes.
- **Hot Restart:** Execute to reset the app state for deep non-widget changes or clean resets.
- **Widget Inspection:** Query tree structures and identify UI hierarchy names.
- **Error Fetching:** Retrieve live runtime exceptions and trace pointers live.
- **Package Management:** Search pub.dev and manage dependencies directly.

## Workflow: Target Identification and Connection
Follow this sequence to establish and verify connections to running instances before attempting any runtime operations.

**Task Progress:**
- [ ] List all active application instances in the current workspace using the Dart MCP server.
- [ ] Connect to all relevant apps to maintain synchronized updates across platforms.
- [ ] Verify the required `appUri` or device identifier is active and matches the project's workspace.
- [ ] Re-sync the connection if the identifier mismatches or drops.

## Workflow: Automated Operations and Debugging
Apply conditional logic based on the type of modification or error encountered to maintain application stability.

**Task Progress:**
- [ ] **If diagnosing an issue:** Query live logs using `get_runtime_errors` first to establish context.
- [ ] **If modifying UI/Visuals:** Trigger `hot_reload` across all targeted instances for visual consistency.
- [ ] **If modifying foundational logic or deep state:** Trigger `hot_restart` to reset state across all devices.
- [ ] Run validator -> review errors -> fix any newly introduced runtime exceptions.

## Workflow: Adding New Functionality
Execute this workflow when tasked with adding new features (e.g., charts, maps) that require external packages.

**Task Progress:**
- [ ] Execute `pub_dev_search` to find highly-rated and suitable packages for the requirement.
- [ ] Add the selected package as a dependency to `pubspec.yaml`.
- [ ] Generate the required widget code and integrate it into the UI.
- [ ] Trigger `hot_reload`.
- [ ] Run validator -> review errors -> fix any syntax or integration issues.

## Examples

### Scenario: Fixing a RenderFlex Overflow
**Trigger:** The application encounters a runtime layout error (e.g., yellow-and-black stripes).
**Action Sequence:**
1. Execute `get_runtime_errors` to fetch the live exception details.
2. Inspect the Flutter widget tree using Widget Inspection tools to understand the layout constraints causing the overflow.
3. Apply the layout fix (e.g., wrapping a widget in `Expanded` or `Flexible`).
4. Trigger `hot_reload`.
5. Execute `get_runtime_errors` again to verify the issue is resolved.

### Scenario: Multi-Device Synchronization
**Trigger:** Applying a global change, such as modifying the application theme.
**Action Sequence:**
1. Identify all active `appUri` targets (e.g., iOS simulator, Android emulator, Web instance).
2. Apply the theme modification in the Dart code.
3. Trigger `hot_reload` across *all* connected instances simultaneously to ensure visual consistency across platforms.
110 changes: 110 additions & 0 deletions skills/flutter-setting-up-mcp/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
---
name: "flutter-setting-up-mcp"
description: "Sets up the Dart and Flutter MCP server to enable AI assistants to interact with Dart and Flutter tools. Use when configuring an MCP client (like Antigravity, Claude Code, or Cursor) to use the Dart and Flutter MCP server."
metadata:
model: "models/gemini-3.1-pro-preview"
last_modified: "Wed, 18 Mar 2026 21:47:27 GMT"

---
# Configuring the Dart and Flutter MCP Server

## Contents
- [Prerequisites & Environment Check](#prerequisites--environment-check)
- [Client Configuration Workflows](#client-configuration-workflows)
- [Usage Workflows](#usage-workflows)
- [Examples](#examples)

## Prerequisites & Environment Check

Before initiating any setup procedures, verify the current environment state to prevent redundant configurations. The Dart and Flutter MCP server exposes specific tools to the agent environment.

**Conditional Setup Logic:**
1. Check available tools in your current environment for `analyze_code`, `hot_reload`, or `get_runtime_errors`.
2. **If** these tools are present, the MCP server is already active. **Do not** proceed with setup instructions unless explicitly instructed to configure a new environment.
3. **If** these tools are unavailable, proceed to the [Client Configuration Workflows](#client-configuration-workflows).

*Note: The base command to start the server is `dart mcp-server`. Append the `--force-roots-fallback` flag if the target client does not correctly set project roots.*

## Client Configuration Workflows

Execute the appropriate configuration workflow based on the active client environment.

### Antigravity Configuration
1. Open the Agent side panel (Cmd/Ctrl + L).
2. Click the Additional options (`...`) menu and select **MCP Servers**.
3. Click **Manage MCP Servers**.
4. **If** using the UI: Search for "Dart" and click **Install**.
5. **If** using raw configuration: Click **View raw config** and append the following JSON:
```json
"dart-mcp-server": {
"command": "dart",
"args": ["mcp-server"],
"env": {}
}
```

### Claude Code Configuration
Run the following command in the terminal to attach the server via stdio:
```bash
claude mcp add --transport stdio dart -- dart mcp-server
```

### Codex CLI Configuration
Run the following command in the terminal (includes the roots fallback flag):
```bash
codex mcp add dart -- dart mcp-server --force-roots-fallback
```

### Cursor / VS Code / Generic Clients
Configure the MCP server manually in the client's respective `mcp.json` or settings UI. Ensure the Dart SDK is in the system `PATH`.
```json
"dart": {
"command": "dart",
"args": ["mcp-server"]
}
```

## Usage Workflows

Utilize the following sequential workflows to interact with the Dart and Flutter MCP server effectively. Copy the checklists to track progress during complex tasks.

### Workflow: Resolving Runtime Layout Errors
Use this feedback loop when encountering UI overflow or RenderFlex errors.

- [ ] **Step 1: Retrieve Errors.** Execute the tool to fetch current runtime errors from the active application.
- [ ] **Step 2: Inspect Widget Tree.** Access the Flutter widget tree to isolate the node causing the layout constraint violation.
- [ ] **Step 3: Apply Fix.** Modify the Dart code to correct the constraint (e.g., wrapping in `Expanded`, `Flexible`, or adjusting `SizedBox` dimensions).
- [ ] **Step 4: Verify.** Trigger a hot reload and re-run the runtime error check.
- [ ] **Step 5: Feedback Loop.** If errors persist, return to Step 2. Otherwise, conclude the task.

### Workflow: Implementing New Package Functionality
Use this workflow when a feature requires an external dependency.

- [ ] **Step 1: Search.** Execute the `pub_dev_search` tool with specific keywords (e.g., "line chart").
- [ ] **Step 2: Evaluate.** Review the search results for high popularity and compatibility.
- [ ] **Step 3: Install.** Use the dependency management tool to add the selected package to `pubspec.yaml`.
- [ ] **Step 4: Implement.** Generate the required boilerplate and integrate the package into the target widget.
- [ ] **Step 5: Validate.** Run static analysis to ensure no syntax errors were introduced.

## Examples

### Example: Prompting for Layout Fixes
When acting on user requests to fix UI issues, translate vague requests into targeted tool executions.

**User Input:**
> "The app has yellow and black stripes on the settings screen."

**Agent Action Sequence:**
1. Execute `get_runtime_errors` to capture the exact RenderFlex exception.
2. Execute code analysis on `settings_screen.dart`.
3. Apply the fix and trigger `hot_reload`.

### Example: Prompting for Package Integration
**User Input:**
> "Find a suitable package to add a line chart that maps the number of button presses over time."

**Agent Action Sequence:**
1. Execute `pub_dev_search` with query `"chart"`.
2. Identify `fl_chart` as the optimal candidate.
3. Add `fl_chart` to dependencies.
4. Write the implementation code using `LineChart` from the package.
Loading