Entrypoint structure, exit codes, cross-platform scripts. Use when building command line utilities, scripts, or applications.
The `dart-build-cli-app` skill provides a comprehensive framework for creating robust command-line applications in Dart. It guides developers through the standard project structure, argument parsing, command routing, execution handling, and testing, ensuring a consistent and maintainable architecture. By following these conventions, developers can efficiently scaffold new CLI projects, handle user inputs gracefully, and manage errors with proper exit codes, reducing runtime issues and improving reliability across platforms.
This skill includes key capabilities for building both simple scripts and complex, multi-command CLI tools. It emphasizes proper separation of entry points and internal logic, use of the `args` package for argument management, and adoption of `io` and `stack_trace` packages for consistent error reporting. Features such as `CommandRunner` for subcommands, structured handling of usage exceptions, and automated testing using `test_process` and `test_descriptor` ensure developers can create well-tested, production-ready tools. It also enforces code formatting standards in CI pipelines and encourages clear, user-friendly help text that guides users in executing the CLI applications correctly.
`dart-build-cli-app` is ideal for Dart developers aiming to create command-line utilities, scripts, or full-featured CLI applications. It suits those building cross-platform tools that require structured input handling, error management, and automated testing. Typical use cases include internal developer tools, deployment scripts, and end-user CLI applications that demand reliability and maintainability. This skill is especially valuable for teams adopting best practices in CLI design and for developers who want to ensure their Dart-based utilities are both user-friendly and robust.
Use the command `dart create -t cli <project_name>` to scaffold a new console application with standard directory structures and basic argument parsing.
Use the `args` package for command-line argument parsing and `io` along with `stack_trace` packages for managing execution flow and formatting stack traces.
Yes. Implement `CommandRunner` and extend `Command` for each subcommand, defining global and command-specific arguments as needed.
All new commands and significant features must have automated tests using `test_process` and `test_descriptor`. Manual verification is recommended for help text and UX.
Yes. Running `dart format . --set-exit-if-changed` in CI environments ensures code formatting compliance, returning an exit code if violations exist.
Quick Setup:
.claude/skills/Repository
dart-lang/skills