ai-dashboad

flutter-skill

0
0
# Install this skill:
npx skills add ai-dashboad/flutter-skill

Or install specific skill: npx add-skill https://github.com/ai-dashboad/flutter-skill

# Description

Controls a running Flutter application via Dart VM Service. Allows inspecting widgets, performing gestures, validating state, taking screenshots, and debugging.

# SKILL.md


description: Controls a running Flutter application via Dart VM Service. Allows inspecting widgets, performing gestures, validating state, taking screenshots, and debugging.

Flutter Skill

This skill allows AI Agents to interact with a running Flutter application for feature verification, UI debugging, and automated testing. It connects to the Dart VM Service and provides 25+ tools for comprehensive app control.

Quick Start

1. Launch & Auto-Setup

The easiest way to start - automatically adds dependencies and patches your app:

flutter_skill launch <project_path>

Or run directly:

dart run bin/flutter_skill.dart launch <project_path>

This will:
- Add flutter_skill dependency if missing
- Inject FlutterSkillBinding.ensureInitialized() into main.dart
- Run flutter run and capture the VM Service URI
- Save URI to .flutter_skill_uri for subsequent commands

2. Interact

Once launched, use CLI commands or MCP tools:

CLI Mode:

flutter_skill inspect
flutter_skill act tap "login_button"
flutter_skill act enter_text "email_field" "[email protected]"
flutter_skill screenshot ./screenshot.png

MCP Mode:
Configure your editor to use the MCP server, then tools are available to the Agent.


MCP Server Configuration

Add to your MCP config (Cursor, Windsurf, Claude Desktop):

{
  "flutter-skill": {
    "command": "dart",
    "args": ["run", "/path/to/flutter-skill/bin/server.dart"]
  }
}

Complete Tool Reference

Connection

Tool Description Parameters
connect_app Connect to running app uri (WebSocket URI)
launch_app Launch app with auto-setup project_path, device_id (optional)

UI Inspection

Tool Description Parameters
inspect Get interactive elements -
get_widget_tree Full widget tree depth (optional, default: 10)
get_widget_properties Widget details key
get_text_content All visible text -
find_by_type Find widgets by type type (e.g., "ElevatedButton")

Interactions

Tool Description Parameters
tap Tap element key or text
double_tap Double tap key or text
long_press Long press key or text
swipe Swipe gesture direction (up/down/left/right), distance, key (optional)
drag Drag between elements from_key, to_key
scroll_to Scroll element into view key or text
enter_text Input text key, text

State & Validation

Tool Description Parameters
get_text_value Get text field value key
get_checkbox_state Get checkbox state key
get_slider_value Get slider value key
wait_for_element Wait for element key or text, timeout (ms)
wait_for_gone Wait for element gone key or text, timeout (ms)

Screenshot

Tool Description Parameters
screenshot Full app screenshot - (returns base64 PNG)
screenshot_element Element screenshot key (returns base64 PNG)
Tool Description Parameters
get_current_route Current route name -
get_navigation_stack Navigation history -
go_back Navigate back -

Debug & Logs

Tool Description Parameters
get_logs Application logs -
get_errors Error messages -
get_performance Performance metrics -
clear_logs Clear log buffer -

Development

Tool Description Parameters
hot_reload Trigger hot reload -
pub_search Search pub.dev query

Usage Examples

Example 1: Verify Counter App

# 1. Launch the app
flutter_skill launch ./my_counter_app

# 2. Inspect to find elements
flutter_skill inspect

# 3. Tap increment button
flutter_skill act tap "increment_button"

# 4. Verify counter changed
flutter_skill inspect

Example 2: Test Login Flow

# Enter credentials
flutter_skill act enter_text "email_field" "[email protected]"
flutter_skill act enter_text "password_field" "secret123"

# Tap login button
flutter_skill act tap "login_button"

# Wait for home screen
flutter_skill act wait_for "home_screen" 5000

# Verify navigation
flutter_skill act get_current_route

Example 3: Test Scrollable List

# Swipe up to scroll
flutter_skill act swipe up 300 "list_view"

# Or scroll to specific item
flutter_skill act scroll_to "item_50"

# Take screenshot
flutter_skill screenshot ./list_screenshot.png

Example 4: Debug Issues

# Check for errors
flutter_skill logs errors

# Get performance info
flutter_skill logs performance

# View all logs
flutter_skill logs

Widget Keys Best Practice

For reliable element identification, add ValueKey to widgets:

ElevatedButton(
  key: const ValueKey('submit_button'),
  onPressed: _submit,
  child: const Text('Submit'),
)

TextField(
  key: const ValueKey('email_input'),
  controller: _emailController,
)

Elements can be found by:
1. Key (most reliable): "submit_button"
2. Text content: "Submit"
3. Widget type: "ElevatedButton"


Manual Setup (If Needed)

Usually not required - launch handles this automatically.

pubspec.yaml:

dependencies:
  flutter_skill:
    path: /path/to/flutter-skill

main.dart:

import 'package:flutter_skill/flutter_skill.dart';
import 'package:flutter/foundation.dart';

void main() {
  if (kDebugMode) {
    FlutterSkillBinding.ensureInitialized();
  }
  runApp(const MyApp());
}

# README.md

Flutter Skill

Give your AI Agent eyes and hands inside your Flutter app.

Version
License
Dart
Platform

Flutter Skill is a bridge that connects AI Agents (like Claude Code, Cursor, Windsurf) directly to a running Flutter application. It creates a bi-directional control channel allowing agents to:

  • Inspect the UI structure (Widget Tree, Text Content, Element Properties)
  • Act on widgets (Tap, Double Tap, Long Press, Swipe, Drag, Scroll, Enter Text)
  • Validate state (Text Values, Checkbox State, Wait for Elements)
  • Capture screenshots (Full App or Specific Elements)
  • Navigate (Get Routes, Go Back, View Navigation Stack)
  • Debug (View Logs, Errors, Performance Metrics)
  • Zero Config setup (Auto-injects dependencies)

Features

UI Inspection

Tool Description
inspect Get interactive elements (buttons, text fields, etc.)
get_widget_tree Get the full widget tree structure with depth control
get_widget_properties Get detailed properties of a widget (size, position, visibility)
get_text_content Extract all visible text from the screen
find_by_type Find all widgets of a specific type (e.g., ElevatedButton)

Interactions

Tool Description
tap Tap a widget by Key or Text
double_tap Double tap a widget
long_press Long press a widget
swipe Swipe gesture (up/down/left/right) globally or on element
drag Drag from one element to another
scroll_to Scroll to make an element visible
enter_text Enter text into a text field

State & Validation

Tool Description
get_text_value Get current value of a text field
get_checkbox_state Get checked state of a checkbox
get_slider_value Get current value of a slider
wait_for_element Wait for an element to appear (with timeout)
wait_for_gone Wait for an element to disappear (with timeout)

Screenshot

Tool Description
screenshot Capture full app screenshot (returns base64 PNG)
screenshot_element Capture screenshot of a specific element
Tool Description
get_current_route Get current route name
get_navigation_stack Get navigation history
go_back Navigate back to previous screen

Debug & Logs

Tool Description
get_logs Fetch application logs
get_errors Get error messages
get_performance Get performance metrics
clear_logs Clear the log buffer

Development Tools

Tool Description
hot_reload Trigger hot reload
pub_search Search packages on pub.dev

Architecture

graph TD
    Agent[AI Agent]
    subgraph "Flutter Skill Layer"
        CLI[flutter_skill CLI]
        MCP[flutter_skill MCP Server]
    end
    subgraph "Target App"
        App[Flutter App]
        VM[Dart VM Service]
    end

    Agent <-->|MCP / JSON-RPC| MCP
    Agent <-->|Shell| CLI
    CLI -->|Auto-Patch| App
    CLI <-->|Capture URI| VM
    MCP <-->|WebSocket| VM
    VM <-->|Extensions| App

Installation

Choose your preferred method:

dart pub global activate flutter_skill

Option 2: Homebrew (macOS)

brew tap ai-dashboad/flutter-skill
brew install flutter-skill

Option 3: From Source

git clone https://github.com/ai-dashboad/flutter-skill.git
cd flutter-skill
dart pub global activate --source path .

Quick Start

You don't need to manually edit your code. The skill handles it for you.

1. Launch with Auto-Setup

# Launch your Flutter project
flutter_skill launch /path/to/your/flutter_project

What happens automatically:
1. Checks for flutter_skill dependency. If missing, adds it.
2. Checks main.dart for initialization. If missing, injects FlutterSkillBinding.ensureInitialized().
3. Runs flutter run.
4. Captures the VM Service URI and saves it to .flutter_skill_uri.

3. Let the Agent Take Over

CLI Mode (Claude Code):

# Inspect the screen
flutter_skill inspect

# Tap a button
flutter_skill act tap "login_button"

# Enter text
flutter_skill act enter_text "email_field" "[email protected]"

# Take screenshot
flutter_skill screenshot ./screenshot.png

MCP Mode (Cursor/Windsurf/Claude Desktop):

Add to your MCP configuration:

{
  "flutter-skill": {
    "command": "flutter-skill",
    "args": ["server"]
  }
}

Alternative configurations:

// If installed via Homebrew
{
  "flutter-skill": {
    "command": "flutter-skill-mcp"
  }
}

// If running from source
{
  "flutter-skill": {
    "command": "dart",
    "args": ["run", "/path/to/flutter-skill/bin/server.dart"]
  }
}

Then tools like connect_app, inspect, tap, screenshot become available to the Agent.


CLI Commands

# Launch app with auto-setup
flutter_skill launch <project_path> [-d <device>]

# Connect to running app
flutter_skill connect <vm_service_uri>

# Inspect UI elements
flutter_skill inspect

# Perform actions
flutter_skill act tap <key_or_text>
flutter_skill act enter_text <key> "text value"
flutter_skill act scroll_to <key_or_text>

# Take screenshot
flutter_skill screenshot [output_path]

# Start MCP server
flutter_skill server

Target App Setup (Manual)

Usually not needed - the launch command handles this automatically.

pubspec.yaml:

dependencies:
  flutter_skill:
    path: /path/to/flutter-skill

main.dart:

import 'package:flutter_skill/flutter_skill.dart';
import 'package:flutter/foundation.dart';

void main() {
  if (kDebugMode) {
    FlutterSkillBinding.ensureInitialized();
  }
  runApp(const MyApp());
}

Widget Keys

For reliable element identification, add ValueKey to your widgets:

ElevatedButton(
  key: const ValueKey('login_button'),
  onPressed: () {},
  child: const Text('Login'),
)

The skill can find elements by:
1. Key (most reliable): tap "login_button"
2. Text content: tap "Login"
3. Widget type: find_by_type "ElevatedButton"


IDE Extensions

VSCode Extension

Download from GitHub Releases and install manually:
- Download flutter-skill-0.2.0.vsix
- Run: code --install-extension flutter-skill-0.2.0.vsix

IntelliJ/Android Studio Plugin

Download from GitHub Releases and install manually:
- Download flutter-skill-intellij-0.2.0.zip
- In IDE: Settings → Plugins → ⚙ → Install Plugin from Disk


Development & Testing

# Run integration tests against mock app
dart run test/integration_test.dart

# Run the test app
cd test_dummy && flutter run -d macos

License

MIT

# Supported AI Coding Agents

This skill is compatible with the SKILL.md standard and works with all major AI coding agents:

Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.