dart-build-cli-app

Builds Dart command-line applications with argument parsing, exit codes, testing, and native compilation.

1|Updated Aug 14, 2026
One-click install
npx skills add https://github.com/sohampawar1866/zeromile-go --skill dart-build-cli-app-sohampawar1866
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dart-build-cli-app
Source: https://github.com/sohampawar1866/zeromile-go/tree/main/.agents/skills/dart-build-cli-app
Command: npx skills add https://github.com/sohampawar1866/zeromile-go --skill dart-build-cli-app-sohampawar1866

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Building production-grade Dart CLI tools requires coordinating argument parsing, POSIX exit codes, error handling, integration testing, and cross-platform compilation, and this Skill provides the complete workflow and code patterns to do it correctly. ## Core Features & Use Cases - Project Scaffolding & Architecture: Initialize CLI projects with dart create -t cli, organize entry points in bin/, and structure logic in lib/src/. - Argument Parsing & Command Routing: Use the args package's ArgParser for simple scripts or CommandRunner/Command for multi-command tools like git. - Robust Error Handling: Return standard POSIX exit codes via the io package and capture readable async stack traces with stack_trace. - Integration Testing: Write subprocess-based tests with test_process and test_descriptor that validate stdout, exit codes, and filesystem mutations. - Compilation & Distribution: Compile standalone native executables with dart compile exe, including Linux cross-compilation for arm64, x64, arm, and riscv64. - Use Case: You need to ship a multi-command developer tool with subcommands, help text, automated tests, and a distributable Linux binary built from your macOS machine. ## Quick Start Use the dart-build-cli-app skill to scaffold a new Dart CLI application with a CommandRunner, one subcommand, integration tests, and a compiled native executable.

Frequently Asked Questions about dart-build-cli-app

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build a CLI application in Dart?

Run dart create -t cli to scaffold a console project, place your main() entry point in bin/, and use the args package's ArgParser or CommandRunner to handle arguments. Compile a standalone executable with dart compile exe bin/cli.dart.

How do I create subcommands in a Dart CLI like git?

Use CommandRunner from the args package and extend the Command class for each subcommand, defining name, description, and command-specific flags in the constructor. Register each command with addCommand() and catch UsageException to display generated help text.

How do I test a Dart CLI application?

Use test_process to spawn the CLI as a subprocess and test_descriptor to build mock filesystems. Validate stdout with StreamQueue matchers, assert exit codes with shouldExit(0), and verify filesystem changes with Descriptor.validate().

Can Dart compile CLI executables for Linux from macOS or Windows?

Yes, dart compile exe supports cross-compilation to Linux using --target-os=linux with --target-arch set to arm64, x64, arm, or riscv64. Linux is currently the only supported cross-compilation target operating system.

What exit codes should a Dart CLI return on errors?

Use the io package's ExitCode enum for standard POSIX codes, such as ExitCode.success.code for success and exit code 64 after a caught UsageException. Failures should write descriptive messages to stderr and exit with non-zero codes.