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

dart-cli-creatordart CLI creator 命令行

Agent Skill

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

总安装

1,364

周安装

58

GitHub Stars

1

下载量

478
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/mono0926/skills --skill dart-cli-creator

简介

dart-cli-creator 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息。

  • 适合围绕仓库状态、代码变更或协作事项进行整理。
  • 可结合来源仓库和原始 README 核验具体用法。
  • 安装前建议确认权限范围、维护状态及是否触发联网或文件读写。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

Dart CLI Creator Skill

This skill provides guidelines and procedures for creating and improving top-quality Command-Line Interface (CLI) tools using Dart. As an agent, you must consistently follow these best practices when requested by the user to create or modify a Dart CLI.

🎯 Core Best Practices

1. Project Structure and Design

  • bin/ directory: Place the entry point executable files for the CLI (e.g., bin/my_cli.dart). Keep this as a thin wrapper that only calls top-level functions or classes from lib/ or src/, avoiding complex logic here.
  • lib/ directory: Place business logic, command implementations, and reusable utilities here (e.g., lib/src/commands/, lib/src/utils/).
  • Separation of Concerns: Always separate the CLI input/output handling (argument parsing, UI rendering) from the core business logic to maximize testability.

2. Command-Line Arguments and Routing

  • Leverage the args package: Use CommandRunner and Command classes from the standard args package to build a Git-like CLI with subcommands.
  • Self-documenting: Carefully write description and help for each command, flag, and option, ensuring that --help provides sufficient usage information.

3. Rich UX (User Experience) and Logging

  • Actively use mason_logger: Avoid standard print statements; use the mason_logger package instead.

- Output color-coded messages with logger.info(), logger.success(), logger.err(), and logger.warn(). - Display a spinner for time-consuming tasks using logger.progress('Doing something...'). - Utilize logger.confirm() or logger.prompt() for user confirmations (y/n) or text input. If more advanced menu selections or spinners are needed, combine it with the interact package. - Tip: For a practical setup, define final logger = Logger(); at the top level in lib/logger.dart and import it across the project. This reduces boilerplate and is highly convenient (ideal for small to medium-sized CLI tools where DI is not mandatory).

  • cli_completion: Consider using the cli_completion package to provide shell completion features by extending CompletionCommandRunner.

4. Proper Error Handling and Exit Strategies

  • Exit Code: Always treat the result of the process as an appropriate exit code (0 for success, 1 or sysexits-compliant error codes for errors).
  • Avoid direct exit() calls: Calling exit() directly causes the Dart VM to terminate immediately, potentially bypassing resource cleanup (like finally blocks). Instead, return an int from CommandRunner.run(), propagate it to the main function, set it to the exitCode property, and allow the process to exit naturally (e.g., after waiting for Process.stdout.close()).
  • Custom Exception Classes and Handling: Define custom domain-specific exception classes (e.g., AppException) and throw them from deep within the call stack.
  • Global Exception Catching: Wrap the entire execution of CommandRunner in a try-catch block to handle AppException, UsageException, and any uncaught exceptions. Rather than showing stack traces directly to the user, output errors gracefully using logger.err(e.message) and return an appropriate exit code.

5. Static Analysis and Code Formatting

  • Apply pedantic_mono: Configure pedantic_mono in analysis_options.yaml and adhere to strict static analysis rules.
  • [ZERO TOLERANCE]: Always resolve ALL errors, warnings, and info level lints immediately after making code changes. A "clean" analysis is mandatory for a project to be considered in a healthy state.

6. Distribution and Execution Configuration

  • Shebang: Always include #!/usr/bin/env dart as the very first line of executable files directly under bin/.
  • Pubspec Configuration: Define the CLI command name in the executables: section of pubspec.yaml to enable easy installation via dart pub global activate.

7. Auto-Update Check Feature

  • Leverage pub_updater: Use pub_updater to check pub.dev or other registries for new version releases, either on every command execution or periodically.
  • If a new version is available, provide an interactive UI prompting the user to update using logger.warn('Update available!') or an interact-based prompt.

8. Version Management and Release Process

  • Robust Version Manipulation: When manipulating SemVer versions, avoid parsing versions manually whenever possible. Always rely on the pub_semver package (e.g., Version.parse, nextMajor, nextMinor) to prevent parsing failures related to edge cases like pre-release tags or build metadata.
  • Automated Releases: To handle version bumping, CHANGELOG generation, git committing, and publishing to GitHub or pub.dev, utilize the release-pub skill. If creating an advanced Dart CLI, recommend using this agentic skill to coordinate complex CI/CD and release pipelines safely rather than instructing users to perform these steps manually.

🛠️ Project Skeleton (Basic Implementation Example)

When creating a CLI, use a structure and implementation similar to the following as a foundation.

Excerpt from pubspec.yaml

environment:
  sdk: ^3.11.0 # Always specify the latest stable version

dependencies:
  args: ^2.5.0
  cli_completion: ^0.4.0
  mason_logger: ^0.2.16
  pub_updater: ^0.4.0

dev_dependencies:
  pedantic_mono: any
  test: ^1.24.0

executables:
  my_cli:

bin/my_cli.dart

#!/usr/bin/env dart
import 'dart:io';

import 'package:my_cli/command_runner.dart';

Future<void> main(List<String> arguments) async {
  final exitCode = await MyCliCommandRunner().run(arguments);
  await flushThenExit(exitCode ?? 0);
}

/// Helper method to set the [status] to exitCode, and wait for the standard output/error to flush before exiting
Future<void> flushThenExit(int status) async {
  exitCode = status;
  await Future.wait<void>([
    stdout.close(),
    stderr.close(),
  ]);
}

lib/logger.dart

import 'package:mason_logger/mason_logger.dart';

/// The [Logger] shared across the application.
final logger = Logger();

lib/command_runner.dart

import 'package:args/args.dart';
import 'package:cli_completion/cli_completion.dart';
import 'package:mason_logger/mason_logger.dart';
import 'package:my_cli/logger.dart';
import 'package:pub_updater/pub_updater.dart';

class MyCliCommandRunner extends CompletionCommandRunner<int> {
  MyCliCommandRunner({PubUpdater? pubUpdater})
      : _pubUpdater = pubUpdater ?? PubUpdater(),
        super('my_cli', 'A highly robust Dart CLI tool.') {
    argParser
      ..addFlag(
        'version',
        abbr: 'v',
        negatable: false,
        help: 'Print the current version.',
      )
      ..addFlag(
        'verbose',
        help: 'Enable verbose logging.',
      );
    // TODO: addCommand(MyCustomCommand());
  }

  final PubUpdater _pubUpdater;

  Future<void> _checkForUpdates() async {
    try {
      final isUpToDate = await _pubUpdater.isUpToDate(
        packageName: 'my_cli',
        currentVersion: '1.0.0', // Optionally link to a packageVersion constant
      );
      if (!isUpToDate) {
        final latestVersion = await _pubUpdater.getLatestVersion('my_cli');
        logger.info('\nUpdate available: $latestVersion');
      }
    } catch (_) {}
  }

  @override
  Future<int> run(Iterable<String> args) async {
    try {
      final argResults = parse(args);
      if (argResults['verbose'] == true) {
        logger.level = Level.verbose;
      }

      // Check for version updates (consider asynchronous background execution)
      await _checkForUpdates();

      return await runCommand(argResults) ?? 0;
    } on FormatException catch (e) {
      logger
        ..err(e.message)
        ..info('')
        ..info(usage);
      return 64; // usage error
    } on UsageException catch (e) {
      logger
        ..err(e.message)
        ..info('')
        ..info(usage);
      return 64;
    } on AppException catch (e) {
      // Gracefully output custom domain exceptions
      logger.err(e.message);
      return 1;
    } catch (e, stackTrace) {
      logger
        ..err('An unexpected error occurred: $e')
        ..err('$stackTrace');
      return 1;
    }
  }

  @override
  Future<int?> runCommand(ArgResults topLevelResults) async {
    if (topLevelResults['version'] == true) {
      logger.info('my_cli version: 1.0.0');
      return 0;
    }
    return super.runCommand(topLevelResults);
  }
}

/// A custom exception specific to the domain.
class AppException implements Exception {
  const AppException(this.message);
  final String message;

  @override
  String toString() => message;
}

lib/src/commands/my_custom_command.dart

import 'package:args/command_runner.dart';
import 'package:my_cli/logger.dart';

class MyCustomCommand extends Command<int> {
  MyCustomCommand() {
    argParser.addOption(
      'name',
      abbr: 'n',
      help: 'Your name.',
      mandatory: true,
    );
  }

  @override
  String get description => 'A custom command example.';

  @override
  String get name => 'hello';

  @override
  Future<int> run() async {
    final name = argResults?['name'] as String?;
    final progress = logger.progress('Saying hello to $name...');

    // Simulate a time-consuming task
    await Future<void>.delayed(const Duration(seconds: 1));

    progress.complete('Hello, $name!');
    return 0; // Success
  }
}

🤖 Instructions for the Agent

When requested by the user to "create a CLI tool for doing X", etc.:

  1. Follow the contents of this skill to structure a project centered around args and mason_logger. Always specify the latest stable Dart SDK version (where the patch version is 0, e.g., ^3.11.0) in pubspec.yaml.
  2. Determine the directory structure and orchestrate/propose a set of commands based on the requirements.
  3. Introduce pedantic_mono and generate high-quality code that adheres to strict static analysis.
  4. (If necessary) After development is complete, document the usage instructions in README.md and present the user with installation steps, such as using dart pub global activate --source path..

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

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

平台分布

Codex

38.72%
按下载量换算185

Claude

27.47%
按下载量换算131

Cursor

17.54%
按下载量换算84

Gemini CLI

8.6%
按下载量换算41

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

执行命令

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

安装前确认

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

来源信息

继续浏览同类 Skills