一键导入
flutter-debug-logging
Use when encountering errors or unexpected behavior in Flutter that needs investigation through strategic logging
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when encountering errors or unexpected behavior in Flutter that needs investigation through strategic logging
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | flutter-debug-logging |
| description | Use when encountering errors or unexpected behavior in Flutter that needs investigation through strategic logging |
通过 debugPrint() 在关键路径添加日志,还原问题现场。AI 主动追踪执行链路,用户热刷新后复现问题。
核心原则:追踪 Action 链路,日志要连贯可读
debugPrint('[WidgetA] action: 点击按钮');
debugPrint('[WidgetA] -> 调用 B');
debugPrint('[WidgetB] 收到调用');
debugPrint('[WidgetB] -> 更新状态');
debugPrint('[WidgetB] -> 触发 rebuild');
debugPrint('[CardWidget] 当前区域: $currentArea 卡片索引: $index');
debugPrint('[CardWidget] 拖拽偏移: $offset 阈值: $threshold');
debugPrint('[Handler] 条件判断: offset.dx=${dx} > $threshold? ${dx > threshold}');
if (dx > threshold) {
debugPrint('[Handler] -> 进入右滑分支');
}
catch (e, s) {
debugPrint('[ApiService] 异常: $e');
debugPrint('[ApiService] stack: $s');
}
1. 理解问题描述
2. 定位最可能的执行路径
3. 从入口开始,按执行顺序添加日志
4. 关键状态点必须输出
5. 条件分支判断前打印条件值
6. 用户热刷新复现
7. 根据日志找到断点
8. 修复并验证
| 规则 | 说明 |
|---|---|
| 带类型标签 | [ClassName] 便于过滤 |
| 顺序清晰 | 日志间有因果关系 |
| 状态完整 | 打印所有相关变量 |
| 不过度 | 定位后删除多余日志 |
// 基本
debugPrint('[ClassName] 描述');
// 状态追踪
debugPrint('[ClassName] 变量: $a, $b, $c');
// 条件判断
debugPrint('[ClassName] if判断: x=$x > y=$y = ${x>y}');
// 流程跳转
debugPrint('[ClassName] -> 调用 OtherClass.method()');
| 错误 | 正确 |
|---|---|
print('log') | debugPrint('[C] log') |
debugPrint('更新') | debugPrint('[Widget] 状态更新: $newState') |
| 满屏日志 | 只在怀疑路径添加 |
| 不带变量 | debugPrint('[C] x=$x') |
问题确认后,删除所有调试日志,保持代码整洁。
Relay-v3 Lua 状态机接入指南。新增一个互联网房间业务(聊天、卡牌、白板、投票、协作…)时使用。描述后端元函数契约、前端闭环套路、Lua 脚本模板、state 转换规范、错误案例。识别"我要实现一个新业务""写一个 Lua 房间脚本""加一个 action 类型"时触发。
当用户提及 Relay/LAN/快照/action 流/net_p2p/net_engine 协议、讨论消息传输层(事件 vs 快照)、新建/重构 P2P 协议、排查"晚加入者错过事件""两端不同步""房间状态丢失""广播丢失"等问题时触发。包含 v1 action/事件驱动(已落地,遗留用法)与 v2 快照驱动(推荐新功能)。
Flutter 项目中"样式"相关工程的渐进式披露指南。当用户要做 UI 样式选型、视觉对齐复刻、画布/HTML mockup 与 Flutter 实现的双向对照、或在 Material 3 体系下选某一类样式(顶部 App Bar / Card / Button / NavigationBar / Modal 等)落地时触发。本 skill 是样式大类的总入口,所有方案的最终形态都登记在分类索引表里,按需加载对应方案文件。同时承载小豆子 FR 项目的 UI 设计原则与实战 bug 沉淀(border-emphasis 边框强调式、嵌套 sheet race condition、多风格 lottery 投票挑选、纯色按钮减负、左重右轻、装饰性 vs 功能性颜色决策)。
flutter的开发操作流程,在dart-flutter任何问题都需要优先加载这个SKILL
Flutter 通过 home_widget 把 1Hz 实时值(如倒计时)推到 Android 桌面 AppWidget 的端到端架构。当用户提到 home_widget 不同步、桌面小组件不刷新、appwidget 实时值、widget 显示卡死、widget 进程被杀场景、AppWidgetProvider 找不到时触发。
Comprehensive Rive animation platform skill covering scripting (Luau), runtime integration (React/Next.js), state machines, data binding, and the complete API. Use this skill when users need to create interactive animations with Rive, integrate Rive into React/Next.js applications, write Rive scripts (Node, Layout, Converter, PathEffect protocols), control animations via state machines, implement scroll-based animations, or work with Rive's drawing API (Path, Paint, Renderer). Triggers on: "rive", "rive animation", "rive script", "luau", "@rive-app/react-canvas", "state machine animation", "interactive animation", "scroll animation with rive". 本项目(xiaodouzi/fr,Flutter + rive ^0.14.5)特化:DataBind / ViewModel 双向数据绑定、lab demo 添加流程见 references/flutter-databind-0.14.md 与 references/flutter-project-workflow.md。