ima2-gen 2.0.15 → 2.0.16
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/README.md +30 -0
- package/bin/commands/skill.js +336 -17
- package/bin/ima2.js +22 -2
- package/bin/lib/doctor-checks.js +6 -4
- package/config.js +1 -0
- package/docs/CLI.md +25 -3
- package/docs/PROMPT_STUDIO.ko.md +29 -0
- package/docs/PROMPT_STUDIO.md +31 -0
- package/docs/migration/runtime-test-inventory.md +7 -1
- package/lib/agentImageVideoGen.js +8 -0
- package/lib/agentQueueStore.js +36 -10
- package/lib/agentQueueWorker.js +79 -7
- package/lib/agentRuntime.js +2 -0
- package/lib/assetLifecycle.js +40 -8
- package/lib/canvasVersionStore.js +86 -0
- package/lib/cardNewsGenerator.js +37 -3
- package/lib/cardNewsJobStore.js +10 -0
- package/lib/cardNewsManifestStore.js +6 -12
- package/lib/cardNewsPath.js +25 -0
- package/lib/db.js +2 -0
- package/lib/generatePipeline.js +474 -0
- package/lib/generationInputValidation.js +32 -0
- package/lib/grokImageCore.js +18 -1
- package/lib/historyIndex.js +11 -4
- package/lib/historyList.js +3 -0
- package/lib/imageMetadata.js +3 -0
- package/lib/inflight.js +30 -3
- package/lib/multimodePipeline.js +462 -0
- package/lib/nodeGeneration.js +440 -0
- package/lib/nodeValidation.js +23 -0
- package/lib/oauthProxy/generators.js +3 -246
- package/lib/oauthProxy/multimodeGenerators.js +251 -0
- package/lib/routeHelpers.js +9 -2
- package/package.json +2 -2
- package/routes/agent.js +4 -4
- package/routes/canvasVersions.js +21 -1
- package/routes/cardNews.js +2 -1
- package/routes/edit.js +25 -9
- package/routes/events.js +5 -1
- package/routes/generate.js +2 -481
- package/routes/keys.js +31 -39
- package/routes/multimode.js +2 -502
- package/routes/nodes.js +3 -448
- package/routes/video.js +12 -3
- package/routes/videoExtended.js +19 -4
- package/server.js +53 -1
- package/skills/ima2/SKILL.md +204 -0
- package/skills/ima2-front/SKILL.md +611 -0
- package/skills/ima2-front/references/a11y-patterns.md +134 -0
- package/skills/ima2-front/references/aesthetics.md +327 -0
- package/skills/ima2-front/references/anti-slop.md +241 -0
- package/skills/ima2-front/references/asset-requirements.md +431 -0
- package/skills/ima2-front/references/brand-asset-sourcing.md +122 -0
- package/skills/ima2-front/references/color-system.md +132 -0
- package/skills/ima2-front/references/consistency-locks.md +20 -0
- package/skills/ima2-front/references/crud-ui.md +53 -0
- package/skills/ima2-front/references/dropdown-layer.md +110 -0
- package/skills/ima2-front/references/i18n-global.md +104 -0
- package/skills/ima2-front/references/iterative-design.md +90 -0
- package/skills/ima2-front/references/korea-2026.md +174 -0
- package/skills/ima2-front/references/layout-discipline.md +161 -0
- package/skills/ima2-front/references/liquid-glass.md +181 -0
- package/skills/ima2-front/references/logo-sections.md +194 -0
- package/skills/ima2-front/references/mobile-ux.md +144 -0
- package/skills/ima2-front/references/performance-budget.md +106 -0
- package/skills/ima2-front/references/preflight-full.md +58 -0
- package/skills/ima2-front/references/product-density.md +53 -0
- package/skills/ima2-front/references/prototype-variants.md +54 -0
- package/skills/ima2-front/references/reference-capture.md +120 -0
- package/skills/ima2-front/references/responsive-viewport.md +139 -0
- package/skills/ima2-front/references/seo-baseline.md +123 -0
- package/skills/ima2-front/references/soft-3d-asset-gates.md +70 -0
- package/skills/ima2-front/references/stacks/astro.md +204 -0
- package/skills/ima2-front/references/stacks/mobile-native.md +281 -0
- package/skills/ima2-front/references/stacks/nextjs.md +219 -0
- package/skills/ima2-front/references/stacks/react.md +264 -0
- package/skills/ima2-front/references/stacks/svelte.md +235 -0
- package/skills/ima2-front/references/stacks/vanilla.md +226 -0
- package/skills/ima2-front/references/theme-switching.md +82 -0
- package/skills/ima2-front/references/top-bar.md +126 -0
- package/skills/ima2-front/references/typography-wrapping.md +270 -0
- package/skills/ima2-front/references/ux-writing-ko.md +62 -0
- package/skills/ima2-front/references/visual-verification.md +102 -0
- package/skills/ima2-uiux/SKILL.md +477 -0
- package/skills/ima2-uiux/references/anti-slop-judgment.md +39 -0
- package/skills/ima2-uiux/references/color-system.md +80 -0
- package/skills/ima2-uiux/references/design-isms.md +194 -0
- package/skills/ima2-uiux/references/design-read-example.md +33 -0
- package/skills/ima2-uiux/references/design-system-bootstrap.md +133 -0
- package/skills/ima2-uiux/references/favicon-logo.md +355 -0
- package/skills/ima2-uiux/references/form-patterns.md +118 -0
- package/skills/ima2-uiux/references/intent-discovery-ladder.md +86 -0
- package/skills/ima2-uiux/references/korean-design-vocabulary.md +52 -0
- package/skills/ima2-uiux/references/layout-macrostructures.md +54 -0
- package/skills/ima2-uiux/references/logo-trust-sections.md +96 -0
- package/skills/ima2-uiux/references/mobile-native-ux.md +207 -0
- package/skills/ima2-uiux/references/product-personalities.md +118 -0
- package/skills/ima2-uiux/references/responsive-nav.md +66 -0
- package/skills/ima2-uiux/references/typography-line-breaks.md +193 -0
- package/skills/ima2-uiux/references/ux-preflight.md +65 -0
- package/skills/ima2-uiux/references/ux-states.md +197 -0
- package/skills/ima2-uiux/references/visual-hierarchy.md +115 -0
- package/ui/dist/.vite/manifest.json +13 -13
- package/ui/dist/assets/AgentWorkspace-CtYt4SF5.js +3 -0
- package/ui/dist/assets/{CardNewsWorkspace-Cdxn1ohU.js → CardNewsWorkspace-DN5cVqG5.js} +1 -1
- package/ui/dist/assets/GenerationRequestLogPanel-DnmUQdKR.js +1 -0
- package/ui/dist/assets/{NodeCanvas-C67sLboA.js → NodeCanvas-CxpfIBI0.js} +1 -1
- package/ui/dist/assets/PromptBuilderPanel-C2R3ObtR.js +2 -0
- package/ui/dist/assets/{PromptImportDialog-DeQXsEEv.js → PromptImportDialog-BIxz_yEx.js} +2 -2
- package/ui/dist/assets/PromptImportDiscoverySection-BQTlPMME.js +1 -0
- package/ui/dist/assets/PromptImportFolderSection-Ds_Th9O3.js +1 -0
- package/ui/dist/assets/{PromptLibraryPanel-Db3xEPM_.js → PromptLibraryPanel-Rs4l45pV.js} +2 -2
- package/ui/dist/assets/{SettingsWorkspace-BDk_1W-V.js → SettingsWorkspace-p1AZ6uT9.js} +1 -1
- package/ui/dist/assets/index-0-_vgFGs.js +4 -0
- package/ui/dist/assets/index-Dm3pFxV4.js +23 -0
- package/ui/dist/assets/index-J8yDF3Ch.css +1 -0
- package/ui/dist/index.html +2 -2
- package/ui/dist/assets/AgentWorkspace-DAg_7zpY.js +0 -3
- package/ui/dist/assets/GenerationRequestLogPanel-C_qvEUi2.js +0 -1
- package/ui/dist/assets/PromptBuilderPanel-DjvVdAie.js +0 -2
- package/ui/dist/assets/PromptImportDiscoverySection-CrwyUKYI.js +0 -1
- package/ui/dist/assets/PromptImportFolderSection-CToGMqYE.js +0 -1
- package/ui/dist/assets/index-2oG6in1i.css +0 -1
- package/ui/dist/assets/index-CoxMOXAU.js +0 -23
- package/ui/dist/assets/index-p8egnGHk.js +0 -4
|
@@ -0,0 +1,611 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ima2-front
|
|
3
|
+
description: "Frontend implementation skill for ima2 users. Use for any frontend, web UI, or visual implementation work — building, styling, or redesigning pages/components, responsive layouts, motion, component architecture, and production-surface polish. Pairs with ima2-uiux: load it first when design direction is vague; this skill implements the chosen direction. Triggers: 'frontend', 'UI', 'component', 'CSS', 'responsive', 'animation', 'React', 'Vue', 'Svelte', 'Tailwind', 'layout', 'styling', 'redesign', 'mockup', 'anti-slop', '프론트엔드', 'UI 작업', '반응형', '디자인 수정'."
|
|
4
|
+
metadata:
|
|
5
|
+
last-verified: "2026-07-02"
|
|
6
|
+
short-description: "ima2-powered production-grade frontend implementation with responsive, accessible, anti-slop UI guidance."
|
|
7
|
+
keywords: [frontend, UI, component, CSS, responsive, layout, animation, design implementation]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# ima2 Frontend — Domain-Correct Frontend Engineering
|
|
11
|
+
|
|
12
|
+
## Setup
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install -g ima2-gen # install globally (Node.js >= 20)
|
|
16
|
+
ima2 setup # first-time auth (GPT OAuth recommended)
|
|
17
|
+
ima2 serve # start local server
|
|
18
|
+
ima2 ping # verify
|
|
19
|
+
ima2 capabilities --json # check models, limits, providers
|
|
20
|
+
ima2 defaults --json # inspect default model/reasoning
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**Agent bootstrap:** `ima2 ping` first. If unreachable: `ima2 serve &`. If not
|
|
24
|
+
installed: `npm install -g ima2-gen && ima2 setup`. Use `ima2 skill path` to
|
|
25
|
+
locate the skills directory; read `../ima2-uiux/SKILL.md` for design direction
|
|
26
|
+
and `../ima2-front/SKILL.md` (this file) for implementation.
|
|
27
|
+
|
|
28
|
+
Build production-grade frontend implementations from an established product/design direction.
|
|
29
|
+
This skill owns HTML/CSS/component/runtime implementation, responsive behavior, accessibility
|
|
30
|
+
wiring, visual verification, and frontend platform rules.
|
|
31
|
+
|
|
32
|
+
> **Role separation:** For design judgment — typography/color/layout direction, UX decision
|
|
33
|
+
> gates, product personalities, or vague visual briefs — load `ima2-uiux` first. This
|
|
34
|
+
> skill implements the chosen direction; `ima2-uiux` makes the design decisions.
|
|
35
|
+
> Implementation anti-slop enforcement stays here; design taste/pattern judgment lives there.
|
|
36
|
+
|
|
37
|
+
> **C0/C1 work (small local patches):** For small patches, skip the full reference chain.
|
|
38
|
+
|
|
39
|
+
## Modular References
|
|
40
|
+
|
|
41
|
+
> **Loading references via CLI:**
|
|
42
|
+
> **Recommended: install skills to your agent's skill directory.**
|
|
43
|
+
> ```bash
|
|
44
|
+
> ima2 skill install --dir <agent-skill-path> # agent provides its own path
|
|
45
|
+
> ima2 skill install --tmp # ephemeral fallback
|
|
46
|
+
> ```
|
|
47
|
+
> The agent determines its own skill directory (e.g. `~/.codex/skills/`,
|
|
48
|
+
> `./skills/`, etc.) and passes it via `--dir`. After install, SKILL.md and
|
|
49
|
+
> `references/` are on disk — the agent reads them natively via relative paths.
|
|
50
|
+
>
|
|
51
|
+
> **Ad-hoc reading (without install):**
|
|
52
|
+
> ```bash
|
|
53
|
+
> ima2 skill front refs # list all reference modules with line counts
|
|
54
|
+
> ima2 skill front ref motion # print one module (basename match)
|
|
55
|
+
> ima2 skill front ref stacks/react # print a nested module
|
|
56
|
+
> ```
|
|
57
|
+
|
|
58
|
+
| File | When to Read | What It Covers |
|
|
59
|
+
| ----------------------------------------- | ------------------------------------ | --------------------------------------------------------------------------------- |
|
|
60
|
+
| `references/crud-ui.md` | C2 list/detail/form product screens | State coverage (loading/empty/error/permission), forms, objective UX gates |
|
|
61
|
+
| `references/anti-slop.md` | New components or UI redesign | 2026 AI slop patterns, Korean slop, oversized text, fake assets, default UI smells |
|
|
62
|
+
| `references/aesthetics.md` | Visual design decisions | Domain-correct visual direction, typography, color, composition, serif three-role system, expressive/functional layers, AI-brand grammar |
|
|
63
|
+
| `references/product-density.md` | Apps, tools, dashboards | Density profiles for landing, consumer app, SaaS, ops, finance, devtools |
|
|
64
|
+
| `references/asset-requirements.md` | Any public/product/visual surface | Required screenshots, images, diagrams, charts, generated bitmaps, or 3D assets, mockup production pipeline |
|
|
65
|
+
| `references/visual-verification.md` | Changes affecting rendered layout | Screenshot, viewport, text fit, state, asset, and motion verification |
|
|
66
|
+
| `references/korea-2026.md` | Korean-first or Korea-facing UI | Korean service patterns, CJK typography, formats, mobile flows, Korean serif/myeongjo display |
|
|
67
|
+
| `references/ux-writing-ko.md` | Korean UI copy | Natural Korean labels, error messages, tone, spacing, punctuation |
|
|
68
|
+
| `references/soft-3d-asset-gates.md` | 3D/miniature/character-like visuals | Toss-style soft 3D vs generic cute asset slop, domain gates |
|
|
69
|
+
| `references/motion.md` | Motion/animation needed | CSS animations, Framer Motion, CSS scroll-driven timelines, pointer-proximity chip motion (magnetic/dock), View Transitions, domain gates, organic bg + capsule label, product-led hero motion |
|
|
70
|
+
| `references/liquid-glass.md` | Translucent materials, glass chrome, pill-chip surfaces | Liquid Glass layer discipline, named material states (pill-at-top/pill-scrolled/media-overlay/clear), FE-PILL-NEST-01, blur-free pill alternative, perf + a11y gates |
|
|
71
|
+
| `references/top-bar.md` | Top/nav bar composition, sticky chrome | Top-bar grammar: geometry, slots, scroll-state contract (FE-TOPBAR-STATE-01), hover-surface contract (FE-TOPBAR-HOVER-01), domain gate, mobile collapse |
|
|
72
|
+
| `references/iterative-design.md` | Multi-round design | LLM convergence problem, Diverge→Kill→Mutate process, upgrade techniques |
|
|
73
|
+
| `references/prototype-variants.md` | Runnable design variants | `?variant=` switchers, structurally distinct options, cleanup after winner selection |
|
|
74
|
+
| `references/typography-wrapping.md` | Heading/descriptor text changes | `text-wrap: balance/pretty`, natural phrase breaks at any width, dynamic-viewport verification, `ch` units, Korean keep-all/orphan rules (verified 2026-07-07) |
|
|
75
|
+
| `references/logo-sections.md` | Integration/partner logo display | Marquee CSS, static grid, orphan cell fix, grayscale treatment, no individual hover |
|
|
76
|
+
| `references/brand-asset-sourcing.md` | Brand logos in UI | Simple Icons/SVGL sourcing, AI agent strategy, placeholder hierarchy, legal guide |
|
|
77
|
+
| `references/reference-capture.md` | Cloning/analyzing other sites | HTML+asset capture mechanics (pageAssets/curl), analysis-only legal line, provenance manifest, never-ship gate |
|
|
78
|
+
| `references/dropdown-layer.md` | Dropdowns, selects, menus, pickers | Unified dropdown design layer (FE-DROPDOWN-LAYER-01): one skin over headless primitives, DS-detection precedence, scope table, mobile sheet |
|
|
79
|
+
| `references/layout-discipline.md` | Landing/marketing pages | Hero, eyebrow, section repetition, bento, zigzag, per-section responsive transforms, hero composition grammar (2026) |
|
|
80
|
+
| `references/consistency-locks.md` | Any multi-section page | Color, shape, theme consistency per page |
|
|
81
|
+
| `references/responsive-viewport.md` | Layout or breakpoint changes | Canonical breakpoints, page containment, container queries, responsive images, safe area, split-screen |
|
|
82
|
+
| `references/mobile-ux.md` | Consumer/landing pages with mobile traffic | Thumb zone, touch targets, sticky CTA, mobile section composition, bottom sheet, portrait media |
|
|
83
|
+
| `references/seo-baseline.md` | Public-facing sites, SSR/SSG | SEO meta, JSON-LD, robots.txt, GEO strategies, OG/Twitter cards |
|
|
84
|
+
| `references/a11y-patterns.md` | Interactive widgets, modals, forms | ARIA patterns, focus management, keyboard nav, screen reader testing |
|
|
85
|
+
| `references/performance-budget.md` | Launch / audit | CWV targets, bundle budgets, font loading, image optimization, build gates |
|
|
86
|
+
| `references/theme-switching.md` | Dark mode / theme | CSS custom properties toggle, FOWT prevention, transition, component checklist |
|
|
87
|
+
| `references/color-system.md` | Color tokens, palettes wiring, theme-ready CSS | Token layering, `oklch()` + fallback discipline, `color-mix()`, `light-dark()`, Tailwind v4/shadcn wiring, contrast gates (verified 2026-07-07) |
|
|
88
|
+
| `references/i18n-global.md` | Multi-language / RTL | RTL layout, pluralization, Intl API, locale switching, content expansion |
|
|
89
|
+
| See also: `ima2-uiux` skill | Vague requests, onboarding, UX states | Intent discovery, design isms, product personalities, onboarding/empty/error patterns |
|
|
90
|
+
| `references/stacks/react.md` | React projects | Server Components, hooks, state, TanStack Query, shadcn/ui, performance |
|
|
91
|
+
| `references/stacks/nextjs.md` | Next.js projects | App Router, RSC, image optimization, data fetching, middleware |
|
|
92
|
+
| `references/stacks/vanilla.md` | HTML+CSS+JS (no framework) | Zero-dependency, viewport fitting, responsive CSS, progressive enhancement |
|
|
93
|
+
| `references/stacks/svelte.md` | Svelte/SvelteKit projects | Svelte 5 Runes, SvelteKit 2 routing/actions, snippets, migration from Svelte 4 |
|
|
94
|
+
| `references/stacks/mobile-native.md` | Native mobile app development | RN/Expo current pairing, Flutter 3.44, KMP, Swift 6, framework selection |
|
|
95
|
+
| `references/stacks/astro.md` | Astro projects | Islands architecture, multi-framework shell, content collections, SSG/SSR/hybrid |
|
|
96
|
+
|
|
97
|
+
Start with `anti-slop.md`, `aesthetics.md`, `responsive-viewport.md`, and `visual-verification.md`. Add domain/locale/stack references only when relevant.
|
|
98
|
+
For C2 ordinary app screens (form/table/list/detail), `crud-ui.md` alone suffices; add the style references above for marketing/visual surfaces or C3+ work.
|
|
99
|
+
|
|
100
|
+
When frontend choices depend on current framework, design-system, browser API,
|
|
101
|
+
library behavior, browser-rendered source evidence, or package/source freshness,
|
|
102
|
+
read the active `search` skill and follow its source-fetch and evidence-status
|
|
103
|
+
rules before treating external material as proof.
|
|
104
|
+
|
|
105
|
+
### Verification grounding
|
|
106
|
+
|
|
107
|
+
**STRICT:** For render/executable artifacts (HTML, SVG, games, UI, charts),
|
|
108
|
+
run the real renderer: headless browser, screenshot, canvas check, or equivalent.
|
|
109
|
+
Observe the actual output yourself, fix what observation reveals, then re-run.
|
|
110
|
+
Static parsing confirms well-formed files; it does not prove the artifact is
|
|
111
|
+
visually or interactively correct. One clean observation is enough for unchanged
|
|
112
|
+
state; do not re-render unchanged output just to repeat evidence.
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## 0. Frontend Routing
|
|
117
|
+
|
|
118
|
+
Before designing or coding, classify the work:
|
|
119
|
+
|
|
120
|
+
| Decision | Options | Why It Matters |
|
|
121
|
+
| --- | --- | --- |
|
|
122
|
+
| Product surface | landing, app, dashboard, AI tool, public service, education, game, creative | Sets density, typography scale, asset requirements |
|
|
123
|
+
| Locale | Korean-first, global/i18n, English-only | Sets CJK typography, copy, date/number formats |
|
|
124
|
+
| Density | campaign, consumer app, productivity, SaaS, ops, finance, developer console | Prevents landing-page composition inside repeated-work tools |
|
|
125
|
+
| Asset need | none, screenshot, product photo, diagram, chart, illustration, soft 3D, game asset | Prevents asset-free gradient/card UI |
|
|
126
|
+
| Soft 3D/character gate | not allowed, subtle, primary | Prevents generic cute 3D/mascot slop |
|
|
127
|
+
| Motion intensity | static, feedback-only, expressive, cinematic | Prevents cinematic motion in utility workflows |
|
|
128
|
+
|
|
129
|
+
Default rules:
|
|
130
|
+
- For apps/tools/dashboards, build the actual working surface first, not a marketing hero.
|
|
131
|
+
- For Korean-first work, read `korea-2026.md` and `ux-writing-ko.md`.
|
|
132
|
+
- For any soft 3D miniature, mascot, chibi, toy-like object, or character-like asset, read `soft-3d-asset-gates.md`.
|
|
133
|
+
- For product/brand/object/place/person pages, use concrete visual assets in the first viewport.
|
|
134
|
+
- For finance, government, B2B, admin, auth, security, and developer tools, keep visual warmth restrained and subordinate to clarity.
|
|
135
|
+
- Every user-facing decision point must justify its existence — defaults first, one primary action per screen, choices demoted to progressive disclosure (`ima2-uiux` UX-LAZY-01 owns the gate).
|
|
136
|
+
- For text-heavy surfaces (landing, marketing, editorial, public service), apply typography wrapping defaults — see `typography-wrapping.md`. Dashboard table cells are excluded.
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## 1. Component Identification
|
|
141
|
+
|
|
142
|
+
When the user describes UI in vague terms (e.g. "접히는 거", "팝업 같은 거"):
|
|
143
|
+
1. Recommend the best-fit component with reasoning: `<Name> — <what it does, why it fits>`
|
|
144
|
+
2. Confirm, then proceed
|
|
145
|
+
|
|
146
|
+
If the user already names a specific component, skip this step.
|
|
147
|
+
Reference: [component.gallery/components](https://component.gallery/components/)
|
|
148
|
+
|
|
149
|
+
For new React/Vue/Svelte/Next UI source files, prefer `.tsx` or typed component files when the repo supports TypeScript. Inherit `dev` TypeScript strict-compatibility rules.
|
|
150
|
+
If frontend structure is unclear, read existing source-of-truth docs first, then document pages, components, routes, state stores, and build commands in the repo's existing docs before broad implementation.
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## 1.5 Objective Gates vs Style Samples
|
|
155
|
+
|
|
156
|
+
Two different kinds of rules live in this skill (see the work classifier):
|
|
157
|
+
- **Objective UX gates (STRICT/DEFAULT)** — accessibility baseline (§7, §11), state coverage
|
|
158
|
+
(loading/empty/error/permission), keyboard operability, visible focus, contrast. Missing
|
|
159
|
+
these are review findings.
|
|
160
|
+
- **Style direction (STYLE_SAMPLE)** — design thinking (§2), aesthetics, density profiles,
|
|
161
|
+
product personalities, preset tokens, and the concrete values in §4-§5 (palettes, font
|
|
162
|
+
choices, pixel max-widths). These illustrate acceptable choices; they are NOT
|
|
163
|
+
requirements, must not override an existing design system (Design System Detection stays
|
|
164
|
+
MANDATORY), and must never be enforced as universal taste (UX-STYLE-01).
|
|
165
|
+
## 2. Design Thinking
|
|
166
|
+
|
|
167
|
+
> When the user cannot articulate a clear design direction, load `ima2-uiux` to
|
|
168
|
+
> discover intent and choose a direction before implementing here.
|
|
169
|
+
|
|
170
|
+
Before coding, commit to a domain-correct direction:
|
|
171
|
+
- **Purpose**: What problem does this interface solve? Who uses it?
|
|
172
|
+
- **Surface**: Is this a working tool, dashboard, public service, AI workflow, game, landing page, or editorial surface?
|
|
173
|
+
- **Tone**: Pick a specific direction. For product tools this often means quiet, dense, trustworthy, and fast rather than loud.
|
|
174
|
+
- **Constraints**: Framework, performance budget, accessibility requirements.
|
|
175
|
+
- **Signature**: What ONE thing will make this unforgettable? (the signature
|
|
176
|
+
moment; supporting scroll reveals may exist alongside it per
|
|
177
|
+
`motion.md` FE-MOTION-BUCKET-01)
|
|
178
|
+
|
|
179
|
+
When user intent is vague ("깔끔하게", "모던하게", "just make it look good"), read the `ima2-uiux` skill and run the User Intent Discovery Protocol before making routing decisions.
|
|
180
|
+
If the user cannot answer these questions, use the `ima2-uiux` skill's structured preference elicitation flow. Offer product references ("Notion 느낌? Linear 느낌?") and visual comparisons.
|
|
181
|
+
|
|
182
|
+
**Concept pass before code (stub — canonical: `ima2-uiux` §2.5 UX-CONCEPT-GEN-01):**
|
|
183
|
+
for a C2+ new/redesigned expressive or brand-visible surface (page, hero, key
|
|
184
|
+
chrome like a top bar) with open design direction — probe `ima2 status`, attempt
|
|
185
|
+
`ima2 serve` if down, `ima2 gen` only as true fallback — then
|
|
186
|
+
generate 5 highly specific candidate mockups of ONE locked concept, then SYNTHESIZE the
|
|
187
|
+
best elements across all 5 (NOT pick a single winner) into DESIGN.md and implement from
|
|
188
|
+
that synthesis — do not start coding the layout blind.
|
|
189
|
+
|
|
190
|
+
Intentionality over intensity. Bold maximalism, refined minimalism, dense utility, and friendly consumer UI can all work when they match the domain.
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## 3. Baseline Configuration
|
|
195
|
+
|
|
196
|
+
Adjust these dials based on what's being built. Present to user if unclear.
|
|
197
|
+
|
|
198
|
+
| Dial | Default | Range | Meaning |
|
|
199
|
+
| ---------------- | :-----: | :---: | ------------------------------------ |
|
|
200
|
+
| DESIGN_VARIANCE | 5 | 1-10 | 1=symmetric utility, 10=asymmetric art |
|
|
201
|
+
| MOTION_INTENSITY | 4 | 1-10 | 1=static, 10=cinematic choreography |
|
|
202
|
+
| VISUAL_DENSITY | 5 | 1-10 | 1=art gallery airy, 10=cockpit dense |
|
|
203
|
+
|
|
204
|
+
After Design Read, set dials per `ima2-uiux` §2 Dial Setting.
|
|
205
|
+
|
|
206
|
+
Product density profile (D1-D8 in `references/product-density.md`) sets component class; VISUAL_DENSITY (1-10) sets spacing within that class. These are orthogonal axes.
|
|
207
|
+
|
|
208
|
+
Adapt dynamically based on user requests. Dashboard → density up. Portfolio → variance up. Data tool → motion down.
|
|
209
|
+
Korean app/tool surfaces usually need higher density and clearer hierarchy, not oversized hero text.
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## 4. Implementation
|
|
214
|
+
|
|
215
|
+
Read `references/aesthetics.md` for full guidelines. Summary:
|
|
216
|
+
|
|
217
|
+
- **Typography**: Use domain-appropriate typography. For Korean-first UIs, prioritize CJK-safe stacks before Latin display fonts. Apply `text-wrap: balance` on all headings **AND short descriptors** (hero subtitle, card description, caption — anything 1-3 lines). Use `text-wrap: pretty` only on body paragraphs (4+ lines). `pretty` has no effect on short text and will leave Korean orphans like "합니다." or "화." on a line alone. See `typography-wrapping.md` for full rules.
|
|
218
|
+
- **Color**: Max 1 accent. Use neutral bases (Zinc/Slate) with singular high-contrast accent — avoid purple-on-white.
|
|
219
|
+
- **Layout**: Match the product surface. Avoid centered-card/hero patterns in repeated-use tools.
|
|
220
|
+
- **Motion**: See `references/motion.md`. One signature moment + a few
|
|
221
|
+
supporting reveals > 10 scattered effects; landing-bucket floor/ceiling per
|
|
222
|
+
FE-MOTION-BUCKET-01.
|
|
223
|
+
- **Assets**: Use screenshots, product images, diagrams, charts, illustrations, generated bitmaps, or soft 3D only when they add product meaning. When a real bitmap is needed (icon, hero, illustration), generate it with `ima2` — probe `ima2 status`, attempt `ima2 serve` if down — falling back to the native `imagegen` tool only when ima2 is truly unavailable; never ship a placeholder. `ima2` is preferred because it supports reference images, multi-candidate generation (`-n N`, multimode, independent CLI parallel — see `asset-requirements.md` FE-ASSET-PARALLEL-01), prompt builder, session style sheets, provider routing (GPT/Grok/Gemini — see `asset-requirements.md` FE-ASSET-PROVIDER-01), variant selection with element-ledger synthesis (`asset-requirements.md` FE-ASSET-SELECT-01), cutout asset background strategy (`asset-requirements.md` FE-ASSET-BG-01), and video (`ima2 video` — see `motion.md` FE-MOTION-VIDEO-01) for motion assets. For parallel generation, monitor with `ima2 ps --json` and cancel unwanted jobs with `ima2 cancel <id>`. Write **very explicit long prompts** (subject, composition, palette, lighting, style, aspect) per `asset-requirements.md`; prefer real/generated image or video assets over CSS gradient washes. Read any design reference or captured screenshot back into context with `view_image` before matching it. Third-party captures follow `reference-capture.md` (analysis-only, provenance manifest).
|
|
224
|
+
- **Visual verification**: after UI changes, exercise the flow per visual verification (screenshot -> view_image) — `browser:control-in-app-browser` on the dev server, screenshot, `view_image` — instead of claiming visual correctness from code alone.
|
|
225
|
+
|
|
226
|
+
### Cutout Asset Generation (FE-ASSET-BG-01 surface — STRICT)
|
|
227
|
+
|
|
228
|
+
GPT Image 2 cannot produce transparent backgrounds. Requesting "transparent
|
|
229
|
+
background" or "PNG with alpha" yields checkerboard artifacts or solid fills.
|
|
230
|
+
**Every cutout asset** (icons, product shots, 3D objects, illustrations, stickers,
|
|
231
|
+
UI elements that float over arbitrary backgrounds) MUST use the solid-background-
|
|
232
|
+
then-remove pipeline. Full rules and recipes: `references/asset-requirements.md`
|
|
233
|
+
§ Asset Background Strategy.
|
|
234
|
+
|
|
235
|
+
**Quick reference — generation template:**
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
# Reflective/metallic/glass subjects → PURE BLACK bg
|
|
239
|
+
ima2 gen "3D render of [subject], [material/style details], [composition]. \
|
|
240
|
+
Floating on a PURE SOLID BLACK background. The background must be 100% flat \
|
|
241
|
+
pure black hex #000000. No checkerboard, no transparency pattern, no gradient, \
|
|
242
|
+
no floor plane, no shadow, no vignette, no ambient glow on the background." \
|
|
243
|
+
--quality high --size 1024x1024 --mode direct -o asset.png
|
|
244
|
+
|
|
245
|
+
# Dark/opaque subjects → PURE WHITE bg
|
|
246
|
+
ima2 gen "[subject description], centered, floating. PURE SOLID WHITE background \
|
|
247
|
+
hex #ffffff. No shadow, no gradient, no surface, no reflection plane." \
|
|
248
|
+
--quality high --size 1024x1024 --mode direct -o asset.png
|
|
249
|
+
|
|
250
|
+
# Known destination color → match it exactly
|
|
251
|
+
ima2 gen "[subject description], centered. PURE SOLID background hex #[target]. \
|
|
252
|
+
No gradient, no texture, no shadow." \
|
|
253
|
+
--quality medium --size 512x512 --mode direct -o asset.png
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
**Quick reference — CSS removal (zero post-processing):**
|
|
257
|
+
|
|
258
|
+
| Source bg | Target page | CSS rule |
|
|
259
|
+
|-----------|-------------|----------|
|
|
260
|
+
| Black | Light | `mix-blend-mode: screen` |
|
|
261
|
+
| White | Dark | `mix-blend-mode: multiply` |
|
|
262
|
+
| Any | Any | `isolation: isolate` on container to prevent bleed |
|
|
263
|
+
|
|
264
|
+
For programmatic removal (build pipelines): `sharp`, ImageMagick, or `rembg`.
|
|
265
|
+
For interactive cleanup: ima2 Canvas Mode. For targeted fix: `ima2 edit`.
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
## 5. Anti-Slop Enforcement
|
|
270
|
+
|
|
271
|
+
Rule classes (dev §0.2): items below are DEFAULT — deviate with a stated reason; concrete
|
|
272
|
+
values and palettes are STYLE_SAMPLE (§1.5); the emoji-as-UI-icon ban is the only STRICT item.
|
|
273
|
+
|
|
274
|
+
Read `references/anti-slop.md` for full rules. Key standards:
|
|
275
|
+
|
|
276
|
+
### Hero discipline (FE-HERO-01)
|
|
277
|
+
|
|
278
|
+
- First viewport must fit: hero content leaves a hint of the next section on mobile and desktop.
|
|
279
|
+
- Keep hero copy to ~4 text elements max: headline, subhead, primary CTA, one proof/context line.
|
|
280
|
+
- Do not put trust strips, pricing teasers, feature bullets, or mini dashboards inside the hero.
|
|
281
|
+
- Logo walls belong below the hero, not as hero filler.
|
|
282
|
+
- Plan font scale with image/product scale so neither crushes the other.
|
|
283
|
+
|
|
284
|
+
- Treat unexamined default typography as a slop signal. Choose a domain-appropriate stack; Korean-first UI should use CJK-safe fonts and system fallbacks deliberately.
|
|
285
|
+
- **Gradient budget (FE-GRADIENT-01)**: gradient soup is the 2026 #1 anti-slop signal; max 1 ambient gradient per viewport and no gradients on 3+ sibling cards — see `anti-slop.md § Gradient Budget`
|
|
286
|
+
- **One-note theme ban (FE-ONENOTE-01)**: full-page single-hue dark washes (terminal green, cyber cyan, CRT amber) are the current dark-mode tell — see `anti-slop.md § One-Note Theme Ban`
|
|
287
|
+
- **No self-describing meta copy (FE-METACOPY-01)**: UI text must explain the product/user job, never narrate the mockup, layout, responsive behavior, or agent process — see `anti-slop.md § Self-Describing Meta Copy`
|
|
288
|
+
- Use neutral or intentional color palettes — purple gradients on white are now the old tell; gradient overuse and one-note single-hue themes are the current tell
|
|
289
|
+
- Use asymmetric or purposeful layouts — centered-everything reads as template
|
|
290
|
+
- Vary card sizes, spans, and groupings — equal 3-card grids read as generic
|
|
291
|
+
- **Bento composition (FE-BENTO-01)**: bento grids must read as one interlocking slab with aligned row edges, a dominant cell, content-weighted spans, and no orphan tail — see `layout-discipline.md § Bento Composition`
|
|
292
|
+
- Avoid oversized bold hero text inside tools, dashboards, admin, finance flows, and public services
|
|
293
|
+
- **Hero composition (FE-HERO-SPLIT-01)**: never build a split hero (left bold headline + right boxed screenshot/mockup card) unless the user explicitly requests one — the product visual is the stage (full-width, background, or interactive demo), never a right-column card; paid-conversion LPs are the one context to propose it — see `layout-discipline.md § Hero Composition Grammar`
|
|
294
|
+
- Avoid asset-free UI: abstract blobs/gradients do not replace real visual evidence
|
|
295
|
+
- Avoid generic soft 3D icon packs; soft 3D must be semantic, brand-consistent, and restrained
|
|
296
|
+
- **NEVER use emoji as UI visual elements** (feature icons, card icons, section markers, buttons) — emoji in production UI is the #1 AI slop signal. Use SVG icons (Lucide/Phosphor/Heroicons). See `anti-slop.md § Emoji Slop`
|
|
297
|
+
- Warm beige/cream backgrounds with brass/clay accents are banned as defaults for premium-consumer briefs — see `anti-slop.md § Premium-Consumer Palette Ban`
|
|
298
|
+
- Layout monotony (same family repeated, 3+ zigzag sections, overused eyebrows) — see `references/layout-discipline.md`
|
|
299
|
+
- Color, shape, and theme must be locked per-page and audited before shipping — see `references/consistency-locks.md`
|
|
300
|
+
- Use off-black (`#0a0a0a`, `#111`) — pure `#000000` lacks depth
|
|
301
|
+
- **Responsive enforcement**: every multi-column section must declare its mobile/tablet collapse behavior — "it'll work at mobile" is not a plan. See `responsive-viewport.md`
|
|
302
|
+
- **Page containment required**: `max-w-[1400px] mx-auto` or equivalent wrapper. Content stretching to viewport edges on wide monitors is a layout bug
|
|
303
|
+
- **Mobile is a different product**: section composition, CTA placement, and interaction model change on mobile — it is NOT just "desktop stacked vertically." See `mobile-ux.md`
|
|
304
|
+
- Use realistic, specific names and brands in placeholder content
|
|
305
|
+
- Write original copy — avoid "Elevate", "Seamless", "Next-Gen" and similar clichés
|
|
306
|
+
- Treat uncontrolled heading line breaks (orphaned single word, no `text-wrap`, no `max-width` in `ch`) as a slop signal — see `typography-wrapping.md`
|
|
307
|
+
- Treat short descriptors (hero subtitle, card description, caption) using `text-wrap: pretty` instead of `balance` as a slop signal — `pretty` does nothing on 1-3 line text, especially Korean
|
|
308
|
+
- Treat Korean orphan fragments ("합니다.", "화.", "입니다." alone on a line) as a slop signal — always verify Korean text breaks at target viewports
|
|
309
|
+
- Treat generic stroke icons as brand logo substitutes as a slop signal — use actual brand SVGs from Simple Icons, SVGL, or press kits. See `brand-asset-sourcing.md`
|
|
310
|
+
- When NO design brief exists, do not invent a generic default: apply the domain-gated no-brief kit owned by `ima2-uiux` §1 UX-DEFAULT-ISM-01 and state the assumption
|
|
311
|
+
|
|
312
|
+
### Do not ship these tells (FE-AI-TELL-01)
|
|
313
|
+
|
|
314
|
+
Version labels in heroes, numbered eyebrows, middle-dot overuse, duplicate image reuse, monospace uppercase card labels, fake social-proof headers, decorative scroll cues, weather/status strips with no product purpose, photo-credit captions in UI chrome, and generic "trusted by teams worldwide" claims are AI-default tells. Full catalog: `references/anti-slop.md` + `references/layout-discipline.md`.
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
## 6. Performance Guardrails
|
|
319
|
+
|
|
320
|
+
- Animate `transform` and `opacity` only — layout properties (`top`, `left`, `width`, `height`) cause jank
|
|
321
|
+
- Grain/noise filters → fixed pseudo-elements only, keep off scrolling containers
|
|
322
|
+
- `will-change` sparingly — remove after animation completes
|
|
323
|
+
- Z-index only for systemic layers (navbar, modal, overlay)
|
|
324
|
+
- Memoize perpetual animations in isolated components
|
|
325
|
+
|
|
326
|
+
### Browser Connection Limits
|
|
327
|
+
|
|
328
|
+
| Protocol | Limit |
|
|
329
|
+
|---|---|
|
|
330
|
+
| HTTP/1.1 | 6 connections per domain (Chrome/Firefox) |
|
|
331
|
+
| HTTP/2 | 1 TCP connection, 100 concurrent streams |
|
|
332
|
+
| WebSocket | Shares the HTTP/1.1 connection pool |
|
|
333
|
+
|
|
334
|
+
Rules:
|
|
335
|
+
- Never open >2 SSE/WebSocket connections to the same origin from one page
|
|
336
|
+
- Use connection multiplexing (single WebSocket with channel/topic routing) over multiple connections
|
|
337
|
+
- If >6 parallel requests needed: use HTTP/2, batch API endpoints, or domain sharding (last resort)
|
|
338
|
+
- Preflight OPTIONS requests count against the connection limit; consolidate CORS-heavy calls
|
|
339
|
+
|
|
340
|
+
Banned:
|
|
341
|
+
- Opening unbounded WebSocket connections per component instance
|
|
342
|
+
- Polling from multiple components independently (centralize into one subscription, fan out via state)
|
|
343
|
+
- Creating new SSE connections on every remount without cleanup
|
|
344
|
+
|
|
345
|
+
---
|
|
346
|
+
|
|
347
|
+
## 7. Accessibility Baseline
|
|
348
|
+
|
|
349
|
+
- Semantic HTML (`<button>`, `<nav>`, `<main>`)
|
|
350
|
+
- Keyboard navigation for all interactive elements
|
|
351
|
+
- WCAG AA minimum (4.5:1 normal text, 3:1 large text)
|
|
352
|
+
- Visible focus indicators (`focus-visible:ring-2`)
|
|
353
|
+
- `prefers-reduced-motion` support
|
|
354
|
+
- Skip link or equivalent bypass for repeated navigation
|
|
355
|
+
- Focus must not be hidden by sticky headers, sticky bottom bars, sheets, or overlays
|
|
356
|
+
- Icon-only buttons need accessible names (`aria-label`, visible text, or labelled-by)
|
|
357
|
+
- Charts, status messages, loading progress, and AI streaming states need screen-reader labels or live regions where appropriate
|
|
358
|
+
- Do not encode meaning by color alone
|
|
359
|
+
- Modals, menus, comboboxes, bottom sheets, and command palettes must have a complete keyboard path
|
|
360
|
+
- Stress-test Korean long labels and screen-reader names; clipped Hangul is a failure
|
|
361
|
+
- Pointer targets follow WCAG 2.2 AA target-size rules; 44×44px is a conservative product baseline, not the only legal minimum
|
|
362
|
+
|
|
363
|
+
### A11y polish (FE-A11Y-POLISH-01)
|
|
364
|
+
|
|
365
|
+
- CTA text fits on one line at target breakpoints; if it wraps, shorten the label or change the layout.
|
|
366
|
+
- Inputs need visible boundaries against their background in default, focus, error, and disabled states.
|
|
367
|
+
- Duplicate CTA intent on the same screen should merge or clearly differ by outcome.
|
|
368
|
+
- Button contrast is checked during visual review, not left to palette intent.
|
|
369
|
+
|
|
370
|
+
---
|
|
371
|
+
|
|
372
|
+
## 8. Custom Hooks
|
|
373
|
+
|
|
374
|
+
Create a custom hook only when it owns reusable behavior, not just because code is a few lines long.
|
|
375
|
+
|
|
376
|
+
Good hook candidates: subscription lifecycle, reusable async state machine, form-field behavior shared across components, media/query/observer integration, keyboard/focus behavior, external store wrapper.
|
|
377
|
+
|
|
378
|
+
Avoid hooks that are merely thin aliases for `useState`, `useToggle`, `useDebounce`, or one-off component logic unless the repo already standardizes them.
|
|
379
|
+
|
|
380
|
+
Hook rules:
|
|
381
|
+
- The hook name describes behavior, not implementation
|
|
382
|
+
- Inputs are explicit and stable; return shape is small
|
|
383
|
+
- Side effects are justified by an external system; cleanup is correct
|
|
384
|
+
- Dependencies are honest; use `useEffectEvent` for non-reactive callbacks inside Effects
|
|
385
|
+
- Do not hide server state, router state, or form ownership inside a generic hook
|
|
386
|
+
|
|
387
|
+
---
|
|
388
|
+
|
|
389
|
+
## 9. React Performance
|
|
390
|
+
|
|
391
|
+
Default performance strategy: keep components pure, keep state local, classify state ownership correctly, use server rendering/caching boundaries, split expensive client islands, measure before memoizing.
|
|
392
|
+
|
|
393
|
+
| Tool | Use when |
|
|
394
|
+
|------|----------|
|
|
395
|
+
| `memo` | child render is expensive and props are stable |
|
|
396
|
+
| `useMemo` | calculation is expensive or identity is required |
|
|
397
|
+
| `useCallback` | callback identity is required by memoized child or external API |
|
|
398
|
+
| `useTransition` | interaction should stay responsive while non-urgent work completes |
|
|
399
|
+
| `useOptimistic` | mutation UX benefits from reversible optimistic state |
|
|
400
|
+
| `Activity` | hidden UI should preserve state without active Effects |
|
|
401
|
+
| `Suspense` | dynamic/async boundary needs isolated loading behavior |
|
|
402
|
+
|
|
403
|
+
If React Compiler is enabled, remove defensive memoization unless measurement or semantics justify it. Split at route boundaries and heavy components (charts, editors, 3D).
|
|
404
|
+
|
|
405
|
+
---
|
|
406
|
+
|
|
407
|
+
## 10. Form Handling
|
|
408
|
+
|
|
409
|
+
For simple forms, use controlled components with schema validation (Zod). For complex forms (multi-step, dynamic fields), use `react-hook-form` + Zod resolver. Always show field-level errors with `role="alert"`.
|
|
410
|
+
|
|
411
|
+
---
|
|
412
|
+
|
|
413
|
+
## 11. Accessibility Quick-Wins
|
|
414
|
+
|
|
415
|
+
Beyond the baseline (§7):
|
|
416
|
+
- Focus management: trap focus in modals, restore on close, handle Escape
|
|
417
|
+
- Arrow keys navigate lists and menus; Enter/Space activate buttons and links
|
|
418
|
+
- Tab order follows visual flow
|
|
419
|
+
- `aria-expanded`, `aria-haspopup`, `aria-activedescendant` on composite widgets
|
|
420
|
+
- Test with screen reader and keyboard-only navigation
|
|
421
|
+
|
|
422
|
+
---
|
|
423
|
+
|
|
424
|
+
## 12. 2026 Frontend Platform Rules
|
|
425
|
+
|
|
426
|
+
Use this section when modernizing or creating React/Next/Vite frontends. Prefer project conventions first.
|
|
427
|
+
|
|
428
|
+
### React 19.2+
|
|
429
|
+
|
|
430
|
+
- **Activity**: Use `<Activity>` for state-preserving hidden UI (tabs, drawers, route shells). Do not use for security hiding or active subscriptions.
|
|
431
|
+
- **useEffectEvent**: For non-reactive logic inside Effects that needs latest props/state without resubscribing. Never call during render or pass to children.
|
|
432
|
+
- **Partial Pre-rendering**: Design pages as static shell + explicit dynamic holes + Suspense boundaries. No `Date.now()`, `Math.random()`, or request-specific data in the pre-rendered shell.
|
|
433
|
+
- **React Compiler**: Do not cargo-cult `memo`/`useMemo`/`useCallback`. Measure first unless referential stability is semantically required.
|
|
434
|
+
|
|
435
|
+
### Next.js 16
|
|
436
|
+
|
|
437
|
+
- Turbopack is default. Do not add custom webpack config unless proven unsupported.
|
|
438
|
+
- **Cache Components** (`cacheComponents: true`): dynamic rendering is default; cache only what you explicitly mark with `use cache` + `cacheLife` + `cacheTag`.
|
|
439
|
+
- Never cache user/session-specific data without explicit user-scoped cache key.
|
|
440
|
+
- Server Actions: validate input server-side, authorize against the resource, revalidate affected cache tags.
|
|
441
|
+
|
|
442
|
+
### Modern CSS
|
|
443
|
+
|
|
444
|
+
Prefer native CSS before JS layout observers or animation libraries:
|
|
445
|
+
- **Container queries** for component-level responsive layout (not viewport)
|
|
446
|
+
- **`:has()`** for parent/sibling state selection — keep selectors narrow
|
|
447
|
+
- **CSS nesting** for modularity — keep shallow, avoid specificity tunnels
|
|
448
|
+
- **Subgrid** when nested content must align to outer grid
|
|
449
|
+
- **View Transitions** for meaningful state continuity — respect `prefers-reduced-motion`
|
|
450
|
+
- **Modern units**: `dvh/svh/lvh` over `100vh`, logical properties over `left/right`
|
|
451
|
+
- **Tailwind v4**: CSS-first configuration, use theme variables over hardcoded values
|
|
452
|
+
|
|
453
|
+
### Build Tools
|
|
454
|
+
|
|
455
|
+
- **Vite 8** (verified 2026-07-02): Rolldown/Oxc is the integrated default bundler (`rolldown-vite` is only a Vite 7 migration bridge). Node 20.19+/22.12+; Baseline target Chrome/Edge 111, Firefox 114, Safari 16.4. Detect Vite 7 vs 8 before editing config.
|
|
456
|
+
- **Agent-visible runtime diagnostics (DEFAULT)**: prefer dev servers that surface browser/runtime errors to the CLI/agent — Vite 8 forwards browser console to the dev server (auto-activates for coding agents); Next 16 ships DevTools MCP. Wire these before debugging rendered behavior.
|
|
457
|
+
- Do not introduce Webpack-era config unless the existing app is already Webpack-bound
|
|
458
|
+
|
|
459
|
+
### State Classification
|
|
460
|
+
|
|
461
|
+
Before adding state, classify it:
|
|
462
|
+
|
|
463
|
+
| State type | Owner | Default tool |
|
|
464
|
+
|---|---|---|
|
|
465
|
+
| render-local UI | nearest component | `useState` / `useReducer` |
|
|
466
|
+
| derived | render calculation | expression / `useMemo` if expensive |
|
|
467
|
+
| form draft | form boundary | native form, React Hook Form, TanStack Form |
|
|
468
|
+
| server/cache | server/cache layer | RSC, Next cache, TanStack Query, SWR |
|
|
469
|
+
| URL/navigation | router | path params, search params |
|
|
470
|
+
| global client UI | external store | Zustand, Jotai, context |
|
|
471
|
+
| optimistic mutation | mutation boundary | `useOptimistic`, mutation library |
|
|
472
|
+
| AI stream | conversation boundary | append-only message model + stream status |
|
|
473
|
+
|
|
474
|
+
Rules: Do not store derived state just to sync with Effect. Do not put server state in Zustand. Do not put URL-shareable state only in component state. Keep optimistic state reversible.
|
|
475
|
+
|
|
476
|
+
### Design System Detection (MANDATORY — before creating tokens)
|
|
477
|
+
|
|
478
|
+
Before inventing design tokens, check:
|
|
479
|
+
1. Does the project have an installed design system? (`grep -r "material-ui\|@mui\|carbon-components\|@carbon\|@fluentui\|govuk-frontend\|uswds" package.json`)
|
|
480
|
+
2. Does the project have existing tokens? (`find . -name "tokens.*" -o -name "theme.*" -o -name "design-system*"`)
|
|
481
|
+
3. Does the brief name a specific design system?
|
|
482
|
+
|
|
483
|
+
If YES to any: use the official package. Do not recreate CSS by hand.
|
|
484
|
+
|
|
485
|
+
| System | Package | Import |
|
|
486
|
+
|--------|---------|--------|
|
|
487
|
+
| Material | @mui/material | `import { Button } from '@mui/material'` |
|
|
488
|
+
| Carbon | @carbon/react | `import { Button } from '@carbon/react'` |
|
|
489
|
+
| Fluent | @fluentui/react | `import { Button } from '@fluentui/react-components'` |
|
|
490
|
+
| GOV.UK | govuk-frontend | `import 'govuk-frontend/dist/govuk/all.scss'` |
|
|
491
|
+
| USWDS | @uswds/uswds | `import '@uswds/uswds/css/uswds.css'` |
|
|
492
|
+
|
|
493
|
+
If NO: proceed with `dev-uiux-design/references/design-system-bootstrap.md`.
|
|
494
|
+
|
|
495
|
+
### shadcn/ui and AI-Assisted UI
|
|
496
|
+
|
|
497
|
+
- Inspect existing installed components before adding new ones
|
|
498
|
+
- Use project's `components.json`, aliases, tokens, and registry conventions
|
|
499
|
+
- Do not hallucinate design-system components; verify against local source
|
|
500
|
+
- Remove demo-only copy and unused variants
|
|
501
|
+
|
|
502
|
+
For AI-native interfaces (chat, agent, copilot), design explicit states: empty → prompt ready → submitted → streaming → tool call → result → complete → feedback. Never fake streaming, citations, or tool calls.
|
|
503
|
+
|
|
504
|
+
---
|
|
505
|
+
|
|
506
|
+
## 13. Error Boundaries
|
|
507
|
+
|
|
508
|
+
React Error Boundary pattern:
|
|
509
|
+
- Wrap each major section (not the entire app) in an Error Boundary
|
|
510
|
+
- Error boundary renders: friendly message + retry button + report link
|
|
511
|
+
- Log error to monitoring service (Sentry, etc.) in componentDidCatch
|
|
512
|
+
- Never show stack traces to end users
|
|
513
|
+
|
|
514
|
+
Error state hierarchy:
|
|
515
|
+
1. Field-level: inline validation message
|
|
516
|
+
2. Form-level: summary at top of form
|
|
517
|
+
3. Section-level: Error Boundary with retry
|
|
518
|
+
4. Page-level: `error.tsx` / error page
|
|
519
|
+
5. App-level: root Error Boundary → offline/crash page
|
|
520
|
+
|
|
521
|
+
---
|
|
522
|
+
|
|
523
|
+
## 14. Pre-Flight Checklist
|
|
524
|
+
|
|
525
|
+
Checklist items apply to production surfaces (the work classifier shared definition); prototypes,
|
|
526
|
+
spikes, and internal demos are exempt unless the user asks for production polish.
|
|
527
|
+
|
|
528
|
+
Before delivering:
|
|
529
|
+
- [ ] Domain-correct direction chosen and committed
|
|
530
|
+
- [ ] Product surface, locale, density, asset need, soft 3D gate, and motion intensity classified
|
|
531
|
+
- [ ] Anti-slop patterns enforced (§5)
|
|
532
|
+
- [ ] Hero discipline enforced: viewport fit, copy count, no in-hero trust/pricing/feature clutter (§5)
|
|
533
|
+
- [ ] Required assets are real, semantic, rendered, and not generic decoration
|
|
534
|
+
- [ ] Korean-first UI follows CJK typography and Korean UX writing rules
|
|
535
|
+
- [ ] Soft 3D/miniature/character assets pass domain and semantic gates
|
|
536
|
+
- [ ] Mobile layout collapse guaranteed with per-section-type rules (see layout-discipline.md § Responsive Transforms)
|
|
537
|
+
- [ ] Full-height sections use `min-h-[100dvh]` not `h-screen`
|
|
538
|
+
- [ ] Page containment: `max-w-[1400px] mx-auto` wrapper present (see responsive-viewport.md)
|
|
539
|
+
- [ ] Tested at 768px (tablet) and 1024px (split-screen) in addition to mobile/desktop
|
|
540
|
+
- [ ] Touch targets ≥ 44px on mobile; no hover-only interactions (see mobile-ux.md)
|
|
541
|
+
- [ ] Responsive images use `srcset`/`sizes` or `<picture>` for art direction (see responsive-viewport.md)
|
|
542
|
+
- [ ] Safe area padding for notched devices: `env(safe-area-inset-*)` on fixed elements
|
|
543
|
+
- [ ] Loading, empty, and error states provided
|
|
544
|
+
- [ ] State classified before adding store/Context/Effect/cache (§12)
|
|
545
|
+
- [ ] Effects sync with external systems; derived state is not Effect-synced
|
|
546
|
+
- [ ] Container queries considered before viewport-query or JS layout workarounds
|
|
547
|
+
- [ ] View transitions respect reduced motion
|
|
548
|
+
- [ ] shadcn components follow local registry and token conventions
|
|
549
|
+
- [ ] AI UI states are honest: no fake streaming, citations, or tool calls
|
|
550
|
+
- [ ] Forms validate with schema and show field-level errors (§10)
|
|
551
|
+
- [ ] A11y polish checked: one-line CTAs, visible input borders, no duplicate CTA intent (§7)
|
|
552
|
+
- [ ] Focus management on modals and popovers (§11)
|
|
553
|
+
- [ ] Desktop/mobile/narrow screenshots checked for overlap, clipping, and asset rendering
|
|
554
|
+
- [ ] Interactive components isolated as Client Components (if RSC)
|
|
555
|
+
- [ ] Design Read declared before code generation (see dev-uiux-design §2)
|
|
556
|
+
- [ ] Eyebrow count ≤ ceil(sectionCount / 3) (see layout-discipline.md)
|
|
557
|
+
- [ ] Section layout diversity: ≥4 different families per 8 sections
|
|
558
|
+
- [ ] Color/shape/theme locks consistent across all sections (see consistency-locks.md)
|
|
559
|
+
- [ ] SEO meta tags present for public pages (`<title>`, `<meta description>`, canonical, OG) — see `seo-baseline.md`
|
|
560
|
+
- [ ] JSON-LD structured data matches page type
|
|
561
|
+
- [ ] Accessibility: modals trap focus, live regions for dynamic content — see `a11y-patterns.md`
|
|
562
|
+
- [ ] Core Web Vitals field metrics are the perf gate (INP ≤200ms); Lighthouse Performance score is advisory smoke only; no JS bundle > 150KB compressed — see `performance-budget.md`
|
|
563
|
+
- [ ] Hero image preloaded, below-fold images lazy-loaded
|
|
564
|
+
- [ ] Theme toggle works: light/dark/system, no FOWT — see `theme-switching.md`
|
|
565
|
+
- [ ] All colors use CSS custom properties (theme-ready)
|
|
566
|
+
- [ ] i18n: no hardcoded strings, CSS logical properties, Intl API for dates/numbers — see `i18n-global.md`
|
|
567
|
+
- [ ] Error Boundaries wrap major sections, not entire app (§13)
|
|
568
|
+
- [ ] Stack-specific rules followed (see `references/stacks/`)
|
|
569
|
+
|
|
570
|
+
---
|
|
571
|
+
|
|
572
|
+
## 15. Backend Contract & Security Alignment
|
|
573
|
+
|
|
574
|
+
Frontend does not operate in isolation. When consuming backend APIs or implementing security-sensitive UI:
|
|
575
|
+
|
|
576
|
+
### 15.1 Contract Ownership
|
|
577
|
+
|
|
578
|
+
| Responsibility | Owner |
|
|
579
|
+
|---------------|-------|
|
|
580
|
+
| Response envelope shape (`success`, `data`, `error`, `meta`) | `dev-backend` defines, `dev-testing` verifies |
|
|
581
|
+
| Consumer-side fixture alignment | **Frontend** — keep mocks in sync with `fixtures/contracts/` |
|
|
582
|
+
| Contract test triggers | Frontend payload changes → update contract tests BEFORE merging (see `dev-testing` §3) |
|
|
583
|
+
| Error display mapping | Frontend maps `error.code` to user-facing messages; never parse `error.message` for logic |
|
|
584
|
+
|
|
585
|
+
**When a frontend change touches API consumption:**
|
|
586
|
+
1. Check if the response shape assumption still holds
|
|
587
|
+
2. If changed, update or add a contract test first (see `dev-testing` §3.5)
|
|
588
|
+
3. Align frontend mocks/fixtures with backend golden examples
|
|
589
|
+
|
|
590
|
+
### 15.2 Security Responsibilities
|
|
591
|
+
|
|
592
|
+
| Control | Policy Owner | Implementation Owner |
|
|
593
|
+
|---------|-------------|---------------------|
|
|
594
|
+
| CSP directives | `dev-security` §5 | Frontend (no inline scripts, no `eval`, no surprise 3rd-party scripts) |
|
|
595
|
+
| CORS | `dev-security` §5 | Backend middleware (`dev-backend` §4) |
|
|
596
|
+
| XSS prevention | `dev-security` §5 | Frontend (avoid `dangerouslySetInnerHTML`; if needed, sanitize with DOMPurify + CSP defense) |
|
|
597
|
+
| Token storage | `dev-security` §2 | Frontend (`httpOnly` cookies preferred over `localStorage`) |
|
|
598
|
+
| Auth state display | `dev-security` §2 | Frontend (loading → check → redirect or render; never flash protected content) |
|
|
599
|
+
|
|
600
|
+
### 15.3 Testing Integration
|
|
601
|
+
|
|
602
|
+
- Playwright smoke tests validate rendered flows AFTER backend API + contract tests pass
|
|
603
|
+
- Frontend unit tests mock API responses using the **same envelope shape** defined in `dev-backend` §5
|
|
604
|
+
- When backend error codes change, frontend error-mapping tests must be updated
|
|
605
|
+
|
|
606
|
+
## §16 Pre-Flight Checklist
|
|
607
|
+
|
|
608
|
+
Before shipping a production frontend surface, run through the full pre-flight checklist
|
|
609
|
+
at `references/preflight-full.md`. It covers design/composition, responsive/mobile,
|
|
610
|
+
states/behavior, Korean-first rules, SEO/theme/i18n, and performance/verification gates.
|
|
611
|
+
Use it as the C-phase audit companion for frontend work at C2+.
|