profile-dart-code
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "profile-dart-code":https://skillpi.com/zh/skills/deepskill-4661e5de86e4751088d0dac57dee035a5b1dc468249510a5c9aa028130aab3ec。安装前核对上游来源和版本:https://github.com/kevmoo/dash_skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
用于使用 VM Service 协议对 Dart 命令行应用进行性能分析的说明。帮助捕获 CPU 采样数据、识别性能瓶颈、自动执行 CPU 分析并生成函数调用分解摘要,且可在无需浏览器或 DevTools 的情况下导出 JSON 格式的分析数据。
介绍来源: third_party · kevmoo · 0.0.1 参考来源
SkillPi 解读
- 能完成的任务
- 翻译待完成,请参阅来源文档。
- 适合谁
- 翻译待完成,请参阅来源文档。
- 实测状态
- 未测试
文件浏览
Frontmatter
name: profile-dart-code
description: |-
Profile Dart command-line applications using the VM Service protocol to
capture CPU samples and identify performance bottlenecks. Helps agents
automate CPU profiling, generate function call breakdown summaries, and
export JSON profiles without a browser or DevTools.
key_features:
- Automated VM Service WebSocket connection
- CPU sampling and top-function call summary
- JSON trace export for further analysisDart CPU Profiling
Guidelines and automated tools for capturing CPU profiles and identifying bottlenecks in Dart command-line applications.
When to use this skill
- When asked to profile, optimize, or benchmark CPU execution of a Dart script or CLI tool.
- When investigating hot loops, heavy function calls, or unexpected execution overhead.
When NOT to use (Abstention Guardrails)
Do NOT profile using this skill when:
- Pure I/O-Bound Bottlenecks: The performance bottleneck is network latency, database queries, or disk I/O wait rather than CPU execution.
- Flutter UI Applications: The target is a Flutter application requiring
frame profiling, raster thread inspection, or widget rebuild tracking (use
Flutter DevTools or
widget_inspector). - Short-Lived Micro-Benchmarks: Micro-benchmarks running for only a few
milliseconds where VM warmup and sampling overhead skew results (use
package:benchmark_harnessorpackage:bench_pressinstead). - Target Does Not Run Cleanly: If the target script fails to compile or crashes on startup, fix functional bugs before attempting CPU profiling.
Workflow
- Ensure clean compilation: Make sure the target Dart script runs cleanly
(
dart run <script.dart>). - Run Profiler Script: Use the automated profiling helper script inside this skill directory to launch the target app with VM Service observability enabled, capture CPU samples, and output top-consuming functions.
- Analyze & Optimize: Review the self and total sample percentages reported by the tool to pinpoint bottlenecks (e.g., excessive object allocation, costly hashing, virtual dispatch overhead).
Running the Profiler Helper Script
This repository includes a zero-dependency (using only official vm_service)
profiling script that launches any Dart file, connects to the VM Service, waits
for execution to complete (--pause-isolates-on-exit), retrieves CPU samples,
and prints a clean summary while exporting the full JSON profile.
Run it from any working directory:
dart run <dash_skills_repo>/skills/profile-dart-code/scripts/bin/profile.dart --out=cpu_profile.json -- <path_to_target.dart> [target_arguments...]
Script Arguments
-o, --out=<file>: Output file path to save the raw JSON CPU profile (default:cpu_profile.json).-p, --period=<micros>: Sampling interval in microseconds (default:1000µs = 1ms). Minimum50µs.-- <target.dart> [args...]: The Dart script to profile, followed by any arguments passed tomain().
[!WARNING] Potential Hangs: When profiling or debugging Dart targets using VM services, target exceptions or connection issues can cause the process to hang indefinitely. Ensure your target script handles timeouts, and monitor the process output.
Example Output
Connecting to VM service at ws://127.0.0.1:8181/ws...
Target execution paused at exit. Retrieving CPU profile samples...
=== Top CPU Functions (Self Samples) ===
1. _PuzzleSmart._shiftSlice (self: 34.2%, total: 41.0%)
2. _countInversions (self: 18.5%, total: 18.5%)
3. shortestPaths (self: 12.1%, total: 98.4%)
Saved complete JSON profile to: cpu_profile.json
Best Practices for Interpreting Profiles
- Focus on Self % vs. Total %: High
self %indicates where CPU time is spent directly inside a function's own body (math, loop branching, array indexing). Hightotal %with lowself %indicates a dispatcher or outer orchestration loop. - Look for Hidden Overhead: Watch out for implicit object allocations
(
_copyData, iterator wrappers, closure creation) inside tight loops. - Verify Optimizations Empirically: Always record baseline sample counts
and execution duration (
time -v) before and after applying optimizations.
当前收录版本
0.0.1
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 提供针对Dart命令行应用的专用CPU性能分析能力
- 填补了无需浏览器或DevTools场景下的性能分析空白
- 包含明确的适用场景和避坑指南
亮点
- 触发词覆盖全面(profile/optimize/benchmark)
- 边界清晰,通过abstention guardrails明确定义不适用场景
- description位置正确且内容完整
亮点
- Phase划分清晰(编译检查->运行分析->优化建议)
- 包含完整的端到端示例和输出展示
- frontmatter完整,单文件结构良好
待提升项
-
脚本错误处理细节未明确展示 原报告严重程度:轻微
文档中提到了潜在挂起风险但未详细说明脚本内部的异常处理机制
改进建议:建议在文档中补充说明脚本如何处理连接失败、超时等常见异常情况
亮点
- 工具来源明确(官方vm_service包)
- 参数定义清晰且有默认值
- 对潜在风险(进程挂起)有明确警告提示
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。