@rashidee/co2 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +25449 -0
- package/drizzle/0000_remarkable_charles_xavier.sql +210 -0
- package/drizzle/0001_wise_wolf_cub.sql +13 -0
- package/drizzle/0002_secret_spyke.sql +16 -0
- package/drizzle/0003_workspace_config_singleton.sql +16 -0
- package/drizzle/0004_terminal_claim_v120.sql +11 -0
- package/drizzle/0005_brainstorm_v124.sql +10 -0
- package/drizzle/0006_project_v140.sql +6 -0
- package/drizzle/0007_prd_wizard_v124.sql +14 -0
- package/drizzle/0008_workflow_artifact_v126.sql +24 -0
- package/drizzle/0009_project_import_v150.sql +7 -0
- package/drizzle/0010_quality_v151.sql +3 -0
- package/drizzle/meta/0000_snapshot.json +1335 -0
- package/drizzle/meta/0001_snapshot.json +1416 -0
- package/drizzle/meta/0002_snapshot.json +1510 -0
- package/drizzle/meta/_journal.json +83 -0
- package/package.json +41 -0
- package/plugin/.claude-plugin/marketplace.json +36 -0
- package/plugin/.claude-plugin/plugin.json +22 -0
- package/plugin/README.md +625 -0
- package/plugin/SKILLS.md +350 -0
- package/plugin/co2.svg +5 -0
- package/plugin/commands/brainstorm-loop.md +129 -0
- package/plugin/skills/conductor-defect/SKILL.md +898 -0
- package/plugin/skills/conductor-feature-develop/SKILL.md +1383 -0
- package/plugin/skills/conductor-feature-develop/references/implementation-domain-template.md +131 -0
- package/plugin/skills/conductor-feature-develop/references/implementation-master-template.md +89 -0
- package/plugin/skills/conductor-feature-develop/references/playwright-setup.md +224 -0
- package/plugin/skills/conductor-feature-prepare/SKILL.md +604 -0
- package/plugin/skills/depgen-k8s/SKILL.md +468 -0
- package/plugin/skills/depgen-k8s/references/dockerfile-laravel.md +197 -0
- package/plugin/skills/depgen-k8s/references/dockerfile-nodejs.md +163 -0
- package/plugin/skills/depgen-k8s/references/dockerfile-spring-boot.md +174 -0
- package/plugin/skills/depgen-k8s/references/k8s-patterns.md +869 -0
- package/plugin/skills/mockgen-shadcn/SKILL.md +1067 -0
- package/plugin/skills/mockgen-shadcn/references/admin-layout-template.md +1467 -0
- package/plugin/skills/mockgen-shadcn/references/mockup-hub-template.md +498 -0
- package/plugin/skills/mockgen-shadcn/references/mockup-index-template.md +216 -0
- package/plugin/skills/mockgen-tailwind/SKILL.md +904 -0
- package/plugin/skills/mockgen-tailwind/references/admin-layout-template.md +720 -0
- package/plugin/skills/mockgen-tailwind/references/mockup-hub-template.md +498 -0
- package/plugin/skills/mockgen-tailwind/references/mockup-index-template.md +190 -0
- package/plugin/skills/modelgen-nosql/SKILL.md +617 -0
- package/plugin/skills/modelgen-nosql/references/model-extraction-methodology.md +497 -0
- package/plugin/skills/modelgen-nosql/references/nosql-design-guide.md +258 -0
- package/plugin/skills/modelgen-relational/SKILL.md +707 -0
- package/plugin/skills/modelgen-relational/references/model-extraction-methodology.md +499 -0
- package/plugin/skills/specgen-flutter-riverpod/SKILL.md +898 -0
- package/plugin/skills/specgen-flutter-riverpod/references/component-patterns.md +971 -0
- package/plugin/skills/specgen-flutter-riverpod/references/notification-patterns.md +457 -0
- package/plugin/skills/specgen-flutter-riverpod/references/routing-patterns.md +362 -0
- package/plugin/skills/specgen-flutter-riverpod/references/security-patterns.md +709 -0
- package/plugin/skills/specgen-flutter-riverpod/references/spec-template.md +1566 -0
- package/plugin/skills/specgen-flutter-riverpod/references/state-patterns.md +518 -0
- package/plugin/skills/specgen-flutter-riverpod/references/storage-patterns.md +370 -0
- package/plugin/skills/specgen-laravel-eloquent-bladehtmx/SKILL.md +984 -0
- package/plugin/skills/specgen-laravel-eloquent-bladehtmx/references/batch-patterns.md +359 -0
- package/plugin/skills/specgen-laravel-eloquent-bladehtmx/references/messaging-patterns.md +468 -0
- package/plugin/skills/specgen-laravel-eloquent-bladehtmx/references/modulith-patterns.md +461 -0
- package/plugin/skills/specgen-laravel-eloquent-bladehtmx/references/reporting-patterns.md +803 -0
- package/plugin/skills/specgen-laravel-eloquent-bladehtmx/references/security-patterns.md +501 -0
- package/plugin/skills/specgen-laravel-eloquent-bladehtmx/references/spec-template.md +1268 -0
- package/plugin/skills/specgen-laravel-eloquent-bladehtmx/references/web-patterns.md +301 -0
- package/plugin/skills/specgen-node-cli-web/SKILL.md +561 -0
- package/plugin/skills/specgen-node-cli-web/references/auth-patterns.md +293 -0
- package/plugin/skills/specgen-node-cli-web/references/cli-packaging-patterns.md +250 -0
- package/plugin/skills/specgen-node-cli-web/references/server-patterns.md +247 -0
- package/plugin/skills/specgen-node-cli-web/references/spec-template.md +401 -0
- package/plugin/skills/specgen-node-cli-web/references/testing-patterns.md +174 -0
- package/plugin/skills/specgen-react-mui/SKILL.md +789 -0
- package/plugin/skills/specgen-react-mui/references/component-patterns.md +1077 -0
- package/plugin/skills/specgen-react-mui/references/reporting-patterns.md +1998 -0
- package/plugin/skills/specgen-react-mui/references/routing-patterns.md +461 -0
- package/plugin/skills/specgen-react-mui/references/security-patterns.md +599 -0
- package/plugin/skills/specgen-react-mui/references/spec-template.md +1030 -0
- package/plugin/skills/specgen-react-mui/references/state-patterns.md +327 -0
- package/plugin/skills/specgen-react-tailwind/SKILL.md +859 -0
- package/plugin/skills/specgen-react-tailwind/references/component-patterns.md +1212 -0
- package/plugin/skills/specgen-react-tailwind/references/reporting-patterns.md +1529 -0
- package/plugin/skills/specgen-react-tailwind/references/routing-patterns.md +669 -0
- package/plugin/skills/specgen-react-tailwind/references/security-patterns.md +656 -0
- package/plugin/skills/specgen-react-tailwind/references/spec-template.md +1237 -0
- package/plugin/skills/specgen-react-tailwind/references/state-patterns.md +327 -0
- package/plugin/skills/specgen-sdk-java/SKILL.md +933 -0
- package/plugin/skills/specgen-sdk-java/references/api-extraction-patterns.md +247 -0
- package/plugin/skills/specgen-sdk-java/references/http-client-patterns.md +495 -0
- package/plugin/skills/specgen-sdk-java/references/packaging-patterns.md +366 -0
- package/plugin/skills/specgen-sdk-java/references/spec-template.md +956 -0
- package/plugin/skills/specgen-spring-jpa-jtehtmx/SKILL.md +1284 -0
- package/plugin/skills/specgen-spring-jpa-jtehtmx/references/batch-patterns.md +1224 -0
- package/plugin/skills/specgen-spring-jpa-jtehtmx/references/jasper-patterns.md +1638 -0
- package/plugin/skills/specgen-spring-jpa-jtehtmx/references/messaging-patterns.md +512 -0
- package/plugin/skills/specgen-spring-jpa-jtehtmx/references/modulith-patterns.md +354 -0
- package/plugin/skills/specgen-spring-jpa-jtehtmx/references/security-patterns.md +551 -0
- package/plugin/skills/specgen-spring-jpa-jtehtmx/references/spec-template.md +2502 -0
- package/plugin/skills/specgen-spring-jpa-jtehtmx/references/web-patterns.md +503 -0
- package/plugin/skills/specgen-spring-jpa-restapi/SKILL.md +990 -0
- package/plugin/skills/specgen-spring-jpa-restapi/references/batch-patterns.md +1224 -0
- package/plugin/skills/specgen-spring-jpa-restapi/references/messaging-patterns.md +512 -0
- package/plugin/skills/specgen-spring-jpa-restapi/references/modulith-patterns.md +279 -0
- package/plugin/skills/specgen-spring-jpa-restapi/references/reporting-patterns.md +1536 -0
- package/plugin/skills/specgen-spring-jpa-restapi/references/restapi-patterns.md +722 -0
- package/plugin/skills/specgen-spring-jpa-restapi/references/security-patterns.md +351 -0
- package/plugin/skills/specgen-spring-jpa-restapi/references/spec-template.md +553 -0
- package/plugin/skills/specgen-ts-cli/SKILL.md +861 -0
- package/plugin/skills/specgen-ts-cli/references/async-patterns.md +1101 -0
- package/plugin/skills/specgen-ts-cli/references/command-patterns.md +383 -0
- package/plugin/skills/specgen-ts-cli/references/config-patterns.md +430 -0
- package/plugin/skills/specgen-ts-cli/references/database-patterns.md +750 -0
- package/plugin/skills/specgen-ts-cli/references/packaging-patterns.md +426 -0
- package/plugin/skills/specgen-ts-cli/references/spec-template.md +1391 -0
- package/plugin/skills/specgen-ts-cli/references/testing-patterns.md +909 -0
- package/plugin/skills/testgen-functional/SKILL.md +1381 -0
- package/plugin/skills/tracegen-matrix/SKILL.md +243 -0
- package/plugin/skills/util-preparek8senv/SKILL.md +422 -0
- package/plugin/skills/util-projectinit/SKILL.md +307 -0
- package/plugin/skills/util-projectinit/reference/brainstorm-loop.md +129 -0
- package/plugin/skills/util-projectinit/reference/brainstorm-protocol.md +144 -0
- package/plugin/skills/util-projectinit/reference/brainstorm-setup-guide.md +153 -0
- package/plugin/skills/util-projectinit/reference/brainstorm-template-appdev.md +87 -0
- package/plugin/skills/util-projectinit/reference/co2-context-generation-guide.md +761 -0
- package/plugin/skills/util-projectsync/SKILL.md +501 -0
- package/plugin/skills/util-updprd/SKILL.md +324 -0
- package/plugin/skills/util-usanalyzer/SKILL.md +307 -0
- package/plugin/skills/util-ustagger/SKILL.md +154 -0
- package/static/assets/abnfDiagram-VRR7QNED-DvPuwyCV.js +1 -0
- package/static/assets/arc-DRKw7sjs.js +1 -0
- package/static/assets/architectureDiagram-ZJ3FMSHR-CaNcxUbC.js +36 -0
- package/static/assets/blockDiagram-677ZJIJ3-Demd4AOK.js +132 -0
- package/static/assets/c4Diagram-LMCZKHZV-PVKUfc2x.js +10 -0
- package/static/assets/channel-C2nVbuwv.js +1 -0
- package/static/assets/chunk-2Q5K7J3B-CExf8ww_.js +1 -0
- package/static/assets/chunk-32BRIVSS-CFPaoONF.js +1 -0
- package/static/assets/chunk-5VM5RSS4-DE2esM67.js +15 -0
- package/static/assets/chunk-EX3LRPZG-SON_YdDG.js +231 -0
- package/static/assets/chunk-JWPE2WC7-Qxah8LNr.js +1 -0
- package/static/assets/chunk-MOJQB5TN-BcWGQV3j.js +88 -0
- package/static/assets/chunk-RYQCIY6F-DkDj-OR5.js +1 -0
- package/static/assets/chunk-V7JOEXUC-BlI1Mrah.js +206 -0
- package/static/assets/chunk-VR4S4FIN-Agf__duj.js +1 -0
- package/static/assets/chunk-XXDRQBXY-B5CfAh85.js +1 -0
- package/static/assets/classDiagram-OUVF2IWQ-DXJIljsR.js +1 -0
- package/static/assets/classDiagram-v2-EOCWNBFH-DXJIljsR.js +1 -0
- package/static/assets/cose-bilkent-JH36ORCC-DO0cQkcy.js +1 -0
- package/static/assets/cynefin-VYW2F7L2-CfOnsnXc.js +178 -0
- package/static/assets/cynefinDiagram-TSTJHNR4-BJ8tULAv.js +62 -0
- package/static/assets/cytoscape.esm-DTSO7Bv0.js +331 -0
- package/static/assets/dagre-VKFMJZFB-DfjwzHqP.js +4 -0
- package/static/assets/defaultLocale-DX6XiGOO.js +1 -0
- package/static/assets/diagram-FQU43EPY-CndSOIIM.js +3 -0
- package/static/assets/diagram-G47NLZAW-Czf5hN0Z.js +24 -0
- package/static/assets/diagram-NH7WQ7WH-COAyojGh.js +24 -0
- package/static/assets/diagram-OA4YK3LP-H8PoiN2m.js +30 -0
- package/static/assets/diagram-WEI45ONY-DzcaVzjp.js +41 -0
- package/static/assets/ebnfDiagram-CCIWWBDH-DPazGYLJ.js +1 -0
- package/static/assets/erDiagram-Q63AITRT-Bo-fubgF.js +85 -0
- package/static/assets/flowDiagram-23GEKE2U-CSvxUDwh.js +156 -0
- package/static/assets/ganttDiagram-NO4QXBWP-DnBveWX6.js +292 -0
- package/static/assets/gitGraphDiagram-IHSO6WYX-B3rVL8c-.js +106 -0
- package/static/assets/graph-C9eacEi8.js +1 -0
- package/static/assets/index-LZSQkLE2.css +41 -0
- package/static/assets/index-y7XDSgMG.js +495 -0
- package/static/assets/infoDiagram-FWYZ7A6U-CvWV9yy2.js +2 -0
- package/static/assets/init-Gi6I4Gst.js +1 -0
- package/static/assets/ishikawaDiagram-FXEZZL3T-DF28a1N6.js +70 -0
- package/static/assets/journeyDiagram-5HDEW3XC-CB6CugYk.js +139 -0
- package/static/assets/kanban-definition-HUTT4EX6-ResSLF6d.js +89 -0
- package/static/assets/katex-C5jXJg4s.js +257 -0
- package/static/assets/layout-DEXfKzaS.js +1 -0
- package/static/assets/linear-CLO--ryk.js +1 -0
- package/static/assets/map-Czzmt4hB.js +1 -0
- package/static/assets/mindmap-definition-LN4V7U3C-BvW3EbxX.js +96 -0
- package/static/assets/ordinal-Cboi1Yqb.js +1 -0
- package/static/assets/pegDiagram-2B236MQR-BHCgqrrM.js +1 -0
- package/static/assets/pieDiagram-ENE6RG2P-DVmCQ5FA.js +39 -0
- package/static/assets/quadrantDiagram-ABIIQ3AL-B3e5KR52.js +7 -0
- package/static/assets/railroadDiagram-RFXS5EU6-Csv5ysLc.js +1 -0
- package/static/assets/requirementDiagram-TGXJPOKE-DOMVzvnB.js +84 -0
- package/static/assets/sankeyDiagram-HTMAVEWB-B1dcTOvy.js +40 -0
- package/static/assets/sequenceDiagram-DBY2YBRQ-BY414yeO.js +162 -0
- package/static/assets/sizeCapture-X5ZJPWSS-CuJfrfBN.js +1 -0
- package/static/assets/stateDiagram-2N3HPSRC-FX4rJkzV.js +1 -0
- package/static/assets/stateDiagram-v2-6OUMAXLB-BVufbO_H.js +1 -0
- package/static/assets/swimlanes-5IMT3BWC-Sfy58mmv.js +2 -0
- package/static/assets/swimlanesDiagram-G3AALYLV-wDCDw08H.js +8 -0
- package/static/assets/timeline-definition-FHXFAJF6-CmV7by8p.js +120 -0
- package/static/assets/vennDiagram-L72KCM5P-FqIyFZFt.js +34 -0
- package/static/assets/wardleyDiagram-EHGQE667-BZ06O45i.js +78 -0
- package/static/assets/xychartDiagram-FW5EYKEG-BOkffR06.js +7 -0
- package/static/index.html +24 -0
|
@@ -0,0 +1,898 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: specgen-flutter-riverpod
|
|
3
|
+
model: claude-opus-4-8
|
|
4
|
+
effort: high
|
|
5
|
+
description: >
|
|
6
|
+
Generate a detailed specification document for building a Flutter mobile application
|
|
7
|
+
using Flutter 3.x (Dart 3.x), Riverpod 2.x for state management, Hive 2.x for local
|
|
8
|
+
storage, Dio 5.x for REST API with smart retry, Firebase Messaging + flutter_local_notifications
|
|
9
|
+
for push/event notifications, go_router 14.x for navigation, freezed 2.x + json_serializable
|
|
10
|
+
for immutable models, and build_runner for code generation. The spec also covers
|
|
11
|
+
cached_network_image, flutter_svg, pull_to_refresh, font_awesome_flutter, material_design_icons_flutter,
|
|
12
|
+
intl, url_launcher, and flutter_native_splash. Authentication (Keycloak OAuth2/OIDC PKCE
|
|
13
|
+
via flutter_appauth, local JWT, or none) and optional features (WebSocket, i18n via intl)
|
|
14
|
+
are configurable based on user input.
|
|
15
|
+
Standardized input: application name (mandatory), version (mandatory), module (optional).
|
|
16
|
+
Use this skill whenever the user asks to create a spec, specification, blueprint, or
|
|
17
|
+
technical design document for a new Flutter mobile application.
|
|
18
|
+
Also trigger when the user says things like "spec out a new Flutter app", "design a
|
|
19
|
+
Flutter app with Riverpod", "write a technical spec for my new mobile app", "scaffold
|
|
20
|
+
spec for a Flutter Riverpod app", or any request for a specification document describing
|
|
21
|
+
a Flutter + Riverpod + Dio + Hive application. Even if the user only mentions a subset
|
|
22
|
+
of the stack (e.g., "Flutter mobile app" or "Flutter with Firebase notifications"),
|
|
23
|
+
this skill likely applies — ask and confirm.
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
# Flutter Mobile Specification Generator
|
|
27
|
+
|
|
28
|
+
This skill generates a comprehensive specification document (Markdown) that serves as a
|
|
29
|
+
blueprint for building a Flutter mobile application. The spec is intended to be followed
|
|
30
|
+
by a developer or a coding agent to produce a fully functional project scaffold targeting
|
|
31
|
+
both Android and iOS.
|
|
32
|
+
|
|
33
|
+
The specification does NOT generate code. It produces a detailed, opinionated technical
|
|
34
|
+
document describing every layer of the application — from `pubspec.yaml` configuration to
|
|
35
|
+
Material Theme, from Riverpod providers to Dio retry interceptors — so that implementation
|
|
36
|
+
becomes a mechanical exercise.
|
|
37
|
+
|
|
38
|
+
## Technology Stack
|
|
39
|
+
|
|
40
|
+
### Core Stack (Always Included)
|
|
41
|
+
|
|
42
|
+
These are the fixed versions the spec targets. Do not deviate unless the user explicitly
|
|
43
|
+
requests different versions.
|
|
44
|
+
|
|
45
|
+
| Component | Version |
|
|
46
|
+
|----------------------------------|-----------|
|
|
47
|
+
| Flutter SDK | 3.24.x |
|
|
48
|
+
| Dart SDK | 3.5.x |
|
|
49
|
+
| flutter_riverpod | 2.5.x |
|
|
50
|
+
| riverpod_annotation | 2.3.x |
|
|
51
|
+
| riverpod_generator | 2.4.x |
|
|
52
|
+
| hooks_riverpod | 2.5.x |
|
|
53
|
+
| flutter_hooks | 0.20.x |
|
|
54
|
+
| hive | 2.2.x |
|
|
55
|
+
| hive_flutter | 1.1.x |
|
|
56
|
+
| dio | 5.7.x |
|
|
57
|
+
| dio_smart_retry | 6.0.x |
|
|
58
|
+
| pretty_dio_logger | 1.4.x |
|
|
59
|
+
| go_router | 14.x |
|
|
60
|
+
| freezed_annotation | 2.4.x |
|
|
61
|
+
| freezed | 2.5.x |
|
|
62
|
+
| json_annotation | 4.9.x |
|
|
63
|
+
| json_serializable | 6.8.x |
|
|
64
|
+
| build_runner | 2.4.x |
|
|
65
|
+
| firebase_core | 3.6.x |
|
|
66
|
+
| firebase_messaging | 15.1.x |
|
|
67
|
+
| flutter_local_notifications | 17.2.x |
|
|
68
|
+
| cached_network_image | 3.4.x |
|
|
69
|
+
| flutter_svg | 2.0.x |
|
|
70
|
+
| pull_to_refresh | 2.0.x |
|
|
71
|
+
| font_awesome_flutter | 10.7.x |
|
|
72
|
+
| material_design_icons_flutter | 7.0.x |
|
|
73
|
+
| intl | 0.19.x |
|
|
74
|
+
| url_launcher | 6.3.x |
|
|
75
|
+
| flutter_native_splash | 2.4.x |
|
|
76
|
+
| flutter_dotenv | 5.2.x |
|
|
77
|
+
| path_provider | 2.1.x |
|
|
78
|
+
| flutter_secure_storage | 9.2.x |
|
|
79
|
+
|
|
80
|
+
### Optional Integration Versions
|
|
81
|
+
|
|
82
|
+
Include in the version table only when the corresponding integration is selected.
|
|
83
|
+
|
|
84
|
+
| Component | Version | When Selected |
|
|
85
|
+
|--------------------------|-----------|-----------------------------|
|
|
86
|
+
| Keycloak | 26.x | Auth = Keycloak |
|
|
87
|
+
| flutter_appauth | 8.0.x | Auth = Keycloak or OIDC |
|
|
88
|
+
| openid_client | 0.4.x | Auth = Keycloak or OIDC |
|
|
89
|
+
| web_socket_channel | 3.0.x | WebSocket = yes |
|
|
90
|
+
| flutter_localizations | SDK | i18n = yes |
|
|
91
|
+
| share_plus | 10.0.x | Sharing = yes |
|
|
92
|
+
| image_picker | 1.1.x | ImagePicker = yes |
|
|
93
|
+
| file_picker | 8.1.x | FilePicker = yes |
|
|
94
|
+
| permission_handler | 11.3.x | Permissions = yes |
|
|
95
|
+
| firebase_analytics | 11.3.x | Analytics = yes |
|
|
96
|
+
| firebase_crashlytics | 4.1.x | Crashlytics = yes |
|
|
97
|
+
|
|
98
|
+
## Core Dependencies (pubspec.yaml)
|
|
99
|
+
|
|
100
|
+
The spec must include these in the `pubspec.yaml` dependencies section (always):
|
|
101
|
+
|
|
102
|
+
**Runtime dependencies:**
|
|
103
|
+
- `flutter` (sdk: flutter) — Core Flutter framework
|
|
104
|
+
- `flutter_riverpod` — Riverpod for Flutter
|
|
105
|
+
- `riverpod_annotation` — Annotations for riverpod_generator
|
|
106
|
+
- `hooks_riverpod` — Riverpod with flutter_hooks integration
|
|
107
|
+
- `flutter_hooks` — React-style hooks for Flutter
|
|
108
|
+
- `hive` + `hive_flutter` — Local NoSQL key-value database
|
|
109
|
+
- `dio` — HTTP client
|
|
110
|
+
- `dio_smart_retry` — Retry interceptor for Dio
|
|
111
|
+
- `pretty_dio_logger` — Request/response logging in development
|
|
112
|
+
- `go_router` — Declarative routing
|
|
113
|
+
- `freezed_annotation` — Annotations for freezed code generation
|
|
114
|
+
- `json_annotation` — Annotations for json_serializable
|
|
115
|
+
- `firebase_core` — Firebase initialization
|
|
116
|
+
- `firebase_messaging` — Push notification (FCM)
|
|
117
|
+
- `flutter_local_notifications` — Foreground/scheduled local notifications
|
|
118
|
+
- `cached_network_image` — Network image with caching and placeholders
|
|
119
|
+
- `flutter_svg` — SVG rendering
|
|
120
|
+
- `pull_to_refresh` — Smart pull-to-refresh widget
|
|
121
|
+
- `font_awesome_flutter` — Font Awesome icons
|
|
122
|
+
- `material_design_icons_flutter` — Material Design Icons (MDI)
|
|
123
|
+
- `intl` — Internationalization, date/number formatting
|
|
124
|
+
- `url_launcher` — Open URLs, dial, mailto, etc.
|
|
125
|
+
- `flutter_dotenv` — Load `.env` configuration files
|
|
126
|
+
- `path_provider` — Filesystem paths for Hive init
|
|
127
|
+
- `flutter_secure_storage` — Encrypted key-value store (keychain/keystore)
|
|
128
|
+
|
|
129
|
+
**Development dependencies:**
|
|
130
|
+
- `flutter_test` (sdk: flutter) — Widget test framework
|
|
131
|
+
- `build_runner` — Code generation runner
|
|
132
|
+
- `freezed` — Immutable data class generator
|
|
133
|
+
- `json_serializable` — JSON serialization generator
|
|
134
|
+
- `riverpod_generator` — Riverpod provider generator
|
|
135
|
+
- `hive_generator` — Hive type adapter generator
|
|
136
|
+
- `flutter_lints` — Recommended lint rules
|
|
137
|
+
- `flutter_native_splash` — Native splash screen generator
|
|
138
|
+
- `mocktail` — Mock library for unit tests
|
|
139
|
+
|
|
140
|
+
### Conditional Dependencies
|
|
141
|
+
|
|
142
|
+
**If Auth = Keycloak or OIDC:**
|
|
143
|
+
- `flutter_appauth` — Native OAuth2/OIDC PKCE flow (uses AppAuth Android/iOS)
|
|
144
|
+
- `openid_client` — OIDC discovery and token parsing
|
|
145
|
+
|
|
146
|
+
**If WebSocket = yes:**
|
|
147
|
+
- `web_socket_channel` — Cross-platform WebSocket client
|
|
148
|
+
|
|
149
|
+
**If i18n = yes:**
|
|
150
|
+
- `flutter_localizations` (sdk: flutter)
|
|
151
|
+
- `intl` is already in core — used for ARB-based message localization
|
|
152
|
+
|
|
153
|
+
**If Analytics = yes:**
|
|
154
|
+
- `firebase_analytics`
|
|
155
|
+
|
|
156
|
+
**If Crashlytics = yes:**
|
|
157
|
+
- `firebase_crashlytics`
|
|
158
|
+
|
|
159
|
+
**If ImagePicker = yes:**
|
|
160
|
+
- `image_picker`
|
|
161
|
+
- `permission_handler` (for camera/photo permissions)
|
|
162
|
+
|
|
163
|
+
**If FilePicker = yes:**
|
|
164
|
+
- `file_picker`
|
|
165
|
+
|
|
166
|
+
**If Sharing = yes:**
|
|
167
|
+
- `share_plus`
|
|
168
|
+
|
|
169
|
+
## When the Skill Triggers
|
|
170
|
+
|
|
171
|
+
Generate the spec when the user provides an **application name** and **version** that
|
|
172
|
+
corresponds to one of the custom applications defined in `CLAUDE.md`. The skill
|
|
173
|
+
reads all required inputs from the project's context files — no interactive Q&A is needed
|
|
174
|
+
for the core inputs.
|
|
175
|
+
|
|
176
|
+
The user invokes this skill by specifying the target application and version, for example:
|
|
177
|
+
- `/specgen-flutter-riverpod mobile v1.0.4`
|
|
178
|
+
- `/specgen-flutter-riverpod mobile v1.0.4 module:Hero Section`
|
|
179
|
+
- `/specgen-flutter-riverpod "Field Worker App" v1.0.4`
|
|
180
|
+
|
|
181
|
+
The skill then locates the matching context folder and reads all input files automatically.
|
|
182
|
+
|
|
183
|
+
## Version Gate
|
|
184
|
+
|
|
185
|
+
Before starting any work, resolve the application folder first (see Input Resolution below), then check `CHANGELOG.md` in the application folder (`<app_folder>/CHANGELOG.md`):
|
|
186
|
+
|
|
187
|
+
1. If `<app_folder>/CHANGELOG.md` does not exist, skip this check (first-ever execution for this application).
|
|
188
|
+
2. If `<app_folder>/CHANGELOG.md` exists, scan all `## vX.Y.Z` headings and determine the **highest version** using semantic versioning comparison.
|
|
189
|
+
3. Compare the requested version against the highest version:
|
|
190
|
+
- If requested version **>=** highest version: proceed normally.
|
|
191
|
+
- If requested version **<** highest version: **STOP immediately**. Print: `"Version {requested} is lower than the current application version {highest} recorded in <app_folder>/CHANGELOG.md. Execution rejected."` Do NOT proceed with any work.
|
|
192
|
+
|
|
193
|
+
## Input Resolution
|
|
194
|
+
|
|
195
|
+
This skill uses standardized input resolution. Provide:
|
|
196
|
+
|
|
197
|
+
| Argument | Required | Example | Description |
|
|
198
|
+
|----------|----------|---------|-------------|
|
|
199
|
+
| `<application>` | Yes | `mobile` | Application name to locate the context folder |
|
|
200
|
+
| `<version>` | Yes | `v1.0.4` | Version to scope processing |
|
|
201
|
+
| `module:<name>` | No | `module:Hero Section` | Limit generation to a single module |
|
|
202
|
+
|
|
203
|
+
### Application Folder Resolution
|
|
204
|
+
|
|
205
|
+
The application name is matched against root-level application folders:
|
|
206
|
+
1. Strip any leading `<number>_` prefix from folder names (e.g., `1_mobile` → `mobile`)
|
|
207
|
+
2. Match case-insensitively against the provided application name
|
|
208
|
+
3. Accept snake_case, kebab-case, or title-case input (all match the same folder)
|
|
209
|
+
4. If no match found, list available applications and stop
|
|
210
|
+
|
|
211
|
+
### Auto-Resolved Paths
|
|
212
|
+
|
|
213
|
+
| File | Resolved Path |
|
|
214
|
+
|------|---------------|
|
|
215
|
+
| PRD.md | `<app_folder>/context/PRD.md` |
|
|
216
|
+
| Module Models | `<app_folder>/context/model/` |
|
|
217
|
+
| HTML Mockups | `<app_folder>/context/mockup/` |
|
|
218
|
+
| Output (specification) | `<app_folder>/context/specification/` |
|
|
219
|
+
|
|
220
|
+
### Version Filtering
|
|
221
|
+
|
|
222
|
+
When a version is provided, only include user stories, NFRs, and constraints from versions
|
|
223
|
+
<= the provided version. For example, if `v1.0.4` is specified:
|
|
224
|
+
- Include items tagged `[v1.0.0]`, `[v1.0.1]`, `[v1.0.2]`, `[v1.0.3]`, `[v1.0.4]`
|
|
225
|
+
- Exclude items tagged `[v1.0.5]` or later
|
|
226
|
+
- Version comparison uses semantic versioning order
|
|
227
|
+
|
|
228
|
+
### Module Filtering
|
|
229
|
+
|
|
230
|
+
When `module:<name>` is provided:
|
|
231
|
+
- Only generate the `SPEC.md` for that specific module
|
|
232
|
+
- Other existing module spec files remain untouched
|
|
233
|
+
- `SPECIFICATION.md` (root) gets a partial update — only that module's entry in the TOC
|
|
234
|
+
is added or updated; all other TOC entries are preserved as-is
|
|
235
|
+
|
|
236
|
+
## Gathering Input
|
|
237
|
+
|
|
238
|
+
The specification is driven by **six input sources** read from the project's context files.
|
|
239
|
+
The skill does NOT ask the user for auth, API backend URL, or optional component choices —
|
|
240
|
+
it **determines** these automatically from the context.
|
|
241
|
+
|
|
242
|
+
### Input 1: Application Name (from CLAUDE.md)
|
|
243
|
+
|
|
244
|
+
From CLAUDE.md (already loaded in context), locate the target application under the
|
|
245
|
+
**Custom Applications** section. Extract:
|
|
246
|
+
|
|
247
|
+
- **Application name**: The section heading (e.g., "Mobile App", "Field Worker")
|
|
248
|
+
- **Application description**: The description paragraph below the heading
|
|
249
|
+
- **Dependencies**: The "Depends on" list — primary source for determining backend API
|
|
250
|
+
base URL, authentication provider, and optional components
|
|
251
|
+
|
|
252
|
+
The application name is used to derive:
|
|
253
|
+
- **Project slug**: snake_case of the application name (Dart/Flutter package naming;
|
|
254
|
+
e.g., `mobile_app`, `field_worker`)
|
|
255
|
+
- **App bundle ID / Application ID**: Reverse-DNS format (e.g.,
|
|
256
|
+
`com.example.mobile_app`) — Android `applicationId` and iOS `CFBundleIdentifier`
|
|
257
|
+
- **App display name**: Title-case of application name (e.g., "Mobile App")
|
|
258
|
+
|
|
259
|
+
### Input 2: User Stories (from PRD.md)
|
|
260
|
+
|
|
261
|
+
Read `<app_folder>/context/PRD.md`. This file contains all user stories organized by
|
|
262
|
+
module. Extract:
|
|
263
|
+
|
|
264
|
+
- **System modules**: Modules under `# System Module` heading (e.g., Authentication,
|
|
265
|
+
Profile). These become system-level features.
|
|
266
|
+
- **Business modules**: Modules under `# Business Module` heading (e.g., Order,
|
|
267
|
+
Catalogue). These become business-level features.
|
|
268
|
+
- **User stories per module**: Each `### User Story` section contains tagged items.
|
|
269
|
+
These define the functional requirements for each feature's repositories, providers,
|
|
270
|
+
forms, and screens.
|
|
271
|
+
|
|
272
|
+
The user stories directly inform:
|
|
273
|
+
- Which API calls each feature's repository must expose
|
|
274
|
+
- Which screens (Stateful/HookConsumerWidget) and routes are needed
|
|
275
|
+
- Which form fields and validation rules apply
|
|
276
|
+
- Which Flutter widgets best match the described UI
|
|
277
|
+
|
|
278
|
+
**Important:** Items with strikethrough (`~~text~~`) are deprecated — do NOT include them
|
|
279
|
+
as active requirements. List them in the "Removed / Replaced" subsection of the
|
|
280
|
+
traceability table.
|
|
281
|
+
|
|
282
|
+
- **Version tags per item**: Each `### User Story`, `### Non Functional Requirement`,
|
|
283
|
+
and `### Constraint` section contains one or more version blocks formatted as `[v1.0.x]`.
|
|
284
|
+
The skill must track the version tag for each item and carry it through to the
|
|
285
|
+
generated specification's traceability section.
|
|
286
|
+
|
|
287
|
+
### Input 3: Non-Functional Requirements (from PRD.md)
|
|
288
|
+
|
|
289
|
+
Within the same `PRD.md`, each module has a `### Non Functional Requirement` section.
|
|
290
|
+
These inform:
|
|
291
|
+
|
|
292
|
+
- UI layout choices (list vs. grid, card sizes, image dimensions)
|
|
293
|
+
- Data fetching strategies (pagination, infinite scroll, refresh)
|
|
294
|
+
- Validation rules (character limits, format requirements)
|
|
295
|
+
- Performance constraints (lazy widgets, image caching, offline support)
|
|
296
|
+
|
|
297
|
+
NFRs should be mapped to specific technical decisions in the spec — for example, an NFR
|
|
298
|
+
stating "paginated with 20 items per page" confirms which Riverpod pagination pattern
|
|
299
|
+
to use, while "must work offline" confirms which Hive box manages the offline cache.
|
|
300
|
+
|
|
301
|
+
### Input 4: Constraints (from PRD.md)
|
|
302
|
+
|
|
303
|
+
Within the same `PRD.md`, each module has a `### Constraint` section. These define
|
|
304
|
+
hard boundaries that the spec must enforce:
|
|
305
|
+
|
|
306
|
+
- Status enum values (e.g., "DRAFT, ACTIVE, EXPIRED")
|
|
307
|
+
- Business rules (e.g., "category must exist before creating content")
|
|
308
|
+
- Access control (e.g., "only WORKER role can access task management")
|
|
309
|
+
|
|
310
|
+
Constraints are embedded directly into the relevant module blueprint — they inform
|
|
311
|
+
freezed model definitions, repository method parameters, and route guard configurations.
|
|
312
|
+
|
|
313
|
+
### Input 5: Module Model (from model/ folder)
|
|
314
|
+
|
|
315
|
+
Read `<app_folder>/context/model/MODEL.md` first as the index, then read the
|
|
316
|
+
individual module model files in each module subfolder.
|
|
317
|
+
|
|
318
|
+
**MODEL.md** provides:
|
|
319
|
+
- Summary table of all modules with table/collection counts and design decisions
|
|
320
|
+
- Links to each module's detailed model files
|
|
321
|
+
|
|
322
|
+
**Per-module files** (e.g., `model/hero-section/model.md`):
|
|
323
|
+
- Complete field definitions with types and constraints
|
|
324
|
+
- Relationships and references
|
|
325
|
+
- Table/collection names
|
|
326
|
+
|
|
327
|
+
**Per-module schema** (e.g., `model/hero-section/schemas.json`):
|
|
328
|
+
- JSON schemas defining exact field types, required fields, and validation rules
|
|
329
|
+
|
|
330
|
+
The module model directly maps to:
|
|
331
|
+
- Freezed data class definitions (field-for-field, not placeholder)
|
|
332
|
+
- Hive type adapters (`@HiveType`/`@HiveField`) for cached entities
|
|
333
|
+
- JSON serialization via `json_serializable`
|
|
334
|
+
- Dio request/response DTOs
|
|
335
|
+
- Riverpod state model
|
|
336
|
+
|
|
337
|
+
### Input 6: HTML Mockup Screens (from mockup/ folder)
|
|
338
|
+
|
|
339
|
+
Read `<app_folder>/context/mockup/MOCKUP.html` first as the index page, then read the
|
|
340
|
+
HTML files organized by role in subfolders.
|
|
341
|
+
|
|
342
|
+
**MOCKUP.html** provides:
|
|
343
|
+
- Application identity (name, version, short name)
|
|
344
|
+
- Design tokens: fonts, colors from Tailwind/CSS config or inline styles
|
|
345
|
+
- List of user roles and their screen sets
|
|
346
|
+
|
|
347
|
+
**Role-specific subfolders** (e.g., `mockup/worker/task/`):
|
|
348
|
+
- Individual HTML screens for each page in the application
|
|
349
|
+
- Screen layout: which widgets are used (ListView, GridView, Forms, Modals, Cards)
|
|
350
|
+
- Navigation structure from drawer/bottom-nav HTML files
|
|
351
|
+
- Data display patterns (list pages, detail pages, create/edit forms)
|
|
352
|
+
|
|
353
|
+
**IMPORTANT — Role folders inform access control, NOT route paths.** The role-specific
|
|
354
|
+
folder structure (e.g., `mockup/worker/task/task-list.html`) determines:
|
|
355
|
+
1. Which role can access the screen → `redirect` guard with role check
|
|
356
|
+
2. Which navigation items appear for each role
|
|
357
|
+
It does NOT determine the route path. The route path is always module-based:
|
|
358
|
+
- `GoRoute(path: '/task', ...)` — NOT `GoRoute(path: '/worker/task', ...)`
|
|
359
|
+
|
|
360
|
+
The mockup screens directly map to:
|
|
361
|
+
- Flutter screen widgets (one per HTML screen)
|
|
362
|
+
- go_router route definitions
|
|
363
|
+
- Widget selections (ListView vs DataTable, BottomSheet vs Drawer, Card vs Tile)
|
|
364
|
+
- Form field layouts
|
|
365
|
+
- Navigation items per role (drawer / bottom navigation bar)
|
|
366
|
+
- ThemeData color tokens (extract from mockup CSS/styles)
|
|
367
|
+
|
|
368
|
+
## PRD.md Extended Sections
|
|
369
|
+
|
|
370
|
+
Before determining optional components, check PRD.md for the following extended sections:
|
|
371
|
+
|
|
372
|
+
### Architecture Principle Extraction
|
|
373
|
+
|
|
374
|
+
If PRD.md contains an `# Architecture Principle` section, extract patterns that affect mobile decisions:
|
|
375
|
+
|
|
376
|
+
| Pattern to Extract | How It Influences the Specification |
|
|
377
|
+
|---|---|
|
|
378
|
+
| "Stateless REST API" | Confirms Dio + Riverpod async provider pattern for API calls |
|
|
379
|
+
| "Event-driven" / "WebSocket" / "real-time" | Include web_socket_channel and a stream provider for live data |
|
|
380
|
+
| "API gateway" | Configure base URL to point to gateway rather than individual services |
|
|
381
|
+
| Backend framework mention | Validate API response format assumptions |
|
|
382
|
+
| "Offline-first" / "local cache" | Include Hive cache layer for read paths |
|
|
383
|
+
|
|
384
|
+
If the section is absent, proceed with existing CLAUDE.md-only detection.
|
|
385
|
+
|
|
386
|
+
### Design System Extraction
|
|
387
|
+
|
|
388
|
+
If PRD.md contains a `# Design System` section with a file reference:
|
|
389
|
+
1. Resolve and read the referenced file
|
|
390
|
+
2. Map design tokens to Flutter `ThemeData` configuration: color scheme, text theme,
|
|
391
|
+
component themes (ElevatedButtonTheme, AppBarTheme, CardTheme, InputDecorationTheme)
|
|
392
|
+
3. Include a complete `ThemeData` configuration in SPECIFICATION.md derived from the
|
|
393
|
+
design system tokens
|
|
394
|
+
|
|
395
|
+
If the section is absent, use a default Material 3 theme (existing behavior).
|
|
396
|
+
|
|
397
|
+
### High Level Process Flow Extraction
|
|
398
|
+
|
|
399
|
+
If PRD.md contains a `# High Level Process Flow` section:
|
|
400
|
+
1. Process flows with user-visible states inform which status values appear in
|
|
401
|
+
filter chips/dropdowns
|
|
402
|
+
2. Process flows with real-time updates inform WebSocket subscription patterns
|
|
403
|
+
3. Multi-step user flows inform go_router nested route design and Stepper/PageView usage
|
|
404
|
+
|
|
405
|
+
If the section is absent, derive UI flow from user stories only (existing behavior).
|
|
406
|
+
|
|
407
|
+
---
|
|
408
|
+
|
|
409
|
+
## Determining Optional Components
|
|
410
|
+
|
|
411
|
+
Instead of asking the user, the skill determines optional components by analyzing the
|
|
412
|
+
dependencies listed in `CLAUDE.md`, the `# Architecture Principle` section in PRD.md (if present),
|
|
413
|
+
and cross-referencing with PRD.md NFRs and constraints.
|
|
414
|
+
|
|
415
|
+
### Backend API Detection
|
|
416
|
+
|
|
417
|
+
Examine the "Depends on" list in CLAUDE.md for the target application:
|
|
418
|
+
|
|
419
|
+
| Dependency Pattern | API Configuration |
|
|
420
|
+
|---|---|
|
|
421
|
+
| References another application's REST API | `API_BASE_URL` set to that app's base URL |
|
|
422
|
+
| References a Spring Boot backend | Include Spring Boot CORS headers note |
|
|
423
|
+
| No explicit backend | Include mock API / json-server note for development |
|
|
424
|
+
|
|
425
|
+
### Authentication Detection
|
|
426
|
+
|
|
427
|
+
| Dependency / PRD Pattern | Auth Selection |
|
|
428
|
+
|---|---|
|
|
429
|
+
| References "Single Sign On" or "Keycloak" in CLAUDE.md dependencies | Auth = Keycloak |
|
|
430
|
+
| PRD.md has login user stories with email/password | Auth = Local (local JWT from API) |
|
|
431
|
+
| PRD.md constraint says "public access, no auth required" | Auth = none |
|
|
432
|
+
| PRD.md has only public-facing content | Auth = none |
|
|
433
|
+
|
|
434
|
+
If Auth = Keycloak, also extract from CLAUDE.md:
|
|
435
|
+
- Keycloak version
|
|
436
|
+
- Keycloak realm: Default derived from project name
|
|
437
|
+
- Keycloak client ID: Default `<project-slug>-mobile`
|
|
438
|
+
- Keycloak issuer URI: Default `http://localhost:8180/realms/<realm>`
|
|
439
|
+
- Keycloak roles: Infer from mockup role folders (e.g., `worker` → `WORKER`, `admin` → `ADMIN`)
|
|
440
|
+
|
|
441
|
+
If Auth = Local (API-managed JWT):
|
|
442
|
+
- Login/logout handled by Dio calls to the backend
|
|
443
|
+
- Access token stored in `flutter_secure_storage` (Keychain / Android Keystore)
|
|
444
|
+
- Refresh token also in `flutter_secure_storage`
|
|
445
|
+
- Dio interceptor attaches `Authorization: Bearer <token>` header
|
|
446
|
+
- Token refresh interceptor handles 401 responses
|
|
447
|
+
|
|
448
|
+
### Optional Component Detection
|
|
449
|
+
|
|
450
|
+
| PRD.md Pattern | Component Selection |
|
|
451
|
+
|---|---|
|
|
452
|
+
| NFRs mention "real-time", "live updates", "push notification" | FirebaseMessaging always-on (core); WebSocket = yes if user-driven streams |
|
|
453
|
+
| User stories mention "schedule reminder", "local alarm", "background reminder" | Local notifications always-on (core); add scheduled notification helper |
|
|
454
|
+
| NFRs mention "share to social", "share link" | Sharing = yes |
|
|
455
|
+
| User stories mention "upload photo", "take photo" | ImagePicker = yes |
|
|
456
|
+
| User stories mention "attach file", "upload document" | FilePicker = yes |
|
|
457
|
+
| PRD.md mentions multiple languages or localization | i18n = yes |
|
|
458
|
+
| NFRs mention "track screen views", "user analytics", "conversion funnel" | Analytics = yes |
|
|
459
|
+
| NFRs mention "crash reporting", "production error monitoring" | Crashlytics = yes |
|
|
460
|
+
| NFRs mention "camera", "gallery", "storage", "location" | Permissions = yes |
|
|
461
|
+
|
|
462
|
+
### Summary of Determination
|
|
463
|
+
|
|
464
|
+
After analyzing all inputs, produce a determination summary before generating the spec.
|
|
465
|
+
Present it to the user for confirmation:
|
|
466
|
+
|
|
467
|
+
```
|
|
468
|
+
Optional Component Determination:
|
|
469
|
+
- Backend API: http://localhost:<port>/api (from CLAUDE.md Port Allocation table → depends on backend app)
|
|
470
|
+
- Authentication: Keycloak PKCE via flutter_appauth (from CLAUDE.md → depends on Single Sign On)
|
|
471
|
+
- WebSocket: no
|
|
472
|
+
- i18n: yes (from PRD.md → English + Bahasa Malaysia required)
|
|
473
|
+
- Analytics: yes (from PRD.md NFR → screen view tracking)
|
|
474
|
+
- Crashlytics: yes (from PRD.md NFR → production error monitoring)
|
|
475
|
+
- ImagePicker: yes (from PRD.md → upload photo of completed task)
|
|
476
|
+
- FilePicker: no
|
|
477
|
+
- Sharing: no
|
|
478
|
+
- Permissions: yes (camera, photo library)
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
If the user disagrees with any determination, allow them to override before proceeding.
|
|
482
|
+
|
|
483
|
+
## Required Inputs
|
|
484
|
+
|
|
485
|
+
After determination, these values are needed. Most are derived automatically:
|
|
486
|
+
|
|
487
|
+
**Auto-derived from context files:**
|
|
488
|
+
- **Application name**: From CLAUDE.md section heading
|
|
489
|
+
- **Project slug**: snake_case of application name
|
|
490
|
+
- **App display name**: Title-case used in `AppBar` title and launcher label
|
|
491
|
+
- **App bundle ID**: Reverse-DNS from project slug
|
|
492
|
+
- **Application description**: From CLAUDE.md description
|
|
493
|
+
- **Backend API base URL**: From CLAUDE.md dependencies
|
|
494
|
+
- **Modules / Features**: From PRD.md module headings + model/MODEL.md
|
|
495
|
+
- **Auth type**: Auto-determined (see above)
|
|
496
|
+
- **Optional components**: Auto-determined (see above)
|
|
497
|
+
- **User roles**: From mockup role folders
|
|
498
|
+
- **Design tokens**: ThemeData colors extracted from mockup CSS/inline styles
|
|
499
|
+
|
|
500
|
+
**Auto-derived from CLAUDE.md (Port Allocation table):**
|
|
501
|
+
- **Backend API base URL**: Look up the backend application's port from the `Port Allocation` table in the `Custom Applications` section of `CLAUDE.md`. Construct the base URL as `http://10.0.2.2:<port>/api/v1` for Android emulator development (which proxies `localhost`) and `http://localhost:<port>/api/v1` for iOS simulator. Do NOT hardcode `8080` — the port MUST match the allocated port for the backend application this mobile app depends on.
|
|
502
|
+
|
|
503
|
+
**Optional (use sensible defaults if not found in context):**
|
|
504
|
+
- **Default locale**: Default `en`
|
|
505
|
+
- **Page size**: Default `20` (mobile-appropriate, from NFRs or fallback)
|
|
506
|
+
- **Min Android SDK**: Default `23` (Android 6.0)
|
|
507
|
+
- **Min iOS deployment target**: Default `13.0`
|
|
508
|
+
|
|
509
|
+
## Generating the Specification
|
|
510
|
+
|
|
511
|
+
Once inputs are gathered from context files and optional components are determined,
|
|
512
|
+
generate the specification as a **multi-file output split by module**. Read the spec
|
|
513
|
+
template at `references/spec-template.md` for the exact structure and content of each
|
|
514
|
+
section. The template is the authoritative guide — follow it closely.
|
|
515
|
+
|
|
516
|
+
The specification is split into two categories:
|
|
517
|
+
|
|
518
|
+
1. **Root `SPECIFICATION.md`** — Table of Contents, shared infrastructure, ThemeData,
|
|
519
|
+
routing, auth configuration, Hive/Dio/Firebase init, and application-level sections
|
|
520
|
+
that apply across all modules.
|
|
521
|
+
2. **Per-module `<module-name>/SPEC.md`** — Each module gets its own folder with a
|
|
522
|
+
self-contained specification covering that module's complete blueprint.
|
|
523
|
+
|
|
524
|
+
This split enables a coding agent to:
|
|
525
|
+
- First, scaffold the shared infrastructure from `SPECIFICATION.md`
|
|
526
|
+
- Then, implement each module independently by picking up its `<module>/SPEC.md`
|
|
527
|
+
|
|
528
|
+
**Important:** The generated spec must use **real module data** from the context files,
|
|
529
|
+
not generic placeholders. Specifically:
|
|
530
|
+
|
|
531
|
+
- **Modules** must use the actual module names from PRD.md and MODEL.md
|
|
532
|
+
(e.g., `task`, `order`, `catalogue` — not `module1`, `module2`)
|
|
533
|
+
- **Freezed models** must match the actual fields defined in the module model files,
|
|
534
|
+
not placeholder `fieldOne`/`fieldTwo`
|
|
535
|
+
- **Repositories** must expose methods matching the actual user stories (e.g., if a story
|
|
536
|
+
says "view list of tasks", the repository needs `fetchTasks()`)
|
|
537
|
+
- **Screens** must map to the actual mockup screens (e.g., if
|
|
538
|
+
`worker/task/task-list.html` exists, there must be a matching route and screen
|
|
539
|
+
widget). The route path is module-based (e.g., `/task`), NOT role-prefixed
|
|
540
|
+
(e.g., NOT `/worker/task`).
|
|
541
|
+
- **Form fields** must match what the mockup screens display
|
|
542
|
+
- **Validation rules** must enforce the constraints from PRD.md (character limits, URL format, etc.)
|
|
543
|
+
- **ThemeData** must use the design tokens extracted from the mockup (colors, border-radius, font)
|
|
544
|
+
- **Version tags**: Every user story ID, NFR ID, constraint ID, and mockup screen in the
|
|
545
|
+
traceability section must include its version tag (e.g., `USA000030 [v1.0.4]`).
|
|
546
|
+
**ALL traceability sub-tables (User Stories, NFRs, AND Constraints) MUST include the
|
|
547
|
+
`| Version |` column.**
|
|
548
|
+
- **Removed / Replaced items**: The traceability section must include a "Removed / Replaced"
|
|
549
|
+
subsection listing deprecated items — showing the removed ID, the version that removed it,
|
|
550
|
+
the replacement ID (if any), and a brief reason.
|
|
551
|
+
|
|
552
|
+
### Output Structure
|
|
553
|
+
|
|
554
|
+
```
|
|
555
|
+
<app_folder>/context/specification/
|
|
556
|
+
├── SPECIFICATION.md ↠TOC + shared/application-level specs
|
|
557
|
+
├── task/
|
|
558
|
+
│ └── SPEC.md ↠Module blueprint for Task
|
|
559
|
+
├── order/
|
|
560
|
+
│ └── SPEC.md ↠Module blueprint for Order
|
|
561
|
+
├── catalogue/
|
|
562
|
+
│ └── SPEC.md ↠Module blueprint for Catalogue
|
|
563
|
+
├── ... ↠One folder per module from PRD.md
|
|
564
|
+
```
|
|
565
|
+
|
|
566
|
+
### What Goes in `SPECIFICATION.md` (Root)
|
|
567
|
+
|
|
568
|
+
The root file contains the TOC and all shared/application-level sections. These are
|
|
569
|
+
sections a coding agent implements **first** before any module work:
|
|
570
|
+
|
|
571
|
+
#### 1. Project Overview
|
|
572
|
+
Project metadata, application description, technology stack summary, user roles, module
|
|
573
|
+
index table linking to each module's SPEC.md, target platforms (Android/iOS) and minimum
|
|
574
|
+
OS versions.
|
|
575
|
+
|
|
576
|
+
#### 2. Package Configuration
|
|
577
|
+
Complete `pubspec.yaml` with all dependencies (core + selected conditional),
|
|
578
|
+
`build_runner` scripts, and asset/font declarations.
|
|
579
|
+
|
|
580
|
+
#### 3. Application Configuration
|
|
581
|
+
`analysis_options.yaml` (lints), `.gitignore`, Flutter `flavors` if multi-environment
|
|
582
|
+
needed, native splash and launcher icon configuration, Android `build.gradle` & iOS
|
|
583
|
+
`Info.plist` notes (permissions, deep links, FCM background handler).
|
|
584
|
+
|
|
585
|
+
#### 3a. Application Version Configuration
|
|
586
|
+
The application MUST include a version value derived from the version argument provided
|
|
587
|
+
during skill invocation. If multiple versions were provided, use the highest one.
|
|
588
|
+
|
|
589
|
+
In `pubspec.yaml`:
|
|
590
|
+
```yaml
|
|
591
|
+
version: 1.0.3+1
|
|
592
|
+
```
|
|
593
|
+
|
|
594
|
+
The first part (`1.0.3`) is the human-readable version; the suffix (`+1`) is the build
|
|
595
|
+
number. The build number MUST be incremented manually or via CI on each release.
|
|
596
|
+
|
|
597
|
+
The application MUST expose this version in a **Settings/About** screen or persistent
|
|
598
|
+
drawer footer. Use `package_info_plus` (add as dependency if surfacing programmatically):
|
|
599
|
+
```dart
|
|
600
|
+
final info = await PackageInfo.fromPlatform();
|
|
601
|
+
final versionLabel = 'v${info.version}+${info.buildNumber}';
|
|
602
|
+
```
|
|
603
|
+
|
|
604
|
+
#### 3b. `.env` File Generation from ENVIRONMENT.md
|
|
605
|
+
Generate `.env.development` and `.env.production` files at the project root for use with
|
|
606
|
+
`flutter_dotenv`. The `.env.development` file is populated by reading `ENVIRONMENT.md` from
|
|
607
|
+
the project root, mapping credential and platform values to plain environment variable
|
|
608
|
+
names (no `VITE_` prefix — Flutter does not use Vite). The `.env.production` file uses
|
|
609
|
+
placeholder values for production.
|
|
610
|
+
|
|
611
|
+
**Process:**
|
|
612
|
+
1. Read `ENVIRONMENT.md` from the project root
|
|
613
|
+
2. Extract credential values from `ENVIRONMENT.md` (`# Supporting 3rd Party Applications`
|
|
614
|
+
for Keycloak host/realm/client, plus `# External Services` such as Firebase config); the
|
|
615
|
+
backend API host/port comes from the `# Port Allocation` table in `CLAUDE.md`. Read any
|
|
616
|
+
toolchain paths from `DEVTOOL.md`
|
|
617
|
+
3. Map each value to the corresponding environment variable name
|
|
618
|
+
4. Generate `.env.development` with actual local values
|
|
619
|
+
5. Generate `.env.production` with production placeholder values
|
|
620
|
+
6. Register both files under `assets:` in `pubspec.yaml`
|
|
621
|
+
|
|
622
|
+
**Example `.env.development` output (derived from ENVIRONMENT.md):**
|
|
623
|
+
```properties
|
|
624
|
+
# Backend API
|
|
625
|
+
API_BASE_URL=http://10.0.2.2:<port from CLAUDE.md Port Allocation table>/api/v1
|
|
626
|
+
API_TIMEOUT_MS=30000
|
|
627
|
+
API_RETRY_ATTEMPTS=3
|
|
628
|
+
|
|
629
|
+
# Authentication (Keycloak)
|
|
630
|
+
KEYCLOAK_ISSUER=http://10.0.2.2:8180/realms/urp
|
|
631
|
+
KEYCLOAK_CLIENT_ID=urp-mobile
|
|
632
|
+
KEYCLOAK_REDIRECT_URI=com.example.mobile_app:/oauth2redirect
|
|
633
|
+
```
|
|
634
|
+
|
|
635
|
+
**Rules:**
|
|
636
|
+
- Use plain environment variable names; access via `dotenv.env['API_BASE_URL']`
|
|
637
|
+
- Use actual values from ENVIRONMENT.md — never use placeholders or `TODO`
|
|
638
|
+
- If ENVIRONMENT.md does not exist or a value is not found, use sensible defaults for local
|
|
639
|
+
development (Android emulator uses `10.0.2.2` for host's `localhost`)
|
|
640
|
+
- Both `.env.development` and `.env.production` are gitignored, but the **files MUST
|
|
641
|
+
still be declared under `assets:`** in `pubspec.yaml` so `flutter_dotenv` can load them
|
|
642
|
+
at runtime
|
|
643
|
+
- Firebase config (`google-services.json`, `GoogleService-Info.plist`) is checked in
|
|
644
|
+
per-flavor but the Firebase project ID/sender ID are read from `.env` if dynamic
|
|
645
|
+
|
|
646
|
+
#### 4. Directory Structure
|
|
647
|
+
The complete source tree under `lib/`. The structure follows feature-based architecture
|
|
648
|
+
where each PRD module maps to a `lib/features/<module>/` folder.
|
|
649
|
+
Read `references/routing-patterns.md` for the module folder layout.
|
|
650
|
+
|
|
651
|
+
#### 5. Theme Configuration
|
|
652
|
+
Custom Material 3 `ThemeData` built from design tokens extracted from mockup screens.
|
|
653
|
+
Includes color scheme (seeded from primary), text theme (Google Fonts or custom font
|
|
654
|
+
family), component themes (ElevatedButtonTheme, AppBarTheme, CardTheme, InputDecorationTheme,
|
|
655
|
+
FloatingActionButtonTheme), and shape/radius tokens.
|
|
656
|
+
Read `references/component-patterns.md` for theme setup patterns.
|
|
657
|
+
|
|
658
|
+
#### 6. Authentication Configuration *(conditional — include only if Auth != none)*
|
|
659
|
+
**If Auth = Keycloak:** PKCE Authorization Code flow using `flutter_appauth`. The native
|
|
660
|
+
AppAuth library (Android + iOS) handles the system browser redirect. `AuthRepository`
|
|
661
|
+
exposes `signIn()`, `signOut()`, `getAccessToken()`. Tokens stored in
|
|
662
|
+
`flutter_secure_storage`. Dio interceptor reads access token. Refresh token used to renew
|
|
663
|
+
silently. Deep link callback configured for both platforms.
|
|
664
|
+
Read `references/security-patterns.md` for the full auth architecture.
|
|
665
|
+
|
|
666
|
+
**If Auth = Local (API JWT):** Login screen submits to backend API, JWT stored in
|
|
667
|
+
`flutter_secure_storage`, Dio interceptor attaches Authorization header, token refresh
|
|
668
|
+
interceptor handles 401 responses, route guard via go_router `redirect` callback
|
|
669
|
+
redirects unauthenticated users.
|
|
670
|
+
|
|
671
|
+
#### 7. Router Configuration
|
|
672
|
+
go_router v14 route tree — top-level routes, nested shell routes for bottom navigation,
|
|
673
|
+
route guards via `redirect`, deep link configuration for FCM/Keycloak callbacks,
|
|
674
|
+
typed route helpers (optional, via `go_router_builder`).
|
|
675
|
+
Read `references/routing-patterns.md` for route patterns.
|
|
676
|
+
|
|
677
|
+
#### 8. API Client Configuration
|
|
678
|
+
Dio instance with `baseUrl` from `dotenv.env['API_BASE_URL']`, request/response
|
|
679
|
+
interceptors:
|
|
680
|
+
- Auth interceptor (Bearer token injection)
|
|
681
|
+
- Retry interceptor (`DioSmartRetry` — exponential backoff on 5xx, network errors, retry idempotent methods)
|
|
682
|
+
- Logging interceptor (`PrettyDioLogger`, **dev only** — guard with `kDebugMode`)
|
|
683
|
+
- Error interceptor (transforms `DioException` → typed `ApiFailure` sealed class)
|
|
684
|
+
|
|
685
|
+
`connectTimeout`, `receiveTimeout`, `sendTimeout` from `.env`.
|
|
686
|
+
|
|
687
|
+
#### 9. Local Storage (Hive)
|
|
688
|
+
`Hive.initFlutter()` in `main()`, type adapters registered for each cached entity,
|
|
689
|
+
typed `Box<T>` providers via Riverpod, helper extension methods for upsert/find/clear,
|
|
690
|
+
encryption optional (HiveAesCipher with key from `flutter_secure_storage`).
|
|
691
|
+
Read `references/storage-patterns.md` for Hive patterns.
|
|
692
|
+
|
|
693
|
+
#### 10. Riverpod Setup
|
|
694
|
+
`ProviderScope` wrapping `MyApp`, code generation via `riverpod_generator`,
|
|
695
|
+
`AsyncNotifier`/`Notifier` providers for state, family providers for parameterized
|
|
696
|
+
queries, naming convention: `<entity>RepositoryProvider`, `<entity>ListProvider`,
|
|
697
|
+
`<entity>ByIdProvider(id)`.
|
|
698
|
+
Read `references/state-patterns.md` for Riverpod patterns.
|
|
699
|
+
|
|
700
|
+
#### 11. Shared Layouts
|
|
701
|
+
`AppShellScreen` (bottom navigation + Scaffold body via `ShellRoute`), `AuthShell`
|
|
702
|
+
(login/forgot-password scaffolding), `PublicShell` for unauthenticated content (if any).
|
|
703
|
+
Each shell uses Material 3 widgets.
|
|
704
|
+
|
|
705
|
+
#### 12. Shared Widgets
|
|
706
|
+
Reusable widgets used across multiple modules: `AppScaffold` (AppBar + body slot),
|
|
707
|
+
`LoadingIndicator`, `EmptyState`, `ErrorState`, `ConfirmDialog`, `StatusChip`,
|
|
708
|
+
`SearchBarField`, `FormTextField`, `FormDatePickerField`, `FormDropdownField`,
|
|
709
|
+
`ImagePickerField` (if ImagePicker = yes), `PullToRefreshList`, `InfiniteScrollList`,
|
|
710
|
+
`CachedSvgIcon`, `AppNetworkImage` (wraps `CachedNetworkImage` with placeholder/error).
|
|
711
|
+
|
|
712
|
+
#### 13. Navigation Configuration
|
|
713
|
+
Bottom navigation items (or drawer items) derived from mockup nav files, organized by
|
|
714
|
+
role. Each item has label, icon (Material/MDI/FA), path, and required role.
|
|
715
|
+
Navigation is rendered dynamically based on the authenticated user's roles.
|
|
716
|
+
|
|
717
|
+
#### 14. Form Infrastructure
|
|
718
|
+
Reusable form-field widgets wrapping `TextFormField` / `DropdownButtonFormField` /
|
|
719
|
+
`DatePicker` with consistent decoration, validators (`Validator` static methods:
|
|
720
|
+
`required`, `email`, `min/maxLength`, `url`, `compose`), submit button with loading
|
|
721
|
+
state (CircularProgressIndicator inside ElevatedButton).
|
|
722
|
+
|
|
723
|
+
#### 15. Error Handling Strategy
|
|
724
|
+
Top-level `FlutterError.onError` and `PlatformDispatcher.instance.onError` for uncaught
|
|
725
|
+
errors (route to Crashlytics if enabled), Dio error interceptor mapping `DioException`
|
|
726
|
+
→ `ApiFailure` sealed class, Riverpod `AsyncValue.when(...)` for screen-level
|
|
727
|
+
error/loading states, `ErrorState` widget for full-screen errors with retry button,
|
|
728
|
+
`ScaffoldMessenger` (SnackBar) for transient errors.
|
|
729
|
+
|
|
730
|
+
#### 16. Notification System
|
|
731
|
+
**Push notifications (FCM):**
|
|
732
|
+
- `firebase_messaging` foreground/background/terminated handlers
|
|
733
|
+
- Token registration with backend on first launch and refresh
|
|
734
|
+
- Notification permission request (iOS + Android 13+)
|
|
735
|
+
- Deep link from notification payload to a specific route via go_router
|
|
736
|
+
|
|
737
|
+
**Local notifications:**
|
|
738
|
+
- `flutter_local_notifications` initialized with platform settings (Android channels,
|
|
739
|
+
iOS categories)
|
|
740
|
+
- Used to display FCM messages received in foreground (FCM does not show banners in
|
|
741
|
+
foreground by default on iOS/Android)
|
|
742
|
+
- Used for in-app scheduled reminders if PRD requires it
|
|
743
|
+
|
|
744
|
+
**In-app toasts:**
|
|
745
|
+
- `ScaffoldMessenger.of(context).showSnackBar(...)` for non-critical user feedback.
|
|
746
|
+
|
|
747
|
+
Read `references/notification-patterns.md` for the full notification architecture.
|
|
748
|
+
|
|
749
|
+
#### 17. Theming & Dark Mode
|
|
750
|
+
`MaterialApp.themeMode` toggled via UI control, persisted in Hive `settings` box.
|
|
751
|
+
`lightTheme` and `darkTheme` constructed via `ThemeData(colorScheme: ColorScheme.fromSeed(...))`
|
|
752
|
+
with brightness override. `ThemeToggle` widget switches mode and writes to Hive.
|
|
753
|
+
|
|
754
|
+
#### 18. Testing Strategy
|
|
755
|
+
Overview: `flutter_test` + `mocktail` for widget/unit tests, `ProviderContainer` for
|
|
756
|
+
testing Riverpod providers in isolation, golden tests for critical screens, integration
|
|
757
|
+
tests via `integration_test` package. Per-feature test conventions matching the module spec.
|
|
758
|
+
|
|
759
|
+
#### 19. Build & Distribution
|
|
760
|
+
- `flutter build apk --release` / `flutter build appbundle --release` (Android)
|
|
761
|
+
- `flutter build ipa --release` (iOS)
|
|
762
|
+
- Code signing notes (Android: upload keystore in `~/.gradle/gradle.properties`; iOS:
|
|
763
|
+
Apple Developer team + provisioning profile)
|
|
764
|
+
- Native splash via `flutter_native_splash` (`dart run flutter_native_splash:create`)
|
|
765
|
+
- Launcher icon via `flutter_launcher_icons` (optional)
|
|
766
|
+
- ProGuard rules for Firebase + AppAuth (Android release builds)
|
|
767
|
+
|
|
768
|
+
#### 20. Internationalisation *(conditional — include only if i18n = yes)*
|
|
769
|
+
`flutter_localizations` enabled, `intl` for ARB messages, `flutter_gen_l10n` configured
|
|
770
|
+
in `pubspec.yaml`, `lib/l10n/app_en.arb` + per-locale ARBs, generated `AppLocalizations`
|
|
771
|
+
class, `MaterialApp.localizationsDelegates` and `supportedLocales` wired, locale-switch
|
|
772
|
+
provider persisted in Hive.
|
|
773
|
+
|
|
774
|
+
#### 21. WebSocket Integration *(conditional — include only if WebSocket = yes)*
|
|
775
|
+
`web_socket_channel` setup, connection management Riverpod provider with auto-reconnect
|
|
776
|
+
+ exponential backoff, typed event handler with sealed-class events, lifecycle hook
|
|
777
|
+
in `AppShellScreen` to open/close socket on app foreground/background.
|
|
778
|
+
|
|
779
|
+
#### 22. Firebase Initialization
|
|
780
|
+
Always required (push notifications depend on it). Cover:
|
|
781
|
+
- `Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform)` in `main()`
|
|
782
|
+
before `runApp(...)`
|
|
783
|
+
- `google-services.json` (Android) + `GoogleService-Info.plist` (iOS) placement
|
|
784
|
+
- `flutterfire configure` CLI workflow (used once during scaffolding)
|
|
785
|
+
- Background message handler: top-level `@pragma('vm:entry-point')` function
|
|
786
|
+
- Firebase Analytics initialization (if Analytics = yes)
|
|
787
|
+
- Firebase Crashlytics setup hook (if Crashlytics = yes)
|
|
788
|
+
|
|
789
|
+
### What Goes in Each `<module>/SPEC.md` (Per-Module)
|
|
790
|
+
|
|
791
|
+
For EACH module from PRD.md and MODEL.md, create a folder named after the module
|
|
792
|
+
(kebab-case, e.g., `task/`) and generate a `SPEC.md` inside it.
|
|
793
|
+
|
|
794
|
+
Each module `SPEC.md` is a **self-contained** blueprint that a coding agent can pick up
|
|
795
|
+
and implement independently (after the shared infrastructure is in place). It must include:
|
|
796
|
+
|
|
797
|
+
- **Header** with module name and back-reference to root `SPECIFICATION.md`
|
|
798
|
+
- **Traceability**: User story IDs, NFR IDs, constraint IDs, table/collection names,
|
|
799
|
+
mockup screen filenames, all with version tags
|
|
800
|
+
- **Freezed Models** — `@freezed` data classes matching the module model fields
|
|
801
|
+
(field-for-field), including `fromJson`/`toJson` via `json_serializable`
|
|
802
|
+
- **Hive Adapters** *(if module is cached offline)* — `@HiveType` adapter with field
|
|
803
|
+
numbers matching the freezed model
|
|
804
|
+
- **Validation Rules** — Validator static methods or `Form` validator closures derived
|
|
805
|
+
from PRD constraints
|
|
806
|
+
- **API Repository** — Dio-based API class matching user story data operations
|
|
807
|
+
- **Riverpod Providers** — `AsyncNotifierProvider` for list, family provider for detail,
|
|
808
|
+
mutation methods on a `Notifier` for CUD operations, cache invalidation pattern via
|
|
809
|
+
`ref.invalidate()`
|
|
810
|
+
- **Screens** — one per mockup screen, using Material 3 widgets matching the mockup layout
|
|
811
|
+
- **Form Widgets** — create/edit forms with `Form` + `GlobalKey<FormState>` + reusable
|
|
812
|
+
field widgets
|
|
813
|
+
- **Route Definitions** — go_router routes for this module with `redirect` guards
|
|
814
|
+
matching the mockup role folder access control
|
|
815
|
+
- **Navigation Items** — bottom-nav / drawer entries for each role that can access this module
|
|
816
|
+
- **Complete code samples** for every widget — continuous and copy-pasteable
|
|
817
|
+
|
|
818
|
+
See `references/spec-template.md` for the exact per-module template structure.
|
|
819
|
+
|
|
820
|
+
## Changelog Append
|
|
821
|
+
|
|
822
|
+
After all specification files are successfully generated, append an entry to `CHANGELOG.md` in the application folder (`<app_folder>/CHANGELOG.md`):
|
|
823
|
+
|
|
824
|
+
1. Read `<app_folder>/CHANGELOG.md`. If it does not exist, create it with:
|
|
825
|
+
```markdown
|
|
826
|
+
# Changelog
|
|
827
|
+
|
|
828
|
+
- This file tracks all skill executions by version for this application.
|
|
829
|
+
- The highest version recorded here is the current application version.
|
|
830
|
+
- Skills MUST NOT execute for a version lower than the highest version in this file.
|
|
831
|
+
|
|
832
|
+
---
|
|
833
|
+
```
|
|
834
|
+
2. Search for a `## {version}` heading matching the current version.
|
|
835
|
+
3. If the section **exists**: append a new row to its table.
|
|
836
|
+
4. If the section **does not exist**: insert a new section after the `---` below the context header and before any existing `## vX.Y.Z` section (newest-first ordering), with a new table header and the first row.
|
|
837
|
+
5. Row format: `| {YYYY-MM-DD} | {application_name} | specgen-flutter-riverpod | {module or "All"} | Generated Flutter Riverpod mobile technical specification |`
|
|
838
|
+
6. **Never modify or delete existing rows.**
|
|
839
|
+
|
|
840
|
+
## Output Format
|
|
841
|
+
|
|
842
|
+
The generated specification is a **folder of files**, not a single document:
|
|
843
|
+
|
|
844
|
+
```
|
|
845
|
+
<app_folder>/context/specification/
|
|
846
|
+
├── SPECIFICATION.md ↠Root: TOC + shared/application-level specs
|
|
847
|
+
├── <module-1>/
|
|
848
|
+
│ └── SPEC.md ↠Module blueprint (self-contained)
|
|
849
|
+
├── <module-2>/
|
|
850
|
+
│ └── SPEC.md
|
|
851
|
+
├── <module-N>/
|
|
852
|
+
│ └── SPEC.md
|
|
853
|
+
```
|
|
854
|
+
|
|
855
|
+
## Constraints (Non-Negotiable)
|
|
856
|
+
|
|
857
|
+
These constraints apply to every code sample in the generated spec:
|
|
858
|
+
|
|
859
|
+
**Null-safe Dart everywhere.** Target Dart 3.5+ with sound null safety. No `dynamic`
|
|
860
|
+
unless the API genuinely returns unstructured JSON — prefer `Object?` with explicit
|
|
861
|
+
type checks, or strongly typed `Map<String, dynamic>` only at the JSON boundary.
|
|
862
|
+
|
|
863
|
+
**Feature-based architecture.** Every module maps to `lib/features/<module>/`. Nothing
|
|
864
|
+
module-specific leaks into `lib/shared/` or `lib/core/`. Shared widgets must be
|
|
865
|
+
genuinely reusable across at least two modules.
|
|
866
|
+
|
|
867
|
+
**No tokens in plaintext storage.** JWT access and refresh tokens are stored in
|
|
868
|
+
`flutter_secure_storage` (Keychain / Android Keystore), never in `SharedPreferences`,
|
|
869
|
+
Hive, or in-memory globals that persist beyond the process. Hive is encrypted (`HiveAesCipher`)
|
|
870
|
+
when storing user-sensitive cached data — encryption key lives in `flutter_secure_storage`.
|
|
871
|
+
|
|
872
|
+
**Riverpod for all state.** Do not use `setState` for state that crosses widgets, and
|
|
873
|
+
do not use `InheritedWidget` directly — use Riverpod providers. `setState` is only
|
|
874
|
+
acceptable for purely local widget UI state (animation controllers, hover, focus).
|
|
875
|
+
|
|
876
|
+
**Freezed for all data models.** No hand-rolled equality / hashCode / copyWith. Every
|
|
877
|
+
data class is `@freezed` with `fromJson`/`toJson` if it crosses the API boundary.
|
|
878
|
+
|
|
879
|
+
**Generated code via build_runner.** Always include the standard commands in the spec:
|
|
880
|
+
- `dart run build_runner build --delete-conflicting-outputs` — one-shot generation
|
|
881
|
+
- `dart run build_runner watch --delete-conflicting-outputs` — watch mode for development
|
|
882
|
+
|
|
883
|
+
**Material 3 only.** `ThemeData(useMaterial3: true)`. Do not mix in Cupertino-only widgets
|
|
884
|
+
in cross-platform screens — use `Adaptive*` constructors or platform-aware wrappers if
|
|
885
|
+
truly necessary.
|
|
886
|
+
|
|
887
|
+
**go_router for navigation.** Do not use raw `Navigator.push`/`Navigator.pop`. All
|
|
888
|
+
navigation is `context.go(...)`, `context.push(...)`, or `context.pop()` via go_router.
|
|
889
|
+
Deep link configuration is centralized in `lib/router/app_router.dart`.
|
|
890
|
+
|
|
891
|
+
**Consistent file naming (Dart conventions):**
|
|
892
|
+
- Widgets / classes: `PascalCase` class names in `snake_case.dart` files (e.g.,
|
|
893
|
+
`task_list_screen.dart` defines `class TaskListScreen`)
|
|
894
|
+
- Riverpod providers: generated by `riverpod_generator` from `<feature>_providers.dart`
|
|
895
|
+
- Repository files: `<feature>_repository.dart` (e.g., `task_repository.dart`)
|
|
896
|
+
- Models: `<entity>.dart` for `@freezed` data class, generated `*.freezed.dart` &
|
|
897
|
+
`*.g.dart` are committed
|
|
898
|
+
- Test files: `<file>_test.dart` co-located in `test/<feature>/` mirroring `lib/features/`
|