Token导航 LogoToken导航TokenDH.com
前端设计执行命令github未标认证来源可访问许可证需确认审计通过

dart-api-designdart API 设计

Agent Skill

用于辅助 API 设计、接口文档、请求响应结构和服务集成说明。它适合让 Agent 梳理 endpoint、生成 OpenAPI 草稿、检查字段命名、整理错误码或辅助前后端联调。使用时需要确认真实业务语义、鉴权方式、分页和错误处理规则;涉及生成接口文档时,应避免凭空补字段,最好从现有代码、schema 或接口样例中提取事实。

总安装

1,584

周安装

66

GitHub Stars

61

下载量

528
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:dart-api-design(dart API 设计)
来源仓库:https://github.com/dart-lang/skills
仓库路径:skills/dart-api-design
安装命令:
npx skills add https://github.com/dart-lang/skills --skill dart-api-design
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/dart-lang/skills --skill dart-api-design

简介

用于辅助 API 设计、接口文档、请求响应结构和服务集成说明。

  • 适合梳理 endpoint、生成 OpenAPI 草稿或检查字段命名。
  • 使用时需确认真实业务语义、鉴权方式、分页和错误处理规则。
  • 涉及生成接口文档时应从现有代码或样例中提取事实,避免凭空补字段。
  • dart-api-design 属于前端设计类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Designing Effective Dart APIs

Contents

Naming Conventions

Enforce consistent, descriptive naming to leverage existing domain and core library knowledge.

  • Properties & Variables:

- Use noun phrases for non-boolean properties (e.g., pageCount, context.lineWidth). - Use non-imperative verb phrases for boolean properties (e.g., isEmpty, canClose). Prefer the "positive" name (e.g., isConnected over isNotDisconnected).

  • Methods & Functions:

- Use imperative verb phrases for side-effect-heavy operations (e.g., list.add(), window.refresh()). - Use noun phrases or non-imperative verb phrases if returning a value is the primary purpose (e.g., list.elementAt(3)). - AVOID starting method names with get. Use a getter or a descriptive verb (e.g., downloadData()). - Name methods to___() if they copy state to a new object (e.g., list.toSet()). - Name methods as___() if they return a different representation backed by the original object (e.g., table.asMap()).

  • Type Parameters: Follow standard mnemonics: E (elements), K/V (key/value), R (return type), or T/S/U (single types).

Class Modifiers & Architecture

Design for extension and encapsulate implementations using Dart 3 class modifiers. Apply modifiers to control external library access.

  • abstract: Use to define a class that requires concrete implementation of its interface. Cannot be instantiated.
  • base: Use to enforce inheritance of a class's implementation. Disallows implements outside its own library. Guarantees the base class constructor is called.
  • interface: Use to define a pure interface. Allows implements but disallows extends outside its library. Reduces the fragile base class problem.
  • final: Use to close the type hierarchy. Disallows both extends and implements outside the library. Guarantees safe incremental API changes.
  • sealed: Use to create a known, enumerable set of subtypes. Enables exhaustive switch statements over subtypes. Implicitly abstract.

*Note: Combine modifiers where appropriate (e.g., abstract interface class for a pure interface).*

Members & Encapsulation

  • Encapsulation: AVOID public fields; use getters and setters for encapsulation to control state access and modification.
  • Getters: Use getters for operations that conceptually access properties. The operation must take no arguments, return a result, have no user-visible side effects, and be idempotent.
  • Setters: Use setters for operations that conceptually change properties. The operation must take a single argument, change state, and be idempotent.

- DON'T define a setter without a corresponding getter. - DON'T specify a return type for a setter (they inherently return void).

  • Method Cascades: AVOID returning this from methods just to enable a fluent interface. Use Dart's cascade operator (..) instead.
  • Equality:

- DO override hashCode if you override ==. - AVOID defining custom equality for mutable classes. - DON'T make the parameter to == nullable (the language handles null checks automatically).

Types & Signatures

  • Type Aliases: DO use type aliases (typedef) to simplify complex function signatures. Use the modern syntax: typedef Comparison<T> = int Function(T a, T b);.
  • Inline Functions: PREFER inline function types over typedefs for simple, one-off callbacks (e.g., void Function(Event) callback).
  • Type Annotations:

- DO type annotate variables without initializers. - DO annotate return types and parameter types on non-local function declarations. - DON'T redundantly type annotate initialized local variables or inferred closure parameters.

  • Generics: Write complete generic types. AVOID incomplete generic types (e.g., use Completer<Map<String, int>>() instead of Completer<Map>()).
  • Dynamic vs. Object: AVOID using dynamic unless you explicitly want to disable static checking. Use Object? to accept any value safely.
  • Async Returns: DO use Future<void> as the return type of asynchronous members that do not produce values. AVOID using FutureOr<T> as a return type (it forces callers to check the type).

Parameters

  • Named Parameters: PREFER named parameters for functions with more than two arguments to improve call-site readability.
  • Boolean Parameters: AVOID positional boolean parameters. Use named parameters instead.

- CONSIDER omitting the 'is/can/has' prefix from named boolean parameters (e.g., use Isolate.spawn(..., paused: true) instead of isPaused: true).

  • Optional Positional Parameters: AVOID optional positional parameters if the user may want to omit earlier parameters. Use named parameters instead.
  • Ranges: DO use inclusive start and exclusive end parameters to accept a range (e.g., substring(1, 3)).

Workflows

Task Progress: API Design & Implementation

Copy this checklist to track progress when designing a new Dart class or library API.

  • Define Class Modifiers:

- If defining a contract without implementation -> abstract interface class. - If providing implementation that must be inherited -> base class. - If closing the hierarchy to external extension/implementation -> final class. - If defining an enumerable set of states for exhaustive switching -> sealed class.

  • Encapsulate State:

- Make internal fields private (_fieldName). - Expose state via getters. - Expose mutations via setters (ensure a corresponding getter exists).

  • Refine Signatures:

- Convert positional parameters to named parameters if > 2 arguments. - Convert positional booleans to named booleans (strip is/can/has prefixes). - Extract complex function parameters into typedef aliases.

  • Verify Types:

- Ensure no implicit dynamic types exist in public signatures. - Replace FutureOr<T> return types with Future<T>. - Ensure async void methods return Future<void>.

  • Run Validator -> Review Errors -> Fix:

- Run dart analyze to catch missing annotations, unhandled sealed class switch cases, and linter violations. Fix all warnings before finalizing the API.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

35.19%
按下载量换算186

Claude

29.45%
按下载量换算155

Cursor

21.04%
按下载量换算111

Gemini CLI

9.09%
按下载量换算48

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/dart-lang/skills --skill dart-api-design 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills