.cursor/skills/test-quality-enforcement/SKILL.md
--- name: test-quality-enforcement description: Enforces test quality standards: behavior-focused tests, no property-only tests, round-trip JSON, comprehensive test blocks. Use when writing tests, reviewing test code, or ensuring test quality. --- # Test Quality Enforcement ## Core Principle **Test what the code DOES, not what it IS.** ## ✅ DO Test - **Behavior** - What happens when you call a method? - **Business Logic** - Calculations, validation, transformations - **Error Handling** - Ho
npx skillsauth add avra-cadavra/avrai .cursor/skills/test-quality-enforcementInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Test what the code DOES, not what it IS.
expect(model.id, equals('1')) - Tests language, not behaviortest('should create', () { expect(obj, isNotNull); }) - Tests Dart works, not your codeexpect(json['field'], ...) checks - Use round-trip insteadexpect(value, isNotNull) without behavior - Test behavior with nullCombine related checks into single tests:
// ✅ GOOD: Comprehensive test
test('should validate coordinates and throw ArgumentError for invalid values', () {
expect(() => Spot(latitude: 200, longitude: 0), throwsArgumentError);
expect(() => Spot(latitude: -100, longitude: 0), throwsArgumentError);
expect(() => Spot(latitude: 0, longitude: 200), throwsArgumentError);
expect(() => Spot(latitude: 0, longitude: -200), throwsArgumentError);
});
// ❌ BAD: Separate tests for each property
test('should have id', () {
expect(model.id, equals('1'));
});
test('should have name', () {
expect(model.name, equals('Test'));
});
Always test serialization and deserialization together:
// ✅ GOOD: Round-trip JSON test
test('should serialize and deserialize correctly (round-trip)', () {
final spot = Spot(
id: '1',
name: 'Test',
latitude: 40.0,
longitude: -74.0,
);
final restored = Spot.fromJson(spot.toJson());
expect(restored, equals(spot));
});
// ❌ BAD: Field-by-field JSON checks
test('should serialize to JSON', () {
final json = spot.toJson();
expect(json['id'], equals('1'));
expect(json['name'], equals('Test'));
// ... many more lines
});
Focus on what code does:
// ✅ GOOD: Tests behavior
test('should calculate compatibility score based on personality dimensions', () {
final user1 = User(personality: Personality(...));
final user2 = User(personality: Personality(...));
final score = compatibilityCalculator.calculate(user1, user2);
expect(score, greaterThan(0.0));
expect(score, lessThanOrEqualTo(1.0));
});
// ❌ BAD: Tests structure
test('should have personality property', () {
expect(user.personality, isNotNull);
});
Every test file must have comprehensive header:
/// SPOTS Component Testing
/// Date: [Current Date]
/// Purpose: [Specific testing goals]
///
/// Test Coverage:
/// - Feature 1: [Description]
/// - Feature 2: [Description]
/// - Edge Cases: [Description]
///
/// Dependencies:
/// - Mock 1: [Purpose]
/// - Service 2: [Purpose]
Models: 100% required
Repositories: 95% required
BLoCs: 100% required
Use Cases: 100% required
Services: 90% required
UI Components: 85% required
docs/plans/test_refactoring/TEST_WRITING_GUIDE.mddocs/plans/test_refactoring/TEST_QUALITY_QUICK_REFERENCE.mdtest/templates/dart run scripts/check_test_quality.dart [file]Before committing tests:
development
--- name: world-model-development description: Guides world model development patterns: state/action encoders, ONNX inference, feature extraction pipeline, latency budgets. Use when implementing world model components, state encoders, action encoders, feature extractors, or ONNX models. Core skill for Phases 3-6. --- # World Model Development Patterns ## Core Principle All world model components follow LeCun's autonomous machine intelligence framework. State observations flow through a percep
tools
Implements base workflow controller patterns for multi-step processes. Use when creating complex workflows that require orchestration of multiple steps with error handling and rollback.
testing
--- name: widget-test-patterns description: Guides widget test patterns: BLoC testing, user interactions, state changes, material app setup. Use when writing widget tests, testing UI components, or validating widget behavior. --- # Widget Test Patterns ## Core Pattern Widget tests verify UI behavior: user interactions, state changes, and visual display. ## Basic Widget Test Setup ```dart testWidgets('widget displays correctly', (WidgetTester tester) async { // Arrange: Create widget awa
testing
--- name: test-template-generation description: Generates test templates: unit, widget, integration, service tests following project patterns. Use when creating new tests or ensuring tests follow project standards. --- # Test Template Generation ## Available Templates Test templates are located in `test/templates/`: - `unit_test_template.dart` - `widget_test_template.dart` - `integration_test_template.dart` - `service_test_template.dart` ## Unit Test Template ```dart /// SPOTS Component Uni