Atomic Design micro-UI architecture
90%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
HALT on any missing prerequisite — instruct the user to resolve it before continuing.
hooks_riverpod and flutter_hooks present in pubspec.yaml.mocktail present in dev_dependencies.lib/shared/widgets/ exists (if shared).All paths follow this convention (substitute {scope} and {type}):
| Scope | Widget source | Test |
|---|---|---|
| Shared | lib/shared/widgets/{type}/{component_name}.dart | test/shared/widgets/{type}/{component_name}_test.dart |
| Feature | lib/features/{feature}/presentation/widgets/{type}/{component_name}.dart | test/features/{feature}/presentation/widgets/{type}/{component_name}_test.dart |
{type} = atoms or molecules. Validator lives in the same directory as the molecule: {component_name}_validator.dart.
const constructorpackage:storestorm/... imports — NEVER relative importsMUST classify the component before writing any code.
| Condition | Classification | Widget Type |
|---|---|---|
All data from constructor, no controllers, no ref | Atom | StatelessWidget |
Needs useTextEditingController, useFocusNode, useState, or ref.watch/ref.read | Molecule | HookConsumerWidget |
If classification is ambiguous, default to Atom. Escalate to Molecule ONLY when a concrete controller or Riverpod access is required.
If the user requests StatefulWidget, HALT — explain the architecture mandates HookConsumerWidget for stateful micro-UI.
Use the Path Template with {type} = atoms.
Atom-specific requirements (in addition to Shared Constraints):
final constructor parametershooks_riverpod, flutter_hooks, flutter_bloc, or providerAtoms do NOT require a Validator or mandatory widget tests (unless conditional rendering exists).
Use the Path Template with {type} = molecules.
Molecule-specific requirements (in addition to Shared Constraints):
HookConsumerWidgetuseTextEditingController(), useFocusNode(), useState()setState() — NEVERref.read(provider.notifier).method()Form widget with a GlobalKey<FormState>TextFormField.validator to the Validator class (generated in Phase 4)formKey.currentState!.validate() before any submission actionExecute for every Molecule that has user input fields.
Path: same directory as the molecule — {component_name}_validator.dart.
Requirements:
ClassName._())static String? validate(String? value) for each validated field — return null for valid, a user-facing error string for invalidBuildContext, ref, or any external servicevalidator: {ValidatorClass}.validate on each TextFormFieldMandatory for EVERY Molecule.
Use the Path Template with {type} = molecules.
import 'package:flutter_test/flutter_test.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:mocktail/mocktail.dart';
// Import the widget and its dependencies
class Mock{X}Notifier extends Mock implements {X}Notifier {}
void main() {
group('{ComponentName}', () {
Widget createTestWidget({List<Override> overrides = const []}) =>
ProviderScope(
overrides: overrides,
child: const MaterialApp(home: Scaffold(body: Form(child: {ComponentName}()))),
);
testWidgets('renders initial state correctly', (tester) async { /* assert key UI elements present */ });
testWidgets('displays validation error for invalid input', (tester) async { /* enter invalid data, trigger validate, assert error text */ });
testWidgets('passes validation for valid input', (tester) async { /* enter valid data, trigger validate, assert no error text */ });
testWidgets('dispatches to provider on valid submission', (tester) async { /* submit, verify(() => mockNotifier.method(any())).called(1) */ });
});
}Mock setup rules:
ProviderScope(overrides: [...]) — NEVER use real providers in testsverify or when callsAfter generating all files, verify each of the following. Fix any violation before reporting completion.
package:storestorm/... — no relative imports anywhere.HookConsumerWidget.String?.ProviderScope with overrides, has minimum 4 test cases.After execution, report: