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.
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 +176 -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,266 @@
1
+ ---
2
+ name: dart-modern-features
3
+ description: |-
4
+ Guidelines for using modern Dart features (v3.0 - v3.10) such as Records,
5
+ Pattern Matching, Switch Expressions, Extension Types, Class Modifiers,
6
+ Wildcards, Null-Aware Elements, and Dot Shorthands.
7
+ ---
8
+
9
+ # Dart Modern Features
10
+
11
+ ## 1. When to use this skill
12
+
13
+ Use this skill when:
14
+ - Writing or reviewing Dart code targeting Dart 3.0 or later.
15
+ - Refactoring legacy Dart code to use modern, concise, and safe features.
16
+ - Looking for idiomatic ways to handle multiple return values, deep data
17
+ extraction, or exhaustive checking.
18
+
19
+ ## Discovery
20
+
21
+ To find candidates for modernization:
22
+
23
+ ### Switch Expressions
24
+ Search for switch statements where every case assigns to the same variable
25
+ or returns:
26
+ - **Regex**: `switch\s*\([^)]+\)\s*\{\s*case`
27
+
28
+ ### Pattern Matching Candidates
29
+ Search for manual map or JSON property extraction and type checking:
30
+ - **Regex**: `containsKey\(['"][^'"]+['"]\)`
31
+ - **Regex**: `json\[['"][^'"]+['"]\]\s+is\s+`
32
+
33
+ ### Null-Aware Elements
34
+ Search for collection `if` statements checking for null:
35
+ - **Regex**: `if\s*\(\w+\s*!=\s*null\)\s*\w+`
36
+
37
+ ### Digit Separators
38
+ Search for long numbers without separators:
39
+ - **Regex**: `\b\d{6,}\b` (Matches numbers with 6 or more digits).
40
+
41
+ ## 2. Features
42
+
43
+ ### Records
44
+ Use records as anonymous, immutable, aggregate structures to bundle multiple
45
+ objects without defining a custom class. Prefer them for returning multiple
46
+ values from a function or grouping related data temporarily.
47
+
48
+ **Avoid:**
49
+ Creating a dedicated class for simple multiple-value returns.
50
+ ```dart
51
+ class UserResult {
52
+ final String name;
53
+ final int age;
54
+ UserResult(this.name, this.age);
55
+ }
56
+
57
+ UserResult fetchUser() {
58
+ return UserResult('Alice', 42);
59
+ }
60
+ ```
61
+
62
+ **Prefer:**
63
+ Using records to bundle types seamlessly on the fly.
64
+ ```dart
65
+ (String, int) fetchUser() {
66
+ return ('Alice', 42);
67
+ }
68
+
69
+ void main() {
70
+ var user = fetchUser();
71
+ print(user.$1); // Alice
72
+ }
73
+ ```
74
+
75
+ ### Patterns and Pattern Matching
76
+ Use patterns to destructure complex data into local variables and match against
77
+ specific shapes or values. Use them in `switch`, `if-case`, or variable
78
+ declarations to unpack data directly.
79
+
80
+ **Avoid:**
81
+ Manually checking types, nulls, and keys for data extraction.
82
+ ```dart
83
+ void processJson(Map<String, dynamic> json) {
84
+ if (json.containsKey('name') && json['name'] is String &&
85
+ json.containsKey('age') && json['age'] is int) {
86
+ String name = json['name'];
87
+ int age = json['age'];
88
+ print('$name is $age years old.');
89
+ }
90
+ }
91
+ ```
92
+
93
+ **Prefer:**
94
+ Combining type-checking, validation, and assignment into a single statement.
95
+ ```dart
96
+ void processJson(Map<String, dynamic> json) {
97
+ if (json case {'name': String name, 'age': int age}) {
98
+ print('$name is $age years old.');
99
+ }
100
+ }
101
+ ```
102
+
103
+ ### Switch Expressions
104
+ Use switch expressions to return a value directly, eliminating bulky `case` and
105
+ `break` statements.
106
+
107
+ **Avoid:**
108
+ Using switch statements where every branch simply returns or assigns a value.
109
+ ```dart
110
+ String describeStatus(int code) {
111
+ switch (code) {
112
+ case 200:
113
+ return 'Success';
114
+ case 404:
115
+ return 'Not Found';
116
+ default:
117
+ return 'Unknown';
118
+ }
119
+ }
120
+ ```
121
+
122
+ **Prefer:**
123
+ Returning the evaluated expression directly using the `=>` syntax.
124
+ ```dart
125
+ String describeStatus(int code) => switch (code) {
126
+ 200 => 'Success',
127
+ 404 => 'Not Found',
128
+ _ => 'Unknown',
129
+ };
130
+ ```
131
+
132
+ ### Class Modifiers
133
+ Use class modifiers (`sealed`, `final`, `base`, `interface`) to restrict how
134
+ classes can be used outside their defines library. Prefer `sealed` for defining
135
+ closed families of subtypes to enable exhaustive checking.
136
+
137
+ **Avoid:**
138
+ Using open `abstract` classes when the set of subclasses is known and fixed.
139
+ ```dart
140
+ abstract class Result {}
141
+
142
+ class Success extends Result {}
143
+ class Failure extends Result {}
144
+
145
+ String handle(Result r) {
146
+ if (r is Success) return 'OK';
147
+ if (r is Failure) return 'Error';
148
+ return 'Unknown';
149
+ }
150
+ ```
151
+
152
+ **Prefer:**
153
+ Using `sealed` to guarantee to the compiler that all cases are covered.
154
+ ```dart
155
+ sealed class Result {}
156
+
157
+ class Success extends Result {}
158
+ class Failure extends Result {}
159
+
160
+ String handle(Result r) => switch(r) {
161
+ Success() => 'OK',
162
+ Failure() => 'Error',
163
+ };
164
+ ```
165
+
166
+ ### Extension Types
167
+ Use extension types for a zero-cost wrapper around an existing type. Use them to
168
+ restrict operations or add custom behavior without runtime overhead.
169
+
170
+ **Avoid:**
171
+ Allocating new wrapper objects just for domain-specific logic or type safety.
172
+ ```dart
173
+ class Id {
174
+ final int value;
175
+ Id(this.value);
176
+ bool get isValid => value > 0;
177
+ }
178
+ ```
179
+
180
+ **Prefer:**
181
+ Using extension types which compile down to the underlying type at runtime.
182
+ ```dart
183
+ extension type Id(int value) {
184
+ bool get isValid => value > 0;
185
+ }
186
+ ```
187
+
188
+ ### Digit Separators
189
+ Use underscores (`_`) in number literals strictly to improve visual readability
190
+ of large numeric values.
191
+
192
+ **Avoid:**
193
+ Long number literals that are difficult to read at a glance.
194
+ ```dart
195
+ const int oneMillion = 1000000;
196
+ ```
197
+
198
+ **Prefer:**
199
+ Using underscores to separate thousands or other groupings.
200
+ ```dart
201
+ const int oneMillion = 1_000_000;
202
+ ```
203
+
204
+ ### Wildcard Variables
205
+ Use wildcards (`_`) as non-binding variables or parameters to explicitly signal
206
+ that a value is intentionally unused.
207
+
208
+ **Avoid:**
209
+ Inventing clunky, distinct variable names to avoid "unused variable" warnings.
210
+ ```dart
211
+ void handleEvent(String ignoredName, int status) {
212
+ print('Status: $status');
213
+ }
214
+ ```
215
+
216
+ **Prefer:**
217
+ Explicitly dropping the binding with an underscore.
218
+ ```dart
219
+ void handleEvent(String _, int status) {
220
+ print('Status: $status');
221
+ }
222
+ ```
223
+
224
+ ### Null-Aware Elements
225
+ Use null-aware elements (`?`) inside collection literals to conditionally
226
+ include items only if they evaluate to a non-null value.
227
+
228
+ **Avoid:**
229
+ Using collection `if` statements for simple null checks.
230
+ ```dart
231
+ var names = [
232
+ 'Alice',
233
+ if (optionalName != null) optionalName,
234
+ 'Charlie'
235
+ ];
236
+ ```
237
+
238
+ **Prefer:**
239
+ Using the `?` prefix inline.
240
+ ```dart
241
+ var names = ['Alice', ?optionalName, 'Charlie'];
242
+ ```
243
+
244
+ ### Dot Shorthands
245
+ Use dot shorthands to omit the explicit type name when it can be confidently
246
+ inferred from context, such as with enums or static fields.
247
+
248
+ **Avoid:**
249
+ Fully qualifying type names when the type is obvious from the context.
250
+ ```dart
251
+ LogLevel currentLevel = LogLevel.info;
252
+ ```
253
+
254
+ **Prefer:**
255
+ Reducing visual noise with inferred shorthand.
256
+ ```dart
257
+ LogLevel currentLevel = .info;
258
+ ```
259
+
260
+ ## Related Skills
261
+
262
+ - **[dart-best-practices]**: General code
263
+ style and foundational Dart idioms that predate or complement the modern
264
+ syntax features.
265
+
266
+ [dart-best-practices]: https://github.com/kevmoo/dash_skills/blob/main/.agent/skills/dart-best-practices/SKILL.md
@@ -0,0 +1,92 @@
1
+ ---
2
+ name: dart-package-maintenance
3
+ description: |-
4
+ Guidelines for maintaining external Dart packages, covering versioning,
5
+ publishing workflows, and pull request management. Use when updating Dart
6
+ packages, preparing for a release, or managing collaborative changes in a
7
+ repository.
8
+ ---
9
+
10
+ # Dart Package Maintenance
11
+
12
+ Guidelines for maintaining Dart packages in alignment with Dart team best
13
+ practices.
14
+
15
+ ## Discovery
16
+
17
+ To find maintenance tasks or inconsistencies:
18
+
19
+ ### Consistency Checks
20
+ Ensure the latest version in `CHANGELOG.md` matches `pubspec.yaml`:
21
+ - Compare the top header in `CHANGELOG.md` with the `version:` field in
22
+ `pubspec.yaml`.
23
+
24
+ ## Versioning
25
+
26
+ ### Semantic Versioning
27
+ - **Major**: Breaking changes.
28
+ - **Minor**: New features (non-breaking API changes).
29
+ - **Patch**: Bug fixes, documentation, or non-impacting changes.
30
+ - **Unstable packages**: Use `0.major.minor+patch`.
31
+ - **Recommendation**: Aim for `1.0.0` as soon as the package is stable.
32
+
33
+ ### Pre-Edit Verification
34
+ - **Check Published Versions**: Before modifying `CHANGELOG.md` or
35
+ `pubspec.yaml`, ALWAYS check the currently released version (e.g., via
36
+ `git tag` or `pub.dev`).
37
+ - **Do Not Amend Released Versions**: Never add new entries to a version header
38
+ that corresponds to a released tag.
39
+ - **Increment for New Changes**: If the current version in `pubspec.yaml`
40
+ matches a released tag, increment the version (e.g., usually to `-wip`) and
41
+ create a new section in `CHANGELOG.md`.
42
+
43
+ - **Consistency**: The `CHANGELOG.md` header must match the new
44
+ `pubspec.yaml` version.
45
+
46
+ - **SemVer Guidelines**:
47
+ - **Breaking Changes**: Bump Major, reset Minor/Patch
48
+ (e.g., `2.0.0-wip`, `0.5.0-wip`).
49
+ - **New Features**: Bump Minor, reset Patch
50
+ (e.g., `1.1.0-wip`, `0.4.5-wip`).
51
+ - **Bug Fixes**: Bump Patch (e.g., `1.0.1-wip`).
52
+
53
+ ### Changelog Content
54
+ - **Focus on User Impact**: Entries in `CHANGELOG.md` should focus on changes
55
+ visible to or impacting the end-user (e.g., new features, bug fixes,
56
+ breaking changes).
57
+ - **Omit Internal Changes**: Do not include internal refactorings, test
58
+ changes, or other modifications that do not affect the package's behavior
59
+ or API for the user.
60
+
61
+ ### Work-in-Progress (WIP) Versions
62
+ - Immediately after a publish, or on the first change after a publish, update
63
+ `pubspec.yaml` and `CHANGELOG.md` with a `-wip` suffix (e.g., `1.1.0-wip`).
64
+ - This indicates the current state is not yet published.
65
+
66
+ ### Breaking Changes
67
+ - Evaluate the impact on dependent packages and internal projects.
68
+ - Consider running changes through internal presubmits if possible.
69
+ - Prefer incremental rollouts (e.g., new behavior as opt-in) to minimize
70
+ downstream breakage.
71
+
72
+ ## Publishing Process
73
+
74
+ 1. **Preparation**: Remove the `-wip` suffix from `pubspec.yaml` and
75
+ `CHANGELOG.md` in a dedicated pull request.
76
+ 2. **Execution**: Run `dart pub publish` (or `flutter pub publish`) and resolve
77
+ all warnings and errors.
78
+ 3. **Tagging**: Create and push a git tag for the published version:
79
+ - For single-package repos: `v1.2.3`
80
+ - For monorepos: `package_name-v1.2.3`
81
+ - Example: `git tag v1.2.3 && git push --tags`
82
+
83
+ ## Pull Request Management
84
+
85
+ - **Commits**: Each PR should generally correspond to a single squashed commit
86
+ upon merging.
87
+ - **Shared History**: Once a PR is open, avoid force pushing to the branch.
88
+ - **Conflict Resolution**: Prefer merging `main` into the PR branch rather than
89
+ rebasing to resolve conflicts. This preserves the review history and comments.
90
+ - **Reviewing**: Add comments from the "Files changed" view to batch them.
91
+ - **Local Inspection**: Use `gh pr checkout <number>` to inspect changes
92
+ locally in your IDE.
@@ -0,0 +1,92 @@
1
+ ---
2
+ name: dart-test-coverage
3
+ description: |-
4
+ Understand and improve test coverage in a Dart package.
5
+ Helps agents run coverage, interpret results, and identify missed lines.
6
+ ---
7
+
8
+ # Dart Test Coverage
9
+
10
+ Guidelines for running and interpreting test coverage in Dart packages.
11
+
12
+ ## When to use this skill
13
+ - When asked to "check test coverage" or "improve coverage".
14
+ - When you need to identify which parts of a library are untested.
15
+
16
+ ## Discovery
17
+
18
+ To find areas lacking test coverage:
19
+
20
+ ### Run Coverage Analysis
21
+ Follow the workflow to generate and interpret coverage data:
22
+ 1. **Run Tests with Coverage**: `dart test --coverage=.dart_tool/coverage`
23
+ 2. **Interpret Results**: Use the script or `format_coverage` as described in
24
+ the **Interpreting Results** section to identify specific files and missed
25
+ lines.
26
+
27
+ ## How to use this skill (The Workflow)
28
+ 1. Ensure tests pass by running `dart test`.
29
+ 2. Collect coverage by running `dart test --coverage=.dart_tool/coverage`.
30
+ 3. Interpret the results using the provided script or standard tools.
31
+ 4. Add tests to cover missed lines.
32
+
33
+ ## Running Coverage
34
+ Run the following command to collect coverage in JSON format:
35
+ ```bash
36
+ dart test --coverage=.dart_tool/coverage
37
+ ```
38
+
39
+ > [!NOTE]
40
+ > We use `.dart_tool/coverage` as the output directory because `.dart_tool`
41
+ > is typically already ignored in `.gitignore` files.
42
+
43
+ > [!TIP]
44
+ > For projects with complex conditional logic, you can pass the
45
+ > `--branch-coverage` flag to `dart test` to collect branch-level coverage.
46
+
47
+ ## Interpreting Results
48
+
49
+ ### Option 1: Use the custom interpreter script
50
+ This repository includes a zero-dependency script that parses the raw JSON
51
+ output and provides a summary of covered percentage and missed lines.
52
+
53
+ Run it from the project root (adjust path to script as needed):
54
+ ```bash
55
+ dart run .agent/skills/dart-test-coverage/scripts/interpret_coverage.dart .dart_tool/coverage <package_name>
56
+ ```
57
+ Replace `<package_name>` with the name from `pubspec.yaml`.
58
+
59
+ Example Output:
60
+ ```
61
+ package:my_pkg/src/file.dart: 50.0% (2/4 lines)
62
+ Missed lines: 3, 4
63
+ ```
64
+
65
+ ### Option 2: Use package:coverage
66
+ If `package:test` is installed, `package:coverage` is likely available as a
67
+ transitive dependency. You can use its `format_coverage` tool.
68
+
69
+ To get a human-readable "pretty print" of the coverage:
70
+ ```bash
71
+ dart run coverage:format_coverage --in=.dart_tool/coverage --out=stdout --pretty-print --report-on=lib
72
+ ```
73
+ This will output the file content with hit counts on the left (e.g., `0|` for
74
+ missed lines).
75
+
76
+ ## Best Practices for Reporting Results
77
+ When presenting coverage results to the user, follow these guidelines:
78
+ 1. **State the high-level percentage first** to give immediate context.
79
+ 2. **Identify specific files and missed lines** clearly.
80
+ 3. **Translate line numbers to code**: Don't just say "lines 3-6 are missed".
81
+ Look at the source file and tell the user which functions or blocks are
82
+ untested (e.g., "The `divide` function is missing coverage").
83
+ 4. **Propose concrete fixes**: Provide example test code that the user can
84
+ immediately apply to cover the missed lines.
85
+ 5. **Use tables for multi-file summaries**: When reporting on multiple files,
86
+ use a markdown table with columns for File, Coverage %, and Missed Lines
87
+ to make the summary easy to scan.
88
+
89
+ ## Constraints
90
+ - ALWAYS verify that tests pass before collecting coverage.
91
+ - DO NOT commit the `.dart_tool/coverage` directory.
92
+ - Focus coverage improvements on `lib/` files, not `test/` or generated files.
@@ -0,0 +1,7 @@
1
+ int add(int a, int b) => a + b;
2
+ int subtract(int a, int b) => a - b;
3
+ int multiply(int a, int b) => a * b;
4
+ int divide(int a, int b) {
5
+ if (b == 0) throw ArgumentError('Cannot divide by zero');
6
+ return a ~/ b;
7
+ }
@@ -0,0 +1,8 @@
1
+ name: dummy_pkg
2
+ publish_to: none
3
+
4
+ environment:
5
+ sdk: ^3.9.0
6
+
7
+ dev_dependencies:
8
+ test: ^1.24.0
@@ -0,0 +1,11 @@
1
+ import 'package:dummy_pkg/src/calculator.dart';
2
+ import 'package:test/test.dart';
3
+
4
+ void main() {
5
+ test('add', () {
6
+ expect(add(1, 2), 3);
7
+ });
8
+ test('subtract', () {
9
+ expect(subtract(2, 1), 1);
10
+ });
11
+ }
@@ -0,0 +1,95 @@
1
+ #!/usr/bin/env dart
2
+
3
+ import 'dart:convert';
4
+ import 'dart:io';
5
+
6
+ void main(List<String> args) {
7
+ if (args.isEmpty) {
8
+ print(
9
+ 'Usage: dart interpret_coverage.dart <coverage_directory> [package_name]',
10
+ );
11
+ exitCode = 64; // Bad usage
12
+ return;
13
+ }
14
+ final dirPath = args[0];
15
+ final packageName = args.length > 1 ? args[1] : null;
16
+
17
+ final dir = Directory(dirPath);
18
+ if (!dir.existsSync()) {
19
+ print('Directory not found: $dirPath');
20
+ exitCode = 78; // Configuration error
21
+ return;
22
+ }
23
+
24
+ final files = dir
25
+ .listSync(recursive: true)
26
+ .whereType<File>()
27
+ .where((f) => f.path.endsWith('.vm.json'));
28
+
29
+ final coverageData = processCoverage(files, packageName);
30
+
31
+ if (coverageData.isEmpty) {
32
+ print('No coverage data found for the specified criteria.');
33
+ return;
34
+ }
35
+
36
+ // Print summary
37
+ coverageData.forEach((source, lineHits) {
38
+ final totalLines = lineHits.length;
39
+ final coveredLines = lineHits.values.where((hits) => hits > 0).length;
40
+ final percent = totalLines > 0
41
+ ? (coveredLines / totalLines * 100).toStringAsFixed(1)
42
+ : '100';
43
+
44
+ print('$source: $percent% ($coveredLines/$totalLines lines)');
45
+
46
+ // Show missed lines
47
+ final missed =
48
+ lineHits.entries.where((e) => e.value == 0).map((e) => e.key).toList()
49
+ ..sort();
50
+
51
+ if (missed.isNotEmpty) {
52
+ print(' Missed lines: ${missed.join(', ')}');
53
+ }
54
+ });
55
+ }
56
+
57
+ /// Processes a list of coverage files and returns a map of file paths to line hit counts.
58
+ ///
59
+ /// The returned map structure is: `{ file_uri: { line_number: hit_count } }`.
60
+ ///
61
+ /// If [packageName] is provided, only files starting with `package:$packageName/` are included.
62
+ /// Files containing `/test/` are skipped.
63
+ Map<String, Map<int, int>> processCoverage(
64
+ Iterable<File> files,
65
+ String? packageName,
66
+ ) {
67
+ final coverageData = <String, Map<int, int>>{}; // file -> (line -> hits)
68
+ for (final file in files) {
69
+ final content = file.readAsStringSync();
70
+ final json = jsonDecode(content) as Map<String, dynamic>;
71
+ final coverage = json['coverage'] as List<dynamic>;
72
+
73
+ for (final item in coverage) {
74
+ final source = item['source'] as String;
75
+
76
+ // Filter by package name if provided
77
+ if (packageName != null && !source.startsWith('package:$packageName/')) {
78
+ continue;
79
+ }
80
+
81
+ // Skip test files usually
82
+ if (source.contains('/test/')) continue;
83
+
84
+ final hits = item['hits'] as List<dynamic>;
85
+ final fileData = coverageData.putIfAbsent(source, () => <int, int>{});
86
+
87
+ for (var i = 0; i < hits.length; i += 2) {
88
+ final line = hits[i] as int;
89
+ final count = hits[i + 1] as int;
90
+ fileData[line] = (fileData[line] ?? 0) + count;
91
+ }
92
+ }
93
+ }
94
+ return coverageData;
95
+ }
@@ -0,0 +1,6 @@
1
+ name: interpret_coverage
2
+ environment:
3
+ sdk: '^3.9.0'
4
+
5
+ dev_dependencies:
6
+ test: ^1.24.0
@@ -0,0 +1,93 @@
1
+ import 'dart:convert';
2
+ import 'dart:io';
3
+ import 'package:test/test.dart';
4
+ import '../interpret_coverage.dart';
5
+
6
+ void main() {
7
+ /// Helper to create a mock coverage file.
8
+ /// Takes a list of items where 'hits' is a Map<int, int> (line -> hits).
9
+ File createMockCoverageFile(
10
+ Directory dir,
11
+ String filename,
12
+ List<Map<String, dynamic>> coverageItems,
13
+ ) {
14
+ final file = File('${dir.path}/$filename');
15
+
16
+ final processedItems = coverageItems.map((item) {
17
+ final source = item['source'] as String;
18
+ final hitsMap = item['hits'] as Map<int, int>;
19
+ final flatHits = <int>[];
20
+ hitsMap.forEach((line, count) {
21
+ flatHits.add(line);
22
+ flatHits.add(count);
23
+ });
24
+ return {'source': source, 'hits': flatHits};
25
+ }).toList();
26
+
27
+ final json = {'coverage': processedItems};
28
+ file.writeAsStringSync(jsonEncode(json));
29
+ return file;
30
+ }
31
+
32
+ test('processCoverage extracts data correctly', () {
33
+ final tempDir = Directory.systemTemp.createTempSync('coverage_test');
34
+ final coverageFile = createMockCoverageFile(tempDir, 'test.vm.json', [
35
+ {
36
+ 'source': 'package:foo/bar.dart',
37
+ 'hits': {1: 1, 2: 0},
38
+ },
39
+ ]);
40
+
41
+ try {
42
+ final result = processCoverage([coverageFile], null);
43
+ expect(result, contains('package:foo/bar.dart'));
44
+ expect(result['package:foo/bar.dart'], {1: 1, 2: 0});
45
+ } finally {
46
+ tempDir.deleteSync(recursive: true);
47
+ }
48
+ });
49
+
50
+ test('processCoverage filters by package name', () {
51
+ final tempDir = Directory.systemTemp.createTempSync('coverage_test');
52
+ final coverageFile = createMockCoverageFile(tempDir, 'test.vm.json', [
53
+ {
54
+ 'source': 'package:foo/bar.dart',
55
+ 'hits': {1: 1},
56
+ },
57
+ {
58
+ 'source': 'package:baz/qux.dart',
59
+ 'hits': {1: 1},
60
+ },
61
+ ]);
62
+
63
+ try {
64
+ final result = processCoverage([coverageFile], 'foo');
65
+ expect(result, contains('package:foo/bar.dart'));
66
+ expect(result, isNot(contains('package:baz/qux.dart')));
67
+ } finally {
68
+ tempDir.deleteSync(recursive: true);
69
+ }
70
+ });
71
+
72
+ test('processCoverage skips test files', () {
73
+ final tempDir = Directory.systemTemp.createTempSync('coverage_test');
74
+ final coverageFile = createMockCoverageFile(tempDir, 'test.vm.json', [
75
+ {
76
+ 'source': 'package:foo/test/bar_test.dart',
77
+ 'hits': {1: 1},
78
+ },
79
+ {
80
+ 'source': 'package:foo/bar.dart',
81
+ 'hits': {1: 1},
82
+ },
83
+ ]);
84
+
85
+ try {
86
+ final result = processCoverage([coverageFile], 'foo');
87
+ expect(result, contains('package:foo/bar.dart'));
88
+ expect(result, isNot(contains('package:foo/test/bar_test.dart')));
89
+ } finally {
90
+ tempDir.deleteSync(recursive: true);
91
+ }
92
+ });
93
+ }