
Dart add unit test
Guides your agent to write and organize Dart and Flutter unit tests with package:test
Dart add unit test is an open-source agent skill for developer tools. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.
- Scripts
- None
- Platforms
- Claude Code, Codex, Cursor
- GitHub stars
- 3.2K
- Last commit
- License
- BSD-3-Clause
- Listing updated
Similar skills
About Dart add unit test
This skill tells the agent how to lay out test code for a Dart or Flutter package: tests live in the test directory and mirror the lib structure, with files named with a _test.dart suffix. It covers the core package:test API, including grouping cases, asserting with matchers, handling async tests, and setup and teardown callbacks. Integration tests are kept in a separate integration_test directory.
The skill also gives a step-by-step workflow for building a new test suite, ending in a run, read-the-stack-trace, fix and re-run loop. It includes two worked examples, one for a plain calculator-style suite and one that uses Mockito to mock a dependency injected into a service.
It expects a Dart project, with dart test for pure Dart code or flutter test for Flutter apps. Mocking requires the mockito package and build_runner to generate mock files.
When your agent uses it
Write and organize unit tests for functions, methods, and classes using `package:test`. Use when creating new logic or fixing bugs to ensure code remains correct and regression-free.
From the skill's SKILL.md. Your agent reads this description to decide when to load the skill.
What it can access
- Instructions only, no scripts(see the files on GitHub)
- License: BSD-3-Clause(see the files on GitHub)
From a static check of its 1 file (5 KB) on GitHub on 1 December 2026. Nothing was run. Read the files before you install a skill: it can tell your agent to run anything its tools allow.
Check another skill before you install it.
Install
This skill ships in the dart-flutter plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):
/plugin marketplace add flutter/agent-plugins
/plugin install dart-flutter@dart-flutterOr copy only this skill to ~/.claude/skills/dart-add-unit-test:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/flutter/agent-plugins.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/dart-add-unit-test &&
cp -R "$tmp/skills/dart-add-unit-test" ~/.claude/skills/dart-add-unit-test &&
rm -rf "$tmp"For one project only, put the folder in .claude/skills/dart-add-unit-test inside it instead.
Copy the skill folder to ~/.agents/skills/dart-add-unit-test to use it in every repository:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/flutter/agent-plugins.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/dart-add-unit-test &&
cp -R "$tmp/skills/dart-add-unit-test" ~/.agents/skills/dart-add-unit-test &&
rm -rf "$tmp"For one repository only, put the folder in .agents/skills/dart-add-unit-test inside it instead.
Copy the skill folder to ~/.cursor/skills/dart-add-unit-test to use it in every project:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/flutter/agent-plugins.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/dart-add-unit-test &&
cp -R "$tmp/skills/dart-add-unit-test" ~/.cursor/skills/dart-add-unit-test &&
rm -rf "$tmp"For one project only, put the folder in .cursor/skills/dart-add-unit-test inside it instead.
Run in a terminal (add --scope workspace to install it for the current workspace only):
gemini skills install https://github.com/flutter/agent-plugins.git --path skills/dart-add-unit-testOr copy the folder to ~/.gemini/skills/dart-add-unit-test yourself.
For GitHub Copilot in VS Code, copy the skill folder to ~/.copilot/skills/dart-add-unit-test:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/flutter/agent-plugins.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/dart-add-unit-test &&
cp -R "$tmp/skills/dart-add-unit-test" ~/.copilot/skills/dart-add-unit-test &&
rm -rf "$tmp"For one project only, put the folder in .github/skills/dart-add-unit-test inside it instead.
Get the folder:
git clone --depth 1 https://github.com/flutter/agent-plugins.gitThen copy agent-plugins/skills/dart-add-unit-test into your agent's skills folder as dart-add-unit-test. Agents that support SKILL.md read one folder per skill.
What it does
- Test file layout
- Explains how to mirror the lib folder inside test and name files with the _test.dart suffix.
- package:test usage
- Covers grouping, test cases, expect with matchers, and async test handling.
- Setup and teardown
- Shows how to share initialized objects across cases with setUp and tearDown callbacks.
- Mockito mocking
- Describes generating mocks for injected dependencies and verifying calls in tests.
- Run commands
- Lists when to use dart test versus flutter test, including integration test directories.
- Step-by-step workflow
- Gives a checklist for creating a suite and iterating until the tests pass.
Good for
- Write unit tests for a new Dart function or class
- Add regression tests after fixing a bug in a Flutter app
- Mock an API client and test a service that depends on it
- Organize test files to match the lib folder structure
- Set up shared test fixtures with setUp and tearDown
Dart add unit test FAQ
Which test runner does Dart add unit test use?
For pure Dart projects it uses dart test, and for Flutter projects flutter test. Integration tests need the directory passed explicitly.
Does Dart add unit test need extra packages for mocking?
Mocking examples use package:mockito with build_runner to generate mock objects.
Where should test files go?
In the test directory at the package root, mirroring lib, with names ending in _test.dart. Integration tests go in integration_test.
How do I install Dart add unit test in Claude Code?
Copy the skill folder from GitHub to ~/.claude/skills/dart-add-unit-test to use it in all your projects, or to .claude/skills/dart-add-unit-test in one project. Or install the dart-flutter plugin, which includes it: /plugin marketplace add flutter/agent-plugins, then /plugin install dart-flutter@dart-flutter.
Does Dart add unit test run scripts?
No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.
Which AI agents can use Dart add unit test?
Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.
What are the best alternatives to Dart add unit test?
The closest alternatives to Dart add unit test are Dart generate test mocks, Flutter add widget test, Flutter testing skill, Flutter add integration test and Dart collect coverage.
Where this comes from
- Description: from the skill's own SKILL.md.
More from flutter/agent-plugins

Sets up Flutter integration tests and turns MCP-driven UI exploration into repeatable
- Open source
- 3.2K GitHub stars
- Developer tools

Guides the agent to write Flutter widget tests with WidgetTester for taps, scrolling
- Open source
- 3.2K GitHub stars
- Developer tools

Teaches agents to write Dart unit tests with generated Mockito mocks via build_runner
- Open source
- 3.2K GitHub stars
- Developer tools

Review Dart or Flutter API code against canonical API design principles
- Open source
- 3.2K GitHub stars
- Developer tools

Write clear docstrings, dartdoc and JSDoc for Dart, Python and TypeScript
- Open source
- 3.2K GitHub stars
- Files and documents

Run a multi-step pull request or local diff review with critique and synthesis
- Open source
- 3.2K GitHub stars
- Developer tools


