@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,859 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: specgen-react-tailwind
|
|
3
|
+
model: claude-opus-4-8
|
|
4
|
+
effort: high
|
|
5
|
+
description: >
|
|
6
|
+
Generate a detailed specification document for building a React SPA (Single Page
|
|
7
|
+
Application) using React 19, TypeScript 5, Vite 6, Tailwind CSS v3, Headless UI v2,
|
|
8
|
+
Heroicons, React Router v7, TanStack Query v5, Zustand v5, React Hook Form v7, and
|
|
9
|
+
Zod v3. Components are built utility-first with Tailwind and made accessible with
|
|
10
|
+
Headless UI primitives (no component framework like MUI). Authentication (Keycloak
|
|
11
|
+
OAuth2/OIDC PKCE, generic OIDC, or none), API integration (REST via Axios), and optional
|
|
12
|
+
features (WebSocket, i18n, TanStack Table data grids, Recharts charts, react-day-picker
|
|
13
|
+
date pickers, Tiptap rich text) are configurable based on user input.
|
|
14
|
+
Standardized input: application name (mandatory), version (mandatory), module (optional).
|
|
15
|
+
Use this skill whenever the user asks to create a spec, specification, blueprint, or
|
|
16
|
+
technical design document for a new React SPA or frontend application styled with Tailwind CSS.
|
|
17
|
+
Also trigger when the user says things like "spec out a new React Tailwind project",
|
|
18
|
+
"design a React SPA with Tailwind", "write a technical spec for my new Tailwind frontend app",
|
|
19
|
+
"scaffold spec for a React Tailwind app", or any request for a specification document
|
|
20
|
+
describing a React + Tailwind + TypeScript application. Even if the user only mentions
|
|
21
|
+
a subset of the stack (e.g., "React SPA with Tailwind" or "React + Headless UI" or
|
|
22
|
+
"React Tailwind dashboard"), this skill likely applies — ask and confirm.
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
# React SPA Specification Generator (Tailwind CSS)
|
|
26
|
+
|
|
27
|
+
This skill generates a comprehensive specification document (Markdown) that serves as a
|
|
28
|
+
blueprint for building a React Single Page Application styled with Tailwind CSS. The spec
|
|
29
|
+
is intended to be followed by a developer or a coding agent to produce a fully functional
|
|
30
|
+
project scaffold.
|
|
31
|
+
|
|
32
|
+
The specification does NOT generate code. It produces a detailed, opinionated technical
|
|
33
|
+
document describing every layer of the application — from Vite configuration to the
|
|
34
|
+
Tailwind design-token theme to React Query patterns — so that implementation becomes a
|
|
35
|
+
mechanical exercise.
|
|
36
|
+
|
|
37
|
+
This skill is the Tailwind-CSS sibling of `specgen-react-mui`. It keeps the same React data
|
|
38
|
+
stack (React Router, TanStack Query, Zustand, React Hook Form, Zod, Axios) but replaces the
|
|
39
|
+
Material UI component framework with a **utility-first Tailwind layer**: components are
|
|
40
|
+
hand-built with Tailwind classes and made accessible with **Headless UI** primitives
|
|
41
|
+
(Dialog, Menu, Listbox, Combobox, Switch, Tabs, Popover, Transition) and **Heroicons**.
|
|
42
|
+
|
|
43
|
+
## Technology Stack
|
|
44
|
+
|
|
45
|
+
### Core Stack (Always Included)
|
|
46
|
+
|
|
47
|
+
These are the fixed versions the spec targets. Do not deviate unless the user explicitly
|
|
48
|
+
requests different versions.
|
|
49
|
+
|
|
50
|
+
| Component | Version |
|
|
51
|
+
|----------------------|-----------|
|
|
52
|
+
| React | 19.x |
|
|
53
|
+
| TypeScript | 5.x |
|
|
54
|
+
| Vite | 6.x |
|
|
55
|
+
| Tailwind CSS | 3.x |
|
|
56
|
+
| PostCSS | 8.x |
|
|
57
|
+
| Autoprefixer | 10.x |
|
|
58
|
+
| @tailwindcss/forms | 0.5.x |
|
|
59
|
+
| Headless UI (`@headlessui/react`) | 2.x |
|
|
60
|
+
| Heroicons (`@heroicons/react`) | 2.x |
|
|
61
|
+
| clsx | 2.x |
|
|
62
|
+
| tailwind-merge | 2.x |
|
|
63
|
+
| class-variance-authority | 0.7.x |
|
|
64
|
+
| React Router | 7.x |
|
|
65
|
+
| TanStack Query | 5.x |
|
|
66
|
+
| Zustand | 5.x |
|
|
67
|
+
| React Hook Form | 7.x |
|
|
68
|
+
| Zod | 3.x |
|
|
69
|
+
| Axios | 1.x |
|
|
70
|
+
| Node.js | 22.x LTS |
|
|
71
|
+
|
|
72
|
+
### Optional Integration Versions
|
|
73
|
+
|
|
74
|
+
Include in the version table only when the corresponding integration is selected.
|
|
75
|
+
|
|
76
|
+
| Component | Version | When Selected |
|
|
77
|
+
|----------------------|-----------|------------------------|
|
|
78
|
+
| Keycloak | 26.x | Auth = Keycloak |
|
|
79
|
+
| oidc-client-ts | 3.x | Auth = Keycloak or OIDC|
|
|
80
|
+
| react-oidc-context | 3.x | Auth = Keycloak or OIDC|
|
|
81
|
+
| @tanstack/react-table| 8.x | DataGrid = yes |
|
|
82
|
+
| recharts | 2.x | Charts = yes |
|
|
83
|
+
| react-day-picker | 9.x | DatePickers = yes |
|
|
84
|
+
| date-fns | 4.x | DatePickers = yes |
|
|
85
|
+
| Socket.io Client | 4.x | WebSocket = yes |
|
|
86
|
+
| react-i18next | 15.x | i18n = yes |
|
|
87
|
+
| i18next | 24.x | i18n = yes |
|
|
88
|
+
| @tiptap/react + @tiptap/starter-kit | 2.x | RichText = yes |
|
|
89
|
+
| @tailwindcss/typography | 0.5.x | RichText = yes |
|
|
90
|
+
|
|
91
|
+
## Core Dependencies (package.json)
|
|
92
|
+
|
|
93
|
+
The spec must include these in the npm configuration section (always):
|
|
94
|
+
|
|
95
|
+
**Production dependencies:**
|
|
96
|
+
- `react` + `react-dom` — Core React
|
|
97
|
+
- `react-router-dom` — Client-side routing
|
|
98
|
+
- `@tanstack/react-query` — Server state and data fetching
|
|
99
|
+
- `zustand` — Global client state management
|
|
100
|
+
- `react-hook-form` — Form state management
|
|
101
|
+
- `@hookform/resolvers` — Zod integration for React Hook Form
|
|
102
|
+
- `zod` — Schema validation
|
|
103
|
+
- `axios` — HTTP client
|
|
104
|
+
- `@headlessui/react` — Accessible, unstyled interactive primitives (Dialog, Menu, Listbox, Combobox, Switch, Tabs, Popover, Transition)
|
|
105
|
+
- `@heroicons/react` — Icon set (outline + solid)
|
|
106
|
+
- `clsx` — Conditional className composition
|
|
107
|
+
- `tailwind-merge` — Resolve conflicting Tailwind classes (powers the `cn()` helper)
|
|
108
|
+
- `class-variance-authority` — Type-safe component style variants (Button, Badge, etc.)
|
|
109
|
+
|
|
110
|
+
**Development dependencies:**
|
|
111
|
+
- `typescript` — Type checking
|
|
112
|
+
- `@types/react` + `@types/react-dom` — React type definitions
|
|
113
|
+
- `vite` + `@vitejs/plugin-react` — Build tooling
|
|
114
|
+
- `tailwindcss` + `postcss` + `autoprefixer` — Tailwind CSS build pipeline
|
|
115
|
+
- `@tailwindcss/forms` — Sensible form-control reset that pairs well with Headless UI inputs
|
|
116
|
+
- `@tanstack/react-query-devtools` — Query devtools (dev only)
|
|
117
|
+
- `eslint` + `@typescript-eslint/*` — Linting
|
|
118
|
+
|
|
119
|
+
### Conditional Dependencies
|
|
120
|
+
|
|
121
|
+
**If Auth = Keycloak or OIDC:**
|
|
122
|
+
- `oidc-client-ts` — OAuth2/OIDC PKCE client
|
|
123
|
+
- `react-oidc-context` — React context wrapper for oidc-client-ts
|
|
124
|
+
|
|
125
|
+
**If DataGrid = yes:**
|
|
126
|
+
- `@tanstack/react-table` — Headless table/data-grid (sorting, filtering, pagination, row selection) styled with Tailwind
|
|
127
|
+
|
|
128
|
+
**If Charts = yes:**
|
|
129
|
+
- `recharts` — Composable SVG chart components
|
|
130
|
+
|
|
131
|
+
**If DatePickers = yes:**
|
|
132
|
+
- `react-day-picker` — Accessible date/range picker rendered inside a Headless UI `Popover`
|
|
133
|
+
- `date-fns` — Date manipulation and formatting
|
|
134
|
+
|
|
135
|
+
**If WebSocket = yes:**
|
|
136
|
+
- `socket.io-client` — WebSocket client
|
|
137
|
+
|
|
138
|
+
**If i18n = yes:**
|
|
139
|
+
- `react-i18next` + `i18next` — Internationalization
|
|
140
|
+
- `i18next-browser-languagedetector` — Auto language detection
|
|
141
|
+
- `i18next-http-backend` — Lazy translation loading
|
|
142
|
+
|
|
143
|
+
**If RichText = yes:**
|
|
144
|
+
- `@tiptap/react` + `@tiptap/starter-kit` — Headless, extensible WYSIWYG editor (React 19 compatible)
|
|
145
|
+
- `@tiptap/extension-link` + `@tiptap/extension-placeholder` — Common editor extensions
|
|
146
|
+
- `@tailwindcss/typography` — `prose` classes to style rendered rich-text HTML
|
|
147
|
+
- `dompurify` + `@types/dompurify` — HTML sanitization when rendering stored rich-text content
|
|
148
|
+
|
|
149
|
+
**If Reporting = yes:**
|
|
150
|
+
- `xlsx` — Client-side XLSX file generation
|
|
151
|
+
- `papaparse` + `@types/papaparse` — Client-side CSV generation
|
|
152
|
+
- Report service (Node.js companion): `puppeteer`, `express`, `cors` — server-side HTML-to-PDF via headless Chrome
|
|
153
|
+
|
|
154
|
+
## When the Skill Triggers
|
|
155
|
+
|
|
156
|
+
Generate the spec when the user provides an **application name** and **version** that
|
|
157
|
+
corresponds to one of the custom applications defined in `CLAUDE.md`. The skill
|
|
158
|
+
reads all required inputs from the project's context files — no interactive Q&A is needed
|
|
159
|
+
for the core inputs.
|
|
160
|
+
|
|
161
|
+
The user invokes this skill by specifying the target application and version, for example:
|
|
162
|
+
- `/specgen-react-tailwind admin v1.0.4`
|
|
163
|
+
- `/specgen-react-tailwind admin v1.0.4 module:Hero Section`
|
|
164
|
+
- `/specgen-react-tailwind "Admin Portal" v1.0.4`
|
|
165
|
+
|
|
166
|
+
The skill then locates the matching context folder and reads all input files automatically.
|
|
167
|
+
|
|
168
|
+
## Version Gate
|
|
169
|
+
|
|
170
|
+
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`):
|
|
171
|
+
|
|
172
|
+
1. If `<app_folder>/CHANGELOG.md` does not exist, skip this check (first-ever execution for this application).
|
|
173
|
+
2. If `<app_folder>/CHANGELOG.md` exists, scan all `## vX.Y.Z` headings and determine the **highest version** using semantic versioning comparison.
|
|
174
|
+
3. Compare the requested version against the highest version:
|
|
175
|
+
- If requested version **>=** highest version: proceed normally.
|
|
176
|
+
- 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.
|
|
177
|
+
|
|
178
|
+
## Input Resolution
|
|
179
|
+
|
|
180
|
+
This skill uses standardized input resolution. Provide:
|
|
181
|
+
|
|
182
|
+
| Argument | Required | Example | Description |
|
|
183
|
+
|----------|----------|---------|-------------|
|
|
184
|
+
| `<application>` | Yes | `admin` | Application name to locate the context folder |
|
|
185
|
+
| `<version>` | Yes | `v1.0.4` | Version to scope processing |
|
|
186
|
+
| `module:<name>` | No | `module:Hero Section` | Limit generation to a single module |
|
|
187
|
+
|
|
188
|
+
### Application Folder Resolution
|
|
189
|
+
|
|
190
|
+
The application name is matched against root-level application folders:
|
|
191
|
+
1. Strip any leading `<number>_` prefix from folder names (e.g., `1_admin` → `admin`)
|
|
192
|
+
2. Match case-insensitively against the provided application name
|
|
193
|
+
3. Accept snake_case, kebab-case, or title-case input (all match the same folder)
|
|
194
|
+
4. If no match found, list available applications and stop
|
|
195
|
+
|
|
196
|
+
### Auto-Resolved Paths
|
|
197
|
+
|
|
198
|
+
| File | Resolved Path |
|
|
199
|
+
|------|---------------|
|
|
200
|
+
| PRD.md | `<app_folder>/context/PRD.md` |
|
|
201
|
+
| Module Models | `<app_folder>/context/model/` |
|
|
202
|
+
| HTML Mockups | `<app_folder>/context/mockup/` |
|
|
203
|
+
| Output (specification) | `<app_folder>/context/specification/` |
|
|
204
|
+
|
|
205
|
+
### Version Filtering
|
|
206
|
+
|
|
207
|
+
When a version is provided, only include user stories, NFRs, and constraints from versions
|
|
208
|
+
<= the provided version. For example, if `v1.0.4` is specified:
|
|
209
|
+
- Include items tagged `[v1.0.0]`, `[v1.0.1]`, `[v1.0.2]`, `[v1.0.3]`, `[v1.0.4]`
|
|
210
|
+
- Exclude items tagged `[v1.0.5]` or later
|
|
211
|
+
- Version comparison uses semantic versioning order
|
|
212
|
+
|
|
213
|
+
### Module Filtering
|
|
214
|
+
|
|
215
|
+
When `module:<name>` is provided:
|
|
216
|
+
- Only generate the `SPEC.md` for that specific module
|
|
217
|
+
- Other existing module spec files remain untouched
|
|
218
|
+
- `SPECIFICATION.md` (root) gets a partial update — only that module's entry in the TOC
|
|
219
|
+
is added or updated; all other TOC entries are preserved as-is
|
|
220
|
+
|
|
221
|
+
## Gathering Input
|
|
222
|
+
|
|
223
|
+
The specification is driven by **six input sources** read from the project's context files.
|
|
224
|
+
The skill does NOT ask the user for auth, API backend URL, or optional component choices —
|
|
225
|
+
it **determines** these automatically from the context.
|
|
226
|
+
|
|
227
|
+
### Input 1: Application Name (from CLAUDE.md)
|
|
228
|
+
|
|
229
|
+
From CLAUDE.md (already loaded in context), locate the target application under the
|
|
230
|
+
**Custom Applications** section. Extract:
|
|
231
|
+
|
|
232
|
+
- **Application name**: The section heading (e.g., "Admin Portal", "Landing Page")
|
|
233
|
+
- **Application description**: The description paragraph below the heading
|
|
234
|
+
- **Dependencies**: The "Depends on" list — primary source for determining backend API
|
|
235
|
+
base URL, authentication provider, and optional components
|
|
236
|
+
|
|
237
|
+
The application name is used to derive:
|
|
238
|
+
- **Project slug**: Kebab-case of the application name (e.g., `admin-portal`)
|
|
239
|
+
- **Vite env prefix**: `VITE_` (standard Vite convention)
|
|
240
|
+
- **App title**: Title-case of application name (e.g., "Admin Portal")
|
|
241
|
+
|
|
242
|
+
### Input 2: User Stories (from PRD.md)
|
|
243
|
+
|
|
244
|
+
Read `<app_folder>/context/PRD.md`. This file contains all user stories organized by
|
|
245
|
+
module. Extract:
|
|
246
|
+
|
|
247
|
+
- **System modules**: Modules under `# System Module` heading (e.g., Authentication,
|
|
248
|
+
User Management). These become system-level features.
|
|
249
|
+
- **Business modules**: Modules under `# Business Module` heading (e.g., Hero Section,
|
|
250
|
+
Product and Service). These become business-level features.
|
|
251
|
+
- **User stories per module**: Each `### User Story` section contains tagged items.
|
|
252
|
+
These define the functional requirements for each feature's API hooks, form schemas,
|
|
253
|
+
and page components.
|
|
254
|
+
|
|
255
|
+
The user stories directly inform:
|
|
256
|
+
- Which API calls each feature's hooks must expose
|
|
257
|
+
- Which pages and routes are needed
|
|
258
|
+
- Which form fields and validation schemas apply
|
|
259
|
+
- Which Tailwind/Headless UI components best match the described UI
|
|
260
|
+
|
|
261
|
+
**Important:** Items with strikethrough (`~~text~~`) are deprecated — do NOT include them
|
|
262
|
+
as active requirements. List them in the "Removed / Replaced" subsection of the
|
|
263
|
+
traceability table.
|
|
264
|
+
|
|
265
|
+
- **Version tags per item**: Each `### User Story`, `### Non Functional Requirement`,
|
|
266
|
+
and `### Constraint` section contains one or more version blocks formatted as `[v1.0.x]`.
|
|
267
|
+
The skill must track the version tag for each item and carry it through to the
|
|
268
|
+
generated specification's traceability section.
|
|
269
|
+
|
|
270
|
+
### Input 3: Non-Functional Requirements (from PRD.md)
|
|
271
|
+
|
|
272
|
+
Within the same `PRD.md`, each module has a `### Non Functional Requirement` section.
|
|
273
|
+
These inform:
|
|
274
|
+
|
|
275
|
+
- UI layout choices (grid columns, card sizes, image dimensions)
|
|
276
|
+
- Data fetching strategies (pagination, filtering, real-time)
|
|
277
|
+
- Validation rules (character limits, format requirements)
|
|
278
|
+
- Performance constraints (lazy loading, caching)
|
|
279
|
+
|
|
280
|
+
NFRs should be mapped to specific technical decisions in the spec — for example, an NFR
|
|
281
|
+
stating "paginated with 10 items per page" confirms which React Query pagination pattern
|
|
282
|
+
to use, while "must support filtering" confirms which Zustand slice manages filter state.
|
|
283
|
+
|
|
284
|
+
### Input 4: Constraints (from PRD.md)
|
|
285
|
+
|
|
286
|
+
Within the same `PRD.md`, each module has a `### Constraint` section. These define
|
|
287
|
+
hard boundaries that the spec must enforce:
|
|
288
|
+
|
|
289
|
+
- Status enum values (e.g., "DRAFT, ACTIVE, EXPIRED")
|
|
290
|
+
- Business rules (e.g., "category must exist before creating content")
|
|
291
|
+
- Access control (e.g., "only ADMIN role can access user management")
|
|
292
|
+
|
|
293
|
+
Constraints are embedded directly into the relevant module blueprint — they inform
|
|
294
|
+
Zod validation schemas, API call parameters, and route guard configurations.
|
|
295
|
+
|
|
296
|
+
### Input 5: Module Model (from model/ folder)
|
|
297
|
+
|
|
298
|
+
Read `<app_folder>/context/model/MODEL.md` first as the index, then read the
|
|
299
|
+
individual module model files in each module subfolder.
|
|
300
|
+
|
|
301
|
+
**MODEL.md** provides:
|
|
302
|
+
- Summary table of all modules with table/collection counts and design decisions
|
|
303
|
+
- Links to each module's detailed model files
|
|
304
|
+
|
|
305
|
+
**Per-module files** (e.g., `model/hero-section/model.md`):
|
|
306
|
+
- Complete field definitions with types and constraints
|
|
307
|
+
- Relationships and references
|
|
308
|
+
- Table/collection names
|
|
309
|
+
|
|
310
|
+
**Per-module schema** (e.g., `model/hero-section/schemas.json`):
|
|
311
|
+
- JSON schemas defining exact field types, required fields, and validation rules
|
|
312
|
+
|
|
313
|
+
The module model directly maps to:
|
|
314
|
+
- TypeScript interface/type definitions (field-for-field, not placeholder)
|
|
315
|
+
- Zod validation schemas
|
|
316
|
+
- React Hook Form field configurations
|
|
317
|
+
- TanStack Query response type annotations
|
|
318
|
+
- API request/response DTOs
|
|
319
|
+
|
|
320
|
+
### Input 6: HTML Mockup Screens (from mockup/ folder)
|
|
321
|
+
|
|
322
|
+
Read `<app_folder>/context/mockup/MOCKUP.html` first as the index page, then read the
|
|
323
|
+
HTML files organized by role in subfolders.
|
|
324
|
+
|
|
325
|
+
**MOCKUP.html** provides:
|
|
326
|
+
- Application identity (name, version, short name)
|
|
327
|
+
- Design tokens: fonts, colors from Tailwind/CSS config or inline styles
|
|
328
|
+
- List of user roles and their screen sets
|
|
329
|
+
|
|
330
|
+
**Role-specific subfolders** (e.g., `mockup/admin/content/`):
|
|
331
|
+
- Individual HTML screens for each page in the application
|
|
332
|
+
- Screen layout: which components are used (tables, forms, cards, modals, grids)
|
|
333
|
+
- Navigation structure from sidebar/header HTML files
|
|
334
|
+
- Data display patterns (list pages, detail pages, create/edit forms)
|
|
335
|
+
|
|
336
|
+
**IMPORTANT — Role folders inform access control, NOT URL paths.** The role-specific
|
|
337
|
+
folder structure (e.g., `mockup/admin/content/hero-section.html`) determines:
|
|
338
|
+
1. Which role can access the page → `<ProtectedRoute requiredRoles={[Roles.ADMIN]} />`
|
|
339
|
+
2. Which navigation items appear for each role
|
|
340
|
+
It does NOT determine the URL path. The URL path is always module-based:
|
|
341
|
+
- `<Route path="/hero-section" />` — NOT `<Route path="/admin/hero-section" />`
|
|
342
|
+
|
|
343
|
+
The mockup screens directly map to:
|
|
344
|
+
- React page components (one per HTML screen)
|
|
345
|
+
- React Router route definitions
|
|
346
|
+
- Tailwind/Headless UI component selections (TanStack Table vs simple table, Headless UI
|
|
347
|
+
`Dialog` vs slide-over panel, etc.)
|
|
348
|
+
- Form field layouts
|
|
349
|
+
- Navigation items per role
|
|
350
|
+
- Tailwind design tokens (extract colors, font, radius, spacing from the mockup CSS/config)
|
|
351
|
+
|
|
352
|
+
## PRD.md Extended Sections
|
|
353
|
+
|
|
354
|
+
Before determining optional components, check PRD.md for the following extended sections:
|
|
355
|
+
|
|
356
|
+
### Architecture Principle Extraction
|
|
357
|
+
|
|
358
|
+
If PRD.md contains an `# Architecture Principle` section, extract patterns that affect frontend decisions:
|
|
359
|
+
|
|
360
|
+
| Pattern to Extract | How It Influences the Specification |
|
|
361
|
+
|---|---|
|
|
362
|
+
| "Stateless REST API" | Confirms Axios + TanStack Query pattern for API calls |
|
|
363
|
+
| "Event-driven" / "WebSocket" / "real-time" | Include Socket.io client integration and real-time notification component |
|
|
364
|
+
| "API gateway" | Configure base URL to point to gateway rather than individual services |
|
|
365
|
+
| Backend framework mention | Validate API response format assumptions |
|
|
366
|
+
|
|
367
|
+
If the section is absent, proceed with existing CLAUDE.md-only detection.
|
|
368
|
+
|
|
369
|
+
### Design System Extraction
|
|
370
|
+
|
|
371
|
+
If PRD.md contains a `# Design System` section with a file reference:
|
|
372
|
+
1. Resolve and read the referenced file
|
|
373
|
+
2. Map design tokens to the Tailwind theme: extend `colors`, `fontFamily`, `borderRadius`,
|
|
374
|
+
`spacing`, and `boxShadow` in `tailwind.config.js`, and seed CSS custom properties in
|
|
375
|
+
`src/index.css` for light/dark token values
|
|
376
|
+
3. Include a complete `tailwind.config.js` in SPECIFICATION.md derived from the design system tokens
|
|
377
|
+
|
|
378
|
+
If the section is absent, derive tokens from the mockup CSS (existing behavior).
|
|
379
|
+
|
|
380
|
+
### High Level Process Flow Extraction
|
|
381
|
+
|
|
382
|
+
If PRD.md contains a `# High Level Process Flow` section:
|
|
383
|
+
1. Process flows with user-visible states inform which status values appear in list/table filter dropdowns
|
|
384
|
+
2. Process flows with real-time updates inform WebSocket subscription patterns
|
|
385
|
+
3. Multi-step user flows inform React Router nested route design
|
|
386
|
+
|
|
387
|
+
If the section is absent, derive UI flow from user stories only (existing behavior).
|
|
388
|
+
|
|
389
|
+
---
|
|
390
|
+
|
|
391
|
+
## Determining Optional Components
|
|
392
|
+
|
|
393
|
+
Instead of asking the user, the skill determines optional components by analyzing the
|
|
394
|
+
dependencies listed in `CLAUDE.md`, the `# Architecture Principle` section in PRD.md (if present),
|
|
395
|
+
and cross-referencing with PRD.md NFRs and constraints.
|
|
396
|
+
|
|
397
|
+
### Backend API Detection
|
|
398
|
+
|
|
399
|
+
Examine the "Depends on" list in CLAUDE.md for the target application:
|
|
400
|
+
|
|
401
|
+
| Dependency Pattern | API Configuration |
|
|
402
|
+
|---|---|
|
|
403
|
+
| References another application's REST API | `VITE_API_BASE_URL` set to that app's base URL |
|
|
404
|
+
| References a Spring Boot backend | Include Spring Boot CORS headers note |
|
|
405
|
+
| No explicit backend | Include mock API / json-server note for development |
|
|
406
|
+
|
|
407
|
+
### Authentication Detection
|
|
408
|
+
|
|
409
|
+
| Dependency / PRD Pattern | Auth Selection |
|
|
410
|
+
|---|---|
|
|
411
|
+
| References "Single Sign On" or "Keycloak" in CLAUDE.md dependencies | Auth = Keycloak |
|
|
412
|
+
| PRD.md has login user stories with email/password | Auth = Local (local JWT from API) |
|
|
413
|
+
| PRD.md constraint says "public access, no auth required" | Auth = none |
|
|
414
|
+
| PRD.md has only public-facing content (landing page) | Auth = none |
|
|
415
|
+
|
|
416
|
+
If Auth = Keycloak, also extract from CLAUDE.md:
|
|
417
|
+
- Keycloak version
|
|
418
|
+
- Keycloak realm: Default derived from project name
|
|
419
|
+
- Keycloak client ID: Default `<project-slug>-spa`
|
|
420
|
+
- Keycloak issuer URI: Default `http://localhost:8180/realms/<realm>`
|
|
421
|
+
- Keycloak roles: Infer from mockup role folders (e.g., `admin` → `ADMIN`, `editor` → `EDITOR`)
|
|
422
|
+
|
|
423
|
+
If Auth = Local (API-managed JWT):
|
|
424
|
+
- Login/logout handled by API calls to the backend
|
|
425
|
+
- JWT stored in memory (not localStorage) for XSS protection
|
|
426
|
+
- Axios interceptor attaches Authorization header
|
|
427
|
+
- Zustand auth store manages token and user info
|
|
428
|
+
|
|
429
|
+
### Optional Component Detection
|
|
430
|
+
|
|
431
|
+
| PRD.md Pattern | Component Selection |
|
|
432
|
+
|---|---|
|
|
433
|
+
| NFRs mention "grid", "sortable columns", "bulk select", "export CSV" | DataGrid = yes (TanStack Table) |
|
|
434
|
+
| NFRs mention "chart", "bar chart", "pie chart", "graph", "statistics" | Charts = yes (Recharts) |
|
|
435
|
+
| NFRs mention "date picker", "date range", "calendar" | DatePickers = yes (react-day-picker) |
|
|
436
|
+
| NFRs mention "real-time", "live updates", "push notification", "WebSocket" | WebSocket = yes |
|
|
437
|
+
| PRD.md mentions multiple languages or localization | i18n = yes |
|
|
438
|
+
| User stories mention "rich text", "WYSIWYG", "formatted content", "HTML content" | RichText = yes (Tiptap) |
|
|
439
|
+
| NFRs mention "report", "generate report", "report generation", "PDF report" | Reporting = yes |
|
|
440
|
+
| User stories describe generating/downloading PDF, Excel, or CSV reports | Reporting = yes |
|
|
441
|
+
| A "Report" module exists in PRD.md with NFRs defining a Report interface | Reporting = yes |
|
|
442
|
+
|
|
443
|
+
### Summary of Determination
|
|
444
|
+
|
|
445
|
+
After analyzing all inputs, produce a determination summary before generating the spec.
|
|
446
|
+
Present it to the user for confirmation:
|
|
447
|
+
|
|
448
|
+
```
|
|
449
|
+
Optional Component Determination:
|
|
450
|
+
- Backend API: http://localhost:<port>/api (from CLAUDE.md Port Allocation table → depends on backend app)
|
|
451
|
+
- Authentication: Keycloak PKCE (from CLAUDE.md → depends on Single Sign On)
|
|
452
|
+
- DataGrid: yes (TanStack Table — from PRD.md → NFR mentions sortable user list with bulk actions)
|
|
453
|
+
- Charts: no
|
|
454
|
+
- DatePickers: yes (react-day-picker — from PRD.md → hero section effective/expiration date fields)
|
|
455
|
+
- WebSocket: no
|
|
456
|
+
- i18n: no
|
|
457
|
+
- RichText: yes (Tiptap — from PRD.md → blog content editor requires rich text)
|
|
458
|
+
- Reporting: yes (from PRD.md → Report module with Report interface NFR)
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
If the user disagrees with any determination, allow them to override before proceeding.
|
|
462
|
+
|
|
463
|
+
## Required Inputs
|
|
464
|
+
|
|
465
|
+
After determination, these values are needed. Most are derived automatically:
|
|
466
|
+
|
|
467
|
+
**Auto-derived from context files:**
|
|
468
|
+
- **Application name**: From CLAUDE.md section heading
|
|
469
|
+
- **Project slug**: Kebab-case of application name
|
|
470
|
+
- **App title**: Title-case used in `<title>` and the topbar
|
|
471
|
+
- **Application description**: From CLAUDE.md description
|
|
472
|
+
- **Backend API base URL**: From CLAUDE.md dependencies
|
|
473
|
+
- **Modules / Features**: From PRD.md module headings + model/MODEL.md
|
|
474
|
+
- **Auth type**: Auto-determined (see above)
|
|
475
|
+
- **Optional components**: Auto-determined (see above)
|
|
476
|
+
- **User roles**: From mockup role folders
|
|
477
|
+
- **Design tokens**: Tailwind theme colors/fonts/radius extracted from mockup CSS/inline styles
|
|
478
|
+
|
|
479
|
+
**Auto-derived from CLAUDE.md (Port Allocation table):**
|
|
480
|
+
- **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://localhost:<port>/api/v1`. Do NOT hardcode `8080` — the port MUST match the allocated port for the backend application this SPA depends on.
|
|
481
|
+
|
|
482
|
+
**Optional (use sensible defaults if not found in context):**
|
|
483
|
+
- **Dev server port**: Default `3000`
|
|
484
|
+
- **Default locale**: Default `en`
|
|
485
|
+
- **Page size**: Default `10` (from NFRs, or fallback)
|
|
486
|
+
|
|
487
|
+
## Generating the Specification
|
|
488
|
+
|
|
489
|
+
Once inputs are gathered from context files and optional components are determined,
|
|
490
|
+
generate the specification as a **multi-file output split by module**. Read the spec
|
|
491
|
+
template at `references/spec-template.md` for the exact structure and content of each
|
|
492
|
+
section. The template is the authoritative guide — follow it closely.
|
|
493
|
+
|
|
494
|
+
The specification is split into two categories:
|
|
495
|
+
|
|
496
|
+
1. **Root `SPECIFICATION.md`** — Table of Contents, shared infrastructure, Tailwind
|
|
497
|
+
configuration and design tokens, routing, auth configuration, and application-level
|
|
498
|
+
sections that apply across all modules.
|
|
499
|
+
2. **Per-module `<module-name>/SPEC.md`** — Each module gets its own folder with a
|
|
500
|
+
self-contained specification covering that module's complete blueprint.
|
|
501
|
+
|
|
502
|
+
This split enables a coding agent to:
|
|
503
|
+
- First, scaffold the shared infrastructure from `SPECIFICATION.md`
|
|
504
|
+
- Then, implement each module independently by picking up its `<module>/SPEC.md`
|
|
505
|
+
|
|
506
|
+
**Important:** The generated spec must use **real module data** from the context files,
|
|
507
|
+
not generic placeholders. Specifically:
|
|
508
|
+
|
|
509
|
+
- **Modules** must use the actual module names from PRD.md and MODEL.md
|
|
510
|
+
(e.g., `heroSection`, `productService`, `blog` — not `module1`, `module2`)
|
|
511
|
+
- **TypeScript types** must match the actual fields defined in the module model files,
|
|
512
|
+
not placeholder `fieldOne`/`fieldTwo`
|
|
513
|
+
- **API hooks** must expose functions matching the actual user stories (e.g., if a story
|
|
514
|
+
says "view list of hero sections", the hook needs `useHeroSections()`)
|
|
515
|
+
- **Page components** must map to the actual mockup screens (e.g., if
|
|
516
|
+
`admin/content/hero_section.html` exists, there must be a matching route and page
|
|
517
|
+
component). The route path is module-based (e.g., `/hero-section`), NOT role-prefixed
|
|
518
|
+
(e.g., NOT `/admin/hero-section`).
|
|
519
|
+
- **Form fields** must match what the mockup screens display
|
|
520
|
+
- **Zod schemas** must enforce the constraints from PRD.md (character limits, URL format, etc.)
|
|
521
|
+
- **Tailwind theme** must use the design tokens extracted from the mockup (colors, border-radius, font)
|
|
522
|
+
- **Version tags**: Every user story ID, NFR ID, constraint ID, and mockup screen in the
|
|
523
|
+
traceability section must include its version tag (e.g., `USA000030 [v1.0.4]`).
|
|
524
|
+
**ALL traceability sub-tables (User Stories, NFRs, AND Constraints) MUST include the
|
|
525
|
+
`| Version |` column.**
|
|
526
|
+
- **Removed / Replaced items**: The traceability section must include a "Removed / Replaced"
|
|
527
|
+
subsection listing deprecated items — showing the removed ID, the version that removed it,
|
|
528
|
+
the replacement ID (if any), and a brief reason.
|
|
529
|
+
|
|
530
|
+
### Output Structure
|
|
531
|
+
|
|
532
|
+
```
|
|
533
|
+
<app_folder>/context/specification/
|
|
534
|
+
├── SPECIFICATION.md ← TOC + shared/application-level specs
|
|
535
|
+
├── hero-section/
|
|
536
|
+
│ └── SPEC.md ← Module blueprint for Hero Section
|
|
537
|
+
├── product-service/
|
|
538
|
+
│ └── SPEC.md ← Module blueprint for Product and Service
|
|
539
|
+
├── blog/
|
|
540
|
+
│ └── SPEC.md ← Module blueprint for Blog
|
|
541
|
+
├── ... ← One folder per module from PRD.md
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
### What Goes in `SPECIFICATION.md` (Root)
|
|
545
|
+
|
|
546
|
+
The root file contains the TOC and all shared/application-level sections. These are
|
|
547
|
+
sections a coding agent implements **first** before any module work:
|
|
548
|
+
|
|
549
|
+
#### 1. Project Overview
|
|
550
|
+
Project metadata, application description, technology stack summary, user roles, module
|
|
551
|
+
index table linking to each module's SPEC.md.
|
|
552
|
+
|
|
553
|
+
#### 2. Package Configuration
|
|
554
|
+
Complete `package.json` with all dependencies (core + selected conditional), npm scripts
|
|
555
|
+
(`dev`, `build`, `preview`, `lint`, `type-check`), and Vite configuration.
|
|
556
|
+
|
|
557
|
+
#### 3. Application Configuration
|
|
558
|
+
Vite `vite.config.ts` (with proxy for backend API), TypeScript `tsconfig.json`, ESLint
|
|
559
|
+
config, Tailwind `tailwind.config.js`, `postcss.config.js`, and `src/index.css`
|
|
560
|
+
(Tailwind directives + design-token CSS variables). All environment-sensitive values use
|
|
561
|
+
`VITE_` prefix in environment files.
|
|
562
|
+
|
|
563
|
+
#### 3a. Application Version Configuration
|
|
564
|
+
The application MUST include a version value exposed via Vite environment variable with a
|
|
565
|
+
default derived from the version argument provided during skill invocation. If multiple
|
|
566
|
+
versions were provided, use the highest one.
|
|
567
|
+
|
|
568
|
+
In `.env.development` and `.env.production`:
|
|
569
|
+
```properties
|
|
570
|
+
VITE_APP_VERSION=1.0.3
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
The application MUST expose this version in the **footer** of the layout. The shared layout
|
|
574
|
+
component (e.g., `src/shared/layouts/Footer.tsx`) must read `import.meta.env.VITE_APP_VERSION`
|
|
575
|
+
and render it as: `v{version}` (e.g., `v1.0.3`).
|
|
576
|
+
|
|
577
|
+
The `package.json` `version` field MUST also be set to the version value (e.g., `1.0.3`).
|
|
578
|
+
|
|
579
|
+
#### 3b. `.env.development` File Generation from ENVIRONMENT.md
|
|
580
|
+
Generate `.env.development` and `.env.production` files at the project root.
|
|
581
|
+
The `.env.development` file is populated by reading the project-root credential file,
|
|
582
|
+
mapping credential and platform values to `VITE_`-prefixed environment variable names.
|
|
583
|
+
The `.env.production` file uses placeholder values for production deployment.
|
|
584
|
+
|
|
585
|
+
**Credential source resolution:** Read `ENVIRONMENT.md` from the project root — this is the
|
|
586
|
+
canonical per-developer credential/platform file generated by `util-projectinit` and
|
|
587
|
+
referenced from `CLAUDE.md` (e.g., `See [ENVIRONMENT.md](./ENVIRONMENT.md)`). For backward
|
|
588
|
+
compatibility, if `ENVIRONMENT.md` is absent but a legacy `SECRET.md` exists, read that
|
|
589
|
+
instead. If neither exists, fall back to sensible local defaults.
|
|
590
|
+
|
|
591
|
+
**Process:**
|
|
592
|
+
1. Read `ENVIRONMENT.md` (or legacy `SECRET.md`) from the project root
|
|
593
|
+
2. Extract relevant values:
|
|
594
|
+
- From `# Supporting 3rd Party Applications` → `## Keycloak` (host, HTTP port, realm,
|
|
595
|
+
OIDC issuer, and the **client ID matching this application** in the Clients table) and
|
|
596
|
+
any other 3rd-party service this SPA talks to directly
|
|
597
|
+
- From `# External Services` → values for any external service the SPA calls directly
|
|
598
|
+
- The **backend API base URL** is derived from the `# Port Allocation` table in
|
|
599
|
+
`CLAUDE.md` (the port of the backend application this SPA depends on), NOT from a
|
|
600
|
+
hardcoded port — construct `http://localhost:<port>/api/v1`
|
|
601
|
+
3. Map each value to the corresponding `VITE_` environment variable name
|
|
602
|
+
4. Generate `.env.development` with actual local values
|
|
603
|
+
5. Generate `.env.production` with production placeholder values
|
|
604
|
+
|
|
605
|
+
**Example `.env.development` output (derived from ENVIRONMENT.md + CLAUDE.md Port Allocation):**
|
|
606
|
+
```properties
|
|
607
|
+
# Backend API (port from CLAUDE.md Port Allocation table for the backend app this SPA depends on)
|
|
608
|
+
VITE_API_BASE_URL=http://localhost:8001/api/v1
|
|
609
|
+
|
|
610
|
+
# Authentication (Keycloak) — host/port/realm/issuer + the client ID for THIS app
|
|
611
|
+
VITE_KEYCLOAK_AUTHORITY=http://127.0.0.1:8180/realms/skf
|
|
612
|
+
VITE_KEYCLOAK_CLIENT_ID=skolafund-web
|
|
613
|
+
VITE_KEYCLOAK_REDIRECT_URI=http://localhost:3000/auth/callback
|
|
614
|
+
```
|
|
615
|
+
|
|
616
|
+
**Rules:**
|
|
617
|
+
- Only include variables that are actually used in the application code via `import.meta.env`
|
|
618
|
+
- Use actual values from `ENVIRONMENT.md` — never use placeholders or `TODO`
|
|
619
|
+
- Match the **client ID** to this application's row in the Keycloak Clients table (e.g., a
|
|
620
|
+
"School Web" SPA uses client `school-web`), not a generic guess
|
|
621
|
+
- If `ENVIRONMENT.md` does not exist or a value is not found, use sensible defaults for local
|
|
622
|
+
development (e.g., `localhost`, default ports)
|
|
623
|
+
- Both `.env.development` and `.env.production` are gitignored
|
|
624
|
+
|
|
625
|
+
#### 4. Directory Structure
|
|
626
|
+
The complete source tree under `src/`. The structure follows feature-based architecture
|
|
627
|
+
where each PRD module maps to a `src/features/<module>/` folder.
|
|
628
|
+
Read `references/routing-patterns.md` for the module folder layout.
|
|
629
|
+
|
|
630
|
+
#### 5. Tailwind Configuration & Design Tokens
|
|
631
|
+
Custom Tailwind theme built from design tokens extracted from mockup screens. Includes:
|
|
632
|
+
- `tailwind.config.js` — `darkMode: 'class'`, `content` globs, `theme.extend` with the
|
|
633
|
+
color palette (primary, secondary, danger, warning, success, neutral), font family,
|
|
634
|
+
border-radius, and box-shadow tokens; `plugins: [forms, typography (if RichText)]`
|
|
635
|
+
- `src/index.css` — `@tailwind base/components/utilities` directives plus `:root` and
|
|
636
|
+
`.dark` CSS custom properties for semantic tokens
|
|
637
|
+
- `src/lib/utils/cn.ts` — the `cn()` helper (`twMerge(clsx(...))`)
|
|
638
|
+
- Design token mapping table showing mockup CSS property → Tailwind token
|
|
639
|
+
Read `references/component-patterns.md` for the theme/token setup pattern.
|
|
640
|
+
|
|
641
|
+
#### 6. Authentication Configuration *(conditional — include only if Auth != none)*
|
|
642
|
+
**If Auth = Keycloak:** PKCE Authorization Code flow using `oidc-client-ts` +
|
|
643
|
+
`react-oidc-context`. `AuthProvider` wraps the app, `useAuthUser()` hook exposes user and
|
|
644
|
+
tokens, Axios interceptor attaches Bearer token, protected route component checks
|
|
645
|
+
authentication. Read `references/security-patterns.md` for the full auth architecture.
|
|
646
|
+
|
|
647
|
+
**If Auth = Local (API JWT):** Login form submits to backend API, JWT stored in Zustand
|
|
648
|
+
auth store (memory only, not localStorage), Axios interceptor attaches Authorization
|
|
649
|
+
header, token refresh interceptor handles 401 responses, protected route component
|
|
650
|
+
redirects unauthenticated users.
|
|
651
|
+
|
|
652
|
+
#### 7. Router Configuration
|
|
653
|
+
React Router v7 route tree — lazy-loaded page components, protected routes with role
|
|
654
|
+
guards, public routes, 404 fallback.
|
|
655
|
+
Read `references/routing-patterns.md` for route patterns.
|
|
656
|
+
|
|
657
|
+
#### 8. API Client Configuration
|
|
658
|
+
Axios instance with `baseURL` from `VITE_API_BASE_URL`, request/response interceptors
|
|
659
|
+
for auth token injection, global error handling (toast notifications for 4xx/5xx),
|
|
660
|
+
request timeout.
|
|
661
|
+
|
|
662
|
+
#### 9. Global State (Zustand)
|
|
663
|
+
App-level Zustand stores: auth store (user info, token, login/logout actions), UI store
|
|
664
|
+
(sidebar open/closed, theme mode, global loading). Feature-level stores defined in each
|
|
665
|
+
module's SPEC.md.
|
|
666
|
+
|
|
667
|
+
#### 10. TanStack Query Setup
|
|
668
|
+
`QueryClient` configuration with sensible defaults (staleTime, gcTime, retry logic),
|
|
669
|
+
`QueryClientProvider` wrapping the app, React Query DevTools for development,
|
|
670
|
+
global error handler for failed queries.
|
|
671
|
+
|
|
672
|
+
#### 11. Shared Layouts
|
|
673
|
+
`DashboardLayout` (sidebar navigation + topbar + content area for authenticated pages),
|
|
674
|
+
`PublicLayout` (minimal header/footer for public pages), `AuthLayout` (centered card
|
|
675
|
+
for login/callback pages). Each layout is built with Tailwind utility classes.
|
|
676
|
+
|
|
677
|
+
#### 12. Shared Components
|
|
678
|
+
Reusable Tailwind/Headless UI components used across multiple modules: `Button`, `Card`,
|
|
679
|
+
`PageHeader`, `DataTable` (wrapper around TanStack Table or a simple Tailwind table),
|
|
680
|
+
`ConfirmDialog` (Headless UI `Dialog`), `StatusBadge`, `Modal`/`FormDialog`,
|
|
681
|
+
`ImageUpload`, `LoadingOverlay`/`Spinner`, `EmptyState`, `ErrorBoundary`, `SearchInput`,
|
|
682
|
+
`FilterBar`, `Pagination`. Each with TypeScript props interface.
|
|
683
|
+
|
|
684
|
+
#### 13. Navigation Configuration
|
|
685
|
+
Sidebar navigation items derived from mockup sidebar files, organized by role. Each item
|
|
686
|
+
has label, icon (Heroicons component), path, and required role. Navigation is rendered
|
|
687
|
+
dynamically based on the authenticated user's roles.
|
|
688
|
+
|
|
689
|
+
#### 14. Form Infrastructure
|
|
690
|
+
`FormProvider` usage pattern from React Hook Form, Zod schema integration via
|
|
691
|
+
`zodResolver`, reusable controlled input components (`TextFieldController`,
|
|
692
|
+
`TextAreaController`, `SelectController` (Headless UI `Listbox`), `DatePickerController`
|
|
693
|
+
(react-day-picker), `SwitchController` (Headless UI `Switch`), `ComboboxController`
|
|
694
|
+
(Headless UI `Combobox`)) that wrap Tailwind-styled inputs with RHF `Controller`.
|
|
695
|
+
|
|
696
|
+
#### 15. Error Handling Strategy
|
|
697
|
+
React `ErrorBoundary` component for rendering errors, Axios response interceptor for
|
|
698
|
+
API errors, TanStack Query `onError` callback for query failures, Zod validation error
|
|
699
|
+
message extraction utility, toast notifications for user-facing error messages.
|
|
700
|
+
|
|
701
|
+
#### 16. Notification System
|
|
702
|
+
Headless UI `Transition`-animated toast stack styled with Tailwind. Zustand notification
|
|
703
|
+
store with `push(type, message)` and `dismiss(id)` actions. `NotificationProvider` renders
|
|
704
|
+
the active queue in a fixed viewport corner.
|
|
705
|
+
|
|
706
|
+
#### 17. Theming & Dark Mode
|
|
707
|
+
Tailwind `darkMode: 'class'` strategy. Theme mode (`light`/`dark`) toggled via UI
|
|
708
|
+
control, persisted to `localStorage` through the Zustand UI store. An effect syncs the
|
|
709
|
+
`dark` class on `document.documentElement`. `useColorMode()` (or the UI store) wraps the
|
|
710
|
+
toggle action. Semantic colors are defined as CSS variables in `src/index.css` for both modes.
|
|
711
|
+
|
|
712
|
+
#### 18. Testing Strategy
|
|
713
|
+
Overview: Vitest + React Testing Library for unit/component tests, MSW (Mock Service
|
|
714
|
+
Worker) for API mocking in tests, Playwright for E2E tests. Per-feature test conventions
|
|
715
|
+
matching the module spec.
|
|
716
|
+
|
|
717
|
+
#### 19. Build & Deployment
|
|
718
|
+
Vite production build (`npm run build`), chunk splitting strategy (vendor chunk, per-
|
|
719
|
+
feature lazy chunks), environment variable injection, static hosting notes (nginx config
|
|
720
|
+
for SPA routing).
|
|
721
|
+
|
|
722
|
+
#### 20. Internationalisation *(conditional — include only if i18n = yes)*
|
|
723
|
+
`react-i18next` setup, `I18nextProvider` wrapping the app, lazy-loaded translation
|
|
724
|
+
namespaces per module (e.g., `heroSection.json`), `useTranslation()` hook usage pattern,
|
|
725
|
+
language switcher component (Headless UI `Menu`).
|
|
726
|
+
|
|
727
|
+
#### 21. WebSocket Integration *(conditional — include only if WebSocket = yes)*
|
|
728
|
+
`socket.io-client` setup, connection management Zustand store, custom `useSocket()`
|
|
729
|
+
hook, event subscription patterns, reconnection handling.
|
|
730
|
+
|
|
731
|
+
#### 22. Reporting (Puppeteer) *(conditional — include only if Reporting = yes)*
|
|
732
|
+
Client-side report UI components and server-side Puppeteer PDF generation service.
|
|
733
|
+
Includes report list page (Tailwind card grid grouped by domain), report parameter
|
|
734
|
+
form page (React Hook Form + Zod + Tailwind/Headless UI controls), report preview dialog
|
|
735
|
+
(iframe-based HTML preview in a Headless UI `Dialog`), `useReportGeneration()` hook
|
|
736
|
+
orchestrating PDF/XLSX/CSV generation, `renderReportHtml()` utility using
|
|
737
|
+
`ReactDOMServer.renderToStaticMarkup()` to produce self-contained HTML with Tailwind CDN
|
|
738
|
+
for Puppeteer rendering, report layout components (React components rendering
|
|
739
|
+
tabular/summary reports as HTML), client-side XLSX export via `xlsx` library, client-side
|
|
740
|
+
CSV export via `PapaParse`, lightweight Node.js Express report service using Puppeteer for
|
|
741
|
+
HTML-to-PDF conversion (deployed as sidecar or microservice), Vite proxy configuration for
|
|
742
|
+
development. Report layouts are fully AI-agent-developed React components — no visual
|
|
743
|
+
designers needed. Read `references/reporting-patterns.md` for the full reporting
|
|
744
|
+
architecture.
|
|
745
|
+
|
|
746
|
+
### What Goes in Each `<module>/SPEC.md` (Per-Module)
|
|
747
|
+
|
|
748
|
+
For EACH module from PRD.md and MODEL.md, create a folder named after the module
|
|
749
|
+
(kebab-case, e.g., `hero-section/`) and generate a `SPEC.md` inside it.
|
|
750
|
+
|
|
751
|
+
Each module `SPEC.md` is a **self-contained** blueprint that a coding agent can pick up
|
|
752
|
+
and implement independently (after the shared infrastructure is in place). It must include:
|
|
753
|
+
|
|
754
|
+
- **Header** with module name and back-reference to root `SPECIFICATION.md`
|
|
755
|
+
- **Traceability**: User story IDs, NFR IDs, constraint IDs, table/collection names,
|
|
756
|
+
mockup screen filenames, all with version tags
|
|
757
|
+
- **TypeScript Types** — interfaces/types matching the module model fields (field-for-field)
|
|
758
|
+
- **Zod Schemas** — validation schemas for create/update forms, derived from PRD constraints
|
|
759
|
+
- **API Functions** — Axios-based API calls matching user story data operations
|
|
760
|
+
- **TanStack Query Hooks** — `useQuery` and `useMutation` hooks wrapping API functions
|
|
761
|
+
- **Zustand Feature Store** (if the module has complex client state beyond server cache)
|
|
762
|
+
- **Page Components** — one per mockup screen, using Tailwind/Headless UI components matching the mockup layout
|
|
763
|
+
- **Form Components** — create/edit forms with React Hook Form + Zod + Tailwind controllers
|
|
764
|
+
- **Route Definitions** — React Router routes for this module
|
|
765
|
+
- **Navigation Items** — sidebar nav entries for each role that can access this module
|
|
766
|
+
- **Complete code samples** for every component — continuous and copy-pasteable
|
|
767
|
+
|
|
768
|
+
See `references/spec-template.md` for the exact per-module template structure.
|
|
769
|
+
|
|
770
|
+
## Changelog Append
|
|
771
|
+
|
|
772
|
+
After all specification files are successfully generated, append an entry to `CHANGELOG.md` in the application folder (`<app_folder>/CHANGELOG.md`):
|
|
773
|
+
|
|
774
|
+
1. Read `<app_folder>/CHANGELOG.md`. If it does not exist, create it with:
|
|
775
|
+
```markdown
|
|
776
|
+
# Changelog
|
|
777
|
+
|
|
778
|
+
- This file tracks all skill executions by version for this application.
|
|
779
|
+
- The highest version recorded here is the current application version.
|
|
780
|
+
- Skills MUST NOT execute for a version lower than the highest version in this file.
|
|
781
|
+
|
|
782
|
+
---
|
|
783
|
+
```
|
|
784
|
+
2. Search for a `## {version}` heading matching the current version.
|
|
785
|
+
3. If the section **exists**: append a new row to its table.
|
|
786
|
+
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.
|
|
787
|
+
5. Row format: `| {YYYY-MM-DD} | {application_name} | specgen-react-tailwind | {module or "All"} | Generated React + Tailwind SPA technical specification |`
|
|
788
|
+
6. **Never modify or delete existing rows.**
|
|
789
|
+
|
|
790
|
+
## Output Format
|
|
791
|
+
|
|
792
|
+
The generated specification is a **folder of files**, not a single document:
|
|
793
|
+
|
|
794
|
+
```
|
|
795
|
+
<app_folder>/context/specification/
|
|
796
|
+
├── SPECIFICATION.md ← Root: TOC + shared/application-level specs
|
|
797
|
+
├── <module-1>/
|
|
798
|
+
│ └── SPEC.md ← Module blueprint (self-contained)
|
|
799
|
+
├── <module-2>/
|
|
800
|
+
│ └── SPEC.md
|
|
801
|
+
├── <module-N>/
|
|
802
|
+
│ └── SPEC.md
|
|
803
|
+
```
|
|
804
|
+
|
|
805
|
+
## Constraints (Non-Negotiable)
|
|
806
|
+
|
|
807
|
+
These constraints apply to every code sample in the generated spec:
|
|
808
|
+
|
|
809
|
+
**TypeScript everywhere.** All files use `.tsx` or `.ts` extensions. No `.js` or `.jsx`
|
|
810
|
+
(except `tailwind.config.js` / `postcss.config.js`, which are config files). No `any`
|
|
811
|
+
type — use `unknown` with type narrowing, or proper type inference.
|
|
812
|
+
|
|
813
|
+
**Feature-based architecture.** Every module maps to `src/features/<module>/`. Nothing
|
|
814
|
+
module-specific leaks into `src/shared/` or `src/lib/`. Shared utilities must be
|
|
815
|
+
genuinely reusable across at least two modules.
|
|
816
|
+
|
|
817
|
+
**No localStorage for tokens.** JWT access tokens are stored in Zustand memory store
|
|
818
|
+
only. Refresh tokens may use `httpOnly` cookies (handled by backend). This prevents XSS
|
|
819
|
+
token theft.
|
|
820
|
+
|
|
821
|
+
**TanStack Query for all server state.** Do not use Zustand or component state to cache
|
|
822
|
+
API responses. TanStack Query manages all server-side data (fetching, caching, invalidation).
|
|
823
|
+
Zustand manages only client-side UI state (filters, selections, modal open/closed).
|
|
824
|
+
|
|
825
|
+
**React Hook Form + Zod for all forms.** Do not use uncontrolled inputs or manual
|
|
826
|
+
`useState` for form fields. Every form uses `useForm()` with `zodResolver()`.
|
|
827
|
+
|
|
828
|
+
**Tailwind utility-first, Headless UI for interactivity.** Style everything with Tailwind
|
|
829
|
+
utility classes. Do NOT introduce a component framework (MUI, Ant Design, Chakra, Bootstrap).
|
|
830
|
+
For interactive/accessible widgets that need focus management, keyboard nav, or ARIA
|
|
831
|
+
(modals, dropdowns, comboboxes, listboxes, switches, tabs, popovers, transitions), use
|
|
832
|
+
**Headless UI** primitives. For icons, use **Heroicons** (`@heroicons/react/24/outline`
|
|
833
|
+
and `/24/solid`). Do not embed inline SVG or icon CDNs.
|
|
834
|
+
|
|
835
|
+
**Compose classes with `cn()`.** Use the `cn()` helper (`tailwind-merge` over `clsx`) for
|
|
836
|
+
all conditional/merged className logic. Never concatenate class strings manually with
|
|
837
|
+
template literals where conflicts could arise.
|
|
838
|
+
|
|
839
|
+
**Variants via `cva`.** Components with multiple visual variants (Button, Badge, Alert)
|
|
840
|
+
define their classes with `class-variance-authority` and expose typed `variant`/`size` props.
|
|
841
|
+
|
|
842
|
+
**Dark mode via the `class` strategy.** Use Tailwind `dark:` variants. The `dark` class is
|
|
843
|
+
toggled on `document.documentElement` from the Zustand UI store; the preference persists to
|
|
844
|
+
`localStorage`. Never hardcode light-only colors — always provide a `dark:` counterpart for
|
|
845
|
+
backgrounds, text, and borders.
|
|
846
|
+
|
|
847
|
+
**Named exports for components.** Use named exports (not default exports) for all
|
|
848
|
+
component files to improve tree-shaking and refactoring.
|
|
849
|
+
|
|
850
|
+
**Lazy loading for all page components.** All route page components use `React.lazy()`
|
|
851
|
+
for code splitting. The router uses `<Suspense>` with a loading fallback.
|
|
852
|
+
|
|
853
|
+
**Consistent file naming:**
|
|
854
|
+
- Components: `PascalCase.tsx` (e.g., `HeroSectionList.tsx`)
|
|
855
|
+
- Hooks: `camelCase.ts` with `use` prefix (e.g., `useHeroSections.ts`)
|
|
856
|
+
- API functions: `camelCase.ts` (e.g., `heroSectionApi.ts`)
|
|
857
|
+
- Types: `camelCase.types.ts` (e.g., `heroSection.types.ts`)
|
|
858
|
+
- Zod schemas: `camelCase.schema.ts` (e.g., `heroSection.schema.ts`)
|
|
859
|
+
- Zustand stores: `camelCase.store.ts` (e.g., `heroSection.store.ts`)
|