sdd-full 4.6.2 → 4.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin.js +1 -1
- package/package.json +1 -1
- package/skills/.agents/skills/flutter-add-integration-test/SKILL.md +165 -0
- package/skills/.agents/skills/flutter-add-widget-preview/SKILL.md +147 -0
- package/skills/.agents/skills/flutter-add-widget-test/SKILL.md +156 -0
- package/skills/.agents/skills/flutter-apply-architecture-best-practices/SKILL.md +164 -0
- package/skills/.agents/skills/flutter-build-responsive-layout/SKILL.md +141 -0
- package/skills/.agents/skills/flutter-fix-layout-issues/SKILL.md +132 -0
- package/skills/.agents/skills/flutter-implement-json-serialization/SKILL.md +155 -0
- package/skills/.agents/skills/flutter-setup-declarative-routing/SKILL.md +257 -0
- package/skills/.agents/skills/flutter-setup-localization/SKILL.md +212 -0
- package/skills/.agents/skills/flutter-use-http-package/SKILL.md +177 -0
- package/skills/VERSION.md +176 -62
- package/skills/design-planning/ai-coding-rules/SKILL.md +5 -13
- package/skills/design-planning/design-to-code/SKILL.md +5 -14
- package/skills/design-planning/enterprise-spec/SKILL.md +5 -13
- package/skills/design-planning/flutter-av/SKILL.md +5 -16
- package/skills/design-planning/flutter-map/SKILL.md +5 -14
- package/skills/design-planning/function-sdd/SKILL.md +5 -13
- package/skills/design-planning/global-overlay-stack-standard/SKILL.md +73 -0
- package/skills/design-planning/ui-motion-interaction-standard/SKILL.md +69 -0
- package/skills/design-planning/ui-sdd-specialized/SKILL.md +5 -14
- package/skills/development-execution/flutter-errors/SKILL.md +5 -15
- package/skills/flutter-skills/.github/dependabot.yaml +15 -0
- package/skills/flutter-skills/.github/workflows/dart_skills_lint_workflow.yaml +68 -0
- package/skills/flutter-skills/.github/workflows/skills_tool.yaml +51 -0
- package/skills/flutter-skills/CODE_OF_CONDUCT.md +3 -0
- package/skills/flutter-skills/CONTRIBUTING.md +36 -0
- package/skills/flutter-skills/LICENSE +26 -0
- package/skills/flutter-skills/README.md +50 -0
- package/skills/flutter-skills/pubspec.yaml +9 -0
- package/skills/flutter-skills/resources/flutter_skills.yaml +434 -0
- package/skills/flutter-skills/skills/flutter-add-integration-test/SKILL.md +163 -0
- package/skills/flutter-skills/skills/flutter-add-widget-preview/SKILL.md +145 -0
- package/skills/flutter-skills/skills/flutter-add-widget-test/SKILL.md +154 -0
- package/skills/flutter-skills/skills/flutter-apply-architecture-best-practices/SKILL.md +162 -0
- package/skills/flutter-skills/skills/flutter-build-responsive-layout/SKILL.md +139 -0
- package/skills/flutter-skills/skills/flutter-fix-layout-issues/SKILL.md +130 -0
- package/skills/flutter-skills/skills/flutter-implement-json-serialization/SKILL.md +153 -0
- package/skills/flutter-skills/skills/flutter-setup-declarative-routing/SKILL.md +255 -0
- package/skills/flutter-skills/skills/flutter-setup-localization/SKILL.md +210 -0
- package/skills/flutter-skills/skills/flutter-use-http-package/SKILL.md +175 -0
- package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/add-dart-lint-validation-rule/SKILL.md +196 -0
- package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-best-practices/SKILL.md +65 -0
- package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-checks-migration/SKILL.md +158 -0
- package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-cli-app-best-practices/SKILL.md +168 -0
- package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-doc-validation/SKILL.md +87 -0
- package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-long-lines/SKILL.md +101 -0
- package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-matcher-best-practices/SKILL.md +136 -0
- package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-modern-features/SKILL.md +266 -0
- package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-package-maintenance/SKILL.md +92 -0
- package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-test-coverage/SKILL.md +92 -0
- package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-test-coverage/example/lib/src/calculator.dart +7 -0
- package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-test-coverage/example/pubspec.yaml +8 -0
- package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-test-coverage/example/test/calculator_test.dart +11 -0
- package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-test-coverage/scripts/interpret_coverage.dart +95 -0
- package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-test-coverage/scripts/pubspec.yaml +6 -0
- package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-test-coverage/scripts/test/interpret_coverage_test.dart +93 -0
- package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-test-fundamentals/SKILL.md +173 -0
- package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/definition-of-done/SKILL.md +27 -0
- package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/flutter_skills_ignore.json +3 -0
- package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/grill-me/SKILL.md +10 -0
- package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/ignore.json +3 -0
- package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/test-driven-development/SKILL.md +371 -0
- package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/test-driven-development/testing-anti-patterns.md +299 -0
- package/skills/flutter-skills/tool/dart_skills_lint/AUTHORS +7 -0
- package/skills/flutter-skills/tool/dart_skills_lint/CHANGELOG.md +12 -0
- package/skills/flutter-skills/tool/dart_skills_lint/CONTRIBUTING.md +51 -0
- package/skills/flutter-skills/tool/dart_skills_lint/LICENSE +27 -0
- package/skills/flutter-skills/tool/dart_skills_lint/README.md +203 -0
- package/skills/flutter-skills/tool/dart_skills_lint/analysis_options.yaml +296 -0
- package/skills/flutter-skills/tool/dart_skills_lint/bench/README.md +23 -0
- package/skills/flutter-skills/tool/dart_skills_lint/bench/baseline_throughput.dart +230 -0
- package/skills/flutter-skills/tool/dart_skills_lint/bin/cli.dart +10 -0
- package/skills/flutter-skills/tool/dart_skills_lint/dart_skills_lint.yaml +14 -0
- package/skills/flutter-skills/tool/dart_skills_lint/documentation/feature_design_docs/PRODUCTION_READYNESS.md +48 -0
- package/skills/flutter-skills/tool/dart_skills_lint/documentation/feature_design_docs/completion_migration_plan.md +99 -0
- package/skills/flutter-skills/tool/dart_skills_lint/documentation/feature_design_docs/legacy_patterns_report.md +110 -0
- package/skills/flutter-skills/tool/dart_skills_lint/documentation/feature_design_docs/pub_vs_skill_report.md +56 -0
- package/skills/flutter-skills/tool/dart_skills_lint/documentation/knowledge/SPECIFICATION.md +79 -0
- package/skills/flutter-skills/tool/dart_skills_lint/documentation/knowledge/architecture_overview.md +64 -0
- package/skills/flutter-skills/tool/dart_skills_lint/lib/dart_skills_lint.dart +11 -0
- package/skills/flutter-skills/tool/dart_skills_lint/lib/src/config_parser.dart +156 -0
- package/skills/flutter-skills/tool/dart_skills_lint/lib/src/entry_point.dart +354 -0
- package/skills/flutter-skills/tool/dart_skills_lint/lib/src/fixable_rule.dart +20 -0
- package/skills/flutter-skills/tool/dart_skills_lint/lib/src/models/analysis_severity.dart +15 -0
- package/skills/flutter-skills/tool/dart_skills_lint/lib/src/models/check_type.dart +17 -0
- package/skills/flutter-skills/tool/dart_skills_lint/lib/src/models/ignore_entry.dart +34 -0
- package/skills/flutter-skills/tool/dart_skills_lint/lib/src/models/ignore_entry.g.dart +19 -0
- package/skills/flutter-skills/tool/dart_skills_lint/lib/src/models/skill_context.dart +27 -0
- package/skills/flutter-skills/tool/dart_skills_lint/lib/src/models/skill_rule.dart +27 -0
- package/skills/flutter-skills/tool/dart_skills_lint/lib/src/models/skills_ignores.dart +26 -0
- package/skills/flutter-skills/tool/dart_skills_lint/lib/src/models/skills_ignores.g.dart +24 -0
- package/skills/flutter-skills/tool/dart_skills_lint/lib/src/models/validation_error.dart +31 -0
- package/skills/flutter-skills/tool/dart_skills_lint/lib/src/rule_registry.dart +79 -0
- package/skills/flutter-skills/tool/dart_skills_lint/lib/src/rules/absolute_paths_rule.dart +74 -0
- package/skills/flutter-skills/tool/dart_skills_lint/lib/src/rules/description_length_rule.dart +49 -0
- package/skills/flutter-skills/tool/dart_skills_lint/lib/src/rules/disallowed_field_rule.dart +61 -0
- package/skills/flutter-skills/tool/dart_skills_lint/lib/src/rules/name_format_rule.dart +167 -0
- package/skills/flutter-skills/tool/dart_skills_lint/lib/src/rules/relative_paths_rule.dart +72 -0
- package/skills/flutter-skills/tool/dart_skills_lint/lib/src/rules/trailing_whitespace_rule.dart +93 -0
- package/skills/flutter-skills/tool/dart_skills_lint/lib/src/rules/valid_yaml_metadata_rule.dart +74 -0
- package/skills/flutter-skills/tool/dart_skills_lint/lib/src/skills_ignores_storage.dart +36 -0
- package/skills/flutter-skills/tool/dart_skills_lint/lib/src/validation_session.dart +559 -0
- package/skills/flutter-skills/tool/dart_skills_lint/lib/src/validator.dart +238 -0
- package/skills/flutter-skills/tool/dart_skills_lint/pubspec.yaml +28 -0
- package/skills/flutter-skills/tool/dart_skills_lint/skills/README.md +10 -0
- package/skills/flutter-skills/tool/dart_skills_lint/skills/dart-skills-lint-validation/SKILL.md +195 -0
- package/skills/flutter-skills/tool/dart_skills_lint/skills-lock.json +75 -0
- package/skills/flutter-skills/tool/dart_skills_lint/test/absolute_paths_test.dart +167 -0
- package/skills/flutter-skills/tool/dart_skills_lint/test/cli_integration_test.dart +683 -0
- package/skills/flutter-skills/tool/dart_skills_lint/test/config_file_test.dart +292 -0
- package/skills/flutter-skills/tool/dart_skills_lint/test/custom_rule_test.dart +122 -0
- package/skills/flutter-skills/tool/dart_skills_lint/test/directory_structure_test.dart +163 -0
- package/skills/flutter-skills/tool/dart_skills_lint/test/field_constraints_test.dart +178 -0
- package/skills/flutter-skills/tool/dart_skills_lint/test/fixer_test.dart +172 -0
- package/skills/flutter-skills/tool/dart_skills_lint/test/ignore_models_test.dart +63 -0
- package/skills/flutter-skills/tool/dart_skills_lint/test/metadata_validation_test.dart +116 -0
- package/skills/flutter-skills/tool/dart_skills_lint/test/relative_path_flag_test.dart +70 -0
- package/skills/flutter-skills/tool/dart_skills_lint/test/relative_paths_test.dart +172 -0
- package/skills/flutter-skills/tool/dart_skills_lint/test/resolve_rules_test.dart +82 -0
- package/skills/flutter-skills/tool/dart_skills_lint/test/rule_naming_test.dart +29 -0
- package/skills/flutter-skills/tool/dart_skills_lint/test/skills_ignores_storage_test.dart +89 -0
- package/skills/flutter-skills/tool/dart_skills_lint/test/test_utils.dart +19 -0
- package/skills/flutter-skills/tool/dart_skills_lint/test/trailing_whitespace_test.dart +152 -0
- package/skills/flutter-skills/tool/generator/README.md +150 -0
- package/skills/flutter-skills/tool/generator/analysis_options.yaml +143 -0
- package/skills/flutter-skills/tool/generator/bin/skills.dart +73 -0
- package/skills/flutter-skills/tool/generator/lib/src/commands/base_skill_command.dart +87 -0
- package/skills/flutter-skills/tool/generator/lib/src/commands/base_yaml_command.dart +83 -0
- package/skills/flutter-skills/tool/generator/lib/src/commands/generate_skill_command.dart +92 -0
- package/skills/flutter-skills/tool/generator/lib/src/commands/update_readme_command.dart +150 -0
- package/skills/flutter-skills/tool/generator/lib/src/commands/update_skill_command.dart +97 -0
- package/skills/flutter-skills/tool/generator/lib/src/commands/validate_skill_command.dart +284 -0
- package/skills/flutter-skills/tool/generator/lib/src/models/skill_params.dart +41 -0
- package/skills/flutter-skills/tool/generator/lib/src/services/gemini_service.dart +310 -0
- package/skills/flutter-skills/tool/generator/lib/src/services/markdown_converter.dart +226 -0
- package/skills/flutter-skills/tool/generator/lib/src/services/prompts.dart +72 -0
- package/skills/flutter-skills/tool/generator/lib/src/services/resource_fetcher_service.dart +84 -0
- package/skills/flutter-skills/tool/generator/lib/src/services/skill_instructions.dart +30 -0
- package/skills/flutter-skills/tool/generator/pubspec.yaml +32 -0
- package/skills/flutter-skills/tool/generator/test/commands/base_skill_command_test.dart +131 -0
- package/skills/flutter-skills/tool/generator/test/commands/validate_skills_input_test.dart +263 -0
- package/skills/flutter-skills/tool/generator/test/custom_skill_rules/last_modified_rule.dart +32 -0
- package/skills/flutter-skills/tool/generator/test/generate_skills_retry_test.dart +105 -0
- package/skills/flutter-skills/tool/generator/test/generate_skills_test.dart +519 -0
- package/skills/flutter-skills/tool/generator/test/lint_skills_test.dart +34 -0
- package/skills/flutter-skills/tool/generator/test/markdown_converter_test.dart +103 -0
- package/skills/flutter-skills/tool/generator/test/markdown_table_test.dart +131 -0
- package/skills/flutter-skills/tool/generator/test/models/skill_params_test.dart +37 -0
- package/skills/flutter-skills/tool/generator/test/services/gemini_service_test.dart +291 -0
- package/skills/flutter-skills/tool/generator/test/services/markdown_converter_test.dart +156 -0
- package/skills/flutter-skills/tool/generator/test/services/resource_fetcher_service_test.dart +188 -0
- package/skills/flutter-skills/tool/generator/test/update_skills_test.dart +241 -0
- package/skills/flutter-skills/tool/generator/test/validate_skills_test.dart +728 -0
- package/skills/quality-assurance/bdd-acceptance/SKILL.md +5 -14
- package/skills/quality-assurance/flutter-test/SKILL.md +5 -16
- package/skills/rules/project_rules.md +538 -127
- package/skills/special-tools/env-check/SKILL.md +5 -13
- package/skills/special-tools/ios-full-auto-debug/SKILL.md +5 -15
- package/skills/writing-skills/SKILL.md +654 -0
- package/skills/writing-skills/anthropic-best-practices.md +1149 -0
- package/skills/writing-skills/examples/CLAUDE_MD_TESTING.md +189 -0
- package/skills/writing-skills/graphviz-conventions.dot +172 -0
- package/skills/writing-skills/persuasion-principles.md +187 -0
- package/skills/writing-skills/render-graphs.js +168 -0
- package/skills/writing-skills/testing-skills-with-subagents.md +384 -0
- package/skills/checklist.md +0 -154
- package/skills/rules/user_rules.md +0 -263
- package/skills//345/256/214/346/225/264/345/274/200/345/217/221/346/265/201/347/250/213/346/211/213/345/206/214.md +0 -454
- package/skills//346/212/200/350/203/275/344/275/223/347/263/273/345/256/214/345/226/204/345/273/272/350/256/256.md +0 -308
- package/skills//346/212/200/350/203/275/344/275/277/347/224/250/346/214/207/345/215/227.md +0 -309
- package/skills//346/212/200/350/203/275/345/206/263/347/255/226/346/240/221.md +0 -338
package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-test-fundamentals/SKILL.md
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dart-test-fundamentals
|
|
3
|
+
description: |-
|
|
4
|
+
Core concepts and best practices for `package:test`.
|
|
5
|
+
Covers `test`, `group`, lifecycle methods (`setUp`, `tearDown`), and
|
|
6
|
+
configuration (`dart_test.yaml`).
|
|
7
|
+
license: Apache-2.0
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Dart Test Fundamentals
|
|
11
|
+
|
|
12
|
+
## When to use this skill
|
|
13
|
+
|
|
14
|
+
Use this skill when:
|
|
15
|
+
- Writing new test files.
|
|
16
|
+
- Structuring test suites with `group`.
|
|
17
|
+
- Configuring test execution via `dart_test.yaml`.
|
|
18
|
+
- Understanding test lifecycle methods.
|
|
19
|
+
|
|
20
|
+
## Discovery
|
|
21
|
+
|
|
22
|
+
To find candidates for improving test structure:
|
|
23
|
+
|
|
24
|
+
### `try-finally` Cleanup
|
|
25
|
+
Search for tests that use `try-finally` for cleanup instead of `addTearDown`:
|
|
26
|
+
- **Regex**: `\bfinally\s*\{` (Check if this is used for resource cleanup
|
|
27
|
+
inside a test).
|
|
28
|
+
|
|
29
|
+
## Core Concepts
|
|
30
|
+
|
|
31
|
+
### 1. Test Structure (`test` and `group`)
|
|
32
|
+
|
|
33
|
+
- **`test`**: The fundamental unit of testing.
|
|
34
|
+
```dart
|
|
35
|
+
test('description', () {
|
|
36
|
+
// assertions
|
|
37
|
+
});
|
|
38
|
+
```
|
|
39
|
+
- **`group`**: Used to organize tests into logical blocks.
|
|
40
|
+
- Groups can be nested.
|
|
41
|
+
- Descriptions are concatenated (e.g., "Group Description Test Description").
|
|
42
|
+
- Helps scope `setUp` and `tearDown` calls.
|
|
43
|
+
- **Naming**: Use `PascalCase` for groups that correspond to a class name
|
|
44
|
+
(e.g., `group('MyClient', ...)`).
|
|
45
|
+
- **Avoid Single Groups**: Do not wrap all tests in a file with a single
|
|
46
|
+
`group` call if it's the only one.
|
|
47
|
+
- **NOTE**: DO NOT remove groups when doing a cleanup on existing code you
|
|
48
|
+
didn't create unless explicitly asked to. This can cause a LOT of churn
|
|
49
|
+
in the DIFF that most engineers won't want!
|
|
50
|
+
|
|
51
|
+
- **Naming Tests** `test('test name here',`:
|
|
52
|
+
- Avoid redundant "test" prefixes. Use `group` instead.
|
|
53
|
+
- Include the expected behavior or outcome in the description (e.g.,
|
|
54
|
+
`'throws StateError'` or `'adds API key to URL'`).
|
|
55
|
+
- Descriptions should read well when concatenated with their group name.
|
|
56
|
+
|
|
57
|
+
- **Named Parameters Placement**:
|
|
58
|
+
- For `test` and `group` calls, place named parameters (e.g., `testOn`,
|
|
59
|
+
`timeout`, `skip`) immediately after the description string, before the
|
|
60
|
+
callback closure. This improves readability by keeping the test logic last.
|
|
61
|
+
```dart
|
|
62
|
+
test('description', testOn: 'vm', () {
|
|
63
|
+
// assertions
|
|
64
|
+
});
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 2. Lifecycle Methods (`setUp`, `tearDown`)
|
|
68
|
+
|
|
69
|
+
- **`setUp`**: Runs *before* every `test` in the current `group` (and nested
|
|
70
|
+
groups).
|
|
71
|
+
- **`tearDown`**: Runs *after* every `test` in the current `group`.
|
|
72
|
+
- **`setUpAll`**: Runs *once* before any test in the group.
|
|
73
|
+
- **`tearDownAll`**: Runs *once* after all tests in the group.
|
|
74
|
+
|
|
75
|
+
**Best Practice:**
|
|
76
|
+
- Use `setUp` for resetting state to ensure test isolation.
|
|
77
|
+
- Avoid sharing mutable state between tests without resetting it.
|
|
78
|
+
|
|
79
|
+
### 3. Cleaning Up Resources
|
|
80
|
+
|
|
81
|
+
- To clean up resources created WITHIN the `test` body, consider using
|
|
82
|
+
`addTearDown` instead of a `try-finally` block.
|
|
83
|
+
|
|
84
|
+
**Avoid:**
|
|
85
|
+
```dart
|
|
86
|
+
test('can create and delete a file', () {
|
|
87
|
+
final file = File('temp.txt');
|
|
88
|
+
try {
|
|
89
|
+
file.writeAsStringSync('hello');
|
|
90
|
+
expect(file.readAsStringSync(), 'hello');
|
|
91
|
+
} finally {
|
|
92
|
+
if (file.existsSync()) file.deleteSync();
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Prefer:**
|
|
98
|
+
```dart
|
|
99
|
+
test('can create and delete a file', () {
|
|
100
|
+
final file = File('temp.txt');
|
|
101
|
+
// Register teardown immediately after resource creation intent
|
|
102
|
+
addTearDown(() {
|
|
103
|
+
if (file.existsSync()) file.deleteSync();
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
file.writeAsStringSync('hello');
|
|
107
|
+
expect(file.readAsStringSync(), 'hello');
|
|
108
|
+
});
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### 4. Configuration (`dart_test.yaml`)
|
|
112
|
+
|
|
113
|
+
The `dart_test.yaml` file configures the test runner. Common configurations
|
|
114
|
+
include:
|
|
115
|
+
|
|
116
|
+
#### Platforms
|
|
117
|
+
Define where tests run (vm, chrome, node).
|
|
118
|
+
|
|
119
|
+
```yaml
|
|
120
|
+
platforms:
|
|
121
|
+
- vm
|
|
122
|
+
- chrome
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
#### Tags
|
|
126
|
+
Categorize tests to run specific subsets.
|
|
127
|
+
|
|
128
|
+
```yaml
|
|
129
|
+
tags:
|
|
130
|
+
integration:
|
|
131
|
+
timeout: 2x
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Usage in code:
|
|
135
|
+
```dart
|
|
136
|
+
@Tags(['integration'])
|
|
137
|
+
import 'package:test/test.dart';
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Running tags:
|
|
141
|
+
`dart test --tags integration`
|
|
142
|
+
|
|
143
|
+
#### Timeouts
|
|
144
|
+
Set default timeouts for tests.
|
|
145
|
+
|
|
146
|
+
```yaml
|
|
147
|
+
timeouts:
|
|
148
|
+
2x # Double the default timeout
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### 5. File Naming
|
|
152
|
+
- Test files **must** end in `_test.dart` to be picked up by the test runner.
|
|
153
|
+
- Place tests in the `test/` directory.
|
|
154
|
+
|
|
155
|
+
## Common commands
|
|
156
|
+
|
|
157
|
+
- `dart test`: Run all tests.
|
|
158
|
+
- `dart test test/path/to/file_test.dart`: Run a specific file.
|
|
159
|
+
- `dart test --name "substring"`: Run tests matching a description.
|
|
160
|
+
|
|
161
|
+
## Related Skills
|
|
162
|
+
|
|
163
|
+
`dart-test-fundamentals` is the core skill for structuring and configuring
|
|
164
|
+
tests. For writing assertions within those tests, refer to:
|
|
165
|
+
|
|
166
|
+
- **[dart-matcher-best-practices]**:
|
|
167
|
+
Use this if the project sticks with the traditional
|
|
168
|
+
`package:matcher` (`expect` calls).
|
|
169
|
+
- **[dart-checks-migration]**: Use this
|
|
170
|
+
if the project is migrating to the modern `package:checks` (`check` calls).
|
|
171
|
+
|
|
172
|
+
[dart-matcher-best-practices]: https://github.com/kevmoo/dash_skills/blob/main/.agent/skills/dart-matcher-best-practices/SKILL.md
|
|
173
|
+
[dart-checks-migration]: https://github.com/kevmoo/dash_skills/blob/main/.agent/skills/dart-checks-migration/SKILL.md
|
package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/definition-of-done/SKILL.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: definition-of-done
|
|
3
|
+
description: Mandatory checks to run before completing any task that touches md files or dart code in this repository.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Definition of Done
|
|
7
|
+
|
|
8
|
+
Use this skill to ensure that all work meets the repository standards before declaring a task complete or requesting review.
|
|
9
|
+
|
|
10
|
+
## 📋 Mandatory Verification Steps
|
|
11
|
+
|
|
12
|
+
Before stating that a task is complete, you MUST execute and pass the following checks:
|
|
13
|
+
|
|
14
|
+
1. **Formatting**: Run `dart format .` to format files, or `dart format --output=none --set-exit-if-changed .` to check without modifying. Ensure all files are formatted correctly.
|
|
15
|
+
2. **Analysis**: Run `dart analyze --fatal-infos` and ensure there are zero issues (including info-level issues).
|
|
16
|
+
3. **Metrics/Linter**: Run `dart run dart_code_linter:metrics analyze lib` and ensure there are zero issues. This checks for cyclomatic complexity and custom rules like file naming and redundant async.
|
|
17
|
+
4. **Tests**: Run `dart test` and ensure all tests pass successfully.
|
|
18
|
+
5. **Skill Validation**: If any skill files were modified, run `dart run dart_skills_lint -d .agents/skills` to ensure they are valid.
|
|
19
|
+
|
|
20
|
+
## 🚦 Completion Checklist
|
|
21
|
+
|
|
22
|
+
- [ ] Code is formatted (`dart format .` or checked with `--output=none --set-exit-if-changed .`).
|
|
23
|
+
- [ ] Analysis is clean (`dart analyze --fatal-infos`).
|
|
24
|
+
- [ ] Metrics/Linter are clean (`dart run dart_code_linter:metrics analyze lib`).
|
|
25
|
+
- [ ] Tests are passing (`dart test`).
|
|
26
|
+
- [ ] Skills validated if modified (`dart run dart_skills_lint -d .agents/skills`).
|
|
27
|
+
- [ ] Documentation is updated.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: grill-me
|
|
3
|
+
description: Interview the user relentlessly about a plan or design until reaching shared understanding, resolving each branch of the decision tree. Use when user wants to stress-test a plan, get grilled on their design, or mentions "grill me".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Interview me relentlessly about every aspect of this plan until we reach a shared understanding. Walk down each branch of the design tree, resolving dependencies between decisions one-by-one. For each question, provide your recommended answer.
|
|
7
|
+
|
|
8
|
+
Ask the questions one at a time.
|
|
9
|
+
|
|
10
|
+
If a question can be answered by exploring the codebase, explore the codebase instead.
|
package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/test-driven-development/SKILL.md
ADDED
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test-driven-development
|
|
3
|
+
description: Use when implementing any feature or bugfix, before writing implementation code
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Test-Driven Development (TDD)
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Write the test first. Watch it fail. Write minimal code to pass.
|
|
11
|
+
|
|
12
|
+
**Core principle:** If you didn't watch the test fail, you don't know if it tests the right thing.
|
|
13
|
+
|
|
14
|
+
**Violating the letter of the rules is violating the spirit of the rules.**
|
|
15
|
+
|
|
16
|
+
## When to Use
|
|
17
|
+
|
|
18
|
+
**Always:**
|
|
19
|
+
- New features
|
|
20
|
+
- Bug fixes
|
|
21
|
+
- Refactoring
|
|
22
|
+
- Behavior changes
|
|
23
|
+
|
|
24
|
+
**Exceptions (ask your human partner):**
|
|
25
|
+
- Throwaway prototypes
|
|
26
|
+
- Generated code
|
|
27
|
+
- Configuration files
|
|
28
|
+
|
|
29
|
+
Thinking "skip TDD just this once"? Stop. That's rationalization.
|
|
30
|
+
|
|
31
|
+
## The Iron Law
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Write code before the test? Delete it. Start over.
|
|
38
|
+
|
|
39
|
+
**No exceptions:**
|
|
40
|
+
- Don't keep it as "reference"
|
|
41
|
+
- Don't "adapt" it while writing tests
|
|
42
|
+
- Don't look at it
|
|
43
|
+
- Delete means delete
|
|
44
|
+
|
|
45
|
+
Implement fresh from tests. Period.
|
|
46
|
+
|
|
47
|
+
## Red-Green-Refactor
|
|
48
|
+
|
|
49
|
+
```dot
|
|
50
|
+
digraph tdd_cycle {
|
|
51
|
+
rankdir=LR;
|
|
52
|
+
red [label="RED\nWrite failing test", shape=box, style=filled, fillcolor="#ffcccc"];
|
|
53
|
+
verify_red [label="Verify fails\ncorrectly", shape=diamond];
|
|
54
|
+
green [label="GREEN\nMinimal code", shape=box, style=filled, fillcolor="#ccffcc"];
|
|
55
|
+
verify_green [label="Verify passes\nAll green", shape=diamond];
|
|
56
|
+
refactor [label="REFACTOR\nClean up", shape=box, style=filled, fillcolor="#ccccff"];
|
|
57
|
+
next [label="Next", shape=ellipse];
|
|
58
|
+
|
|
59
|
+
red -> verify_red;
|
|
60
|
+
verify_red -> green [label="yes"];
|
|
61
|
+
verify_red -> red [label="wrong\nfailure"];
|
|
62
|
+
green -> verify_green;
|
|
63
|
+
verify_green -> refactor [label="yes"];
|
|
64
|
+
verify_green -> green [label="no"];
|
|
65
|
+
refactor -> verify_green [label="stay\ngreen"];
|
|
66
|
+
verify_green -> next;
|
|
67
|
+
next -> red;
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### RED - Write Failing Test
|
|
72
|
+
|
|
73
|
+
Write one minimal test showing what should happen.
|
|
74
|
+
|
|
75
|
+
<Good>
|
|
76
|
+
```typescript
|
|
77
|
+
test('retries failed operations 3 times', async () => {
|
|
78
|
+
let attempts = 0;
|
|
79
|
+
const operation = () => {
|
|
80
|
+
attempts++;
|
|
81
|
+
if (attempts < 3) throw new Error('fail');
|
|
82
|
+
return 'success';
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const result = await retryOperation(operation);
|
|
86
|
+
|
|
87
|
+
expect(result).toBe('success');
|
|
88
|
+
expect(attempts).toBe(3);
|
|
89
|
+
});
|
|
90
|
+
```
|
|
91
|
+
Clear name, tests real behavior, one thing
|
|
92
|
+
</Good>
|
|
93
|
+
|
|
94
|
+
<Bad>
|
|
95
|
+
```typescript
|
|
96
|
+
test('retry works', async () => {
|
|
97
|
+
const mock = jest.fn()
|
|
98
|
+
.mockRejectedValueOnce(new Error())
|
|
99
|
+
.mockRejectedValueOnce(new Error())
|
|
100
|
+
.mockResolvedValueOnce('success');
|
|
101
|
+
await retryOperation(mock);
|
|
102
|
+
expect(mock).toHaveBeenCalledTimes(3);
|
|
103
|
+
});
|
|
104
|
+
```
|
|
105
|
+
Vague name, tests mock not code
|
|
106
|
+
</Bad>
|
|
107
|
+
|
|
108
|
+
**Requirements:**
|
|
109
|
+
- One behavior
|
|
110
|
+
- Clear name
|
|
111
|
+
- Real code (no mocks unless unavoidable)
|
|
112
|
+
|
|
113
|
+
### Verify RED - Watch It Fail
|
|
114
|
+
|
|
115
|
+
**MANDATORY. Never skip.**
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
npm test path/to/test.test.ts
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Confirm:
|
|
122
|
+
- Test fails (not errors)
|
|
123
|
+
- Failure message is expected
|
|
124
|
+
- Fails because feature missing (not typos)
|
|
125
|
+
|
|
126
|
+
**Test passes?** You're testing existing behavior. Fix test.
|
|
127
|
+
|
|
128
|
+
**Test errors?** Fix error, re-run until it fails correctly.
|
|
129
|
+
|
|
130
|
+
### GREEN - Minimal Code
|
|
131
|
+
|
|
132
|
+
Write simplest code to pass the test.
|
|
133
|
+
|
|
134
|
+
<Good>
|
|
135
|
+
```typescript
|
|
136
|
+
async function retryOperation<T>(fn: () => Promise<T>): Promise<T> {
|
|
137
|
+
for (let i = 0; i < 3; i++) {
|
|
138
|
+
try {
|
|
139
|
+
return await fn();
|
|
140
|
+
} catch (e) {
|
|
141
|
+
if (i === 2) throw e;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
throw new Error('unreachable');
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
Just enough to pass
|
|
148
|
+
</Good>
|
|
149
|
+
|
|
150
|
+
<Bad>
|
|
151
|
+
```typescript
|
|
152
|
+
async function retryOperation<T>(
|
|
153
|
+
fn: () => Promise<T>,
|
|
154
|
+
options?: {
|
|
155
|
+
maxRetries?: number;
|
|
156
|
+
backoff?: 'linear' | 'exponential';
|
|
157
|
+
onRetry?: (attempt: number) => void;
|
|
158
|
+
}
|
|
159
|
+
): Promise<T> {
|
|
160
|
+
// YAGNI
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
Over-engineered
|
|
164
|
+
</Bad>
|
|
165
|
+
|
|
166
|
+
Don't add features, refactor other code, or "improve" beyond the test.
|
|
167
|
+
|
|
168
|
+
### Verify GREEN - Watch It Pass
|
|
169
|
+
|
|
170
|
+
**MANDATORY.**
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
npm test path/to/test.test.ts
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Confirm:
|
|
177
|
+
- Test passes
|
|
178
|
+
- Other tests still pass
|
|
179
|
+
- Output pristine (no errors, warnings)
|
|
180
|
+
|
|
181
|
+
**Test fails?** Fix code, not test.
|
|
182
|
+
|
|
183
|
+
**Other tests fail?** Fix now.
|
|
184
|
+
|
|
185
|
+
### REFACTOR - Clean Up
|
|
186
|
+
|
|
187
|
+
After green only:
|
|
188
|
+
- Remove duplication
|
|
189
|
+
- Improve names
|
|
190
|
+
- Extract helpers
|
|
191
|
+
|
|
192
|
+
Keep tests green. Don't add behavior.
|
|
193
|
+
|
|
194
|
+
### Repeat
|
|
195
|
+
|
|
196
|
+
Next failing test for next feature.
|
|
197
|
+
|
|
198
|
+
## Good Tests
|
|
199
|
+
|
|
200
|
+
| Quality | Good | Bad |
|
|
201
|
+
|---------|------|-----|
|
|
202
|
+
| **Minimal** | One thing. "and" in name? Split it. | `test('validates email and domain and whitespace')` |
|
|
203
|
+
| **Clear** | Name describes behavior | `test('test1')` |
|
|
204
|
+
| **Shows intent** | Demonstrates desired API | Obscures what code should do |
|
|
205
|
+
|
|
206
|
+
## Why Order Matters
|
|
207
|
+
|
|
208
|
+
**"I'll write tests after to verify it works"**
|
|
209
|
+
|
|
210
|
+
Tests written after code pass immediately. Passing immediately proves nothing:
|
|
211
|
+
- Might test wrong thing
|
|
212
|
+
- Might test implementation, not behavior
|
|
213
|
+
- Might miss edge cases you forgot
|
|
214
|
+
- You never saw it catch the bug
|
|
215
|
+
|
|
216
|
+
Test-first forces you to see the test fail, proving it actually tests something.
|
|
217
|
+
|
|
218
|
+
**"I already manually tested all the edge cases"**
|
|
219
|
+
|
|
220
|
+
Manual testing is ad-hoc. You think you tested everything but:
|
|
221
|
+
- No record of what you tested
|
|
222
|
+
- Can't re-run when code changes
|
|
223
|
+
- Easy to forget cases under pressure
|
|
224
|
+
- "It worked when I tried it" ≠ comprehensive
|
|
225
|
+
|
|
226
|
+
Automated tests are systematic. They run the same way every time.
|
|
227
|
+
|
|
228
|
+
**"Deleting X hours of work is wasteful"**
|
|
229
|
+
|
|
230
|
+
Sunk cost fallacy. The time is already gone. Your choice now:
|
|
231
|
+
- Delete and rewrite with TDD (X more hours, high confidence)
|
|
232
|
+
- Keep it and add tests after (30 min, low confidence, likely bugs)
|
|
233
|
+
|
|
234
|
+
The "waste" is keeping code you can't trust. Working code without real tests is technical debt.
|
|
235
|
+
|
|
236
|
+
**"TDD is dogmatic, being pragmatic means adapting"**
|
|
237
|
+
|
|
238
|
+
TDD IS pragmatic:
|
|
239
|
+
- Finds bugs before commit (faster than debugging after)
|
|
240
|
+
- Prevents regressions (tests catch breaks immediately)
|
|
241
|
+
- Documents behavior (tests show how to use code)
|
|
242
|
+
- Enables refactoring (change freely, tests catch breaks)
|
|
243
|
+
|
|
244
|
+
"Pragmatic" shortcuts = debugging in production = slower.
|
|
245
|
+
|
|
246
|
+
**"Tests after achieve the same goals - it's spirit not ritual"**
|
|
247
|
+
|
|
248
|
+
No. Tests-after answer "What does this do?" Tests-first answer "What should this do?"
|
|
249
|
+
|
|
250
|
+
Tests-after are biased by your implementation. You test what you built, not what's required. You verify remembered edge cases, not discovered ones.
|
|
251
|
+
|
|
252
|
+
Tests-first force edge case discovery before implementing. Tests-after verify you remembered everything (you didn't).
|
|
253
|
+
|
|
254
|
+
30 minutes of tests after ≠ TDD. You get coverage, lose proof tests work.
|
|
255
|
+
|
|
256
|
+
## Common Rationalizations
|
|
257
|
+
|
|
258
|
+
| Excuse | Reality |
|
|
259
|
+
|--------|---------|
|
|
260
|
+
| "Too simple to test" | Simple code breaks. Test takes 30 seconds. |
|
|
261
|
+
| "I'll test after" | Tests passing immediately prove nothing. |
|
|
262
|
+
| "Tests after achieve same goals" | Tests-after = "what does this do?" Tests-first = "what should this do?" |
|
|
263
|
+
| "Already manually tested" | Ad-hoc ≠ systematic. No record, can't re-run. |
|
|
264
|
+
| "Deleting X hours is wasteful" | Sunk cost fallacy. Keeping unverified code is technical debt. |
|
|
265
|
+
| "Keep as reference, write tests first" | You'll adapt it. That's testing after. Delete means delete. |
|
|
266
|
+
| "Need to explore first" | Fine. Throw away exploration, start with TDD. |
|
|
267
|
+
| "Test hard = design unclear" | Listen to test. Hard to test = hard to use. |
|
|
268
|
+
| "TDD will slow me down" | TDD faster than debugging. Pragmatic = test-first. |
|
|
269
|
+
| "Manual test faster" | Manual doesn't prove edge cases. You'll re-test every change. |
|
|
270
|
+
| "Existing code has no tests" | You're improving it. Add tests for existing code. |
|
|
271
|
+
|
|
272
|
+
## Red Flags - STOP and Start Over
|
|
273
|
+
|
|
274
|
+
- Code before test
|
|
275
|
+
- Test after implementation
|
|
276
|
+
- Test passes immediately
|
|
277
|
+
- Can't explain why test failed
|
|
278
|
+
- Tests added "later"
|
|
279
|
+
- Rationalizing "just this once"
|
|
280
|
+
- "I already manually tested it"
|
|
281
|
+
- "Tests after achieve the same purpose"
|
|
282
|
+
- "It's about spirit not ritual"
|
|
283
|
+
- "Keep as reference" or "adapt existing code"
|
|
284
|
+
- "Already spent X hours, deleting is wasteful"
|
|
285
|
+
- "TDD is dogmatic, I'm being pragmatic"
|
|
286
|
+
- "This is different because..."
|
|
287
|
+
|
|
288
|
+
**All of these mean: Delete code. Start over with TDD.**
|
|
289
|
+
|
|
290
|
+
## Example: Bug Fix
|
|
291
|
+
|
|
292
|
+
**Bug:** Empty email accepted
|
|
293
|
+
|
|
294
|
+
**RED**
|
|
295
|
+
```typescript
|
|
296
|
+
test('rejects empty email', async () => {
|
|
297
|
+
const result = await submitForm({ email: '' });
|
|
298
|
+
expect(result.error).toBe('Email required');
|
|
299
|
+
});
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
**Verify RED**
|
|
303
|
+
```bash
|
|
304
|
+
$ npm test
|
|
305
|
+
FAIL: expected 'Email required', got undefined
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
**GREEN**
|
|
309
|
+
```typescript
|
|
310
|
+
function submitForm(data: FormData) {
|
|
311
|
+
if (!data.email?.trim()) {
|
|
312
|
+
return { error: 'Email required' };
|
|
313
|
+
}
|
|
314
|
+
// ...
|
|
315
|
+
}
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
**Verify GREEN**
|
|
319
|
+
```bash
|
|
320
|
+
$ npm test
|
|
321
|
+
PASS
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
**REFACTOR**
|
|
325
|
+
Extract validation for multiple fields if needed.
|
|
326
|
+
|
|
327
|
+
## Verification Checklist
|
|
328
|
+
|
|
329
|
+
Before marking work complete:
|
|
330
|
+
|
|
331
|
+
- [ ] Every new function/method has a test
|
|
332
|
+
- [ ] Watched each test fail before implementing
|
|
333
|
+
- [ ] Each test failed for expected reason (feature missing, not typo)
|
|
334
|
+
- [ ] Wrote minimal code to pass each test
|
|
335
|
+
- [ ] All tests pass
|
|
336
|
+
- [ ] Output pristine (no errors, warnings)
|
|
337
|
+
- [ ] Tests use real code (mocks only if unavoidable)
|
|
338
|
+
- [ ] Edge cases and errors covered
|
|
339
|
+
|
|
340
|
+
Can't check all boxes? You skipped TDD. Start over.
|
|
341
|
+
|
|
342
|
+
## When Stuck
|
|
343
|
+
|
|
344
|
+
| Problem | Solution |
|
|
345
|
+
|---------|----------|
|
|
346
|
+
| Don't know how to test | Write wished-for API. Write assertion first. Ask your human partner. |
|
|
347
|
+
| Test too complicated | Design too complicated. Simplify interface. |
|
|
348
|
+
| Must mock everything | Code too coupled. Use dependency injection. |
|
|
349
|
+
| Test setup huge | Extract helpers. Still complex? Simplify design. |
|
|
350
|
+
|
|
351
|
+
## Debugging Integration
|
|
352
|
+
|
|
353
|
+
Bug found? Write failing test reproducing it. Follow TDD cycle. Test proves fix and prevents regression.
|
|
354
|
+
|
|
355
|
+
Never fix bugs without a test.
|
|
356
|
+
|
|
357
|
+
## Testing Anti-Patterns
|
|
358
|
+
|
|
359
|
+
When adding mocks or test utilities, read @testing-anti-patterns.md to avoid common pitfalls:
|
|
360
|
+
- Testing mock behavior instead of real behavior
|
|
361
|
+
- Adding test-only methods to production classes
|
|
362
|
+
- Mocking without understanding dependencies
|
|
363
|
+
|
|
364
|
+
## Final Rule
|
|
365
|
+
|
|
366
|
+
```
|
|
367
|
+
Production code → test exists and failed first
|
|
368
|
+
Otherwise → not TDD
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
No exceptions without your human partner's permission.
|