@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,984 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: specgen-laravel-eloquent-bladehtmx
|
|
3
|
+
model: claude-opus-4-8
|
|
4
|
+
effort: high
|
|
5
|
+
description: >
|
|
6
|
+
Generate a detailed specification document for building a monolith Laravel 12 web
|
|
7
|
+
application with server-rendered views (Blade), Tailwind CSS, Alpine.js, htmx, and
|
|
8
|
+
nwidart/laravel-modules modular packaging. Database (MongoDB, PostgreSQL, MySQL, or none),
|
|
9
|
+
authentication (Keycloak OAuth2 Client, Laravel Breeze form login, or none), scheduling
|
|
10
|
+
(Laravel Task Scheduling + Queue Batching or none), messaging (RabbitMQ pub/sub or
|
|
11
|
+
none), and internationalisation (multi-locale via Laravel's native translation system,
|
|
12
|
+
or none) are configurable based on user input.
|
|
13
|
+
Standardized input: application name (mandatory), version (mandatory), module (optional).
|
|
14
|
+
Use this skill whenever the user asks to create a spec, specification, blueprint, or
|
|
15
|
+
technical design document for a new Laravel web application with server-side rendering.
|
|
16
|
+
Also trigger when the user says things like "spec out a new Laravel project",
|
|
17
|
+
"design a Laravel web skeleton", "write a technical spec for my new Laravel app",
|
|
18
|
+
"scaffold spec for a monolith Laravel app", or any request for a specification document
|
|
19
|
+
describing a Laravel + Blade + Tailwind application. Even if the user only mentions
|
|
20
|
+
a subset of the stack (e.g., "Laravel web app" or "Laravel with Mongo" or
|
|
21
|
+
"Laravel with Keycloak"), this skill likely applies — ask and confirm.
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
# Laravel Web Application Specification Generator
|
|
25
|
+
|
|
26
|
+
This skill generates a comprehensive specification document (Markdown) that serves as a
|
|
27
|
+
blueprint for building a monolith Laravel 12 web application with server-rendered
|
|
28
|
+
views. The spec is intended to be followed by a developer or a coding agent to produce
|
|
29
|
+
a fully functional project scaffold.
|
|
30
|
+
|
|
31
|
+
The specification does NOT generate code. It produces a detailed, opinionated technical
|
|
32
|
+
document describing every layer of the application — from Composer configuration to Blade
|
|
33
|
+
layouts to middleware chains — so that implementation becomes a mechanical exercise.
|
|
34
|
+
|
|
35
|
+
## Technology Stack
|
|
36
|
+
|
|
37
|
+
### Core Stack (Always Included)
|
|
38
|
+
|
|
39
|
+
These are the fixed versions the spec targets. Do not deviate unless the user explicitly
|
|
40
|
+
requests different versions.
|
|
41
|
+
|
|
42
|
+
| Component | Version |
|
|
43
|
+
|--------------------|-----------|
|
|
44
|
+
| PHP | 8.3+ |
|
|
45
|
+
| Laravel | 12.x |
|
|
46
|
+
| Composer | 2.x |
|
|
47
|
+
| Blade | Built-in |
|
|
48
|
+
| Tailwind CSS | 4.x |
|
|
49
|
+
| Alpine.js | 3.x |
|
|
50
|
+
| htmx | 2.x |
|
|
51
|
+
| Vite | 6.x |
|
|
52
|
+
| Node.js | 22.x LTS |
|
|
53
|
+
|
|
54
|
+
### Optional Integration Versions
|
|
55
|
+
|
|
56
|
+
Include in the version table only when the corresponding integration is selected.
|
|
57
|
+
|
|
58
|
+
| Component | Version | When Selected |
|
|
59
|
+
|--------------------|-----------|----------------------|
|
|
60
|
+
| MongoDB | 8.0.x | Database = MongoDB |
|
|
61
|
+
| PostgreSQL | 17.x | Database = PostgreSQL|
|
|
62
|
+
| MySQL | 8.4.x | Database = MySQL |
|
|
63
|
+
| Keycloak | 26.5.x | Auth = Keycloak |
|
|
64
|
+
| RabbitMQ | 4.x | Messaging = yes OR Queue driver = rabbitmq |
|
|
65
|
+
|
|
66
|
+
## Core Dependencies (composer.json)
|
|
67
|
+
|
|
68
|
+
The spec must include these in the Composer configuration section (always):
|
|
69
|
+
|
|
70
|
+
- `laravel/framework` — Core framework
|
|
71
|
+
- `nwidart/laravel-modules` — Modular architecture
|
|
72
|
+
- `spatie/laravel-data` — Typed DTOs with transformation and validation
|
|
73
|
+
- `laravel-vite-plugin` — Vite integration (npm)
|
|
74
|
+
|
|
75
|
+
### Conditional Dependencies
|
|
76
|
+
|
|
77
|
+
**If Database = MongoDB:**
|
|
78
|
+
- `mongodb/laravel-mongodb` — Official MongoDB Eloquent driver
|
|
79
|
+
|
|
80
|
+
**If Database = PostgreSQL or MySQL:**
|
|
81
|
+
- Built-in Eloquent ORM + PDO driver (no extra package needed)
|
|
82
|
+
- Laravel Migrations (built-in) for schema management
|
|
83
|
+
|
|
84
|
+
**If Auth = Keycloak:**
|
|
85
|
+
- `laravel/socialite` — OAuth2 abstraction
|
|
86
|
+
- `socialiteproviders/keycloak` — Keycloak OAuth2 provider
|
|
87
|
+
|
|
88
|
+
**If Auth = Laravel Breeze (form login):**
|
|
89
|
+
- `laravel/breeze` — Simple authentication scaffolding
|
|
90
|
+
|
|
91
|
+
**If Scheduling = yes:**
|
|
92
|
+
- Built-in Laravel Task Scheduling (`Illuminate\Console\Scheduling`)
|
|
93
|
+
|
|
94
|
+
**If Scheduling = yes AND Batch Processing = yes:**
|
|
95
|
+
- Built-in `Illuminate\Bus\Batch` (Bus::batch())
|
|
96
|
+
|
|
97
|
+
**If Messaging = yes:**
|
|
98
|
+
- `vladimir-yuldashev/laravel-queue-rabbitmq` — RabbitMQ queue driver
|
|
99
|
+
- `php-amqplib/php-amqplib` — Low-level AMQP for advanced exchange patterns
|
|
100
|
+
|
|
101
|
+
**If i18n = yes:**
|
|
102
|
+
- No extra package — uses Laravel's **built-in localization** (`lang/` directory, `__()` /
|
|
103
|
+
`trans()` / `@lang` helpers, `trans_choice()` for pluralization, `app()->setLocale()`).
|
|
104
|
+
- Locale is resolved per request by a custom `SetLocale` middleware (session → cookie →
|
|
105
|
+
`Accept-Language` header → configured default).
|
|
106
|
+
- Each module contributes its own translation namespace via its module service provider
|
|
107
|
+
(`loadTranslationsFrom()`), keeping module strings self-contained.
|
|
108
|
+
|
|
109
|
+
**If Reporting = yes:**
|
|
110
|
+
- `spatie/browsershot` — PDF generation via Puppeteer (headless Chrome) with full CSS support
|
|
111
|
+
- `maatwebsite/excel` — XLSX and CSV export
|
|
112
|
+
- Requires `npm install puppeteer` on the server (Node.js + headless Chrome binary)
|
|
113
|
+
|
|
114
|
+
**Additional cross-cutting packages:**
|
|
115
|
+
- `spatie/laravel-permission` — RBAC (roles and permissions)
|
|
116
|
+
- `owen-it/laravel-auditing` — Audit trail (created_by, updated_by, field change history)
|
|
117
|
+
- `spatie/laravel-health` — Health check endpoints
|
|
118
|
+
- `spatie/laravel-view-models` — Typed view models for Blade templates
|
|
119
|
+
|
|
120
|
+
## When the Skill Triggers
|
|
121
|
+
|
|
122
|
+
Generate the spec when the user provides an **application name** and **version** that
|
|
123
|
+
corresponds to one of the custom applications defined in `CLAUDE.md`. The skill
|
|
124
|
+
reads all required inputs from the project's context files — no interactive Q&A is needed
|
|
125
|
+
for the core inputs.
|
|
126
|
+
|
|
127
|
+
The user invokes this skill by specifying the target application and version, for example:
|
|
128
|
+
- `/specgen-laravel-eloquent-bladehtmx hub_middleware v1.0.3`
|
|
129
|
+
- `/specgen-laravel-eloquent-bladehtmx hub_middleware v1.0.3 module:Location Information`
|
|
130
|
+
- `/specgen-laravel-eloquent-bladehtmx "Hub Middleware" v1.0.3`
|
|
131
|
+
|
|
132
|
+
The skill then locates the matching context folder and reads all input files automatically.
|
|
133
|
+
|
|
134
|
+
## Version Gate
|
|
135
|
+
|
|
136
|
+
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`):
|
|
137
|
+
|
|
138
|
+
1. If `<app_folder>/CHANGELOG.md` does not exist, skip this check (first-ever execution for this application).
|
|
139
|
+
2. If `<app_folder>/CHANGELOG.md` exists, scan all `## vX.Y.Z` headings and determine the **highest version** using semantic versioning comparison.
|
|
140
|
+
3. Compare the requested version against the highest version:
|
|
141
|
+
- If requested version **>=** highest version: proceed normally.
|
|
142
|
+
- 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.
|
|
143
|
+
|
|
144
|
+
## Input Resolution
|
|
145
|
+
|
|
146
|
+
This skill uses standardized input resolution. Provide:
|
|
147
|
+
|
|
148
|
+
| Argument | Required | Example | Description |
|
|
149
|
+
|----------|----------|---------|-------------|
|
|
150
|
+
| `<application>` | Yes | `hub_middleware` | Application name to locate the context folder |
|
|
151
|
+
| `<version>` | Yes | `v1.0.3` | Version to scope processing |
|
|
152
|
+
| `module:<name>` | No | `module:Location Information` | Limit generation to a single module |
|
|
153
|
+
|
|
154
|
+
### Application Folder Resolution
|
|
155
|
+
|
|
156
|
+
The application name is matched against root-level application folders:
|
|
157
|
+
1. Strip any leading `<number>_` prefix from folder names (e.g., `1_hub_middleware` → `hub_middleware`)
|
|
158
|
+
2. Match case-insensitively against the provided application name
|
|
159
|
+
3. Accept snake_case, kebab-case, or title-case input (all match the same folder)
|
|
160
|
+
4. If no match found, list available applications and stop
|
|
161
|
+
|
|
162
|
+
### Auto-Resolved Paths
|
|
163
|
+
|
|
164
|
+
| File | Resolved Path |
|
|
165
|
+
|------|---------------|
|
|
166
|
+
| PRD.md | `<app_folder>/context/PRD.md` |
|
|
167
|
+
| Module Models | `<app_folder>/context/model/` |
|
|
168
|
+
| HTML Mockups | `<app_folder>/context/mockup/` |
|
|
169
|
+
| Output (specification) | `<app_folder>/context/specification/` |
|
|
170
|
+
|
|
171
|
+
### Example Invocations
|
|
172
|
+
|
|
173
|
+
- `/specgen-laravel-eloquent-bladehtmx hub_middleware v1.0.3` (all modules)
|
|
174
|
+
- `/specgen-laravel-eloquent-bladehtmx hub_middleware v1.0.3 module:Location Information` (one module)
|
|
175
|
+
- `/specgen-laravel-eloquent-bladehtmx "Hub Middleware" v1.0.3`
|
|
176
|
+
|
|
177
|
+
### Version Filtering
|
|
178
|
+
|
|
179
|
+
When a version is provided, only include user stories, NFRs, and constraints from versions
|
|
180
|
+
<= the provided version. For example, if `v1.0.3` is specified:
|
|
181
|
+
- Include items tagged `[v1.0.0]`, `[v1.0.1]`, `[v1.0.2]`, `[v1.0.3]`
|
|
182
|
+
- Exclude items tagged `[v1.0.4]` or later
|
|
183
|
+
- Version comparison uses semantic versioning order
|
|
184
|
+
|
|
185
|
+
### Module Filtering
|
|
186
|
+
|
|
187
|
+
When `module:<name>` is provided:
|
|
188
|
+
- Only generate the `SPEC.md` for that specific module
|
|
189
|
+
- Other existing module spec files remain untouched
|
|
190
|
+
- `SPECIFICATION.md` (root) gets a partial update — only that module's entry in the TOC
|
|
191
|
+
is added or updated; all other TOC entries are preserved as-is
|
|
192
|
+
|
|
193
|
+
## Gathering Input
|
|
194
|
+
|
|
195
|
+
The specification is driven by **six input sources** that are read from the project's
|
|
196
|
+
context files. The skill does NOT ask the user for database, authentication, scheduling,
|
|
197
|
+
or messaging choices — it **determines** these automatically from the context.
|
|
198
|
+
|
|
199
|
+
### Input 1: Application Name (from CLAUDE.md)
|
|
200
|
+
|
|
201
|
+
From CLAUDE.md (already loaded in context), locate the target application under the **Custom Applications**
|
|
202
|
+
section. Extract:
|
|
203
|
+
|
|
204
|
+
- **Application name**: The section heading (e.g., "Hub Middleware", "HC Adapter")
|
|
205
|
+
- **Application description**: The description paragraph below the heading
|
|
206
|
+
- **Dependencies**: The "Depends on" list — this is the primary source for determining
|
|
207
|
+
optional components (see [Determining Optional Components](#determining-optional-components))
|
|
208
|
+
|
|
209
|
+
The application name is used to derive:
|
|
210
|
+
- **Project slug**: Kebab-case of the application name (e.g., `hub-middleware`)
|
|
211
|
+
- **Namespace root**: `App\Modules` (for nwidart/laravel-modules) or `App` (for core)
|
|
212
|
+
|
|
213
|
+
### Input 2: User Stories (from PRD.md)
|
|
214
|
+
|
|
215
|
+
Read `<app_folder>/context/PRD.md`. This file contains all user stories
|
|
216
|
+
organized by module. Extract:
|
|
217
|
+
|
|
218
|
+
- **System modules**: Modules under the `# System Module` heading (e.g., User, Notification,
|
|
219
|
+
Activities, Audit Trail). These become system-level modules in the spec.
|
|
220
|
+
- **Business modules**: Modules under the `# Business Module` heading (e.g., Location
|
|
221
|
+
Information, Corridor, Employer). These become business-level modules.
|
|
222
|
+
- **User stories per module**: Each `### User Story` section contains tagged items like
|
|
223
|
+
`[USHM00108] As a user, I want to...`. These define the functional requirements for
|
|
224
|
+
each module's service interface and page controllers.
|
|
225
|
+
|
|
226
|
+
The user stories directly inform:
|
|
227
|
+
- Which CRUD operations each module's service must expose
|
|
228
|
+
- Which controllers and Blade views are needed
|
|
229
|
+
- Which form fields and validation rules apply
|
|
230
|
+
|
|
231
|
+
**Important:** Items with strikethrough (`~~text~~`) are deprecated — do NOT include them
|
|
232
|
+
as active requirements. Instead, list them in the "Removed / Replaced" subsection of the
|
|
233
|
+
traceability table (see spec-template.md) so that developers can see what was removed and
|
|
234
|
+
which version removed it. If a deprecated item has a replacement (e.g., `USHM00015` replaced
|
|
235
|
+
by `USHM00222`), note the replacement ID.
|
|
236
|
+
|
|
237
|
+
- **Version tags per item**: Each `### User Story`, `### Non Functional Requirement`,
|
|
238
|
+
and `### Constraint` section contains one or more version blocks formatted as `[v1.0.x]`.
|
|
239
|
+
Items listed under each version tag belong to that version. The skill must track the
|
|
240
|
+
version tag for each item (user story, NFR, constraint) and carry it through to the
|
|
241
|
+
generated specification's traceability section. When a version block explicitly lists
|
|
242
|
+
"Removed ... from previous version", record those removals in a "Removed / Replaced"
|
|
243
|
+
subsection with the version that removed them and the replacement ID (if any).
|
|
244
|
+
|
|
245
|
+
### Input 3: Non-Functional Requirements (from PRD.md)
|
|
246
|
+
|
|
247
|
+
Within the same `PRD.md`, each module has a `### Non Functional Requirement` section
|
|
248
|
+
with tagged items like `[NFRHM0120]`. These inform:
|
|
249
|
+
|
|
250
|
+
- Data storage strategies (e.g., "stored in JWT token", "stored in the database")
|
|
251
|
+
- Integration patterns (e.g., "API call to SSO service", "sent asynchronously")
|
|
252
|
+
- Performance constraints (e.g., "automatically deleted after 30 days")
|
|
253
|
+
- Security requirements (e.g., "require user to relogin")
|
|
254
|
+
|
|
255
|
+
NFRs should be mapped to specific technical decisions in the spec — for example, an NFR
|
|
256
|
+
stating "stored in JWT token" confirms stateless auth, while "sent asynchronously" confirms
|
|
257
|
+
event-driven processing.
|
|
258
|
+
|
|
259
|
+
### Input 4: Constraints (from PRD.md)
|
|
260
|
+
|
|
261
|
+
Within the same `PRD.md`, each module has a `### Constraint` section with tagged
|
|
262
|
+
items like `[CONSHM042]`. These define hard boundaries that the spec must enforce:
|
|
263
|
+
|
|
264
|
+
- Field-level restrictions (e.g., "can only change name and phone number")
|
|
265
|
+
- Feature boundaries (e.g., "only 2 delivery channels supported")
|
|
266
|
+
- Scope limitations (e.g., "does not manage any user, permissions and roles")
|
|
267
|
+
|
|
268
|
+
Constraints are embedded directly into the relevant module blueprint — they inform
|
|
269
|
+
service interface contracts, validation rules, and UI form configurations.
|
|
270
|
+
|
|
271
|
+
### Input 5: Module Model (from model/ folder)
|
|
272
|
+
|
|
273
|
+
Read `<app_folder>/context/model/MODEL.md` first as the index, then read the
|
|
274
|
+
individual module model files in each module subfolder.
|
|
275
|
+
|
|
276
|
+
**MODEL.md** provides:
|
|
277
|
+
- Summary table of all modules with collection/table counts and design decisions
|
|
278
|
+
- Links to each module's detailed model files
|
|
279
|
+
|
|
280
|
+
**Per-module files** (e.g., `model/location-information/model.md`):
|
|
281
|
+
- Complete field definitions with types and constraints
|
|
282
|
+
- Embedded vs. referenced relationships
|
|
283
|
+
- Collection/table names
|
|
284
|
+
- Index specifications
|
|
285
|
+
- Audit field patterns
|
|
286
|
+
|
|
287
|
+
**Per-module schema** (e.g., `model/location-information/schemas.json`):
|
|
288
|
+
- JSON schemas defining exact field types, required fields, and validation rules
|
|
289
|
+
|
|
290
|
+
**Per-module diagram** (e.g., `model/location-information/document-model.mermaid`):
|
|
291
|
+
- Visual representation of data structure and relationships
|
|
292
|
+
|
|
293
|
+
The module model directly maps to:
|
|
294
|
+
- Eloquent Models (field-for-field, not placeholder)
|
|
295
|
+
- Migration scripts (for SQL databases)
|
|
296
|
+
- Repository/query patterns
|
|
297
|
+
- spatie/laravel-data DTO structures matching the actual module fields
|
|
298
|
+
- Service interface method signatures
|
|
299
|
+
|
|
300
|
+
- **Version tracking**: The MODEL.md summary table includes a "Versions" column listing
|
|
301
|
+
which versions each module participates in (e.g., "1.0.0, 1.0.1, 1.0.3"). Per-module
|
|
302
|
+
model.md files may also include version annotations on fields and indexes. The skill
|
|
303
|
+
must carry these version tags into the generated specification.
|
|
304
|
+
|
|
305
|
+
### Input 6: HTML Mockup Screens (from mockup/ folder)
|
|
306
|
+
|
|
307
|
+
Read `<app_folder>/context/mockup/MOCKUP.html` first as the index page, then
|
|
308
|
+
read the HTML files organized by role in subfolders.
|
|
309
|
+
|
|
310
|
+
**MOCKUP.html** provides:
|
|
311
|
+
- Application identity (name, version, short name)
|
|
312
|
+
- Design tokens: fonts, colors, spacing from Tailwind config
|
|
313
|
+
- List of user roles and their screen sets
|
|
314
|
+
- Setup instructions for the shared Mockup Hub (`<root>/mockup`)
|
|
315
|
+
|
|
316
|
+
**Role-specific subfolders** (e.g., `mockup/hub_administrator/content/`):
|
|
317
|
+
- Individual HTML screens for each page in the application
|
|
318
|
+
- Screen layout: which components are used (tables, forms, cards, tabs, modals)
|
|
319
|
+
- Navigation structure from sidebar HTML files
|
|
320
|
+
- Data display patterns (list pages, detail pages, create/edit forms)
|
|
321
|
+
|
|
322
|
+
**IMPORTANT — Role folders inform access control, NOT URL paths.** The role-specific
|
|
323
|
+
folder structure (e.g., `mockup/hub_administrator/content/corridor.html`) determines:
|
|
324
|
+
1. Which role can access the page → `middleware('role:hub_administrator')`
|
|
325
|
+
2. Which sidebar navigation items appear for each role
|
|
326
|
+
It does NOT determine the URL path. The URL path is always module-based:
|
|
327
|
+
- `Route::get('/corridor', ...)` — NOT `Route::get('/hub_administrator/corridor', ...)`
|
|
328
|
+
- Fragment URL: `Route::get('/corridor/fragments/...', ...)` — NOT role-prefixed
|
|
329
|
+
|
|
330
|
+
**Shared partials** (e.g., `mockup/partials/`):
|
|
331
|
+
- `header.html` — Header bar layout and elements
|
|
332
|
+
- `footer.html` — Footer layout
|
|
333
|
+
- `sidebar-<role>.html` — Per-role navigation menus
|
|
334
|
+
- `shell.html` — Page shell/wrapper structure
|
|
335
|
+
|
|
336
|
+
The mockup screens directly map to:
|
|
337
|
+
- Blade page templates (one per HTML screen)
|
|
338
|
+
- Blade partial templates (for htmx partial updates)
|
|
339
|
+
- Controller endpoints (one per screen)
|
|
340
|
+
- View model classes (with fields matching the data shown in each screen)
|
|
341
|
+
- Sidebar navigation items per role
|
|
342
|
+
- Form field layouts and validation display
|
|
343
|
+
- Design tokens for Tailwind configuration (colors, fonts from MOCKUP.html)
|
|
344
|
+
|
|
345
|
+
- **Version tracking**: The MOCKUP.html index page shows a version tag on each screen
|
|
346
|
+
card (e.g., `v1.0.0`, `v1.0.3`). Individual mockup screens may include version
|
|
347
|
+
annotations. The skill must associate each mockup screen with its version and carry
|
|
348
|
+
this through to the generated specification.
|
|
349
|
+
|
|
350
|
+
## PRD.md Extended Sections
|
|
351
|
+
|
|
352
|
+
Before determining optional components, check PRD.md for the following extended sections and extract their content for use throughout specification generation:
|
|
353
|
+
|
|
354
|
+
### Architecture Principle Extraction
|
|
355
|
+
|
|
356
|
+
If PRD.md contains an `# Architecture Principle` section, read it and extract architectural patterns as a structured context object. These patterns serve as **primary signals** for optional component determination and specification content:
|
|
357
|
+
|
|
358
|
+
| Pattern to Extract | How It Influences the Specification |
|
|
359
|
+
|---|---|
|
|
360
|
+
| Framework mention (e.g., "Laravel") | Validates technology stack choice |
|
|
361
|
+
| "Monolithic" / "modular architecture" | Validates nwidart/laravel-modules structure; inter-module via Laravel events |
|
|
362
|
+
| "Stateless" | Confirms no server-side session — JWT/OAuth2 token-based auth |
|
|
363
|
+
| "Event-driven" | Map to Laravel Event Broadcasting and Event Listeners; include event catalog |
|
|
364
|
+
| "Message driven" / "message queue" | Map to Laravel Queue Jobs; validate RabbitMQ integration |
|
|
365
|
+
| "Document based database" / "MongoDB" | Primary signal for Database = MongoDB |
|
|
366
|
+
| "Container based deployment" | Confirms `.env` environment variable configuration |
|
|
367
|
+
|
|
368
|
+
If the section is absent, proceed with existing CLAUDE.md-only detection.
|
|
369
|
+
|
|
370
|
+
### Design System Extraction
|
|
371
|
+
|
|
372
|
+
If PRD.md contains a `# Design System` section with a file reference (e.g., `[DESIGN_SYSTEM.md](reference/DESIGN_SYSTEM.md)`):
|
|
373
|
+
1. Resolve the path relative to PRD.md and read the referenced file
|
|
374
|
+
2. Extract design tokens: color palettes, typography, component patterns
|
|
375
|
+
3. Include a "Design System Integration" subsection in SPECIFICATION.md specifying:
|
|
376
|
+
- Tailwind CSS custom theme configuration (colors, fonts)
|
|
377
|
+
- Blade layout template design token variables
|
|
378
|
+
- CSS variable definitions
|
|
379
|
+
4. In per-module SPEC.md, reference which design tokens apply to specific components
|
|
380
|
+
|
|
381
|
+
If the section is absent, use design tokens from MOCKUP.html Tailwind config (existing behavior).
|
|
382
|
+
|
|
383
|
+
### High Level Process Flow Extraction
|
|
384
|
+
|
|
385
|
+
If PRD.md contains a `# High Level Process Flow` section:
|
|
386
|
+
1. Parse all named process flows and their ordered steps
|
|
387
|
+
2. Each process flow is an **authoritative source** for messaging pipeline sections in per-module SPEC.md:
|
|
388
|
+
- Each step maps to a Laravel Queue Job, Event Listener, or Controller method
|
|
389
|
+
- Error paths generate corresponding exception handlers and failed job configurations
|
|
390
|
+
- ACK/NACK patterns become outbound message publisher specifications
|
|
391
|
+
3. Include a "Process Flow Implementation" subsection in each affected module's SPEC.md mapping flow steps to service methods
|
|
392
|
+
4. Generate an event catalog in SPECIFICATION.md listing all domain events from process flows
|
|
393
|
+
|
|
394
|
+
If the section is absent, derive messaging patterns from NFRs only (existing behavior).
|
|
395
|
+
|
|
396
|
+
---
|
|
397
|
+
|
|
398
|
+
## Determining Optional Components
|
|
399
|
+
|
|
400
|
+
Instead of asking the user, the skill determines optional components by analyzing the
|
|
401
|
+
dependencies listed in `CLAUDE.md`, the `# Architecture Principle` section in PRD.md (if present),
|
|
402
|
+
and cross-referencing with PRD.md NFRs and constraints.
|
|
403
|
+
|
|
404
|
+
### Database Detection
|
|
405
|
+
|
|
406
|
+
**First check PRD.md `# Architecture Principle`**: If it explicitly mentions a database type (e.g., "document based database", "MongoDB", "relational database", "MySQL"), use that as the primary signal.
|
|
407
|
+
|
|
408
|
+
**Fallback to CLAUDE.md**: Examine the "Depends on" list in CLAUDE.md for the target application:
|
|
409
|
+
|
|
410
|
+
| Dependency Pattern | Database Selection |
|
|
411
|
+
|---|---|
|
|
412
|
+
| References "Hub Database" (MongoDB) | Database = MongoDB |
|
|
413
|
+
| References "HC Database" or "SC Database" (MySQL) | Database = MySQL |
|
|
414
|
+
| No database dependency listed | Database = none |
|
|
415
|
+
|
|
416
|
+
Also check `CLAUDE.md`'s database section for the exact database name, and read
|
|
417
|
+
`ENVIRONMENT.md` (in the project root) for host, port, and credentials to use in the
|
|
418
|
+
spec's application configuration.
|
|
419
|
+
|
|
420
|
+
### Authentication Detection
|
|
421
|
+
|
|
422
|
+
| Dependency Pattern | Auth Selection |
|
|
423
|
+
|---|---|
|
|
424
|
+
| References "Hub Single Sign On" (Keycloak) | Auth = Keycloak |
|
|
425
|
+
| PRD.md constraint says "does not manage any user, permissions and roles" | Auth = none |
|
|
426
|
+
| PRD.md NFRs reference "SSO service" or "JWT token" | Auth = Keycloak |
|
|
427
|
+
| No SSO/Keycloak dependency but has user management stories | Auth = form |
|
|
428
|
+
|
|
429
|
+
If Auth = Keycloak, also extract from CLAUDE.md:
|
|
430
|
+
- Keycloak version from "Hub Single Sign On" section
|
|
431
|
+
- Keycloak realm: Default derived from project name
|
|
432
|
+
- Keycloak client ID: Default `<project-slug>-web`
|
|
433
|
+
- Keycloak issuer URI: Default `http://localhost:8180/realms/<realm>`
|
|
434
|
+
- Keycloak roles: Infer from mockup sidebar roles (e.g., `hub_administrator` → `HUB_ADMINISTRATOR`)
|
|
435
|
+
|
|
436
|
+
### Messaging Detection
|
|
437
|
+
|
|
438
|
+
| Dependency Pattern | Messaging Selection |
|
|
439
|
+
|---|---|
|
|
440
|
+
| References "Hub to HC Adapter Message Queue" or "Hub to SC Adapter Message Queue" (RabbitMQ) | Messaging = yes |
|
|
441
|
+
| No message queue dependency listed | Messaging = no |
|
|
442
|
+
|
|
443
|
+
If Messaging = yes, also extract the RabbitMQ version from the corresponding message
|
|
444
|
+
queue section in CLAUDE.md.
|
|
445
|
+
|
|
446
|
+
### Scheduling Detection
|
|
447
|
+
|
|
448
|
+
Scheduling is determined from PRD.md content:
|
|
449
|
+
|
|
450
|
+
| Content Pattern | Scheduling Selection |
|
|
451
|
+
|---|---|
|
|
452
|
+
| NFRs mention "automatically deleted after X days", "scheduled", "periodic", "batch processing" | Scheduling = yes |
|
|
453
|
+
| User stories describe recurring jobs, cleanup tasks, or time-triggered operations | Scheduling = yes |
|
|
454
|
+
| No scheduling-related requirements found | Scheduling = no |
|
|
455
|
+
|
|
456
|
+
**If Scheduling = yes**, further determine:
|
|
457
|
+
- **Batch Processing = yes** if NFRs mention "batch processing", "ETL", "bulk import/export",
|
|
458
|
+
or processing large volumes of data with reader/processor/writer patterns
|
|
459
|
+
|
|
460
|
+
### Reporting Detection
|
|
461
|
+
|
|
462
|
+
Reporting is determined from PRD.md content:
|
|
463
|
+
|
|
464
|
+
| Content Pattern | Reporting Selection |
|
|
465
|
+
|---|---|
|
|
466
|
+
| NFRs mention "report", "Report interface", "generate report", "report generation" | Reporting = yes |
|
|
467
|
+
| User stories describe generating/downloading PDF, Excel, or CSV reports | Reporting = yes |
|
|
468
|
+
| A "Report" module exists in PRD.md with NFRs defining a Report interface | Reporting = yes |
|
|
469
|
+
| No reporting-related requirements found | Reporting = no |
|
|
470
|
+
|
|
471
|
+
**If Reporting = yes**, the spec includes:
|
|
472
|
+
- Puppeteer via Browsershot for PDF generation from Blade templates (full CSS/Tailwind support)
|
|
473
|
+
- Laravel Excel for XLSX and CSV export
|
|
474
|
+
- `ReportDefinition` interface for modules to implement
|
|
475
|
+
- `ReportService` orchestrating render → export
|
|
476
|
+
- Report registry persisted in the database
|
|
477
|
+
- Report controller with parameter form and download endpoint
|
|
478
|
+
- Blade templates for report list, parameter form, and PDF report layouts (Tailwind-styled)
|
|
479
|
+
|
|
480
|
+
### Internationalisation Detection
|
|
481
|
+
|
|
482
|
+
Internationalisation is determined from PRD.md content:
|
|
483
|
+
|
|
484
|
+
| Content Pattern | i18n Selection |
|
|
485
|
+
|---|---|
|
|
486
|
+
| PRD.md mentions multiple languages or localization (e.g., "English and Bahasa Malaysia", "multilingual", "support multiple locales") | i18n = yes |
|
|
487
|
+
| NFRs require translatable UI, locale-specific date/number formatting, or a language switcher | i18n = yes |
|
|
488
|
+
| User stories describe choosing/switching the interface language | i18n = yes |
|
|
489
|
+
| No language/localization requirements found | i18n = no |
|
|
490
|
+
|
|
491
|
+
**If i18n = yes**, the spec includes:
|
|
492
|
+
- `config/app.php` `locale` / `fallback_locale` + an `app.supported_locales` list
|
|
493
|
+
- A `SetLocale` middleware (session → cookie → `Accept-Language` → default) registered on the web group
|
|
494
|
+
- Per-locale translation files (`lang/<locale>/...`) plus per-module translation namespaces
|
|
495
|
+
- A locale-switch route/controller persisting the choice to session + cookie
|
|
496
|
+
- A language switcher partial (Alpine.js dropdown in the header)
|
|
497
|
+
- Localized validation messages (`lang/<locale>/validation.php`)
|
|
498
|
+
|
|
499
|
+
**If i18n = no**, do NOT generate a locale/language switcher or any translation scaffolding —
|
|
500
|
+
Blade templates use literal copy. Never add a non-functional language switcher "for future use".
|
|
501
|
+
|
|
502
|
+
### Summary of Determination
|
|
503
|
+
|
|
504
|
+
After analyzing all inputs, produce a determination summary before generating the spec.
|
|
505
|
+
Present it to the user for confirmation:
|
|
506
|
+
|
|
507
|
+
```
|
|
508
|
+
Optional Component Determination:
|
|
509
|
+
- Database: MongoDB (from CLAUDE.md → depends on Hub Database)
|
|
510
|
+
- Authentication: Keycloak (from CLAUDE.md → depends on Hub Single Sign On)
|
|
511
|
+
- Scheduling: yes (from PRD.md → NFR mentions automatic deletion)
|
|
512
|
+
- Batch Processing: no
|
|
513
|
+
- Messaging: yes (from CLAUDE.md → depends on Hub to HC/SC Adapter Message Queue)
|
|
514
|
+
- Reporting: yes (from PRD.md → Report module with Report interface NFR)
|
|
515
|
+
- Internationalisation: yes (en, ms) (from PRD.md → English + Bahasa Malaysia required)
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
If the user disagrees with any determination, allow them to override before proceeding.
|
|
519
|
+
|
|
520
|
+
## Required Inputs
|
|
521
|
+
|
|
522
|
+
After determination, these values are needed. Most are derived automatically:
|
|
523
|
+
|
|
524
|
+
**Auto-derived from context files:**
|
|
525
|
+
- **Application name**: From CLAUDE.md section heading
|
|
526
|
+
- **Project slug**: Kebab-case of application name
|
|
527
|
+
- **Namespace root**: `App` (core) / `Modules\<ModuleName>` (for modules)
|
|
528
|
+
- **Application description**: From CLAUDE.md description
|
|
529
|
+
- **Modules**: From PRD.md module headings + model/MODEL.md
|
|
530
|
+
- **Database**: Auto-determined (see above)
|
|
531
|
+
- **Authentication**: Auto-determined (see above)
|
|
532
|
+
- **Scheduling**: Auto-determined (see above)
|
|
533
|
+
- **Messaging**: Auto-determined (see above)
|
|
534
|
+
- **Database name/credentials**: From ENVIRONMENT.md (root-level file with local environment credentials)
|
|
535
|
+
- **User roles**: From mockup sidebar files
|
|
536
|
+
- **Design tokens**: From MOCKUP.html Tailwind config
|
|
537
|
+
|
|
538
|
+
**Auto-derived from CLAUDE.md (Port Allocation table):**
|
|
539
|
+
- **Server port**: Look up the application's port from the `Port Allocation` table in the `Custom Applications` section of `CLAUDE.md`. Do NOT hardcode a default — the port MUST match the allocated port for this application.
|
|
540
|
+
|
|
541
|
+
**Optional (use sensible defaults if not found in context):**
|
|
542
|
+
- **Default theme**: Default `light` (supports `light`/`dark`)
|
|
543
|
+
- **Log level**: Default `info` for application, `warning` for frameworks
|
|
544
|
+
- **Default locale**: Default `en` (only relevant if i18n = yes)
|
|
545
|
+
- **Supported locales**: Derived from PRD.md language requirements (e.g., `en`, `ms`); default `['en']`
|
|
546
|
+
|
|
547
|
+
## Generating the Specification
|
|
548
|
+
|
|
549
|
+
Once inputs are gathered from context files and optional components are determined,
|
|
550
|
+
generate the specification as a **multi-file output split by module**. Read the spec
|
|
551
|
+
template at `references/spec-template.md` for the exact structure and content of each
|
|
552
|
+
section. The template is the authoritative guide — follow it closely.
|
|
553
|
+
|
|
554
|
+
The specification is split into two categories:
|
|
555
|
+
|
|
556
|
+
1. **Root `SPECIFICATION.md`** — Contains the Table of Contents, shared infrastructure,
|
|
557
|
+
and application-level sections that apply across all modules.
|
|
558
|
+
2. **Per-module `<module-name>/SPEC.md`** — Each module gets its own folder with
|
|
559
|
+
a self-contained specification file covering that module's complete blueprint.
|
|
560
|
+
|
|
561
|
+
This split enables a coding agent to:
|
|
562
|
+
- First, scaffold the shared infrastructure from `SPECIFICATION.md`
|
|
563
|
+
- Then, implement each module independently by picking up its `<module>/SPEC.md`
|
|
564
|
+
|
|
565
|
+
**Important:** The generated spec must use **real module data** from the context files,
|
|
566
|
+
not generic placeholders. Specifically:
|
|
567
|
+
|
|
568
|
+
- **Modules** must use the actual module names from PRD.md and MODEL.md
|
|
569
|
+
(e.g., `LocationInformation`, `Corridor`, `Employer` — not `Module1`, `Module2`)
|
|
570
|
+
- **Model fields** must match the actual fields defined in the module model
|
|
571
|
+
files (e.g., `model/location-information/model.md`), not placeholder `field_one`/`field_two`
|
|
572
|
+
- **Service interfaces** must expose methods matching the actual user stories (e.g., if
|
|
573
|
+
a story says "view provinces by country", the service needs `listProvincesByCountry()`)
|
|
574
|
+
- **Controllers** must map to the actual mockup screens (e.g., if
|
|
575
|
+
`hub_administrator/content/location_information.html` exists, there must be a matching
|
|
576
|
+
controller endpoint and Blade page). The controller URL is module-based (e.g.,
|
|
577
|
+
`/location-information`), NOT role-prefixed (e.g., NOT `/hub_administrator/location-information`).
|
|
578
|
+
The mockup's role folder determines `middleware('role:...')` annotations, not URL structure.
|
|
579
|
+
- **Sidebar navigation** must match the mockup sidebar files per role. Sidebar hrefs use
|
|
580
|
+
module-based paths (e.g., `/corridor`, `/quota`) — the role determines which items
|
|
581
|
+
appear in the sidebar, not the URL prefix
|
|
582
|
+
- **Form fields** must match what the mockup screens display
|
|
583
|
+
- **Design tokens** (colors, fonts) must match the MOCKUP.html Tailwind configuration
|
|
584
|
+
- **Version tags**: Every user story ID, NFR ID, constraint ID, and mockup screen in
|
|
585
|
+
the traceability section must include its version tag (e.g., `USHM00228 [v1.0.3]`).
|
|
586
|
+
This enables incremental implementation by version. **ALL traceability sub-tables
|
|
587
|
+
(User Stories, NFRs, AND Constraints) MUST include the `| Version |` column.** Do not
|
|
588
|
+
omit the Version column from any table — even if a module only has v1.0.0 items.
|
|
589
|
+
- **Removed / Replaced items**: The traceability section must include a "Removed / Replaced"
|
|
590
|
+
subsection listing any deprecated items from previous versions — showing the removed ID,
|
|
591
|
+
the version that removed it, the replacement ID (if any), and a brief reason. This
|
|
592
|
+
ensures developers can see what was removed and understand the evolution of requirements.
|
|
593
|
+
If a module has no removed items, include the subsection with `_None._` to make it
|
|
594
|
+
explicit that nothing was removed.
|
|
595
|
+
|
|
596
|
+
### Output Structure
|
|
597
|
+
|
|
598
|
+
```
|
|
599
|
+
<app_folder>/context/specification/
|
|
600
|
+
├── SPECIFICATION.md ↠TOC + shared/application-level specs
|
|
601
|
+
├── location-information/
|
|
602
|
+
│ └── SPEC.md ↠Module blueprint for Location Information
|
|
603
|
+
├── corridor/
|
|
604
|
+
│ └── SPEC.md ↠Module blueprint for Corridor
|
|
605
|
+
├── employer/
|
|
606
|
+
│ └── SPEC.md ↠Module blueprint for Employer
|
|
607
|
+
├── ... ↠One folder per module from PRD.md
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
### What Goes in `SPECIFICATION.md` (Root)
|
|
611
|
+
|
|
612
|
+
The root file contains the TOC and all shared/application-level sections. These are the
|
|
613
|
+
sections that a coding agent implements **first** before any module work:
|
|
614
|
+
|
|
615
|
+
#### 1. Project Overview
|
|
616
|
+
Project metadata, application description, technology stack summary, the complete
|
|
617
|
+
list of user roles extracted from mockup sidebar files, and the **Module Index** —
|
|
618
|
+
a table listing every module with a link to its `<module>/SPEC.md` file.
|
|
619
|
+
|
|
620
|
+
#### 2. Composer & npm Configuration
|
|
621
|
+
Complete `composer.json` structure with all dependencies (core + selected conditional).
|
|
622
|
+
Complete `package.json` with Vite, Tailwind CSS, Alpine.js, htmx, and build scripts.
|
|
623
|
+
|
|
624
|
+
#### 3. Application Configuration *(conditional content varies)*
|
|
625
|
+
Full `config/` files covering database connection (MongoDB URI or SQL DSN
|
|
626
|
+
depending on selection), auth settings (Keycloak/OAuth2 if selected, or Breeze if selected),
|
|
627
|
+
scheduling config (if selected), theme defaults, and logging configuration. **All
|
|
628
|
+
environment-sensitive values (ports, hostnames, credentials, URIs) MUST be externalized
|
|
629
|
+
using Laravel's `env('VAR', 'default')` helper in config files**, with sensible defaults
|
|
630
|
+
for local development. Production overrides via system environment variables or
|
|
631
|
+
`.env.production`.
|
|
632
|
+
|
|
633
|
+
#### 3a. Application Version Configuration
|
|
634
|
+
The application configuration MUST include a version value set via environment variable
|
|
635
|
+
with a default derived from the version argument provided during skill invocation. If
|
|
636
|
+
multiple versions were provided, use the highest one.
|
|
637
|
+
|
|
638
|
+
In `config/app.php`:
|
|
639
|
+
```php
|
|
640
|
+
'version' => env('APP_VERSION', '1.0.0'),
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
The application MUST expose this version in the **footer** of every page. The shared footer
|
|
644
|
+
Blade partial (`resources/views/partials/footer.blade.php`) must render
|
|
645
|
+
`config('app.version')` as: `v{version}` (e.g., `v1.0.3`).
|
|
646
|
+
|
|
647
|
+
The `.env` file must include `APP_VERSION={version}` with the actual version value.
|
|
648
|
+
|
|
649
|
+
The `composer.json` `version` field MUST also be set to the version value (e.g., `1.0.3`).
|
|
650
|
+
|
|
651
|
+
#### 3b. `.env` File Generation from ENVIRONMENT.md
|
|
652
|
+
Generate the `.env` file at the project root by reading `ENVIRONMENT.md` from the project root.
|
|
653
|
+
The `.env` file maps ENVIRONMENT.md credential and platform values to the environment variable
|
|
654
|
+
names referenced in `config/` files via `env()` calls. The spec must define the complete
|
|
655
|
+
`.env` content with actual values from ENVIRONMENT.md.
|
|
656
|
+
|
|
657
|
+
**Process:**
|
|
658
|
+
1. Read `ENVIRONMENT.md` from the project root
|
|
659
|
+
2. Extract credential values from `ENVIRONMENT.md` (`# Supporting 3rd Party Applications`
|
|
660
|
+
for database hosts, ports, usernames, passwords, plus Keycloak/Mail/RabbitMQ); read
|
|
661
|
+
toolchain paths (Node.js, PHP) from `DEVTOOL.md`
|
|
662
|
+
3. Map each value to the corresponding `env('VAR')` name used in Laravel config files
|
|
663
|
+
4. Generate the `.env` file with `KEY=value` pairs
|
|
664
|
+
|
|
665
|
+
**Example `.env` output (derived from ENVIRONMENT.md):**
|
|
666
|
+
```properties
|
|
667
|
+
APP_NAME="HC Support Portal"
|
|
668
|
+
APP_ENV=local
|
|
669
|
+
APP_DEBUG=true
|
|
670
|
+
APP_URL=http://localhost:<port from CLAUDE.md Port Allocation table>
|
|
671
|
+
|
|
672
|
+
# Database
|
|
673
|
+
DB_CONNECTION=mysql
|
|
674
|
+
DB_HOST=localhost
|
|
675
|
+
DB_PORT=3306
|
|
676
|
+
DB_DATABASE=hc_support_my
|
|
677
|
+
DB_USERNAME=root
|
|
678
|
+
DB_PASSWORD=B3st1n3t@2025
|
|
679
|
+
|
|
680
|
+
# Authentication (Keycloak)
|
|
681
|
+
KEYCLOAK_BASE_URL=http://localhost:8180
|
|
682
|
+
KEYCLOAK_REALM=urp
|
|
683
|
+
KEYCLOAK_CLIENT_ID=hc-support-portal-web
|
|
684
|
+
KEYCLOAK_CLIENT_SECRET=
|
|
685
|
+
|
|
686
|
+
# Mail (Mailcatcher)
|
|
687
|
+
MAIL_MAILER=smtp
|
|
688
|
+
MAIL_HOST=localhost
|
|
689
|
+
MAIL_PORT=1025
|
|
690
|
+
MAIL_USERNAME=null
|
|
691
|
+
MAIL_PASSWORD=null
|
|
692
|
+
|
|
693
|
+
# Messaging (RabbitMQ)
|
|
694
|
+
RABBITMQ_HOST=localhost
|
|
695
|
+
RABBITMQ_PORT=5672
|
|
696
|
+
RABBITMQ_USER=guest
|
|
697
|
+
RABBITMQ_PASSWORD=guest
|
|
698
|
+
```
|
|
699
|
+
|
|
700
|
+
**Rules:**
|
|
701
|
+
- Only include variables that are actually referenced in `config/` files via `env()` calls
|
|
702
|
+
- Use actual values from ENVIRONMENT.md — never use placeholders or `TODO`
|
|
703
|
+
- If ENVIRONMENT.md does not exist or a value is not found, use sensible defaults for local
|
|
704
|
+
development (e.g., `localhost`, default ports)
|
|
705
|
+
- The `.env` file is gitignored (already covered in `.gitignore`)
|
|
706
|
+
|
|
707
|
+
#### 4. Build & Tooling
|
|
708
|
+
Vite configuration (`vite.config.js`), Tailwind CSS setup (using design tokens from
|
|
709
|
+
MOCKUP.html), PostCSS config, and `resources/` directory structure.
|
|
710
|
+
|
|
711
|
+
#### 4b. `.gitignore`
|
|
712
|
+
Generate a `.gitignore` file at the project root. Laravel's default `.gitignore` plus:
|
|
713
|
+
|
|
714
|
+
```
|
|
715
|
+
# Laravel
|
|
716
|
+
/vendor/
|
|
717
|
+
/node_modules/
|
|
718
|
+
/public/build/
|
|
719
|
+
/public/hot
|
|
720
|
+
/storage/*.key
|
|
721
|
+
.env
|
|
722
|
+
.env.backup
|
|
723
|
+
.env.production
|
|
724
|
+
|
|
725
|
+
# IDE
|
|
726
|
+
.idea/
|
|
727
|
+
*.iml
|
|
728
|
+
.vscode/
|
|
729
|
+
*.swp
|
|
730
|
+
*~
|
|
731
|
+
|
|
732
|
+
# OS
|
|
733
|
+
.DS_Store
|
|
734
|
+
Thumbs.db
|
|
735
|
+
|
|
736
|
+
# Testing
|
|
737
|
+
/coverage/
|
|
738
|
+
.phpunit.result.cache
|
|
739
|
+
|
|
740
|
+
# E2E
|
|
741
|
+
e2e/node_modules/
|
|
742
|
+
e2e/test-results/
|
|
743
|
+
e2e/playwright-report/
|
|
744
|
+
e2e/visual-baselines/
|
|
745
|
+
|
|
746
|
+
# Logs
|
|
747
|
+
*.log
|
|
748
|
+
storage/logs/*
|
|
749
|
+
!storage/logs/.gitkeep
|
|
750
|
+
```
|
|
751
|
+
|
|
752
|
+
**Conditional additions:**
|
|
753
|
+
- **If Reporting = yes:** Add compiled report cache entries if applicable
|
|
754
|
+
|
|
755
|
+
#### 5. Directory Structure
|
|
756
|
+
The complete directory tree rooted at the project. The structure follows
|
|
757
|
+
Domain-Driven Design with nwidart/laravel-modules conventions, adapted for server-rendered
|
|
758
|
+
web with page and fragment separation. Use actual module names from the context.
|
|
759
|
+
Read `references/modulith-patterns.md` for the detailed module layout and inter-module
|
|
760
|
+
communication rules.
|
|
761
|
+
|
|
762
|
+
#### 6. Security Configuration *(conditional — include only if Auth != none)*
|
|
763
|
+
**If Auth = Keycloak:** OAuth2 Client setup with Keycloak OIDC via Laravel Socialite,
|
|
764
|
+
custom `KeycloakGuard`, middleware for role extraction from OIDC ID token claims, CSP
|
|
765
|
+
nonce middleware, automatic redirect to Keycloak login, and public route configuration.
|
|
766
|
+
Session-based. Read `references/security-patterns.md` for the full security architecture.
|
|
767
|
+
|
|
768
|
+
**If Auth = form:** Laravel Breeze form login configuration, custom `UserDetailsService`
|
|
769
|
+
backed by the selected database, password hashing with bcrypt, role-based access control
|
|
770
|
+
via spatie/laravel-permission, CSRF enabled (standard for form login), and remember-me.
|
|
771
|
+
|
|
772
|
+
#### 7. Layouts (Blade)
|
|
773
|
+
Three layouts: `app.blade.php` (header/sidebar/footer for authenticated pages),
|
|
774
|
+
`auth.blade.php` (split-screen for login), `error.blade.php` (centered error display).
|
|
775
|
+
Each uses Blade component syntax with slots. Layout structure should match the mockup
|
|
776
|
+
shell/partials. *Note: If Auth = none, auth layout may be omitted or simplified.*
|
|
777
|
+
|
|
778
|
+
#### 8. Partials & Includes
|
|
779
|
+
Reusable Blade partials: header, sidebar, footer, theme-switcher. Sidebar must include
|
|
780
|
+
the actual navigation items from the mockup sidebar files, organized per role.
|
|
781
|
+
|
|
782
|
+
#### 9. UI Components (Blade + Tailwind)
|
|
783
|
+
Pure Tailwind CSS components (no DaisyUI): Alert, Avatar, Badge, Breadcrumb, Button,
|
|
784
|
+
Card, Drawer, Dropdown, FormControl/Input/Select/Textarea/Checkbox/Radio/Toggle,
|
|
785
|
+
Loading, Menu, Modal, Navbar, Pagination, Progress, Stats, Steps, Table, Tabs,
|
|
786
|
+
Toast, Tooltip. Each as an anonymous Blade component with Tailwind utility classes.
|
|
787
|
+
|
|
788
|
+
#### 10. Frontend JS Structure
|
|
789
|
+
Alpine.js stores (toast, modal, drawer, theme), htmx extensions (loading states, toast
|
|
790
|
+
errors), ES module organization, and CSP nonce integration.
|
|
791
|
+
|
|
792
|
+
#### 11. Styles
|
|
793
|
+
Tailwind CSS organization: base (reset, typography), components (buttons, forms, cards,
|
|
794
|
+
tables, modals, navigation), layouts (sidebar, navbar, footer responsive), themes
|
|
795
|
+
(light/dark CSS custom properties). Use the actual design tokens (colors, fonts) from
|
|
796
|
+
MOCKUP.html.
|
|
797
|
+
|
|
798
|
+
#### 12. Authentication Pages *(conditional — include only if Auth != none)*
|
|
799
|
+
**If Auth = Keycloak:** No custom login page needed. Middleware automatically redirects
|
|
800
|
+
unauthenticated users to Keycloak login. Keycloak handles the login form, social login
|
|
801
|
+
providers, and credential management. After successful authentication, Keycloak redirects
|
|
802
|
+
back with an authorization code which the app exchanges for tokens.
|
|
803
|
+
|
|
804
|
+
**If Auth = form:** Login page with email/password form, CSRF token, remember-me checkbox.
|
|
805
|
+
Logout endpoint. Optionally a registration page if user self-registration is desired.
|
|
806
|
+
Provided by Laravel Breeze scaffolding.
|
|
807
|
+
|
|
808
|
+
#### 13. Data Access *(conditional content varies)*
|
|
809
|
+
**If Database = MongoDB:** Eloquent models per module using `mongodb/laravel-mongodb`.
|
|
810
|
+
DTO mapping via `spatie/laravel-data`. Pagination via Laravel's built-in `paginate()`.
|
|
811
|
+
All list endpoints paginated. Use actual collection names from the module model.
|
|
812
|
+
|
|
813
|
+
**If Database = PostgreSQL/MySQL:** Eloquent models per module with standard Eloquent ORM.
|
|
814
|
+
Laravel Migrations for schema versioning. UUIDs via `$table->uuid('id')->primary()` or
|
|
815
|
+
Laravel's built-in `HasUuids` trait. DTO mapping via `spatie/laravel-data`. Pagination
|
|
816
|
+
via built-in `paginate()`. All list endpoints paginated. Use actual table names from the
|
|
817
|
+
module model.
|
|
818
|
+
|
|
819
|
+
**If Database = none:** In-memory data structures or stubs. The spec should note that a
|
|
820
|
+
database integration can be added later.
|
|
821
|
+
|
|
822
|
+
#### 14. Error Handling & Exceptions
|
|
823
|
+
Base `WebApplicationException` with status/code/userMessage. `Handler.php` returning
|
|
824
|
+
error pages for full requests and toast fragments for htmx requests (detected via
|
|
825
|
+
`request()->header('HX-Request')`).
|
|
826
|
+
|
|
827
|
+
#### 15. Theming
|
|
828
|
+
Light/dark theme switching via cookie. Server reads cookie via middleware and shares
|
|
829
|
+
`$theme` with all views. Alpine store syncs toggle with cookie and `data-theme` attribute.
|
|
830
|
+
|
|
831
|
+
#### 16. Pagination Support
|
|
832
|
+
Laravel's built-in `->paginate()` with custom Blade pagination component matching
|
|
833
|
+
the Tailwind design system.
|
|
834
|
+
|
|
835
|
+
#### 17. Logging Strategy
|
|
836
|
+
Laravel Log (Monolog) configuration, correlation ID middleware (from JWT if auth is
|
|
837
|
+
enabled, or request-scoped UUID otherwise), contextual logging via `Log::withContext()`,
|
|
838
|
+
per-channel log levels.
|
|
839
|
+
|
|
840
|
+
#### 18. Scheduling and Batch Processing *(conditional — include only if Scheduling = yes)*
|
|
841
|
+
Laravel Task Scheduling via `routes/console.php` with `Schedule` facade. If Batch
|
|
842
|
+
Processing = yes, includes `Bus::batch()` patterns with `Batchable` trait on jobs for
|
|
843
|
+
chunk-oriented processing. Read `references/batch-patterns.md` for the full
|
|
844
|
+
scaffolding spec.
|
|
845
|
+
|
|
846
|
+
#### 19. Event-Driven Architecture
|
|
847
|
+
Laravel Events & Listeners for inter-module communication. Event classes in module's
|
|
848
|
+
public namespace, listeners in internal namespace. `ShouldQueue` for async processing,
|
|
849
|
+
`$afterCommit = true` for post-transaction delivery. Read
|
|
850
|
+
`references/modulith-patterns.md` for details.
|
|
851
|
+
|
|
852
|
+
#### 20. Messaging (RabbitMQ Pub/Sub) *(conditional — include only if Messaging = yes)*
|
|
853
|
+
Standalone RabbitMQ publisher/consumer services for inter-system communication.
|
|
854
|
+
Topic exchange for event broadcasting, direct exchange for point-to-point commands.
|
|
855
|
+
Read `references/messaging-patterns.md` for the full messaging architecture.
|
|
856
|
+
|
|
857
|
+
#### 21. DTO & Data Transformation
|
|
858
|
+
Per-module `spatie/laravel-data` DTO conventions and mapping flow patterns (Model → DTO
|
|
859
|
+
→ View, Request → DTO → Model).
|
|
860
|
+
|
|
861
|
+
#### 22. Testing Strategy
|
|
862
|
+
Overview of testing approach — unit tests (PHPUnit), feature tests (Laravel HTTP tests),
|
|
863
|
+
module isolation tests, security test utilities (Socialite fake for Keycloak, `actingAs()`
|
|
864
|
+
for form login), view model tests.
|
|
865
|
+
|
|
866
|
+
#### 23. Reporting (Puppeteer / Browsershot) *(conditional — include only if Reporting = yes)*
|
|
867
|
+
Puppeteer via `spatie/browsershot` for PDF generation from Blade templates with full
|
|
868
|
+
CSS/Tailwind support (headless Chrome rendering), Laravel Excel for XLSX/CSV export.
|
|
869
|
+
Includes `ReportDefinition` interface for modules to implement, `ReportService`
|
|
870
|
+
orchestrating HTML render → Browsershot PDF conversion → export, `ReportRegistry` for
|
|
871
|
+
auto-discovering and persisting report definitions at startup, report controller with
|
|
872
|
+
parameter form and download endpoint, Blade templates for report list, parameter form,
|
|
873
|
+
and self-contained PDF report layouts (including Tailwind CDN for standalone rendering),
|
|
874
|
+
multi-format export. Report Blade templates are fully AI-agent-developed — no visual
|
|
875
|
+
designers needed. Read `references/reporting-patterns.md` for the full reporting
|
|
876
|
+
architecture.
|
|
877
|
+
|
|
878
|
+
#### 24. Internationalisation (Localization) *(conditional — include only if i18n = yes)*
|
|
879
|
+
Laravel's built-in localization. Covers: `config/app.php` `locale`/`fallback_locale` and
|
|
880
|
+
the `app.supported_locales` list; a `SetLocale` middleware resolving the active locale
|
|
881
|
+
(session → cookie → `Accept-Language` header → default) and calling `app()->setLocale()`,
|
|
882
|
+
registered on the `web` middleware group; per-locale translation files under `lang/`
|
|
883
|
+
(`lang/<locale>/messages.php`, `lang/<locale>/validation.php`) plus per-module translation
|
|
884
|
+
namespaces loaded via each module's service provider (`loadTranslationsFrom()`); a
|
|
885
|
+
locale-switch route + controller that validates the requested locale against the supported
|
|
886
|
+
list and persists it to session and a long-lived cookie (htmx-aware — returns `HX-Refresh`
|
|
887
|
+
for partial requests); a language switcher partial (Alpine.js dropdown in the header,
|
|
888
|
+
CSRF-protected); and Blade usage conventions (`__('messages.welcome')`, `@lang`,
|
|
889
|
+
`trans_choice()` for pluralization, namespaced `__('locationinformation::messages.title')`),
|
|
890
|
+
including locale-aware date formatting via `Carbon::setLocale()` / `->translatedFormat()`.
|
|
891
|
+
The language switcher is the ONLY locale UI element and MUST NOT be rendered when i18n = no.
|
|
892
|
+
|
|
893
|
+
### What Goes in Each `<module>/SPEC.md` (Per-Module)
|
|
894
|
+
|
|
895
|
+
For EACH module from PRD.md and MODEL.md, create a folder named after the
|
|
896
|
+
module (kebab-case, e.g., `location-information/`) and generate a `SPEC.md` inside it.
|
|
897
|
+
|
|
898
|
+
Each module `SPEC.md` is a **self-contained** blueprint that a coding agent can pick up
|
|
899
|
+
and implement independently (after the shared infrastructure is in place). It must include:
|
|
900
|
+
|
|
901
|
+
- **Header** with module name and a back-reference to the root `SPECIFICATION.md`
|
|
902
|
+
- **Traceability**: User story IDs, NFR IDs, constraint IDs, collection/table names,
|
|
903
|
+
mockup screen filenames
|
|
904
|
+
- **Service interface** with methods derived from user stories
|
|
905
|
+
- **DTOs** (spatie/laravel-data) with fields matching the module model fields
|
|
906
|
+
- **Exception class** for module-specific errors
|
|
907
|
+
- **Eloquent Model** with fields from `model/<module>/model.md` and
|
|
908
|
+
`model/<module>/schemas.json`
|
|
909
|
+
- **Migration** (for SQL databases) matching the model schema
|
|
910
|
+
- **Repository** (optional pattern) or direct Eloquent queries in service
|
|
911
|
+
- **Service implementation** with full CRUD logic
|
|
912
|
+
- **Page controllers** with endpoints matching mockup screens for that module
|
|
913
|
+
- **Fragment controllers** for htmx partial updates
|
|
914
|
+
- **View models** (spatie/laravel-view-models) with fields matching what mockup screens display
|
|
915
|
+
- **Blade templates** (list, detail, create, edit, row fragments)
|
|
916
|
+
- **Form Request** classes for validation
|
|
917
|
+
- **Translation namespace** *(only if i18n = yes)* — a module translation file per locale
|
|
918
|
+
(e.g., `Modules/<Module>/lang/<locale>/messages.php`) registered via the module service
|
|
919
|
+
provider's `loadTranslationsFrom(..., '<module-slug>')`, and Blade templates that reference
|
|
920
|
+
keys through the namespace (`__('<module-slug>::messages.<key>')`) instead of literal copy
|
|
921
|
+
- **Complete code samples** for every component — continuous and copy-pasteable
|
|
922
|
+
|
|
923
|
+
**Separating UI Layer from Messaging/Async Pipeline:**
|
|
924
|
+
|
|
925
|
+
When a module has BOTH user-facing screens (user stories) AND async processing NFRs
|
|
926
|
+
(e.g., RabbitMQ message consumption, message validation, ACK publishing, forwarding),
|
|
927
|
+
the SPEC.md MUST clearly separate these into distinct sections:
|
|
928
|
+
|
|
929
|
+
1. **UI Layer sections** — service methods for read-only queries (search, getById,
|
|
930
|
+
getHistory), page controllers, fragment controllers, Blade templates. These are driven
|
|
931
|
+
by user stories (USHMxxxxx).
|
|
932
|
+
2. **Messaging Pipeline sections** — message consumer (queue job), message validator,
|
|
933
|
+
ACK publisher, forward publisher, queue configuration, domain events,
|
|
934
|
+
`processIncomingMessage()` service method. These are driven by NFRs (NFRHMxxxx).
|
|
935
|
+
|
|
936
|
+
This separation enables the implementation orchestrator to track and implement each
|
|
937
|
+
concern independently. A module may have its UI layer fully implemented while its
|
|
938
|
+
messaging pipeline remains pending.
|
|
939
|
+
|
|
940
|
+
See `references/spec-template.md` for the exact template structure.
|
|
941
|
+
|
|
942
|
+
## Changelog Append
|
|
943
|
+
|
|
944
|
+
After all specification files are successfully generated, append an entry to `CHANGELOG.md` in the application folder (`<app_folder>/CHANGELOG.md`):
|
|
945
|
+
|
|
946
|
+
1. Read `<app_folder>/CHANGELOG.md`. If it does not exist, create it with:
|
|
947
|
+
```markdown
|
|
948
|
+
# Changelog
|
|
949
|
+
|
|
950
|
+
- This file tracks all skill executions by version for this application.
|
|
951
|
+
- The highest version recorded here is the current application version.
|
|
952
|
+
- Skills MUST NOT execute for a version lower than the highest version in this file.
|
|
953
|
+
|
|
954
|
+
---
|
|
955
|
+
```
|
|
956
|
+
2. Search for a `## {version}` heading matching the current version.
|
|
957
|
+
3. If the section **exists**: append a new row to its table.
|
|
958
|
+
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.
|
|
959
|
+
5. Row format: `| {YYYY-MM-DD} | {application_name} | specgen-laravel-eloquent-bladehtmx | {module or "All"} | Generated Laravel web application technical specification |`
|
|
960
|
+
6. **Never modify or delete existing rows.**
|
|
961
|
+
|
|
962
|
+
## Output Format
|
|
963
|
+
|
|
964
|
+
The generated specification is a **folder of files**, not a single document:
|
|
965
|
+
|
|
966
|
+
```
|
|
967
|
+
<app_folder>/context/specification/
|
|
968
|
+
├── SPECIFICATION.md ↠Root: TOC + shared/application-level specs
|
|
969
|
+
├── <module-1>/
|
|
970
|
+
│ └── SPEC.md ↠Module blueprint (self-contained)
|
|
971
|
+
├── <module-2>/
|
|
972
|
+
│ └── SPEC.md
|
|
973
|
+
├── <module-N>/
|
|
974
|
+
│ └── SPEC.md
|
|
975
|
+
```
|
|
976
|
+
|
|
977
|
+
- **Root folder**: `<app_folder>/context/specification/`
|
|
978
|
+
- **Root file**: `SPECIFICATION.md` — contains the Table of Contents (with links to
|
|
979
|
+
each module's `SPEC.md`), all shared infrastructure sections (1–9), and all
|
|
980
|
+
application-level cross-cutting sections (10–24, excluding module blueprints)
|
|
981
|
+
- **Module folders**: One folder per module from PRD.md, named in kebab-case
|
|
982
|
+
(e.g., `location-information/`, `corridor/`, `employer/`)
|
|
983
|
+
- **Module files**: Each `SPEC.md` is self-contained with full code samples for that
|
|
984
|
+
module's module — service, DTOs, model, migration, controller, views, and Blade templates
|