PlugWiki

Dart Add Unit Test Skill: Write and Run Dart and Flutter Tests

dart-add-unit-test (from the Dart team) makes Claude write Dart and Flutter unit tests with package:test, in the right folder, and run them until they pass.

Installs
19.8K
on skills.sh
Stars
537
on GitHub
Updated
Oct 2026
last repo commit

The skill covers three things: where test files go, how to write tests, and which command runs them. Test files mirror lib/ under test/ and end in _test.dart. Tests use package:test (or flutter_test for Flutter) with group(), test(), expect() and matchers, plus setUp() and tearDown().

For classes that take dependencies, it uses package:mockito. Claude runs dart test for pure Dart, flutter test for Flutter, and names the integration_test folder explicitly because the default runner skips it.

SKILL.md ends with a 7-step workflow and a feedback loop: run the test, read the stack trace, fix the code or assertion, and run again until it passes. It includes two examples, a calculator test suite and a mockito mock for an API client. The README's example prompt is "Add a unit test for the Point class."

Good for

  • Dart developers adding tests for new logic or a bug fix
  • Flutter developers who want tests laid out to match their lib folder
  • Teams that want mockito mocks for classes that use APIs or databases

Install dart-add-unit-test

Claude Code

  1. 1

    Copy this prompt.

    Install the dart-add-unit-test skill in Claude Code. Run this command:
    
    npx skills add https://github.com/dart-lang/skills --skill dart-add-unit-test
    
    Then check that it loaded and tell me how to use it.
  2. 2

    Paste it into Claude Code. It shows the change and asks before running it.

Requires Node.js.

From its listing on skills.sh. Source.

What's in the skill

When it loads

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.

Sections in SKILL.md

  1. Contents
  2. Structuring Test Files
  3. Writing Tests
  4. Executing Tests
  5. Test Implementation Workflow
  6. Task Progress
  7. Examples
  8. Standard Unit Test Suite
  9. Mocking with Mockito

Key facts

Installs on skills.sh
19,758 as of 2026-11-02
GitHub stars (whole repo)
537 as of 2026-11-02
Last repo commit
2026-10-16
Files in the skill folder
1 file including SKILL.md

What it includes

  • Mirror lib/ under test/, add the _test.dart suffix

    Integration tests go in an integration_test folder at the package root.

    Write · Structure test files

  • package:test with group, test, expect, setUp and tearDown

    Async tests use async and await. Matchers include equals, isTrue and throwsA.

    Write · Write tests

  • Generate mocks for injected dependencies

    The example uses @GenerateNiceMocks and says to generate with dart run build_runner build.

    Runs code · Mock with mockito

  • dart test, flutter test, or name integration_test

    Picks the runner by project type.

    Runs code · Run tests

  • Create file, import, main(), setUp, group tests, run, loop

    Ends with a feedback loop of run, read the stack trace, fix, and rerun until passing.

    Runs code · 7-step workflow

  • A calculator suite and a mockito example

    Show grouping, setup, sync and async tests, and mock configuration with verify.

    Examples

From the official docs

Permissions

Low risk

The skill makes Claude write test files and run dart test or flutter test, which executes your own code. Review tests that call real services before running them.

What it can do

  • Read your data
  • Create and change things
  • Delete things
  • Read-only mode

Watch out for

  • Tests run your code

    dart test and flutter test execute whatever the tests and the code under test do, including calls to APIs or databases. Use test doubles or a test environment. github.com

  • The mock example uses build_runner

    SKILL.md's mock example imports data_service_test.mocks.dart and says to generate the mock with dart run build_runner build. That runs a code generator in your package. github.com

Technical details
Scopes
  • your Dart or Flutter package

Questions

What does the dart-add-unit-test skill do?

It makes Claude write unit tests for Dart and Flutter code with package:test, place them in the right folder, add mockito mocks where needed, and run them until they pass.

How do I install it in Claude Code or Codex?

Use the install box above for this skill. The dart-lang/skills README also documents installing all Dart skills with --agent universal, which uses the standard .agents/skills folder.

Does it need an API key?

No. SKILL.md names no key. It needs a Dart or Flutter project with the test package, and mockito and build_runner if you use mocks.

Is it safe to install?

It is a single instruction file with no scripts. It makes Claude create test files and run dart test or flutter test, and your tests then run your own code. Review tests that touch real APIs or databases before running them.

Who makes it?

The README says the dart-lang/skills collection is maintained by the Dart team.

How is it different from dart-generate-test-mocks?

This skill is about writing and running unit tests. The README lists dart-generate-test-mocks as the separate skill for defining and generating mocks with mockito and build_runner.

Information

updated Nov 2, 2026

Folder
skills/dart-add-unit-test

dart-lang/skillsskills.sh

Sources

Docs, issue trackers and discussions this page is built from.

Show all 2
  1. dart-add-unit-test SKILL.md · github.com
  2. dart-lang/skills README · github.com

Updated Nov 2, 2026.