api-review

作者: flutter

对照规范的API设计指南审查指定代码。当用户要求进行API审查或根据API设计规范检查代码时,请使用此技能…

npx skills add https://github.com/flutter/agent-plugins --skill api-review

API review skill

This skill reviews code against the canonical API Design guidelines.

Instructions

  1. Load Guidelines: Read the API design guidelines from references/canonical_api_design.md to ensure they are fully available in the context.
  2. Identify Target: Identify the code to review.
    • If the user specified files (e.g., "review main.dart"), use those.
    • If the user has an open file in their context, assume that is the target.
    • If neither, ask the user to specify the target files.
  3. Analyze: For each target file, perform a deep analysis against the "Foundations of Canonical API Design Principles" (loaded in step 1), specifically looking for:
    • Contract-First: Is the interface clear and decoupled from implementation?
    • KISS/YAGNI: Are there unnecessary parameters or over-generalized features?
    • Ergonomics: Are names intent-revealing? Do they follow the Principle of Least Astonishment?
    • CQS: Are commands and queries separated?
    • Safety: Are types used strictly (Enums vs Strings)? Is validation visible?
    • Explicit Configuration: Are dependencies explicitly injected rather than implicitly resolved via global state, registries, or environment variables?
  4. Report: Generate a structured report:
    • Score: Give a letter grade (A-F) based on alignment.
    • Critical Issues: Violations that must be fixed (e.g., severe strictness or safety issues).
    • Suggestions: Ergonomic improvements (renaming, rearranging).
    • Code Examples: Provide before vs after code blocks for the suggested improvements.
    • Save the report as a markdown artifact in the conversation artifacts directory (e.g., <appDataDir>/brain/<conversation-id>/api_review_results.md).

来自 flutter 的更多技能

dart-modern-features
flutter
为了找到现代化的候选方案:
flutter-fix-layout-issues
flutter
使用Dart和Flutter MCP工具修复Flutter布局错误(溢出、无界约束)。适用于处理“RenderFlex溢出”、“垂直…
adding-release-notes
flutter
在 DevTools 发布说明中添加面向用户的变更描述。用于在 NEXT_RELEASE_NOTES.md 文件中记录改进、修复或新功能。
reviewing-devtools-prs
flutter
DevTools 仓库专属的PR审查工作流程,执行DevTools风格指南和常见审查模式。在审查……中的拉取请求时使用。
dart-use-primary-constructors
flutter
帮助用户在Dart中编写语法和语义正确的主构造函数,并迁移/使用新的构造函数语法、空体分号语法等。
code-documentation
flutter
编写有效代码文档的指南,包括docstrings、JSDoc、dartdoc和实现注释。在编写新代码、添加…时使用此技能。
flutter-accessibility
flutter
在Flutter应用中实现WCAG 2和EN 301 549无障碍标准及自适应布局。在移动端、网页端和桌面端强制实施语义标注、点击目标尺寸(最小48x48 dp)和文本对比度(小文本4.5:1,大文本3:1)。提供网页语义初始化、交互式组件包裹、基于屏幕尺寸的布局切换以及键盘/鼠标输入处理的决策逻辑。包含通过FocusTraversalGroup实现的焦点遍历管理,以及...
flutter-accessibility-audit
flutter
通过widget_inspector触发无障碍扫描,并自动向源代码中添加Semantics组件或缺失的标签。