🚀 flutter-skill
flutter-skill 可以讓任何 AI 智能體在運行的應用程序中擁有視覺和交互能力。它支持 10 個平臺,無需編寫測試代碼,僅需一個 MCP 服務器即可。
🚀 快速開始
1. 安裝(30 秒)
npm install -g flutter-skill
2. 添加到你的 AI(複製粘貼到 MCP 配置中)
{
"mcpServers": {
"flutter-skill": {
"command": "flutter-skill",
"args": ["server"]
}
}
}
支持 Claude Desktop、Cursor、Windsurf、Copilot、Cline、OpenClaw 等任何兼容 MCP 的智能體。
3. 添加到你的應用(Flutter 只需 2 行代碼)
import 'package:flutter_skill/flutter_skill.dart';
void main() {
if (kDebugMode) FlutterSkillBinding.ensureInitialized();
runApp(MyApp());
}
4. 測試 — 直接與你的 AI 對話
"啟動我的應用,探索每個屏幕,並報告任何錯誤"
就是這麼簡單。無需配置,無需測試代碼,整個過程在 60 秒內完成。
📦 更多安裝方法(Homebrew、Scoop、Docker、IDE、智能體技能)
| 方法 |
命令 |
| npm |
npm install -g flutter-skill |
| Homebrew |
brew install ai-dashboad/flutter-skill/flutter-skill |
| Scoop |
scoop install flutter-skill |
| Docker |
docker pull ghcr.io/ai-dashboad/flutter-skill |
| pub.dev |
dart pub global activate flutter_skill |
| VSCode |
擴展 → "Flutter Skill" |
| JetBrains |
插件 → "Flutter Skill" |
| 智能體技能 |
npx skills add ai-dashboad/flutter-skill |
| 零配置 |
flutter-skill init(自動檢測並修補你的應用) |
✨ 主要特性
- 連接任意 AI 智能體:通過 MCP 直接將任何 AI 智能體(Claude、Cursor、Windsurf、Copilot、OpenClaw 等)連接到你正在運行的應用程序。
- 智能體可查看屏幕:智能體可以像不知疲倦的人類測試人員一樣,點擊按鈕、輸入文本、滾動頁面和導航。
- 無需測試代碼:無需使用 Page Objects、XPath 或脆弱的選擇器,只需用普通英語描述測試任務。
- 零配置:只需兩行代碼,即可在所有 10 個平臺上運行。
💻 使用示例
基礎用法
flutter-skill explore https://my-app.com --depth=3
flutter-skill monkey https://my-app.com --actions=100 --seed=42
flutter-skill test --url https://my-app.com --platforms web,electron,android
flutter-skill serve https://my-app.com
高級用法
{"actions": [
{"type": "fill", "target": "input:Coupon Code", "value": "SAVE20"},
{"type": "tap", "target": "button:Apply"},
{"type": "tap", "target": "button:Checkout"},
{"type": "fill", "target": "input:Email", "value": "test@example.com"},
{"type": "tap", "target": "button:Continue"}
]}
📚 詳細文檔
與 AI 平臺結合使用
MCP 服務器模式(IDE 集成)
適用於任何兼容 MCP 的 AI 工具,只需一行配置:
{
"mcpServers": {
"flutter-skill": {
"command": "flutter-skill",
"args": ["server"]
}
}
}
| 平臺 |
配置文件 |
狀態 |
| Cursor |
.cursor/mcp.json |
✅ |
| Claude Desktop |
claude_desktop_config.json |
✅ |
| Windsurf |
~/.codeium/windsurf/mcp_config.json |
✅ |
| VSCode Copilot |
.vscode/mcp.json |
✅ |
| Cline |
VSCode 設置 → Cline → MCP |
✅ |
| OpenClaw |
技能或 MCP 配置 |
✅ |
| Continue.dev |
.continue/config.json |
✅ |
HTTP 服務模式(CLI 和自動化)
適用於獨立的瀏覽器自動化、CI/CD 管道或遠程訪問:
flutter-skill serve https://your-app.com
flutter-skill nav https://google.com
flutter-skill snap
flutter-skill screenshot /tmp/ss.jpg
flutter-skill tap "Login"
flutter-skill type "hello@example.com"
flutter-skill eval "document.title"
flutter-skill tools
| 命令 |
描述 |
nav <url> |
導航到 URL |
snap |
可訪問性樹快照 |
screenshot [path] |
截圖 |
tap <text|ref|x y> |
點擊元素 |
type <text> |
通過鍵盤輸入文本 |
key <key> [mod] |
按下按鍵 |
eval <js> |
執行 JavaScript |
title |
獲取頁面標題 |
text |
獲取可見文本 |
hover <text> |
懸停在元素上 |
upload <sel> <file> |
上傳文件 |
tools |
列出工具 |
call <tool> [json] |
調用任何工具 |
支持 --port=N、--host=H 標誌以及 FS_PORT/FS_HOST 環境變量。
兩種模式對比
|
server(MCP stdio) |
serve(HTTP) |
| 用例 |
IDE / AI 智能體集成 |
CLI / 自動化 / CI/CD |
| 協議 |
MCP(通過 stdio 的 JSON-RPC) |
HTTP REST |
| 工具 |
253(每頁動態變化) |
246(通用) |
| 瀏覽器 |
自動啟動 Chrome |
連接到現有的 Chrome |
| 最適合 |
Cursor、Claude、VSCode |
OpenClaw、腳本、管道 |
完整的 CLI 客戶端參考:docs/CLI_CLIENT.md
支持 10 個平臺
大多數測試工具僅支持 1 - 2 個平臺,而 flutter-skill 支持 10 個平臺:
| 平臺 |
SDK |
測試得分 |
| Flutter (iOS/Android/Web) |
flutter_skill |
✅ 188/195 |
| React Native |
|
✅ 75/75 |
| Electron |
|
✅ 75/75 |
| Tauri (Rust) |
|
✅ 75/75 |
| Android (Kotlin) |
|
✅ 74/75 |
| KMP Desktop |
|
✅ 75/75 |
| .NET MAUI |
|
✅ 75/75 |
| iOS (Swift/UIKit) |
|
✅ 19/19 |
| Web (任何網站) |
|
✅ |
| Web CDP (零配置) |
無需 SDK |
✅ 141/156 |
總計:656/664 個測試通過(98.8%)——每個平臺都針對一個包含 50 多個元素的複雜社交媒體應用進行了測試。
性能表現
針對複雜社交媒體應用的自動化測試運行的真實基準測試結果:
| 操作 |
Web (CDP) |
Electron |
Android |
connect |
93 ms |
55 ms |
103 ms |
tap |
1 ms |
1 ms |
2 ms |
enter_text |
1 ms |
1 ms |
2 ms |
inspect |
3 ms |
12 ms |
10 ms |
snapshot |
2 ms |
8 ms |
29 ms |
screenshot |
31 ms |
80 ms |
88 ms |
eval |
1 ms |
— |
— |
令牌效率:snapshot() 返回結構化的元素樹,而不是圖像,與向 AI 智能體發送截圖相比,減少 87 - 99% 的令牌。
速度有多快:一次 tap 操作的端到端時間僅為 1 - 2 毫秒。像 Playwright 和 Selenium 這樣的瀏覽器自動化工具通常需要 50 - 100 毫秒才能完成相同的操作。這意味著 flutter-skill 快 50 - 100 倍,因為它直接與應用程序運行時通信,而無需通過 WebDriver 或 CDP 間接通信。
複雜 DOM 網站(真實世界場景)
對 15 個 MCP 工具在生產網站上進行了測試,75/75 通過,無超時情況:
| 網站 |
工具 |
總時間 |
snapshot |
screenshot |
count_elements |
| YouTube |
15/15 ✅ |
6.9s |
43 ms |
30 ms |
4 ms |
| Amazon |
15/15 ✅ |
14.2s |
1 ms |
5 ms |
2 ms |
| Reddit |
15/15 ✅ |
17.9s |
6 ms |
32 ms |
51 ms |
| Hacker News |
15/15 ✅ |
4.8s |
53 ms |
188 ms |
1 ms |
| Wikipedia |
15/15 ✅ |
7.8s |
15 ms |
336 ms |
1 ms |
總時間包括頁面加載時間。即使在複雜 DOM 網站上,工具執行時間也始終低於 100 毫秒。
與其他工具對比
|
flutter-skill |
Playwright MCP |
Appium |
Detox |
| MCP 工具 |
253 |
~33 |
❌ |
❌ |
| 平臺 |
10 |
1 (web) |
移動 |
React Native |
| 設置時間 |
30 秒 |
幾分鐘 |
幾小時 |
幾小時 |
| 需要測試代碼 |
❌ 無需 |
✅ 需要 |
✅ 需要 |
✅ 需要 |
| 原生支持 AI (MCP) |
✅ |
✅ |
❌ |
❌ |
| 自修複測試 |
✅ |
❌ |
❌ |
❌ |
| 猴子/模糊測試 |
✅ |
❌ |
❌ |
❌ |
| 視覺迴歸測試 |
✅ |
❌ |
❌ |
❌ |
| 網絡模擬/重放 |
✅ |
❌ |
❌ |
❌ |
| API + UI 測試 |
✅ |
❌ |
❌ |
❌ |
| 多設備同步 |
✅ |
❌ |
部分支持 |
❌ |
| 可訪問性審計 |
✅ |
❌ |
❌ |
❌ |
| 國際化測試 |
✅ |
❌ |
❌ |
❌ |
| 性能監控 |
✅ |
❌ |
❌ |
❌ |
| 自然語言支持 |
✅ |
❌ |
❌ |
❌ |
| Flutter 支持 |
✅ 原生支持 |
部分支持 |
部分支持 |
❌ |
| 桌面應用支持 |
✅ |
✅ |
❌ |
❌ |
| AI 頁面理解 |
✅ 可訪問性樹 |
❌ 截圖 |
❌ |
❌ |
| 邊界/安全測試 |
✅ 13 種有效負載 |
❌ |
❌ |
❌ |
| 批量操作 |
✅ 每次調用 5 個以上操作 |
每次調用 1 個操作 |
每次調用 1 個操作 |
每次調用 1 個操作 |
flutter-skill 是唯一一款跨移動、Web 和桌面平臺的原生 AI 端到端測試工具,其工具數量是最接近的競爭對手的 7 倍。
支持的操作
查看
screenshot — 捕獲屏幕
inspect_interactive — 獲取所有可點擊/可輸入元素及其語義引用
find_element / wait_for_element
get_elements — 獲取完整的元素樹
交互
tap / long_press / swipe / drag
enter_text / set_text / clear_text
scroll — 支持所有方向滾動
go_back / press_key
檢查(v0.8.0)
- 語義引用:
button:Login, input:Email
- 在 UI 更改時保持穩定
tap(ref: "button:Submit")
- 支持 7 種角色:按鈕、輸入框、開關、滑塊、選擇框、鏈接、項目
控制
launch_app — 以不同的版本啟動應用
hot_reload / hot_restart
get_logs / get_errors
scan_and_connect — 自動查找應用
253 個工具 — 完整參考
AI 探索:page_summary, explore_actions, boundary_test, explore_report
啟動與連接:launch_app, scan_and_connect, connect_cdp, hot_reload, hot_restart, list_sessions, switch_session, close_session, disconnect, stop_app
屏幕操作:screenshot, screenshot_region, screenshot_element, native_screenshot, inspect, inspect_interactive, snapshot, get_widget_tree, find_by_type, get_text_content, get_visible_text
交互操作:tap, double_tap, long_press, enter_text, set_text, clear_text, swipe, scroll_to, drag, go_back, press_key, type_text, hover, fill, select_option, set_checkbox, focus, blur, native_tap, native_input_text, native_swipe
智能測試:smart_tap, smart_enter_text, smart_assert(通過模糊匹配實現自修復)
斷言操作:assert_text, assert_visible, assert_not_visible, assert_element_count, assert_batch, wait_for_element, wait_for_gone, wait_for_idle, wait_for_stable, wait_for_url, wait_for_text, wait_for_element_count
視覺迴歸測試:visual_baseline_save, visual_baseline_compare, visual_baseline_update, visual_regression_report, visual_verify, visual_diff, compare_screenshot
網絡模擬:mock_api, mock_clear, record_network, replay_network, intercept_requests, clear_interceptions, block_urls, http_request
API 測試:api_request, api_assert
覆蓋與可靠性測試:coverage_start, coverage_stop, coverage_report, coverage_gaps, retry_on_fail, stability_check
數據驅動測試:test_with_data, generate_test_data
多設備測試:multi_connect, multi_action, multi_compare, multi_disconnect, parallel_snapshot, parallel_tap
可訪問性測試:accessibility_audit, a11y_full_audit, a11y_tab_order, a11y_color_contrast, a11y_screen_reader
國際化測試:set_locale, verify_translations, i18n_snapshot
性能測試:perf_start, perf_stop, perf_report, get_performance, get_frame_stats, get_memory_stats
會話管理:save_session, restore_session, session_diff
錄製與導出:record_start, record_stop, record_export(支持 Playwright、Cypress、XCUITest、Espresso、Detox、Maestro 等 5 種以上格式), video_start, video_stop
認證操作:auth_inject_session, auth_biometric, auth_otp, auth_deeplink
CDP 瀏覽器操作:navigate, reload, go_forward, get_title, get_page_source, eval, get_tabs, new_tab, switch_tab, close_tab, get_cookies, set_cookie, clear_cookies, get_local_storage, set_local_storage, clear_local_storage, generate_pdf, set_viewport, emulate_device, throttle_network, go_offline, set_geolocation, set_timezone, set_color_scheme
調試操作:get_logs, get_errors, get_console_messages, get_network_requests, diagnose, diagnose_project, reset_app
平臺設置
Flutter (iOS / Android / Web)
dependencies:
flutter_skill: ^0.9.7
import 'package:flutter_skill/flutter_skill.dart';
void main() {
if (kDebugMode) FlutterSkillBinding.ensureInitialized();
runApp(MyApp());
}
React Native
npm install flutter-skill-react-native
import FlutterSkill from 'flutter-skill-react-native';
FlutterSkill.start();
Electron
npm install flutter-skill-electron
const { FlutterSkillBridge } = require('flutter-skill-electron');
FlutterSkillBridge.start(mainWindow);
iOS (Swift)
import FlutterSkill
FlutterSkillBridge.shared.start()
Text("Hello").flutterSkillId("greeting")
Android (Kotlin)
implementation("com.flutterskill:flutter-skill:0.8.0")
FlutterSkillBridge.start(this)
Tauri (Rust)
[dependencies]
flutter-skill-tauri = "0.8.0"
KMP Desktop
添加 Gradle 依賴 — 詳情見 。
.NET MAUI
添加 NuGet 包 — 詳情見 。
示例提示
只需告訴 AI 要測試的內容:
| 提示 |
操作 |
| "使用錯誤密碼測試登錄功能" |
截圖 → 輸入憑證 → 點擊登錄 → 驗證錯誤信息 |
| "探索每個屏幕並報告錯誤" |
系統地瀏覽所有屏幕,測試所有元素 |
| "使用邊界情況填寫註冊表單" |
測試表情符號 🌍、長字符串、空字段、特殊字符 |
| "比較 iOS 和 Android 上的結賬流程" |
在兩個平臺上運行相同的測試,比較截圖 |
| "截取所有 5 個標籤頁的屏幕截圖" |
點擊每個標籤頁,捕獲狀態 |
🔧 技術細節
減少 95% 的令牌使用
大多數 AI 測試工具會向大語言模型發送 截圖,每張截圖大約需要 4000 個令牌。而 flutter-skill 使用 Chrome 的 可訪問性樹 為 AI 提供任何頁面的緊湊語義摘要:
{
"title": "購物車",
"nav": ["主頁", "產品", "購物車", "賬戶"],
"forms": [{"輸入框:優惠券代碼": "文本"}],
"buttons": ["應用", "結算", "繼續購物"],
"特性": {"搜索": true, "分頁": true},
"鏈接": 47, "輸入框": 3
}
然後在一次調用中批量執行多個操作:
{"actions": [
{"type": "填充", "目標": "輸入框:優惠券代碼", "值": "SAVE20"},
{"type": "點擊", "目標": "按鈕:應用"},
{"type": "點擊", "目標": "按鈕:結算"},
{"type": "填充", "目標": "輸入框:電子郵件", "值": "test@example.com"},
{"type": "點擊", "目標": "按鈕:繼續"}
]}
結果:你的 AI 智能體測試速度更快,成本更低,並且比基於截圖的工具更能理解頁面。
|
flutter-skill |
基於截圖的工具 |
| 每頁令牌數 |
~200 |
~4000 |
| 每次調用操作數 |
5+ |
1 |
| 是否理解語義 |
✅ 角色、名稱、狀態 |
❌ 僅像素信息 |
| 是否支持 Shadow DOM |
✅ |
❌ |
📄 許可證
MIT License © 2025
貢獻指南
請參閱 CONTRIBUTING.md 獲取貢獻指南。
git clone https://github.com/ai-dashboad/flutter-skill
cd flutter-skill
dart pub get
dart run bin/flutter_skill.dart server
相關鏈接
⭐ 如果 flutter-skill 為你節省了時間,請給項目點個星,讓更多人發現它!