sdd-full 4.8.0 → 4.8.1

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 (163) hide show
  1. package/bin.js +1 -1
  2. package/index.js +18 -12
  3. package/package.json +1 -1
  4. package/skills/VERSION.md +61 -175
  5. package/skills/design-planning/ai-coding-rules/SKILL.md +13 -5
  6. package/skills/design-planning/design-to-code/SKILL.md +14 -5
  7. package/skills/design-planning/enterprise-spec/SKILL.md +13 -5
  8. package/skills/design-planning/flutter-av/SKILL.md +16 -5
  9. package/skills/design-planning/flutter-map/SKILL.md +14 -5
  10. package/skills/design-planning/function-sdd/SKILL.md +13 -5
  11. package/skills/design-planning/global-overlay-stack-standard/SKILL.md +14 -4
  12. package/skills/design-planning/ui-motion-interaction-standard/SKILL.md +14 -4
  13. package/skills/design-planning/ui-sdd-specialized/SKILL.md +14 -5
  14. package/skills/development-execution/flutter-errors/SKILL.md +15 -5
  15. package/skills/quality-assurance/bdd-acceptance/SKILL.md +14 -5
  16. package/skills/quality-assurance/flutter-test/SKILL.md +16 -5
  17. package/skills/requirement-analysis/sdd/mock_sdd.md +156 -0
  18. package/skills/rules/project_rules.md +127 -538
  19. package/skills/rules/user_rules.md +263 -0
  20. package/skills/special-tools/env-check/SKILL.md +13 -5
  21. package/skills/special-tools/ios-full-auto-debug/SKILL.md +15 -5
  22. package/skills/flutter-skills/.github/dependabot.yaml +0 -15
  23. package/skills/flutter-skills/.github/workflows/dart_skills_lint_workflow.yaml +0 -68
  24. package/skills/flutter-skills/.github/workflows/skills_tool.yaml +0 -51
  25. package/skills/flutter-skills/CODE_OF_CONDUCT.md +0 -3
  26. package/skills/flutter-skills/CONTRIBUTING.md +0 -36
  27. package/skills/flutter-skills/LICENSE +0 -26
  28. package/skills/flutter-skills/README.md +0 -50
  29. package/skills/flutter-skills/pubspec.yaml +0 -9
  30. package/skills/flutter-skills/resources/flutter_skills.yaml +0 -434
  31. package/skills/flutter-skills/skills/flutter-add-integration-test/SKILL.md +0 -163
  32. package/skills/flutter-skills/skills/flutter-add-widget-preview/SKILL.md +0 -145
  33. package/skills/flutter-skills/skills/flutter-add-widget-test/SKILL.md +0 -154
  34. package/skills/flutter-skills/skills/flutter-apply-architecture-best-practices/SKILL.md +0 -162
  35. package/skills/flutter-skills/skills/flutter-build-responsive-layout/SKILL.md +0 -139
  36. package/skills/flutter-skills/skills/flutter-fix-layout-issues/SKILL.md +0 -130
  37. package/skills/flutter-skills/skills/flutter-implement-json-serialization/SKILL.md +0 -153
  38. package/skills/flutter-skills/skills/flutter-setup-declarative-routing/SKILL.md +0 -255
  39. package/skills/flutter-skills/skills/flutter-setup-localization/SKILL.md +0 -210
  40. package/skills/flutter-skills/skills/flutter-use-http-package/SKILL.md +0 -175
  41. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/add-dart-lint-validation-rule/SKILL.md +0 -196
  42. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-best-practices/SKILL.md +0 -65
  43. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-checks-migration/SKILL.md +0 -158
  44. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-cli-app-best-practices/SKILL.md +0 -168
  45. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-doc-validation/SKILL.md +0 -87
  46. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-long-lines/SKILL.md +0 -101
  47. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-matcher-best-practices/SKILL.md +0 -136
  48. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-modern-features/SKILL.md +0 -266
  49. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-package-maintenance/SKILL.md +0 -92
  50. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-test-coverage/SKILL.md +0 -92
  51. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-test-coverage/example/lib/src/calculator.dart +0 -7
  52. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-test-coverage/example/pubspec.yaml +0 -8
  53. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-test-coverage/example/test/calculator_test.dart +0 -11
  54. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-test-coverage/scripts/interpret_coverage.dart +0 -95
  55. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-test-coverage/scripts/pubspec.yaml +0 -6
  56. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-test-coverage/scripts/test/interpret_coverage_test.dart +0 -93
  57. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/dart-test-fundamentals/SKILL.md +0 -173
  58. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/definition-of-done/SKILL.md +0 -27
  59. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/flutter_skills_ignore.json +0 -3
  60. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/grill-me/SKILL.md +0 -10
  61. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/ignore.json +0 -3
  62. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/test-driven-development/SKILL.md +0 -371
  63. package/skills/flutter-skills/tool/dart_skills_lint/.agents/skills/test-driven-development/testing-anti-patterns.md +0 -299
  64. package/skills/flutter-skills/tool/dart_skills_lint/AUTHORS +0 -7
  65. package/skills/flutter-skills/tool/dart_skills_lint/CHANGELOG.md +0 -12
  66. package/skills/flutter-skills/tool/dart_skills_lint/CONTRIBUTING.md +0 -51
  67. package/skills/flutter-skills/tool/dart_skills_lint/LICENSE +0 -27
  68. package/skills/flutter-skills/tool/dart_skills_lint/README.md +0 -203
  69. package/skills/flutter-skills/tool/dart_skills_lint/analysis_options.yaml +0 -296
  70. package/skills/flutter-skills/tool/dart_skills_lint/bench/README.md +0 -23
  71. package/skills/flutter-skills/tool/dart_skills_lint/bench/baseline_throughput.dart +0 -230
  72. package/skills/flutter-skills/tool/dart_skills_lint/bin/cli.dart +0 -10
  73. package/skills/flutter-skills/tool/dart_skills_lint/dart_skills_lint.yaml +0 -14
  74. package/skills/flutter-skills/tool/dart_skills_lint/documentation/feature_design_docs/PRODUCTION_READYNESS.md +0 -48
  75. package/skills/flutter-skills/tool/dart_skills_lint/documentation/feature_design_docs/completion_migration_plan.md +0 -99
  76. package/skills/flutter-skills/tool/dart_skills_lint/documentation/feature_design_docs/legacy_patterns_report.md +0 -110
  77. package/skills/flutter-skills/tool/dart_skills_lint/documentation/feature_design_docs/pub_vs_skill_report.md +0 -56
  78. package/skills/flutter-skills/tool/dart_skills_lint/documentation/knowledge/SPECIFICATION.md +0 -79
  79. package/skills/flutter-skills/tool/dart_skills_lint/documentation/knowledge/architecture_overview.md +0 -64
  80. package/skills/flutter-skills/tool/dart_skills_lint/lib/dart_skills_lint.dart +0 -11
  81. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/config_parser.dart +0 -156
  82. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/entry_point.dart +0 -354
  83. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/fixable_rule.dart +0 -20
  84. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/models/analysis_severity.dart +0 -15
  85. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/models/check_type.dart +0 -17
  86. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/models/ignore_entry.dart +0 -34
  87. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/models/ignore_entry.g.dart +0 -19
  88. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/models/skill_context.dart +0 -27
  89. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/models/skill_rule.dart +0 -27
  90. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/models/skills_ignores.dart +0 -26
  91. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/models/skills_ignores.g.dart +0 -24
  92. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/models/validation_error.dart +0 -31
  93. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/rule_registry.dart +0 -79
  94. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/rules/absolute_paths_rule.dart +0 -74
  95. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/rules/description_length_rule.dart +0 -49
  96. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/rules/disallowed_field_rule.dart +0 -61
  97. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/rules/name_format_rule.dart +0 -167
  98. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/rules/relative_paths_rule.dart +0 -72
  99. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/rules/trailing_whitespace_rule.dart +0 -93
  100. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/rules/valid_yaml_metadata_rule.dart +0 -74
  101. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/skills_ignores_storage.dart +0 -36
  102. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/validation_session.dart +0 -559
  103. package/skills/flutter-skills/tool/dart_skills_lint/lib/src/validator.dart +0 -238
  104. package/skills/flutter-skills/tool/dart_skills_lint/pubspec.yaml +0 -28
  105. package/skills/flutter-skills/tool/dart_skills_lint/skills/README.md +0 -10
  106. package/skills/flutter-skills/tool/dart_skills_lint/skills/dart-skills-lint-validation/SKILL.md +0 -195
  107. package/skills/flutter-skills/tool/dart_skills_lint/skills-lock.json +0 -75
  108. package/skills/flutter-skills/tool/dart_skills_lint/test/absolute_paths_test.dart +0 -167
  109. package/skills/flutter-skills/tool/dart_skills_lint/test/cli_integration_test.dart +0 -683
  110. package/skills/flutter-skills/tool/dart_skills_lint/test/config_file_test.dart +0 -292
  111. package/skills/flutter-skills/tool/dart_skills_lint/test/custom_rule_test.dart +0 -122
  112. package/skills/flutter-skills/tool/dart_skills_lint/test/directory_structure_test.dart +0 -163
  113. package/skills/flutter-skills/tool/dart_skills_lint/test/field_constraints_test.dart +0 -178
  114. package/skills/flutter-skills/tool/dart_skills_lint/test/fixer_test.dart +0 -172
  115. package/skills/flutter-skills/tool/dart_skills_lint/test/ignore_models_test.dart +0 -63
  116. package/skills/flutter-skills/tool/dart_skills_lint/test/metadata_validation_test.dart +0 -116
  117. package/skills/flutter-skills/tool/dart_skills_lint/test/relative_path_flag_test.dart +0 -70
  118. package/skills/flutter-skills/tool/dart_skills_lint/test/relative_paths_test.dart +0 -172
  119. package/skills/flutter-skills/tool/dart_skills_lint/test/resolve_rules_test.dart +0 -82
  120. package/skills/flutter-skills/tool/dart_skills_lint/test/rule_naming_test.dart +0 -29
  121. package/skills/flutter-skills/tool/dart_skills_lint/test/skills_ignores_storage_test.dart +0 -89
  122. package/skills/flutter-skills/tool/dart_skills_lint/test/test_utils.dart +0 -19
  123. package/skills/flutter-skills/tool/dart_skills_lint/test/trailing_whitespace_test.dart +0 -152
  124. package/skills/flutter-skills/tool/generator/README.md +0 -150
  125. package/skills/flutter-skills/tool/generator/analysis_options.yaml +0 -143
  126. package/skills/flutter-skills/tool/generator/bin/skills.dart +0 -73
  127. package/skills/flutter-skills/tool/generator/lib/src/commands/base_skill_command.dart +0 -87
  128. package/skills/flutter-skills/tool/generator/lib/src/commands/base_yaml_command.dart +0 -83
  129. package/skills/flutter-skills/tool/generator/lib/src/commands/generate_skill_command.dart +0 -92
  130. package/skills/flutter-skills/tool/generator/lib/src/commands/update_readme_command.dart +0 -150
  131. package/skills/flutter-skills/tool/generator/lib/src/commands/update_skill_command.dart +0 -97
  132. package/skills/flutter-skills/tool/generator/lib/src/commands/validate_skill_command.dart +0 -284
  133. package/skills/flutter-skills/tool/generator/lib/src/models/skill_params.dart +0 -41
  134. package/skills/flutter-skills/tool/generator/lib/src/services/gemini_service.dart +0 -310
  135. package/skills/flutter-skills/tool/generator/lib/src/services/markdown_converter.dart +0 -226
  136. package/skills/flutter-skills/tool/generator/lib/src/services/prompts.dart +0 -72
  137. package/skills/flutter-skills/tool/generator/lib/src/services/resource_fetcher_service.dart +0 -84
  138. package/skills/flutter-skills/tool/generator/lib/src/services/skill_instructions.dart +0 -30
  139. package/skills/flutter-skills/tool/generator/pubspec.yaml +0 -32
  140. package/skills/flutter-skills/tool/generator/test/commands/base_skill_command_test.dart +0 -131
  141. package/skills/flutter-skills/tool/generator/test/commands/validate_skills_input_test.dart +0 -263
  142. package/skills/flutter-skills/tool/generator/test/custom_skill_rules/last_modified_rule.dart +0 -32
  143. package/skills/flutter-skills/tool/generator/test/generate_skills_retry_test.dart +0 -105
  144. package/skills/flutter-skills/tool/generator/test/generate_skills_test.dart +0 -519
  145. package/skills/flutter-skills/tool/generator/test/lint_skills_test.dart +0 -34
  146. package/skills/flutter-skills/tool/generator/test/markdown_converter_test.dart +0 -103
  147. package/skills/flutter-skills/tool/generator/test/markdown_table_test.dart +0 -131
  148. package/skills/flutter-skills/tool/generator/test/models/skill_params_test.dart +0 -37
  149. package/skills/flutter-skills/tool/generator/test/services/gemini_service_test.dart +0 -291
  150. package/skills/flutter-skills/tool/generator/test/services/markdown_converter_test.dart +0 -156
  151. package/skills/flutter-skills/tool/generator/test/services/resource_fetcher_service_test.dart +0 -188
  152. package/skills/flutter-skills/tool/generator/test/update_skills_test.dart +0 -241
  153. package/skills/flutter-skills/tool/generator/test/validate_skills_test.dart +0 -728
  154. /package/skills/{.agents → flutter}/skills/flutter-add-integration-test/SKILL.md +0 -0
  155. /package/skills/{.agents → flutter}/skills/flutter-add-widget-preview/SKILL.md +0 -0
  156. /package/skills/{.agents → flutter}/skills/flutter-add-widget-test/SKILL.md +0 -0
  157. /package/skills/{.agents → flutter}/skills/flutter-apply-architecture-best-practices/SKILL.md +0 -0
  158. /package/skills/{.agents → flutter}/skills/flutter-build-responsive-layout/SKILL.md +0 -0
  159. /package/skills/{.agents → flutter}/skills/flutter-fix-layout-issues/SKILL.md +0 -0
  160. /package/skills/{.agents → flutter}/skills/flutter-implement-json-serialization/SKILL.md +0 -0
  161. /package/skills/{.agents → flutter}/skills/flutter-setup-declarative-routing/SKILL.md +0 -0
  162. /package/skills/{.agents → flutter}/skills/flutter-setup-localization/SKILL.md +0 -0
  163. /package/skills/{.agents → flutter}/skills/flutter-use-http-package/SKILL.md +0 -0
@@ -1,210 +0,0 @@
1
- ---
2
- name: flutter-setup-localization
3
- description: Add `flutter_localizations` and `intl` dependencies, enable "generate true" in `pubspec.yaml`, and create an `l10n.yaml` configuration file. Use when initializing localization support for a new Flutter project.
4
- metadata:
5
- model: models/gemini-3.1-pro-preview
6
- last_modified: Tue, 21 Apr 2026 21:27:35 GMT
7
- ---
8
- # Internationalizing Flutter Applications
9
-
10
- ## Contents
11
- - [Core Concepts](#core-concepts)
12
- - [Setup Workflow](#setup-workflow)
13
- - [Implementation Workflow](#implementation-workflow)
14
- - [Advanced Formatting](#advanced-formatting)
15
- - [Examples](#examples)
16
-
17
- ## Core Concepts
18
- Flutter handles internationalization (i18n) and localization (l10n) via the `flutter_localizations` and `intl` packages. The standard approach uses App Resource Bundle (`.arb`) files to define localized strings, which are then compiled into a generated `AppLocalizations` class for type-safe access within the widget tree.
19
-
20
- ## Setup Workflow
21
-
22
- Copy and track this checklist when initializing internationalization in a Flutter project:
23
-
24
- - [ ] **Task Progress**
25
- - [ ] 1. Add dependencies to `pubspec.yaml`.
26
- - [ ] 2. Enable the `generate` flag.
27
- - [ ] 3. Create the `l10n.yaml` configuration file.
28
- - [ ] 4. Configure `MaterialApp` or `CupertinoApp`.
29
-
30
- ### 1. Add Dependencies
31
- Add the required localization packages to the project. Execute the following commands in the terminal:
32
- ```bash
33
- flutter pub add flutter_localizations --sdk=flutter
34
- flutter pub add intl:any
35
- ```
36
-
37
- Verify your `pubspec.yaml` includes the following under `dependencies`:
38
- ```yaml
39
- dependencies:
40
- flutter:
41
- sdk: flutter
42
- flutter_localizations:
43
- sdk: flutter
44
- intl: any
45
- ```
46
-
47
- ### 2. Enable Code Generation
48
- Open `pubspec.yaml` and enable the `generate` flag within the `flutter` section to automate localization tasks:
49
- ```yaml
50
- flutter:
51
- generate: true
52
- ```
53
-
54
- ### 3. Create Configuration File
55
- Create a new file named `l10n.yaml` in the root directory of the Flutter project. Define the input directory, template file, and output file:
56
- ```yaml
57
- arb-dir: lib/l10n
58
- template-arb-file: app_en.arb
59
- output-localization-file: app_localizations.dart
60
- synthetic-package: true
61
- ```
62
-
63
- ### 4. Configure the App Entry Point
64
- Import the generated localizations and the `flutter_localizations` library in your `main.dart`. Inject the delegates and supported locales into your `MaterialApp` or `CupertinoApp`.
65
-
66
- ```dart
67
- import 'package:flutter_localizations/flutter_localizations.dart';
68
- import 'package:flutter_gen/gen_l10n/app_localizations.dart'; // Adjust path if synthetic-package is false
69
-
70
- // ... inside build method
71
- return MaterialApp(
72
- localizationsDelegates: const [
73
- AppLocalizations.delegate,
74
- GlobalMaterialLocalizations.delegate,
75
- GlobalWidgetsLocalizations.delegate,
76
- GlobalCupertinoLocalizations.delegate,
77
- ],
78
- supportedLocales: const [
79
- Locale('en'), // English
80
- Locale('es'), // Spanish
81
- ],
82
- home: const MyHomePage(),
83
- );
84
- ```
85
-
86
- ## Implementation Workflow
87
-
88
- Follow this workflow when adding or modifying localized content.
89
-
90
- ### 1. Define ARB Files
91
- * **If creating NEW content:** Add the base string to the template file (`lib/l10n/app_en.arb`). Include a description for context.
92
- * **If EDITING existing content:** Locate the key in all supported `.arb` files and update the values.
93
-
94
- ```json
95
- {
96
- "helloWorld": "Hello World!",
97
- "@helloWorld": {
98
- "description": "The conventional newborn programmer greeting"
99
- }
100
- }
101
- ```
102
-
103
- Create corresponding files for other locales (e.g., `app_es.arb`):
104
- ```json
105
- {
106
- "helloWorld": "¡Hola Mundo!"
107
- }
108
- ```
109
-
110
- ### 2. Generate Localization Classes
111
- Run the following command to trigger code generation:
112
- ```bash
113
- flutter pub get
114
- ```
115
- *Feedback Loop:* Run validator -> review terminal output for ARB syntax errors -> fix missing commas or mismatched placeholders -> re-run `flutter pub get`.
116
-
117
- ### 3. Consume Localized Strings
118
- Access the localized strings in your widget tree using `AppLocalizations.of(context)`. Ensure the widget calling this is a descendant of `MaterialApp`.
119
-
120
- ```dart
121
- Text(AppLocalizations.of(context)!.helloWorld)
122
- ```
123
-
124
- ## Advanced Formatting
125
-
126
- Use placeholders for dynamic data, plurals, and conditional selects.
127
-
128
- ### Placeholders
129
- Define parameters within curly braces and specify their type in the metadata object.
130
- ```json
131
- "hello": "Hello {userName}",
132
- "@hello": {
133
- "description": "A message with a single parameter",
134
- "placeholders": {
135
- "userName": {
136
- "type": "String",
137
- "example": "Bob"
138
- }
139
- }
140
- }
141
- ```
142
-
143
- ### Plurals
144
- Use the `plural` syntax to handle quantity-based string variations. The `other` case is mandatory.
145
- ```json
146
- "nWombats": "{count, plural, =0{no wombats} =1{1 wombat} other{{count} wombats}}",
147
- "@nWombats": {
148
- "description": "A plural message",
149
- "placeholders": {
150
- "count": {
151
- "type": "num",
152
- "format": "compact"
153
- }
154
- }
155
- }
156
- ```
157
-
158
- ### Selects
159
- Use the `select` syntax for conditional strings, such as gendered text.
160
- ```json
161
- "pronoun": "{gender, select, male{he} female{she} other{they}}",
162
- "@pronoun": {
163
- "description": "A gendered message",
164
- "placeholders": {
165
- "gender": {
166
- "type": "String"
167
- }
168
- }
169
- }
170
- ```
171
-
172
- ## Examples
173
-
174
- ### Complete `l10n.yaml`
175
- ```yaml
176
- arb-dir: lib/l10n
177
- template-arb-file: app_en.arb
178
- output-localization-file: app_localizations.dart
179
- synthetic-package: true
180
- use-escaping: true
181
- ```
182
-
183
- ### Complete Widget Implementation
184
- ```dart
185
- import 'package:flutter/material.dart';
186
- import 'package:flutter_gen/gen_l10n/app_localizations.dart';
187
-
188
- class GreetingWidget extends StatelessWidget {
189
- final String userName;
190
- final int notificationCount;
191
-
192
- const GreetingWidget({
193
- super.key,
194
- required this.userName,
195
- required this.notificationCount,
196
- });
197
-
198
- @override
199
- Widget build(BuildContext context) {
200
- final l10n = AppLocalizations.of(context)!;
201
-
202
- return Column(
203
- children: [
204
- Text(l10n.hello(userName)),
205
- Text(l10n.nWombats(notificationCount)),
206
- ],
207
- );
208
- }
209
- }
210
- ```
@@ -1,175 +0,0 @@
1
- ---
2
- name: flutter-use-http-package
3
- description: Use the `http` package to execute GET, POST, PUT, or DELETE requests. Use when you need to fetch from or send data to a REST API.
4
- metadata:
5
- model: models/gemini-3.1-pro-preview
6
- last_modified: Tue, 21 Apr 2026 21:36:42 GMT
7
- ---
8
- # Implementing Flutter Networking
9
-
10
- ## Contents
11
- - [Configuration & Permissions](#configuration--permissions)
12
- - [Request Execution & Response Handling](#request-execution--response-handling)
13
- - [Background Parsing](#background-parsing)
14
- - [Workflow: Executing Network Operations](#workflow-executing-network-operations)
15
- - [Examples](#examples)
16
-
17
- ## Configuration & Permissions
18
-
19
- Configure the environment and platform-specific permissions required for network access.
20
-
21
- 1. Add the `http` package dependency via the terminal:
22
- ```bash
23
- flutter pub add http
24
- ```
25
- 2. Import the package in your Dart files:
26
- ```dart
27
- import 'package:http/http.dart' as http;
28
- ```
29
- 3. Configure Android permissions by adding the Internet permission to `android/app/src/main/AndroidManifest.xml`:
30
- ```xml
31
- <uses-permission android:name="android.permission.INTERNET" />
32
- ```
33
- 4. Configure macOS entitlements by adding the network client key to both `macos/Runner/DebugProfile.entitlements` and `macos/Runner/Release.entitlements`:
34
- ```xml
35
- <key>com.apple.security.network.client</key>
36
- <true/>
37
- ```
38
-
39
- ## Request Execution & Response Handling
40
-
41
- Execute HTTP operations and map responses to strongly typed Dart objects.
42
-
43
- * **URIs:** Always parse URL strings using `Uri.parse('your_url')`.
44
- * **Headers:** Inject authorization and content-type headers via the `headers` parameter map. Use `HttpHeaders.authorizationHeader` for auth tokens.
45
- * **Payloads:** For POST and PUT requests, encode the body using `jsonEncode()` from `dart:convert`.
46
- * **Status Validation:** Evaluate `response.statusCode`. Treat `200 OK` (GET/PUT/DELETE) and `201 CREATED` (POST) as success.
47
- * **Error Handling:** Throw explicit exceptions for non-success status codes. Never return `null` on failure, as this prevents `FutureBuilder` from triggering its error state and causes infinite loading indicators.
48
- * **Deserialization:** Parse the raw string using `jsonDecode(response.body)` and map it to a custom Dart object using a factory constructor (e.g., `fromJson`).
49
-
50
- ## Background Parsing
51
-
52
- Offload expensive JSON parsing to a separate Isolate to prevent UI jank (frame drops).
53
-
54
- * Import `package:flutter/foundation.dart`.
55
- * Use the `compute()` function to run the parsing logic in a background isolate.
56
- * Ensure the parsing function passed to `compute()` is a top-level function or a static method, as closures or instance methods cannot be passed across isolates.
57
-
58
- ## Workflow: Executing Network Operations
59
-
60
- Use the following checklist to implement and validate network operations.
61
-
62
- **Task Progress:**
63
- - [ ] 1. Define the strongly typed Dart model with a `fromJson` factory constructor.
64
- - [ ] 2. Implement the network request method returning a `Future<Model>`.
65
- - [ ] 3. Apply conditional logic based on the operation type:
66
- - **If fetching data (GET):** Append query parameters to the URI.
67
- - **If mutating data (POST/PUT):** Set `'Content-Type': 'application/json; charset=UTF-8'` and attach the `jsonEncode` body.
68
- - **If deleting data (DELETE):** Return an empty model instance on success (`200 OK`).
69
- - [ ] 4. Validate the `statusCode` and throw an `Exception` on failure.
70
- - [ ] 5. Integrate the `Future` into the UI using `FutureBuilder`.
71
- - [ ] 6. Handle `snapshot.hasData`, `snapshot.hasError`, and default to a `CircularProgressIndicator`.
72
- - [ ] 7. **Feedback Loop:** Run the app -> trigger the network request -> review console for unhandled exceptions -> fix parsing or permission errors.
73
-
74
- ## Examples
75
-
76
- ### High-Fidelity Implementation: Fetching and Parsing in the Background
77
-
78
- ```dart
79
- import 'dart:async';
80
- import 'dart:convert';
81
- import 'dart:io';
82
- import 'package:flutter/foundation.dart';
83
- import 'package:flutter/material.dart';
84
- import 'package:http/http.dart' as http;
85
-
86
- // 1. Top-level parsing function for Isolate
87
- List<Photo> parsePhotos(String responseBody) {
88
- final parsed = (jsonDecode(responseBody) as List<Object?>)
89
- .cast<Map<String, Object?>>();
90
- return parsed.map<Photo>(Photo.fromJson).toList();
91
- }
92
-
93
- // 2. Network execution with background parsing
94
- Future<List<Photo>> fetchPhotos() async {
95
- final response = await http.get(
96
- Uri.parse('https://jsonplaceholder.typicode.com/photos'),
97
- headers: {
98
- HttpHeaders.authorizationHeader: 'Bearer your_token_here',
99
- HttpHeaders.acceptHeader: 'application/json',
100
- },
101
- );
102
-
103
- if (response.statusCode == 200) {
104
- // Offload heavy parsing to a background isolate
105
- return compute(parsePhotos, response.body);
106
- } else {
107
- throw Exception('Failed to load photos. Status: ${response.statusCode}');
108
- }
109
- }
110
- }
111
-
112
- // 3. Strongly typed model
113
- class Photo {
114
- final int id;
115
- final String title;
116
- final String thumbnailUrl;
117
-
118
- const Photo({
119
- required this.id,
120
- required this.title,
121
- required this.thumbnailUrl,
122
- });
123
-
124
- factory Photo.fromJson(Map<String, dynamic> json) {
125
- return Photo(
126
- id: json['id'] as int,
127
- title: json['title'] as String,
128
- thumbnailUrl: json['thumbnailUrl'] as String,
129
- );
130
- }
131
- }
132
-
133
- // 4. UI Integration
134
- class PhotoGallery extends StatefulWidget {
135
- const PhotoGallery({super.key});
136
-
137
- @override
138
- State<PhotoGallery> createState() => _PhotoGalleryState();
139
- }
140
-
141
- class _PhotoGalleryState extends State<PhotoGallery> {
142
- late Future<List<Photo>> _futurePhotos;
143
-
144
- @override
145
- void initState() {
146
- super.initState();
147
- // Initialize Future once to prevent re-fetching on rebuilds
148
- _futurePhotos = fetchPhotos();
149
- }
150
-
151
- @override
152
- Widget build(BuildContext context) {
153
- return FutureBuilder<List<Photo>>(
154
- future: _futurePhotos,
155
- builder: (context, snapshot) {
156
- if (snapshot.hasData) {
157
- final photos = snapshot.data!;
158
- return ListView.builder(
159
- itemCount: photos.length,
160
- itemBuilder: (context, index) => ListTile(
161
- leading: Image.network(photos[index].thumbnailUrl),
162
- title: Text(photos[index].title),
163
- ),
164
- );
165
- } else if (snapshot.hasError) {
166
- return Center(child: Text('Error: ${snapshot.error}'));
167
- }
168
-
169
- // Default loading state
170
- return const Center(child: CircularProgressIndicator());
171
- },
172
- );
173
- }
174
- }
175
- ```
@@ -1,196 +0,0 @@
1
- ---
2
- name: add-dart-lint-validation-rule
3
- description: Instructions for adding a new validation rule and CLI flag to dart_skills_lint.
4
- ---
5
-
6
- # Add a New Validation Rule and Flag
7
-
8
- Use this skill when you need to add a new validation rule to the `dart_skills_lint` package, expose it as a toggleable CLI flag, and verify its behavior.
9
-
10
- ---
11
-
12
- ## 🛠️ Step-by-Step Implementation
13
-
14
- ### 1. Create the Rule Class
15
- Create a new file in `lib/src/rules/` extending `SkillRule`.
16
-
17
- > [!TIP]
18
- > If your rule expects a specific structure in the skill's YAML frontmatter (e.g., inside `metadata`), document this structure clearly in the class Dart docstring.
19
-
20
- ```dart
21
- // lib/src/rules/my_new_rule.dart
22
-
23
- import '../models/analysis_severity.dart';
24
- import '../models/skill_context.dart';
25
- import '../models/skill_rule.dart';
26
- import '../models/validation_error.dart';
27
-
28
- class MyNewRule extends SkillRule {
29
- MyNewRule({super.severity});
30
-
31
- @override
32
- Future<List<ValidationError>> validate(SkillContext context) async {
33
- final errors = <ValidationError>[];
34
- // Add validation logic here using context.rawContent or context.directory
35
- return errors;
36
- }
37
- }
38
- ```
39
-
40
- #### Accessing YAML Frontmatter
41
- If your rule needs configuration from the skill's YAML frontmatter, you can access it via `context.parsedYaml`.
42
-
43
- ```dart
44
- @override
45
- Future<List<ValidationError>> validate(SkillContext context) async {
46
- final errors = <ValidationError>[];
47
- final yaml = context.parsedYaml;
48
- if (yaml != null) {
49
- final metadata = yaml['metadata'];
50
- if (metadata is Map) {
51
- // Read your custom config here
52
- }
53
- }
54
- return errors;
55
- }
56
- ```
57
-
58
- ### 2. Register the Rule in `lib/src/rule_registry.dart`
59
-
60
- Add a new `CheckType` instance to `RuleRegistry.allChecks` list. This automatically exposes it as a CLI flag.
61
-
62
- ```dart
63
- // lib/src/rule_registry.dart in allChecks list
64
-
65
- const CheckType(
66
- name: MyNewRule.ruleName,
67
- defaultSeverity: MyNewRule.defaultSeverity,
68
- help: 'Description of what the rule does for CLI help.',
69
- ),
70
- ```
71
-
72
- Then, add a case to `RuleRegistry.createRule` to instantiate your rule:
73
-
74
- ```dart
75
- // lib/src/rule_registry.dart in createRule method
76
-
77
- static SkillRule? createRule(String name, AnalysisSeverity severity) {
78
- switch (name) {
79
- // ... other rules
80
- case MyNewRule.ruleName:
81
- return MyNewRule(severity: severity);
82
- default:
83
- return null;
84
- }
85
- }
86
- ```
87
-
88
- ### 3. Handle Disabled by Default Rules (If applicable)
89
- If the rule is disabled by default (`defaultSeverity: AnalysisSeverity.disabled`), passing the flag `--check-my-new-rule` will automatically enable it with `AnalysisSeverity.error` severity (handled in `entry_point.dart`).
90
-
91
- ---
92
-
93
- ## 🧪 Testing the New Rule
94
-
95
- You must write automated tests verifying your rule triggers when it should and skips when it shouldn't.
96
-
97
- ### Preferred Approach: In-Memory Unit Tests
98
- Instead of writing files to disk, test the rule directly using a mock `SkillContext`. This is faster and avoids I/O dependencies.
99
-
100
- ```dart
101
- // test/my_new_rule_test.dart
102
-
103
- import 'dart:io';
104
- import 'package:dart_skills_lint/src/models/analysis_severity.dart';
105
- import 'package:dart_skills_lint/src/models/skill_context.dart';
106
- import 'package:dart_skills_lint/src/models/validation_error.dart';
107
- import 'package:dart_skills_lint/src/rules/my_new_rule.dart';
108
- import 'package:test/test.dart';
109
-
110
- void main() {
111
- group('MyNewRule', () {
112
- test('flags invalid content', () async {
113
- final rule = MyNewRule(severity: AnalysisSeverity.warning);
114
- final context = SkillContext(
115
- directory: Directory('dummy'),
116
- rawContent: 'Invalid content',
117
- );
118
-
119
- final List<ValidationError> errors = await rule.validate(context);
120
-
121
- expect(errors, isNotEmpty);
122
- expect(errors.first.message, contains('Expected error message'));
123
- });
124
-
125
- test('passes valid content', () async {
126
- final rule = MyNewRule(severity: AnalysisSeverity.warning);
127
- final context = SkillContext(
128
- directory: Directory('dummy'),
129
- rawContent: 'Valid content',
130
- );
131
-
132
- final List<ValidationError> errors = await rule.validate(context);
133
-
134
- expect(errors, isEmpty);
135
- });
136
- });
137
- }
138
- ```
139
-
140
- ### Alternative Approach: File System Interaction
141
- If the rule interacts with the file system or wraps an external CLI tool (like `popmark`), you should use a temporary directory for testing instead of in-memory mocks.
142
-
143
- ```dart
144
- late Directory tempDir;
145
-
146
- setUp(() async {
147
- tempDir = await Directory.systemTemp.createTemp('my_rule_test.');
148
- });
149
-
150
- tearDown(() async {
151
- if (tempDir.existsSync()) {
152
- await tempDir.delete(recursive: true);
153
- }
154
- });
155
-
156
- test('flags invalid file content', () async {
157
- final Directory skillDir = await Directory('${tempDir.path}/test-skill').create();
158
- await File('${skillDir.path}/SKILL.md').writeAsString('Invalid content');
159
-
160
- final rule = MyNewRule(severity: AnalysisSeverity.warning);
161
- final context = SkillContext(directory: skillDir, rawContent: 'Invalid content');
162
-
163
- final List<ValidationError> errors = await rule.validate(context);
164
-
165
- expect(errors, isNotEmpty);
166
- });
167
- ```
168
-
169
- ### Integration Tests
170
- If the rule interacts with CLI flags or configuration files, add a test in `test/cli_integration_test.dart` using `TestProcess`.
171
- > [!IMPORTANT]
172
- > When writing integration tests that use config files and `TestProcess`, ensure that paths in the config file and paths passed to the CLI match in style (both relative or both absolute) to avoid issues with path matching in `entry_point.dart`.
173
-
174
- ---
175
-
176
- ## 📚 Documentation Updates
177
-
178
- When a new rule is introduced, verify that you synchronize sibling markdown files!
179
-
180
- 1. **`README.md`:**
181
- * Add your flag under the **Usage** and **Flags** sections so users know it exists.
182
- 2. **`documentation/knowledge/SPECIFICATION.md`:**
183
- * Document the formal constraint in the specification if it defines a standard for skill files.
184
-
185
- ---
186
-
187
- ## 🚦 Checklist Before Submitting PR
188
-
189
- - [ ] Rule class created in `lib/src/rules/`.
190
- - [ ] Rule registered in `lib/src/rule_registry.dart`.
191
- - [ ] Unit tests added in `test/` using in-memory `SkillContext`.
192
- - [ ] Usage listed in `README.md`.
193
- - [ ] Schema documented in `documentation/knowledge/SPECIFICATION.md` (if applicable).
194
- - [ ] Run `dart format .` to format code.
195
- - [ ] Run `dart analyze --fatal-infos` to ensure no issues.
196
- - [ ] Run `dart test` to ensure tests passing.
@@ -1,65 +0,0 @@
1
- ---
2
- name: dart-best-practices
3
- description: |-
4
- General best practices for Dart development.
5
- Covers code style, effective Dart, and language features.
6
- license: Apache-2.0
7
- ---
8
-
9
- # Dart Best Practices
10
-
11
- ## 1. When to use this skill
12
- Use this skill when:
13
- - Writing or reviewing Dart code.
14
- - Looking for guidance on idiomatic Dart usage.
15
-
16
- ## 2. Best Practices
17
-
18
- ### Multi-line Strings
19
- Prefer using multi-line strings (`'''`) over concatenating strings with `+` and
20
- `\n`, especially for large blocks of text like SQL queries, HTML, or
21
- PEM-encoded keys. This improves readability and avoids
22
- `lines_longer_than_80_chars` lint errors by allowing natural line breaks.
23
-
24
- **Avoid:**
25
- ```dart
26
- final pem = '-----BEGIN RSA PRIVATE KEY-----\n' +
27
- base64Encode(fullBytes) +
28
- '\n-----END RSA PRIVATE KEY-----';
29
- ```
30
-
31
- **Prefer:**
32
- ```dart
33
- final pem = '''
34
- -----BEGIN RSA PRIVATE KEY-----
35
- ${base64Encode(fullBytes)}
36
- -----END RSA PRIVATE KEY-----''';
37
- ```
38
-
39
- ### Line Length
40
- Avoid lines longer than 80 characters, even in Markdown files and comments.
41
- This ensures code is readable in split-screen views and on smaller screens
42
- without horizontal scrolling.
43
-
44
- **Prefer:**
45
- Target 80 characters for wrapping text. Exceptions are allowed for long URLs
46
- or identifiers that cannot be broken.
47
-
48
- ## Discovery
49
-
50
- ### Multi-line Strings
51
- To find candidates for multi-line strings, search for string concatenation
52
- with `+` involving newlines:
53
- - **Regex**: `['"]\s*\+\s*['"]`
54
- - **Regex**: `\+\s*['"].*\\n`
55
-
56
- ### Line Length
57
- - Rely on the `lines_longer_than_80_chars` lint from the analyzer.
58
-
59
- ## Related Skills
60
-
61
- - **[dart-modern-features]**: For idiomatic
62
- usage of modern Dart features like Pattern Matching (useful for deep JSON
63
- extraction), Records, and Switch Expressions.
64
-
65
- [dart-modern-features]: https://github.com/kevmoo/dash_skills/blob/main/.agent/skills/dart-modern-features/SKILL.md