Token导航 LogoToken导航

Agent Skill · 开发

dart-guide(飞镖指南)

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

dart-guide 是开发类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为执行命令;许可证信息还不明确,第三方扫描已通过,按安装量在开发类的 21,746 个 Skill 里排第 20,764。

总安装 212周安装 9GitHub Stars 8下载 74核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/ar4mirez/samuel --skill dart-guide

这个 Skill 是做什么的

开发类 Skill 面向写代码、改代码和排查问题,一般会读写仓库文件,部分还会执行构建或测试命令。

dart-guide 提供 Dart 3.0+ 的核心编程原则与实践指南,涵盖空安全、异步处理和不可变数据结构。适用于新项目初始化、语言迁移或团队协作中对编码规范有统一要求的场景。强调组合优于继承、有效 Dart 风格及依赖版本控制,确保代码健壮性和可维护性。

使用前请核对项目当前 Dart SDK 版本,部分语法特性可能需要特定版本支持。涉及重大升级时建议分阶段实施,并利用 @dart 注解对关键文件做版本隔离。

来源仓库内路径:skills/dart-guide

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/ar4mirez/samuel --skill dart-guide;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要执行命令,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

dart-guide 怎么安装?

在终端执行 npx skills add https://github.com/ar4mirez/samuel --skill dart-guide。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

dart-guide 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

dart-guide 需要什么权限?

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

dart-guide 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

dart-guide 用的人多吗?

公开数据是累计安装 212 次,近一周安装 9 次,下载 74 次,GitHub 8 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

dart-guide 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 需要执行命令,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理开发类任务、又不想每次都手写提示词的人。

不太适合

  • 不能接受 Skill 在你机器上执行命令的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

开发类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
skill-vetter

技能审查员 · OpenClaw

8,779,018986操作浏览器MIT-0通过
ontology

本体论 · OpenClaw

6,636,960576只读MIT-0通过
entra-app-registration

内部应用程序注册 · Codex、Claude

6,631,872764接触敏感数据未明确通过
entra-app-registration

内部应用程序注册 · Codex、Claude

3,757,680201接触敏感数据未明确通过
nano-banana-pro

纳米香蕉专业版 · OpenClaw

3,526,898364接触敏感数据MIT-0有提醒
dart-guide

飞镖指南 · 本页

2128执行命令未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Dart Guide

Applies to: Dart 3.0+, Sound Null Safety, Flutter, Server-side Dart

Core Principles

  1. Sound Null Safety: The type system guarantees non-nullable by default; nullable types are explicit
  2. Async by Design: Use Futures, Streams, and async/await for all I/O and event-driven logic
  3. Immutability First: Prefer final locals, const constructors, and immutable data structures
  4. Composition Over Inheritance: Use mixins, extension methods, and sealed class hierarchies
  5. Effective Dart: Follow official Effective Dart style for naming, documentation, and API design

Guardrails

Version & Dependencies

  • Use Dart 3.0+ with sound null safety enabled (no // @dart=2.x opt-outs)
  • Manage dependencies with pubspec.yaml; run dart pub get after changes
  • Pin dependency versions with caret syntax (^1.2.0) for libraries, exact for apps
  • Run dart pub outdated periodically to check for updates
  • Audit transitive dependencies with dart pub deps

Code Style

  • Run dart format. before every commit (line length: 80 characters)
  • Run dart analyze with strict mode before committing
  • Libraries/packages: lowercase_with_underscores (my_package)
  • Classes/enums/typedefs: UpperCamelCase (UserProfile)
  • Functions/variables/parameters: lowerCamelCase (fetchUser)
  • Constants: lowerCamelCase (defaultTimeout, not DEFAULT_TIMEOUT)
  • Private members: prefix with _ (_internalState)
  • Follow Effective Dart guidelines

Null Safety

  • Never use ! (null assertion) without a preceding null check or guarantee
  • Use ? for nullable types only at API boundaries (JSON, platform channels)
  • Prefer ?? (if-null) and ?. (null-aware access) over explicit null checks
  • Use required keyword for non-optional named parameters
  • Use late only when initialization is guaranteed before access (avoid for laziness)
// BAD: crashes at runtime if null
final name = json['name'] as String;

// GOOD: explicit nullable handling
final name = json['name'] as String? ?? 'Unknown';

// GOOD: required parameter enforces non-null at call site
void createUser({required String name, required String email}) { ... }

// BAD: late used for laziness without guarantees
late final String config;

// GOOD: late with guaranteed initialization in constructor body
late final Database _db;
void init(Database db) => _db = db;

Async/Await

  • Always await Futures or return them; never fire-and-forget without error handling
  • Use async* and yield for Stream generators
  • Set timeouts on all external calls with .timeout(Duration(...))
  • Catch specific exceptions, not bare catch (e)
  • Use Completer only when bridging callback-based APIs to Futures
// BAD: fire-and-forget loses errors
void save() {
  repository.save(data); // Future ignored
}

// GOOD: propagate or handle
Future<void> save() async {
  await repository.save(data);
}

// GOOD: timeout on external calls
final response = await http.get(uri).timeout(
  const Duration(seconds: 10),
  onTimeout: () => throw TimeoutException('Request timed out'),
);

Immutability

  • Use final for all local variables that are not reassigned
  • Use const constructors for compile-time constant objects (widgets, values)
  • Prefer UnmodifiableListView or immutable collections from package:collection
  • Use records for lightweight immutable data groupings
  • Mark classes @immutable when all fields are final

Project Structure

myproject/
├── lib/
│   ├── src/                   # Private implementation
│   │   ├── models/            # Data classes, records, sealed types
│   │   ├── services/          # Business logic, use cases
│   │   ├── repositories/      # Data access layer
│   │   └── utils/             # Shared utilities, extensions
│   └── my_package.dart        # Public barrel export file
├── bin/                       # CLI entry points (for command-line apps)
│   └── main.dart
├── test/                      # Tests (mirrors lib/src/ structure)
│   ├── models/
│   ├── services/
│   └── repositories/
├── pubspec.yaml               # Dependencies and metadata
├── analysis_options.yaml      # Linter and analyzer configuration
└── README.md
  • lib/src/ for private implementation; export public API from lib/my_package.dart
  • test/ mirrors lib/src/ directory structure
  • bin/ only for executable entry points
  • No business logic in main.dart (delegate to services)

Key Patterns

Records and Pattern Matching (Dart 3)

// Records: lightweight immutable tuples with named fields
typedef UserSummary = ({String name, String email, int age});

UserSummary fetchSummary() => (name: 'Alice', email: 'a@b.com', age: 30);

// Destructuring with pattern matching
final (name: userName, email: _, age: userAge) = fetchSummary();

// Switch expressions with patterns
String classify(Object value) => switch (value) {
  int n when n < 0   => 'negative',
  int n when n == 0  => 'zero',
  int()              => 'positive',
  String s           => 'string: $s',
  (int x, int y)     => 'point ($x, $y)',
  _                  => 'unknown',
};

Sealed Classes and Exhaustive Matching

sealed class Result<T> {
  const Result();
}

final class Success<T> extends Result<T> {
  final T value;
  const Success(this.value);
}

final class Failure<T> extends Result<T> {
  final String message;
  final Object? error;
  const Failure(this.message, [this.error]);
}

// Exhaustive switch: compiler enforces all subtypes handled
String describe<T>(Result<T> result) => switch (result) {
  Success(:final value) => 'Success: $value',
  Failure(:final message) => 'Failed: $message',
};

Extension Methods and Types

// Extension methods: add functionality to existing types
extension StringValidation on String {
  bool get isValidEmail => RegExp(r'^[\w-.]+@[\w-]+\.\w+$').hasMatch(this);
  String truncate(int maxLength) =>
      length <= maxLength ? this : '${substring(0, maxLength)}...';
}

// Extension types (Dart 3.3): zero-cost type wrappers
extension type UserId(String value) {
  UserId.generate() : value = Uuid().v4();
  bool get isValid => value.isNotEmpty;
}

// Usage: compile-time type safety, zero runtime overhead
void fetchUser(UserId id) { ... }
fetchUser(UserId('abc-123'));
// fetchUser('raw-string'); // Compile error

Late Keyword (Correct Usage)

class ApiClient {
  // GOOD: late for dependency injection with guaranteed init
  late final HttpClient _client;

  void configure(HttpClient client) {
    _client = client;
  }

  // GOOD: late final for expensive one-time computation
  late final Map<String, dynamic> _config = _loadConfig();

  Map<String, dynamic> _loadConfig() {
    // expensive operation, runs once on first access
    return jsonDecode(File('config.json').readAsStringSync());
  }
}

Stream Patterns

// async* generator for producing streams
Stream<int> countDown(int from) async* {
  for (var i = from; i >= 0; i--) {
    await Future.delayed(const Duration(seconds: 1));
    yield i;
  }
}

// Stream transformations
final results = inputStream
    .where((event) => event.isValid)
    .map((event) => event.transform())
    .handleError((error) => logger.warning('Stream error: $error'))
    .distinct();

Isolates for Heavy Computation

import 'dart:isolate';

// Simple one-shot isolate computation
Future<List<int>> computePrimes(int limit) async {
  return await Isolate.run(() => _sieveOfEratosthenes(limit));
}

List<int> _sieveOfEratosthenes(int limit) {
  final sieve = List.filled(limit + 1, true);
  sieve[0] = sieve[1] = false;
  for (var i = 2; i * i <= limit; i++) {
    if (sieve[i]) {
      for (var j = i * i; j <= limit; j += i) {
        sieve[j] = false;
      }
    }
  }
  return [for (var i = 2; i <= limit; i++) if (sieve[i]) i];
}

Testing

Standards

  • Test files: *_test.dart in test/ (mirror lib/src/ structure)
  • Test functions: test('description of behavior', () {...})
  • Group related tests: group('ClassName', () {...})
  • Use package:test for pure Dart, package:flutter_test for widgets
  • Use package:mockito with @GenerateMocks for type-safe mocking
  • Coverage target: >80% for business logic, >60% overall
  • Test names describe behavior: 'returns empty list when no users exist'

Unit Test Pattern

import 'package:test/test.dart';
import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.dart';

@GenerateMocks([UserRepository])
import 'user_service_test.mocks.dart';

void main() {
  late MockUserRepository mockRepo;
  late UserService service;

  setUp(() {
    mockRepo = MockUserRepository();
    service = UserService(mockRepo);
  });

  group('UserService', () {
    group('getUser', () {
      test('returns user when found', () async {
        final expected = User(id: '1', name: 'Alice');
        when(mockRepo.findById('1')).thenAnswer((_) async => expected);

        final result = await service.getUser('1');

        expect(result, isA<Success<User>>());
        expect((result as Success).value, equals(expected));
        verify(mockRepo.findById('1')).called(1);
      });

      test('returns failure when user not found', () async {
        when(mockRepo.findById('99')).thenAnswer((_) async => null);

        final result = await service.getUser('99');

        expect(result, isA<Failure>());
        expect((result as Failure).message, contains('not found'));
      });
    });
  });
}

Async and Stream Testing

test('stream emits values in order', () {
  expect(
    countDown(3),
    emitsInOrder([3, 2, 1, 0, emitsDone]),
  );
});

test('completes within timeout', () async {
  final result = await fetchData().timeout(const Duration(seconds: 5));
  expect(result, isNotNull);
});

Tooling

Essential Commands

dart format .                        # Format all Dart files
dart analyze                         # Static analysis (lint + type checks)
dart test                            # Run all tests
dart test --coverage=coverage        # Run tests with coverage
dart run bin/main.dart               # Run CLI application
dart compile exe bin/main.dart       # AOT compile to native executable
dart pub get                         # Install dependencies
dart pub outdated                    # Check for dependency updates
dart pub deps                        # Show dependency tree
dart fix --apply                     # Auto-apply suggested fixes

Analysis Options Configuration

# analysis_options.yaml
include: package:lints/recommended.yaml

analyzer:
  language:
    strict-casts: true
    strict-inference: true
    strict-raw-types: true
  errors:
    missing_return: error
    dead_code: warning

linter:
  rules:
    - prefer_final_locals
    - prefer_const_constructors
    - prefer_const_declarations
    - avoid_dynamic_calls
    - unawaited_futures
    - always_declare_return_types
    - annotate_overrides
    - avoid_print
    - prefer_single_quotes
    - require_trailing_commas
    - unnecessary_lambdas
    - prefer_expression_function_bodies

Pub Configuration

# pubspec.yaml
name: my_package
description: A concise description of the package.
version: 1.0.0

environment:
  sdk: ^3.0.0

dependencies:
  http: ^1.2.0
  json_annotation: ^4.8.0

dev_dependencies:
  test: ^1.25.0
  mockito: ^5.4.0
  build_runner: ^2.4.0
  json_serializable: ^6.7.0
  lints: ^4.0.0
  coverage: ^1.7.0

References

For detailed patterns and examples, see:

External References

平台分布

Codex

34.32%
按下载量换算25

Claude

30.18%
按下载量换算22

Cursor

19.42%
按下载量换算14

Gemini CLI

9.39%
按下载量换算7

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

执行命令

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

安装前确认

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

继续浏览同类 Skills