sdd-full 4.6.1 → 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.
Files changed (173) hide show
  1. package/bin.js +1 -1
  2. package/package.json +1 -1
  3. package/skills/.agents/skills/flutter-add-integration-test/SKILL.md +165 -0
  4. package/skills/.agents/skills/flutter-add-widget-preview/SKILL.md +147 -0
  5. package/skills/.agents/skills/flutter-add-widget-test/SKILL.md +156 -0
  6. package/skills/.agents/skills/flutter-apply-architecture-best-practices/SKILL.md +164 -0
  7. package/skills/.agents/skills/flutter-build-responsive-layout/SKILL.md +141 -0
  8. package/skills/.agents/skills/flutter-fix-layout-issues/SKILL.md +132 -0
  9. package/skills/.agents/skills/flutter-implement-json-serialization/SKILL.md +155 -0
  10. package/skills/.agents/skills/flutter-setup-declarative-routing/SKILL.md +257 -0
  11. package/skills/.agents/skills/flutter-setup-localization/SKILL.md +212 -0
  12. package/skills/.agents/skills/flutter-use-http-package/SKILL.md +177 -0
  13. package/skills/VERSION.md +186 -62
  14. package/skills/design-planning/ai-coding-rules/SKILL.md +5 -13
  15. package/skills/design-planning/design-to-code/SKILL.md +5 -14
  16. package/skills/design-planning/enterprise-spec/SKILL.md +5 -13
  17. package/skills/design-planning/flutter-av/SKILL.md +5 -16
  18. package/skills/design-planning/flutter-map/SKILL.md +5 -14
  19. package/skills/design-planning/function-sdd/SKILL.md +5 -13
  20. package/skills/design-planning/global-overlay-stack-standard/SKILL.md +73 -0
  21. package/skills/design-planning/ui-motion-interaction-standard/SKILL.md +69 -0
  22. package/skills/design-planning/ui-sdd-specialized/SKILL.md +5 -14
  23. package/skills/development-execution/flutter-errors/SKILL.md +5 -15
  24. package/skills/flutter-skills/.github/dependabot.yaml +15 -0
  25. package/skills/flutter-skills/.github/workflows/dart_skills_lint_workflow.yaml +68 -0
  26. package/skills/flutter-skills/.github/workflows/skills_tool.yaml +51 -0
  27. package/skills/flutter-skills/CODE_OF_CONDUCT.md +3 -0
  28. package/skills/flutter-skills/CONTRIBUTING.md +36 -0
  29. package/skills/flutter-skills/LICENSE +26 -0
  30. package/skills/flutter-skills/README.md +50 -0
  31. package/skills/flutter-skills/pubspec.yaml +9 -0
  32. package/skills/flutter-skills/resources/flutter_skills.yaml +434 -0
  33. package/skills/flutter-skills/skills/flutter-add-integration-test/SKILL.md +163 -0
  34. package/skills/flutter-skills/skills/flutter-add-widget-preview/SKILL.md +145 -0
  35. package/skills/flutter-skills/skills/flutter-add-widget-test/SKILL.md +154 -0
  36. package/skills/flutter-skills/skills/flutter-apply-architecture-best-practices/SKILL.md +162 -0
  37. package/skills/flutter-skills/skills/flutter-build-responsive-layout/SKILL.md +139 -0
  38. package/skills/flutter-skills/skills/flutter-fix-layout-issues/SKILL.md +130 -0
  39. package/skills/flutter-skills/skills/flutter-implement-json-serialization/SKILL.md +153 -0
  40. package/skills/flutter-skills/skills/flutter-setup-declarative-routing/SKILL.md +255 -0
  41. package/skills/flutter-skills/skills/flutter-setup-localization/SKILL.md +210 -0
  42. package/skills/flutter-skills/skills/flutter-use-http-package/SKILL.md +175 -0
  43. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/add-dart-lint-validation-rule/SKILL.md +196 -0
  44. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-best-practices/SKILL.md +65 -0
  45. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-checks-migration/SKILL.md +158 -0
  46. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-cli-app-best-practices/SKILL.md +168 -0
  47. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-doc-validation/SKILL.md +87 -0
  48. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-long-lines/SKILL.md +101 -0
  49. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-matcher-best-practices/SKILL.md +136 -0
  50. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-modern-features/SKILL.md +266 -0
  51. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-package-maintenance/SKILL.md +92 -0
  52. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-test-coverage/SKILL.md +92 -0
  53. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-test-coverage/example/lib/src/calculator.dart +7 -0
  54. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-test-coverage/example/pubspec.yaml +8 -0
  55. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-test-coverage/example/test/calculator_test.dart +11 -0
  56. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-test-coverage/scripts/interpret_coverage.dart +95 -0
  57. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-test-coverage/scripts/pubspec.yaml +6 -0
  58. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-test-coverage/scripts/test/interpret_coverage_test.dart +93 -0
  59. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-test-fundamentals/SKILL.md +173 -0
  60. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/definition-of-done/SKILL.md +27 -0
  61. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/flutter_skills_ignore.json +3 -0
  62. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/grill-me/SKILL.md +10 -0
  63. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/ignore.json +3 -0
  64. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/test-driven-development/SKILL.md +371 -0
  65. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/test-driven-development/testing-anti-patterns.md +299 -0
  66. package/skills/flutter-skills/tool/dart_skills_lint/AUTHORS +7 -0
  67. package/skills/flutter-skills/tool/dart_skills_lint/CHANGELOG.md +12 -0
  68. package/skills/flutter-skills/tool/dart_skills_lint/CONTRIBUTING.md +51 -0
  69. package/skills/flutter-skills/tool/dart_skills_lint/LICENSE +27 -0
  70. package/skills/flutter-skills/tool/dart_skills_lint/README.md +203 -0
  71. package/skills/flutter-skills/tool/dart_skills_lint/analysis_options.yaml +296 -0
  72. package/skills/flutter-skills/tool/dart_skills_lint/bench/README.md +23 -0
  73. package/skills/flutter-skills/tool/dart_skills_lint/bench/baseline_throughput.dart +230 -0
  74. package/skills/flutter-skills/tool/dart_skills_lint/bin/cli.dart +10 -0
  75. package/skills/flutter-skills/tool/dart_skills_lint/dart_skills_lint.yaml +14 -0
  76. package/skills/flutter-skills/tool/dart_skills_lint/documentation/feature_design_docs/PRODUCTION_READYNESS.md +48 -0
  77. package/skills/flutter-skills/tool/dart_skills_lint/documentation/feature_design_docs/completion_migration_plan.md +99 -0
  78. package/skills/flutter-skills/tool/dart_skills_lint/documentation/feature_design_docs/legacy_patterns_report.md +110 -0
  79. package/skills/flutter-skills/tool/dart_skills_lint/documentation/feature_design_docs/pub_vs_skill_report.md +56 -0
  80. package/skills/flutter-skills/tool/dart_skills_lint/documentation/knowledge/SPECIFICATION.md +79 -0
  81. package/skills/flutter-skills/tool/dart_skills_lint/documentation/knowledge/architecture_overview.md +64 -0
  82. package/skills/flutter-skills/tool/dart_skills_lint/lib/dart_skills_lint.dart +11 -0
  83. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/config_parser.dart +156 -0
  84. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/entry_point.dart +354 -0
  85. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/fixable_rule.dart +20 -0
  86. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/models/analysis_severity.dart +15 -0
  87. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/models/check_type.dart +17 -0
  88. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/models/ignore_entry.dart +34 -0
  89. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/models/ignore_entry.g.dart +19 -0
  90. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/models/skill_context.dart +27 -0
  91. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/models/skill_rule.dart +27 -0
  92. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/models/skills_ignores.dart +26 -0
  93. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/models/skills_ignores.g.dart +24 -0
  94. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/models/validation_error.dart +31 -0
  95. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/rule_registry.dart +79 -0
  96. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/rules/absolute_paths_rule.dart +74 -0
  97. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/rules/description_length_rule.dart +49 -0
  98. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/rules/disallowed_field_rule.dart +61 -0
  99. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/rules/name_format_rule.dart +167 -0
  100. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/rules/relative_paths_rule.dart +72 -0
  101. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/rules/trailing_whitespace_rule.dart +93 -0
  102. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/rules/valid_yaml_metadata_rule.dart +74 -0
  103. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/skills_ignores_storage.dart +36 -0
  104. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/validation_session.dart +559 -0
  105. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/validator.dart +238 -0
  106. package/skills/flutter-skills/tool/dart_skills_lint/pubspec.yaml +28 -0
  107. package/skills/flutter-skills/tool/dart_skills_lint/skills/README.md +10 -0
  108. package/skills/flutter-skills/tool/dart_skills_lint/skills/dart-skills-lint-validation/SKILL.md +195 -0
  109. package/skills/flutter-skills/tool/dart_skills_lint/skills-lock.json +75 -0
  110. package/skills/flutter-skills/tool/dart_skills_lint/test/absolute_paths_test.dart +167 -0
  111. package/skills/flutter-skills/tool/dart_skills_lint/test/cli_integration_test.dart +683 -0
  112. package/skills/flutter-skills/tool/dart_skills_lint/test/config_file_test.dart +292 -0
  113. package/skills/flutter-skills/tool/dart_skills_lint/test/custom_rule_test.dart +122 -0
  114. package/skills/flutter-skills/tool/dart_skills_lint/test/directory_structure_test.dart +163 -0
  115. package/skills/flutter-skills/tool/dart_skills_lint/test/field_constraints_test.dart +178 -0
  116. package/skills/flutter-skills/tool/dart_skills_lint/test/fixer_test.dart +172 -0
  117. package/skills/flutter-skills/tool/dart_skills_lint/test/ignore_models_test.dart +63 -0
  118. package/skills/flutter-skills/tool/dart_skills_lint/test/metadata_validation_test.dart +116 -0
  119. package/skills/flutter-skills/tool/dart_skills_lint/test/relative_path_flag_test.dart +70 -0
  120. package/skills/flutter-skills/tool/dart_skills_lint/test/relative_paths_test.dart +172 -0
  121. package/skills/flutter-skills/tool/dart_skills_lint/test/resolve_rules_test.dart +82 -0
  122. package/skills/flutter-skills/tool/dart_skills_lint/test/rule_naming_test.dart +29 -0
  123. package/skills/flutter-skills/tool/dart_skills_lint/test/skills_ignores_storage_test.dart +89 -0
  124. package/skills/flutter-skills/tool/dart_skills_lint/test/test_utils.dart +19 -0
  125. package/skills/flutter-skills/tool/dart_skills_lint/test/trailing_whitespace_test.dart +152 -0
  126. package/skills/flutter-skills/tool/generator/README.md +150 -0
  127. package/skills/flutter-skills/tool/generator/analysis_options.yaml +143 -0
  128. package/skills/flutter-skills/tool/generator/bin/skills.dart +73 -0
  129. package/skills/flutter-skills/tool/generator/lib/src/commands/base_skill_command.dart +87 -0
  130. package/skills/flutter-skills/tool/generator/lib/src/commands/base_yaml_command.dart +83 -0
  131. package/skills/flutter-skills/tool/generator/lib/src/commands/generate_skill_command.dart +92 -0
  132. package/skills/flutter-skills/tool/generator/lib/src/commands/update_readme_command.dart +150 -0
  133. package/skills/flutter-skills/tool/generator/lib/src/commands/update_skill_command.dart +97 -0
  134. package/skills/flutter-skills/tool/generator/lib/src/commands/validate_skill_command.dart +284 -0
  135. package/skills/flutter-skills/tool/generator/lib/src/models/skill_params.dart +41 -0
  136. package/skills/flutter-skills/tool/generator/lib/src/services/gemini_service.dart +310 -0
  137. package/skills/flutter-skills/tool/generator/lib/src/services/markdown_converter.dart +226 -0
  138. package/skills/flutter-skills/tool/generator/lib/src/services/prompts.dart +72 -0
  139. package/skills/flutter-skills/tool/generator/lib/src/services/resource_fetcher_service.dart +84 -0
  140. package/skills/flutter-skills/tool/generator/lib/src/services/skill_instructions.dart +30 -0
  141. package/skills/flutter-skills/tool/generator/pubspec.yaml +32 -0
  142. package/skills/flutter-skills/tool/generator/test/commands/base_skill_command_test.dart +131 -0
  143. package/skills/flutter-skills/tool/generator/test/commands/validate_skills_input_test.dart +263 -0
  144. package/skills/flutter-skills/tool/generator/test/custom_skill_rules/last_modified_rule.dart +32 -0
  145. package/skills/flutter-skills/tool/generator/test/generate_skills_retry_test.dart +105 -0
  146. package/skills/flutter-skills/tool/generator/test/generate_skills_test.dart +519 -0
  147. package/skills/flutter-skills/tool/generator/test/lint_skills_test.dart +34 -0
  148. package/skills/flutter-skills/tool/generator/test/markdown_converter_test.dart +103 -0
  149. package/skills/flutter-skills/tool/generator/test/markdown_table_test.dart +131 -0
  150. package/skills/flutter-skills/tool/generator/test/models/skill_params_test.dart +37 -0
  151. package/skills/flutter-skills/tool/generator/test/services/gemini_service_test.dart +291 -0
  152. package/skills/flutter-skills/tool/generator/test/services/markdown_converter_test.dart +156 -0
  153. package/skills/flutter-skills/tool/generator/test/services/resource_fetcher_service_test.dart +188 -0
  154. package/skills/flutter-skills/tool/generator/test/update_skills_test.dart +241 -0
  155. package/skills/flutter-skills/tool/generator/test/validate_skills_test.dart +728 -0
  156. package/skills/quality-assurance/bdd-acceptance/SKILL.md +5 -14
  157. package/skills/quality-assurance/flutter-test/SKILL.md +5 -16
  158. package/skills/rules/project_rules.md +538 -127
  159. package/skills/special-tools/env-check/SKILL.md +5 -13
  160. package/skills/special-tools/ios-full-auto-debug/SKILL.md +5 -15
  161. package/skills/writing-skills/SKILL.md +654 -0
  162. package/skills/writing-skills/anthropic-best-practices.md +1149 -0
  163. package/skills/writing-skills/examples/CLAUDE_MD_TESTING.md +189 -0
  164. package/skills/writing-skills/graphviz-conventions.dot +172 -0
  165. package/skills/writing-skills/persuasion-principles.md +187 -0
  166. package/skills/writing-skills/render-graphs.js +168 -0
  167. package/skills/writing-skills/testing-skills-with-subagents.md +384 -0
  168. package/skills/checklist.md +0 -154
  169. package/skills/rules/user_rules.md +0 -263
  170. 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
  171. 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
  172. package/skills//346/212/200/350/203/275/344/275/277/347/224/250/346/214/207/345/215/227.md +0 -309
  173. package/skills//346/212/200/350/203/275/345/206/263/347/255/226/346/240/221.md +0 -338
@@ -0,0 +1,158 @@
1
+ ---
2
+ name: dart-checks-migration
3
+ description: |-
4
+ Replace the usage of `expect` and similar functions from `package:matcher`
5
+ to `package:checks` equivalents.
6
+ license: Apache-2.0
7
+ ---
8
+
9
+ # Dart Checks Migration
10
+
11
+ ## When to use this skill
12
+ Use this skill when:
13
+ - Migrating existing test files from `package:matcher` to `package:checks`.
14
+ - A user specifically asks for "modern checks" or similar.
15
+
16
+ ## The Workflow
17
+
18
+ 1. **Analysis**:
19
+ - Use `grep` to identify files using `expect` or `package:matcher`.
20
+ - Review custom matchers; these may require manual migration.
21
+ 2. **Tools & Dependencies**:
22
+ - Ensure `dev_dependencies` includes `checks`.
23
+ - Run `dart pub add --dev checks` if missing.
24
+ 3. **Discovery**:
25
+ - Use the **Strategies for Discovery** below to find candidates.
26
+ 4. **Replacement**:
27
+ - Add `import 'package:checks/checks.dart';`.
28
+ - Apply the **Common Patterns** below.
29
+ - **Final Step**: Replace `import 'package:test/test.dart';` with
30
+ `import 'package:test/scaffolding.dart';` ONLY after all `expect` calls
31
+ are replaced. This ensures incremental progress.
32
+ 5. **Verification**:
33
+ - Ensure the code analyzes cleanly.
34
+ - Ensure tests pass.
35
+
36
+ ## Strategies for Discovery
37
+
38
+ To find candidates for migration, use the following search strategies:
39
+
40
+ ### Files using Legacy Matchers
41
+ Search for test files that import `package:test/test.dart` or use `expect`:
42
+ - **Search Query**: `import 'package:test/test.dart';`
43
+ - **Regex**: `expect\(`
44
+
45
+ ### Specific Matchers to Target
46
+ Search for specific matchers that are easy to migrate:
47
+ - **Regex**: `expect\(.*,\s*equals\(`
48
+ - **Regex**: `expect\(.*,\s*isNull\)`
49
+ - **Regex**: `expect\(.*,\s*isTrue\)`
50
+ - **Regex**: `expect\(.*,\s*isFalse\)`
51
+ - **Regex**: `expect\(.*,\s*throwsA`
52
+
53
+ ## Common Patterns
54
+
55
+ | Legacy `expect` | Modern `check` |
56
+ | :--- | :--- |
57
+ | `expect(a, equals(b))` | `check(a).equals(b)` |
58
+ | `expect(a, isTrue)` | `check(a).isTrue()` |
59
+ | `expect(a, isFalse)` | `check(a).isFalse()` |
60
+ | `expect(a, isNull)` | `check(a).isNull()` |
61
+ | `expect(a, isNotNull)` | `check(a).isNotNull()` |
62
+ | `expect(() => fn(), throwsA<T>())` | `check(() => fn()).throws<T>()` |
63
+ | `expect(list, hasLength(n))` | `check(list).length.equals(n)` |
64
+ | `expect(a, closeTo(b, delta))` | `check(a).isA<num>().isCloseTo(b, delta)` |
65
+ | `expect(a, greaterThan(b))` | `check(a).isGreaterThan(b)` |
66
+ | `expect(a, lessThan(b))` | `check(a).isLessThan(b)` |
67
+ | `expect(list, isEmpty)` | `check(list).isEmpty()` |
68
+ | `expect(list, isNotEmpty)` | `check(list).isNotEmpty()` |
69
+ | `expect(list, contains(item))` | `check(list).contains(item)` |
70
+ | `expect(map, equals(otherMap))` | `check(map).deepEquals(otherMap)` |
71
+ | `expect(list, equals(otherList))` | `check(list).deepEquals(otherList)` |
72
+ | `expect(future, completes)` | `await check(future).completes()` |
73
+ | `expect(stream, emitsInOrder(...))` | `await check(stream).withQueue.inOrder(...)` |
74
+
75
+ ### Async & Futures (CRITICAL)
76
+
77
+ - **Checking async functions:**
78
+ `check(() => asyncFunc()).throws<T>()` causes **FALSE POSITIVES** because the
79
+ closure returns a `Future`, which is a value, so it "completes normally"
80
+ (as a Future).
81
+ **Correct Usage:**
82
+ ```dart
83
+ await check(asyncFunc()).throws<T>();
84
+ ```
85
+
86
+ - **Chaining on void returns:**
87
+ Many async check methods (like `throws`) return `Future<void>`. You cannot
88
+ chain directly on them. Use cascades or callbacks.
89
+ **Wrong:**
90
+ ```dart
91
+ await check(future)
92
+ .throws<Error>()
93
+ .has((e) => e.message, 'message')
94
+ .equals('foo');
95
+ ```
96
+ **Correct:**
97
+ ```dart
98
+ await check(future).throws<Error>(
99
+ (it) => it.has((e) => e.message, 'message').equals('foo'));
100
+ ```
101
+
102
+ ## Complex Examples
103
+
104
+ *Deep Verification with `isA` and `having`:*
105
+
106
+ **Legacy:**
107
+ ```dart
108
+ expect(() => foo(), throwsA(isA<ArgumentError>()
109
+ .having((e) => e.message, 'message', contains('MSG'))));
110
+ ```
111
+
112
+ **Modern:**
113
+ ```dart
114
+ check(() => foo())
115
+ .throws<ArgumentError>()
116
+ .has((e) => e.message, 'message')
117
+ .contains('MSG');
118
+ ```
119
+
120
+ *Property Extraction:*
121
+
122
+ **Legacy:**
123
+ ```dart
124
+ expect(obj.prop, equals(value)); // When checking multiple props
125
+ ```
126
+
127
+ **Modern:**
128
+ ```dart
129
+ check(obj)
130
+ ..has((e) => e.prop, 'prop').equals(value)
131
+ ..has((e) => e.other, 'other').equals(otherValue);
132
+ ```
133
+
134
+ *One-line Cascades:*
135
+ Since checks often return `void`, use cascades for multiple assertions on the
136
+ same subject.
137
+ ```dart
138
+ check(it)..isGreaterThan(10)..isLessThan(20);
139
+ ```
140
+
141
+ ## Constraints
142
+
143
+ - **Scope**: Only modify files in `test/` (and `pubspec.yaml`).
144
+ - **Correctness**: One failing test is unacceptable. If a test fails after
145
+ migration and you cannot fix it immediately, REVERT that specific change.
146
+ - **Type Safety**: `package:checks` is stricter about types than `matcher`.
147
+ You may need to add explicit `as T` casts or `isA<T>()` checks in the chain.
148
+
149
+ ## Related Skills
150
+
151
+ - **[dart-test-fundamentals]**: Core
152
+ concepts for structuring tests, lifecycles, and configuration.
153
+ - **[dart-matcher-best-practices]**:
154
+ Best practices for the traditional `package:matcher` that is being migrated
155
+ away from.
156
+
157
+ [dart-test-fundamentals]: https://github.com/kevmoo/dash_skills/blob/main/.agent/skills/dart-test-fundamentals/SKILL.md
158
+ [dart-matcher-best-practices]: https://github.com/kevmoo/dash_skills/blob/main/.agent/skills/dart-matcher-best-practices/SKILL.md
@@ -0,0 +1,168 @@
1
+ ---
2
+ name: dart-cli-app-best-practices
3
+ description: |-
4
+ Best practices for creating high-quality, executable Dart CLI applications.
5
+ Covers entrypoint structure, exit code handling, and recommended packages.
6
+ license: Apache-2.0
7
+ ---
8
+
9
+ # Dart CLI Application Best Practices
10
+
11
+ ## 1. When to use this skill
12
+ Use this skill when:
13
+ - Creating a new Dart CLI application.
14
+ - Refactoring an existing CLI entrypoint (`bin/`).
15
+ - Reviewing CLI code for quality and standards.
16
+ - Setting up executable scripts for Linux/Mac.
17
+
18
+ ## 2. Best Practices
19
+
20
+ ### Entrypoint Structure (`bin/`)
21
+ Keep the contents of your entrypoint file (e.g., `bin/my_app.dart`) minimal.
22
+ This improves testability by decoupling logic from the process runner.
23
+
24
+ **DO:**
25
+ ```dart
26
+ // bin/my_app.dart
27
+ import 'package:my_app/src/entry_point.dart';
28
+
29
+ Future<void> main(List<String> arguments) async {
30
+ await runApp(arguments);
31
+ }
32
+ ```
33
+
34
+ **DON'T:**
35
+ - Put complex logic directly in `bin/my_app.dart`.
36
+ - Define classes or heavy functions in the entrypoint.
37
+
38
+ ### Put an `executable` entry in `pubspec.yaml`
39
+
40
+ List your executables in `pubspec.yaml` to make them available for global
41
+ activation and clean invocation via `dart run`.
42
+
43
+ **DO:**
44
+ Add an `executables` section mapping the command name to the Dart file in
45
+ `bin/` (excluding the `.dart` extension).
46
+
47
+ ```yaml
48
+ executables:
49
+ my_app: # Maps to bin/my_app.dart
50
+ custom_name: main # Maps to bin/main.dart
51
+ ```
52
+
53
+ Then run via `dart run my_app` or `dart run custom_name`.
54
+
55
+ ### CONSIDER `#!` for other scripts on *nix systems
56
+
57
+ This is NOT a hard and fast rule, but it is something to consider.
58
+
59
+ For CLI tools intended to be run directly on Linux and Mac, add a shebang and
60
+ ensure the file is executable.
61
+
62
+ **DO:**
63
+ 1. Add `#!/usr/bin/env dart` to the first line.
64
+ 2. Run `chmod +x bin/my_script.dart` to make it executable.
65
+
66
+ ```dart
67
+ #!/usr/bin/env dart
68
+
69
+ void main() => print('Ready to run!');
70
+ ```
71
+
72
+ ### Process Termination (`exitCode`)
73
+ Properly handle process termination to allow for debugging and correct status
74
+ reporting.
75
+
76
+ **DO:**
77
+ - Use the `exitCode` setter to report failure.
78
+ - Allow `main` to complete naturally.
79
+ - Use standard exit codes (sysexits) for clarity (e.g., `64` for bad usage,
80
+ `78` for configuration errors).
81
+ - See `package:io` `ExitCode` class or FreeBSD sysexits man page.
82
+
83
+ ```dart
84
+ import 'dart:io';
85
+
86
+ void main() {
87
+ if (someFailure) {
88
+ exitCode = 64; // DO!
89
+ return;
90
+ }
91
+ }
92
+ ```
93
+
94
+ **AVOID:**
95
+ - Calling `exit(code)` directly, as it terminates the VM immediately,
96
+ preventing "pause on exit" debugging and `finally` blocks from running.
97
+
98
+ ### Exception Handling
99
+ Uncaught exceptions automatically set a non-zero exit code, but you should
100
+ handle expected errors gracefully.
101
+
102
+ **Example:**
103
+ ```dart
104
+ Future<void> main(List<String> arguments) async {
105
+ try {
106
+ await runApp(arguments);
107
+ } catch (e, stack) {
108
+ print('App crashed!');
109
+ print(e);
110
+ print(stack);
111
+ exitCode = 1; // Explicitly fail
112
+ }
113
+ }
114
+ ```
115
+
116
+ ### Cross-Platform Compatibility (Windows Support)
117
+ When writing CLI applications and tests, ensure compatibility with Windows:
118
+ - **Paths**: Avoid hardcoding path separators like `/` because Windows uses `\`.
119
+ Use `package:path`'s `p.join` or `p.normalize` to construct paths portably.
120
+ - **File Permissions**: When testing file permission errors, remember that
121
+ `chmod` is not available on Windows. Use `icacls` on Windows or appropriate
122
+ mock libraries to simulate permission errors. Never skip tests on Windows
123
+ simply because of permission commands if a Windows equivalent exists.
124
+
125
+ ## Discovery
126
+
127
+ To find areas to apply these best practices:
128
+
129
+ ### Heavy Entrypoints
130
+ Inspect files in `bin/` to see if they contain logic that should be in `lib/`:
131
+ - **Target**: Files matching `bin/*.dart`.
132
+
133
+ ### Direct Process Termination
134
+ Search for calls to `exit()` instead of setting `exitCode`:
135
+ - **Regex**: `\bexit\(`
136
+
137
+ ### Hardcoded Path Separators
138
+ Search for hardcoded `/` in strings that appear to be file paths:
139
+ - **Regex**: `['"][^'"]+/[^'"]+['"]` (Verify context as this may match URLs).
140
+
141
+ ## 3. Recommended Packages
142
+
143
+ Use these community-standard packages owned by the [Dart team](https://dart.dev)
144
+ to solve common CLI problems:
145
+
146
+ | Category | Recommended Package | Usage |
147
+ | :--- | :--- | :--- |
148
+ | **Stack Traces** | [`package:stack_trace`](https://pub.dev/packages/stack_trace) | detailed, cleaner stack traces |
149
+ | **Arg Parsing** | [`package:args`](https://pub.dev/packages/args) | standard flag/option parsing |
150
+ | **Testing** | [`package:test_process`](https://pub.dev/packages/test_process) | integration testing for CLI apps |
151
+ | **Testing** | [`package:test_descriptor`](https://pub.dev/packages/test_descriptor) | file system fixtures for tests |
152
+ | **Networking** | [`package:http`](https://pub.dev/packages/http) | standard HTTP client (remember user-agent!) |
153
+ | **ANSI Output** | [`package:io`](https://pub.dev/packages/io) | handling ANSI colors and styles |
154
+
155
+ ## 4. Interesting community packages
156
+
157
+ | Category | Recommended Package | Usage |
158
+ | :--- | :--- | :--- |
159
+ | **Configuration** | [`package:json_serializable`](https://pub.dev/packages/json_serializable) | strongly typed config objects |
160
+ | **CLI Generation** | [`package:build_cli`](https://pub.dev/packages/build_cli) | generate arg parsers from classes |
161
+ | **Version Info** | [`package:build_version`](https://pub.dev/packages/build_version) | automatic version injection |
162
+ | **Configuration** | [`package:checked_yaml`](https://pub.dev/packages/checked_yaml) | precise YAML parsing with line numbers |
163
+
164
+ ## 5. Conventions
165
+
166
+ - **File Caching**: Write cached files to `.dart_tool/[pkg_name]/`.
167
+ - **User-Agent**: Always set a User-Agent header in HTTP requests, including
168
+ version info.
@@ -0,0 +1,87 @@
1
+ ---
2
+ name: dart-doc-validation
3
+ description: |-
4
+ Best practices for validating Dart documentation comments.
5
+ Covers using `dart doc` to catch unresolved references and macros.
6
+ license: Apache-2.0
7
+ ---
8
+
9
+ # Dart Doc Validation
10
+
11
+ ## 1. When to use this skill
12
+
13
+ Use this skill when:
14
+ - Writing or updating documentation comments (`///`) in Dart code.
15
+ - Checking for broken documentation links, references, or macros.
16
+ - Preparing a package for publishing to pub.dev.
17
+
18
+ ## Discovery
19
+
20
+ To find documentation issues:
21
+
22
+ ### Missing Lint
23
+ Verify if the `comment_references` lint is enabled:
24
+ - **Target**: `analysis_options.yaml`
25
+ - **Search Query**: `comment_references`
26
+
27
+ ### Automated Validation
28
+ Run the documentation generator to surface warnings:
29
+ - **Command**: `dart doc -o $(mktemp -d)`
30
+ - **Keywords to look for**: `warning:`, `unresolved doc reference`,
31
+ `undefined macro`
32
+
33
+ ## 2. Best Practices
34
+
35
+ ### Enable the doc validation lint
36
+
37
+ In your `analysis_options.yaml`, enable the `comment_references` lint.
38
+
39
+ ```yaml
40
+ linter:
41
+ rules:
42
+ - comment_references
43
+ ```
44
+
45
+ ### Validating Documentation Locally
46
+
47
+ Use the `dart doc` command with a temporary output directory to validate
48
+ documentation comments without polluting the local project workspace.
49
+
50
+ This command parses all documentation comments and reports warnings such as:
51
+ - `warning: unresolved doc reference`
52
+ - `warning: undefined macro`
53
+
54
+ **Command to run:**
55
+
56
+ ```bash
57
+ dart doc -o $(mktemp -d)
58
+ ```
59
+
60
+ *This will work on Mac and Linux.*
61
+
62
+ This ensures that the generated HTML files are stored in a temporary location
63
+ and don't clutter the package directory, while still surfacing all validation
64
+ warnings in the terminal output.
65
+
66
+ **Browsing the docs:**
67
+
68
+ Our docs use features designed to be run on a web server. If you want to browse
69
+ the generated docs locally, install the `dhttpd` package.
70
+
71
+
72
+ ```shell
73
+ pub global activate dhttpd
74
+ TMP_DIR=$(mktemp -d) && dart doc -o "$TMP_DIR" && dhttpd --path "$TMP_DIR"
75
+ ```
76
+
77
+ *(Or use another HTTP server, such as `python3 -m http.server`.)*
78
+
79
+
80
+ ### Fixing Common Warnings
81
+
82
+ - **Unresolved doc reference**: Ensure that any identifier wrapped in square
83
+ brackets (`[Identifier]`) correctly points to an existing class, method,
84
+ property, or parameter in the current scope or imported libraries.
85
+ - **Undefined macro**: If using `{@macro macro_name}`, ensure that the
86
+ template `{@template macro_name}` is defined in the same file or a file
87
+ that is imported and visible to the documentation generator.
@@ -0,0 +1,101 @@
1
+ ---
2
+ name: dart-long-lines
3
+ description: |-
4
+ Guidelines for handling long lines in Dart code to adhere to the 80-column
5
+ rule. The `lines_longer_than_80_chars` lint.
6
+ license: Apache-2.0
7
+ ---
8
+
9
+ # Dart Long Lines
10
+
11
+ ## 1. When to use this skill
12
+
13
+ Use this skill when:
14
+ - Writing Dart code that might exceed the 80-column limit.
15
+ - Refactoring code to comply with the `lines_longer_than_80_chars` lint.
16
+ Reference: https://dart.dev/tools/linter-rules/lines_longer_than_80_chars
17
+
18
+ ## Discovery
19
+
20
+ To find lines that exceed the limit:
21
+
22
+ ### Automated Analysis
23
+ The most reliable way to find long lines is to use the Dart analyzer:
24
+ - **Command**: `dart analyze`
25
+ - **Lint**: `lines_longer_than_80_chars`
26
+
27
+ ### Manual Search
28
+ To search for long lines using regex:
29
+ - **Regex**: `^.{81,}$` (Matches any line with 81 or more characters).
30
+
31
+ ## 2. Guidelines
32
+
33
+ ### Format First
34
+ Always run `dart format` before manually breaking long lines. The formatter
35
+ often automatically fixes long lines, especially in generated code, and
36
+ applies standard Dart styling rules.
37
+
38
+ ### Code Comments
39
+ Break long code comments (`//`) cleanly at word boundaries to ensure lines do
40
+ not exceed 80 characters. Maintain tight formatting and avoid unnecessary
41
+ vertical space.
42
+
43
+ ### Documentation Comments (`///`)
44
+ - Apply the same line-breaking rules as for code comments.
45
+ - Avoid breaking markdown link blocks like `[name]` or
46
+ `[text](http://example.com)` across lines. Place them on their own line if
47
+ they exceed the limit.
48
+ - Start doc comments with a single summary sentence, followed by a blank line
49
+ before the rest of the comment. It is okay to break this first sentence
50
+ across multiple lines to fit the 80-column limit.
51
+ - Avoid unresolved references or dangling sentences.
52
+
53
+ ### Long Strings
54
+ - Use adjacent string literals (e.g., `'part 1 ' 'part 2'`) to break long
55
+ strings. Break at word boundaries.
56
+ - If a single-line string contains newline characters (`\n`) or if there are
57
+ consecutive `print` statements, consider migrating to a multi-line string
58
+ literal (`'''`).
59
+
60
+ ### Format and Analyze After Changes
61
+ - Run `dart format` and `dart analyze` after making changes.
62
+ - Be aware that splitting strings may trigger new lints (e.g.,
63
+ `prefer_single_quotes` if a double-quoted string is split into parts that
64
+ no longer contain single quotes).
65
+
66
+ ## 3. Examples
67
+
68
+ ### Documentation Comment Link
69
+ **Avoid:**
70
+ ```dart
71
+ /// This is a long doc comment that contains a link to [a very long
72
+ /// URL](http://example.com/very/long/url/that/exceeds/eighty/chars).
73
+ ```
74
+
75
+ **Prefer:**
76
+ ```dart
77
+ /// This is a long doc comment that contains a link to [a very long URL][ref].
78
+ ///
79
+ /// [ref]: http://example.com/very/long/url/that/exceeds/eighty/chars
80
+ ```
81
+
82
+ ### Adjacent String Literals
83
+ **Prefer:**
84
+ ```dart
85
+ final longString = 'This is a very long string that needs to be broken '
86
+ 'across multiple lines to stay under the limit.';
87
+ ```
88
+
89
+ ### Multi-line String Migration
90
+ **Avoid:**
91
+ ```dart
92
+ print('This is line 1\nThis is line 2 that is also quite long\nThis is line 3 which makes the whole thing exceed eighty characters');
93
+ ```
94
+
95
+ **Prefer:**
96
+ ```dart
97
+ print('''This is line 1
98
+ This is line 2 that is also quite long
99
+ This is line 3 which makes the whole thing exceed eighty characters''');
100
+ ```
101
+
@@ -0,0 +1,136 @@
1
+ ---
2
+ name: dart-matcher-best-practices
3
+ description: |-
4
+ Best practices for using `expect` and `package:matcher`.
5
+ Focuses on readable assertions, proper matcher selection, and avoiding
6
+ common pitfalls.
7
+ license: Apache-2.0
8
+ ---
9
+
10
+ # Dart Matcher Best Practices
11
+
12
+ ## When to use this skill
13
+
14
+ Use this skill when:
15
+ - Writing assertions using `expect` and `package:matcher`.
16
+ - Migrating legacy manual checks to cleaner matchers.
17
+ - Debugging confusing test failures.
18
+
19
+ ## Discovery
20
+
21
+ To find candidates for improving matcher usage, search for suboptimal patterns:
22
+
23
+ ### Suboptimal Length Checks
24
+ Search for length checks that should use `hasLength`:
25
+ - **Regex**: `expect\([^,]+.length,\s*`
26
+
27
+ ### Suboptimal Boolean Checks
28
+ Search for checks on boolean properties that have specific matchers:
29
+ - **Regex**: `expect\([^,]+.isEmpty,\s*(true|equals\(true\))`
30
+ - **Regex**: `expect\([^,]+.isNotEmpty,\s*(true|equals\(true\))`
31
+ - **Regex**: `expect\([^,]+.contains\(.*\),\s*(true|equals\(true\))`
32
+
33
+ ### Suboptimal Map Lookups
34
+ Search for manual map lookups instead of `containsPair`:
35
+ - **Regex**: `expect\([^,]+\[.*\],\s*`
36
+
37
+ ## Core Matchers
38
+
39
+ ### 1. Collections (`hasLength`, `contains`, `isEmpty`, `unorderedEquals`, `containsPair`)
40
+
41
+ - **`hasLength(n)`**:
42
+ - Prefer `expect(list, hasLength(n))` over `expect(list.length, n)`.
43
+ - Gives better error messages on failure (shows actual list content).
44
+
45
+ - **`isEmpty` / `isNotEmpty`**:
46
+ - Prefer `expect(list, isEmpty)` over `expect(list.isEmpty, true)`.
47
+ - Prefer `expect(list, isNotEmpty)` over `expect(list.isNotEmpty, true)`.
48
+
49
+ - **`contains(item)`**:
50
+ - Verify existence without manual iteration.
51
+ - Prefer over `expect(list.contains(item), true)`.
52
+
53
+ - **`unorderedEquals(items)`**:
54
+ - Verify contents regardless of order.
55
+ - Prefer over `expect(list, containsAll(items))`.
56
+
57
+ - **`containsPair(key, value)`**:
58
+ - Verify a map contains a specific key-value pair.
59
+ - Prefer over checking `expect(map[key], value)` or
60
+ `expect(map.containsKey(key), true)`.
61
+
62
+ ### 2. Type Checks (`isA<T>` and `TypeMatcher<T>`)
63
+
64
+ - **`isA<T>()`**:
65
+ - Prefer for inline assertions: `expect(obj, isA<Type>())`.
66
+ - More concise and readable than `TypeMatcher<Type>()`.
67
+ - Allows chaining constraints using `.having()`.
68
+
69
+ - **`TypeMatcher<T>`**:
70
+ - Prefer when defining top-level reusable matchers.
71
+ - **Use `const`**: `const isMyType = TypeMatcher<MyType>();`
72
+ - Chaining `.having()` works here too, but the resulting matcher is not `const`.
73
+
74
+ ### 3. Object Properties (`having`)
75
+
76
+ Use `.having()` on `isA<T>()` or other TypeMatchers to check properties.
77
+
78
+ - **Descriptive Names**: Use meaningful parameter names in the closure (e.g.,
79
+ `(e) => e.message`) instead of generic ones like `p0` to improve readability.
80
+
81
+ ```dart
82
+ expect(person, isA<Person>()
83
+ .having((p) => p.name, 'name', 'Alice')
84
+ .having((p) => p.age, 'age', greaterThan(18)));
85
+ ```
86
+
87
+ This provides detailed failure messages indicating exactly which property
88
+ failed.
89
+
90
+ ### 4. Async Assertions
91
+
92
+ - **`completion(matcher)`**:
93
+ - Wait for a future to complete and check its value.
94
+ - **Prefer `await expectLater(...)`** to ensure the future completes before
95
+ the test continues.
96
+ - `await expectLater(future, completion(equals(42)))`.
97
+
98
+ - **`throwsA(matcher)`**:
99
+ - Check that a future or function throws an exception.
100
+ - `await expectLater(future, throwsA(isA<StateError>()))`.
101
+ - `expect(() => function(), throwsA(isA<ArgumentError>()))` (synchronous
102
+ function throwing is fine with `expect`).
103
+
104
+ ### 5. Using `expectLater`
105
+
106
+ Use `await expectLater(...)` when testing async behavior to ensure proper
107
+ sequencing.
108
+
109
+ ```dart
110
+ // GOOD: Waits for future to complete before checking side effects
111
+ await expectLater(future, completion(equals(42)));
112
+ expect(sideEffectState, equals('done'));
113
+
114
+ // BAD: Side effect check might run before future completes
115
+ expect(future, completion(equals(42)));
116
+ expect(sideEffectState, equals('done')); // Race condition!
117
+ ```
118
+
119
+ ## Principles
120
+
121
+ 1. **Readable Failures**: Choose matchers that produce clear error messages.
122
+ 2. **Avoid Manual Logic**: Don't use `if` statements or `for` loops for
123
+ assertions; let matchers handle it.
124
+ 3. **Specific Matchers**: Use the most specific matcher available (e.g.,
125
+ `containsPair` for maps instead of checking keys manually).
126
+
127
+ ## Related Skills
128
+
129
+ - **[dart-test-fundamentals]**: Core
130
+ concepts for structuring tests, lifecycles, and configuration.
131
+ - **[dart-checks-migration]**: Use this
132
+ skill if you are migrating tests from `package:matcher` to modern
133
+ `package:checks`.
134
+
135
+ [dart-test-fundamentals]: https://github.com/kevmoo/dash_skills/blob/main/.agent/skills/dart-test-fundamentals/SKILL.md
136
+ [dart-checks-migration]: https://github.com/kevmoo/dash_skills/blob/main/.agent/skills/dart-checks-migration/SKILL.md