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

dart-migrate-to-checks-packagedart 迁移到检查包

Agent Skill

dart-migrate-to-checks-package 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

1,693

周安装

72

GitHub Stars

63

下载量

593
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/dart-lang/skills --skill dart-migrate-to-checks-package

简介

dart-migrate-to-checks-package 协助将基于 package:matcher 的测试迁移至更现代的 package:checks。

  • 适用于希望简化断言语法、提升测试可读性或跟随 Dart 测试生态演进的项目。
  • 支持自动转换 test() 到 expect().equals() 风格,并移除冗余的 equals() 包装。
  • 使用前请先在 pubspec.yaml 中添加 dev_dependency checks,并更新 import 语句。
  • 迁移过程中建议保留原有测试逻辑不变,逐步替换断言方式以确保行为一致。

SKILL.md

Migrating Dart Tests to Package Checks

Contents

Dependency Management

Manage dependencies using the Dart Tooling MCP Server pub tool or standard CLI commands.

  • Add package:checks as a dev_dependency using dart pub add dev:checks.
  • Remove package:matcher if it is explicitly listed in the pubspec.yaml (note: it is often transitively included by package:test, which is fine).
  • Import package:checks/checks.dart in all test files undergoing migration.

Syntax Migration Guidelines

Transition test assertions from the package:matcher syntax to the literate API provided by package:checks.

  • Basic Equality: Replace expect(actual, equals(expected)) or expect(actual, expected) with check(actual).equals(expected).
  • Type Checking: Replace expect(actual, isA<Type>()) with check(actual).isA<Type>().
  • Property Extraction: Replace expect(actual.property, expected) with check(actual).has((a) => a.property, 'property name').equals(expected).
  • Cascades for Multiple Checks: Use Dart's cascade operator (..) to chain multiple expectations on a single subject.
  • Asynchronous Expectations:

- If checking a Future, await the check call: await check(someFuture).completes((r) => r.equals(expected));. - If checking a Stream, wrap it in a StreamQueue for multiple checks, or use .withQueue for single/broadcast checks.

Utilizing Dart MCP Tools

Leverage the Dart MCP Server tools to automate and validate the migration process.

  • Use pub to run dart pub get or dart pub add.
  • Use analyze_files to run static analysis on the project or specific paths.
  • Use run_tests to execute Dart or Flutter tests with an agent-centric UX. ALWAYS use this instead of shell commands like dart test.
  • Use dart_fix to apply automated fixes if applicable.

Migration Workflow

Copy and use the following checklist to track progress when migrating a test suite:

  • Task Progress

- Add package:checks as a dev dependency. - Identify all test files using package:matcher (expect calls). - Import package:checks/checks.dart in target test files. - Rewrite all expect(...) statements to check(...) statements. - Run static analyzer (analyze_files). - Run tests (run_tests).

Feedback Loop: Static Analysis

  1. Run the analyze_files tool on the modified test directories.
  2. Review any static analysis warnings or errors (e.g., missing imports, incorrect generic types on isA, unawaited futures).
  3. Fix the warnings.
  4. Repeat until the analyzer returns zero issues.

Feedback Loop: Test Validation

  1. Run the run_tests tool.
  2. If tests fail, review the failure output. package:checks provides detailed context (e.g., Which: has length of <2>).
  3. Adjust the check() expectations or the underlying code to resolve the failure.
  4. Repeat until all tests pass.

Examples

Basic Assertions

Input (matcher):

expect(someList.length, 1);
expect(someString, startsWith('a'));
expect(someObject, isA<Map>());

Output (checks):

check(someList).length.equals(1);
check(someString).startsWith('a');
check(someObject).isA<Map>();

Composed Expectations

Input (matcher):

expect('foo,bar,baz', allOf([
  contains('foo'),
  isNot(startsWith('bar')),
  endsWith('baz')
]));

Output (checks):

check('foo,bar,baz')
  ..contains('foo')
  ..not((s) => s.startsWith('bar'))
  ..endsWith('baz');

Asynchronous Futures

Input (matcher):

expect(Future.value(10), completion(equals(10)));
expect(Future.error('oh no'), throwsA(equals('oh no')));

Output (checks):

await check(Future.value(10)).completes((it) => it.equals(10));
await check(Future.error('oh no')).throws<String>().equals('oh no');

Asynchronous Streams

Input (matcher):

var stdout = StreamQueue(Stream.fromIterable(['Ready', 'Go']));
await expectLater(stdout, emitsThrough('Ready'));

Output (checks):

var stdout = StreamQueue(Stream.fromIterable(['Ready', 'Go']));
await check(stdout).emitsThrough((it) => it.equals('Ready'));

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

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

平台分布

Codex

34.3%
按下载量换算203

Claude

27.22%
按下载量换算161

Cursor

20.57%
按下载量换算122

Gemini CLI

10.22%
按下载量换算61

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

执行命令

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

安装前确认

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

来源信息

继续浏览同类 Skills