test-driven-development
Write tests first, watch them fail, then implement minimal code to pass.
dart-test-fundamentals
Core concepts and best practices for package:test. Covers test, group, lifecycle methods (setUp, tearDown), and configuration (dart_test.yaml).
Full skill instructions
Use this skill when:
group.dart_test.yaml.To find candidates for improving test structure:
try-finally CleanupSearch for tests that use try-finally for cleanup instead of addTearDown:
\bfinally\s*\{ (Check if this is used for resource cleanup
inside a test).test and group)test: The fundamental unit of testing.
test('description', () {
// assertions
});
group: Used to organize tests into logical blocks.
setUp and tearDown calls.PascalCase for groups that correspond to a class name
(e.g., group('MyClient', ...)).group call if it's the only one.
Naming Tests test('test name here',:
group instead.'throws StateError' or 'adds API key to URL').Named Parameters Placement:
test and group calls, place named parameters (e.g., testOn,
timeout, skip) immediately after the description string, before the
callback closure. This improves readability by keeping the test logic last.
test('description', testOn: 'vm', () {
// assertions
});
setUp, tearDown)setUp: Runs before every test in the current group (and nested
groups).tearDown: Runs after every test in the current group.setUpAll: Runs once before any test in the group.tearDownAll: Runs once after all tests in the group.Best Practice:
setUp for resetting state to ensure test isolation.test body, consider using
addTearDown instead of a try-finally block.Avoid:
test('can create and delete a file', () {
final file = File('temp.txt');
try {
file.writeAsStringSync('hello');
expect(file.readAsStringSync(), 'hello');
} finally {
if (file.existsSync()) file.deleteSync();
}
});
Prefer:
test('can create and delete a file', () {
final file = File('temp.txt');
// Register teardown immediately after resource creation intent
addTearDown(() {
if (file.existsSync()) file.deleteSync();
});
file.writeAsStringSync('hello');
expect(file.readAsStringSync(), 'hello');
});
dart_test.yaml)The dart_test.yaml file configures the test runner. Common configurations
include:
Define where tests run (vm, chrome, node).
platforms:
- vm
- chrome
Categorize tests to run specific subsets.
tags:
integration:
timeout: 2x
Usage in code:
@Tags(['integration'])
import 'package:test/test.dart';
Running tags:
dart test --tags integration
Set default timeouts for tests.
timeouts:
2x # Double the default timeout
_test.dart to be picked up by the test runner.test/ directory.dart test: Run all tests.dart test test/path/to/file_test.dart: Run a specific file.dart test --name "substring": Run tests matching a description.dart-test-fundamentals is the core skill for structuring and configuring
tests. For writing assertions within those tests, refer to:
package:matcher (expect calls).Write tests first, watch them fail, then implement minimal code to pass.
Enforce verification commands before claiming work completion, fixes, or test passes—no success assertions without fresh evidence.
Dispatch fresh subagents per task with two-stage review (spec compliance, then code quality) in the current session.
Evaluate code review feedback with technical rigor before implementing, avoiding performative agreement and blind implementation.
Test-driven documentation for creating reusable agent techniques, patterns, and reference guides.
Structured workflow for completing development branches with test verification and merge/PR options.
Browser automation with 40+ commands for navigation, interaction, form filling, and web testing.
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.
Comprehensive reference guide for writing, debugging, and maintaining Playwright tests across all testing types and scenarios.
End-to-end Solana development with framework-kit, @solana/kit, Anchor programs, and local testing.
ab testing
Build custom Expo development clients for testing native code on physical devices via EAS Build or locally.
Opus.ai: Revolutionize Your Web Experience
Build a no-code AI app in minutes.
An IDE for code migration from legacy to modern frameworks through coding agents.
Automate CGI animation in live-action scenes
Branded artistic QR-code concepts
Launch a website in seconds with AI.
Streamline Your Coding Experience with AI Code Helper
Convert any screenshot or design to clean code.