medesign 1.6.0 → 1.7.0

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 CHANGED
@@ -1,6 +1,6 @@
1
- # ME-DESIGN v1.4.0
1
+ # ME-DESIGN v1.7.0
2
2
 
3
- **The Autonomous Design Engineering System & Quality Linter for AI Coding Assistants**
3
+ **The Autonomous Design Engineering System, Deterministic Quality Linter & Auto-Compiler for AI Coding Assistants**
4
4
 
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
6
6
  [![CI Matrix](https://github.com/methastrategy/medesign/actions/workflows/ci.yml/badge.svg)](https://github.com/methastrategy/medesign/actions/workflows/ci.yml)
@@ -8,36 +8,74 @@
8
8
  [![Node Version](https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen.svg)](https://nodejs.org/)
9
9
  [![Status](https://img.shields.io/badge/status-production--ready-emerald.svg)]()
10
10
  [![Archetypes](https://img.shields.io/badge/archetypes-38%20models-indigo.svg)]()
11
+ [![Brand Systems](https://img.shields.io/badge/brands-74%20global%20systems-purple.svg)]()
11
12
 
12
13
  *Eliminate AI Slop and bring optical mathematics, perceptual color science, and mission-critical engineering rigor to automated UI/UX generation.*
13
14
 
14
15
  ---
15
16
 
16
- </div>
17
-
18
17
  ## 🌟 Why ME-DESIGN?
19
18
 
20
19
  Most AI-generated user interfaces suffer from **Decisionless Uniformity**: generic 3-card grids, oversaturated neon glows, clipping Thai/Latin font metrics, broken keyboard accessibility, and non-proportional press deformations.
21
20
 
22
- **ME-DESIGN** changes the paradigm from subjective aesthetic prompting to an **executable 5-Engine Design Architecture** coupled with a **Dual-Tier Quality Linter**, **Knowledge Discovery Search Engine**, and **Self-Healing Code Repair**.
21
+ **ME-DESIGN** changes the paradigm from subjective aesthetic prompting to an **executable Frontend Design Engineering Skill**:
22
+ - **Two-Level Workflow:** Fast Path for focused 1-component fixes, and Deep Path for whole-page architecture and product redesigns.
23
+ - **Context-First Design Intelligence:** Design decisions derived from product domain, target audience, and brand—never forced universal templates.
24
+ - **Deterministic Quality Linter:** Enforces 5 Non-Overridable Hard Invariants with source line & column diagnostics.
25
+ - **Safe Atomic Auto-Repair (`medesign polish`):** Candidate validation, quality regression guards, unified line diffs, and automatic rollback on failure.
26
+ - **Headless Chrome CDP Browser Audit:** Real computed contrast, keyboard tab focus, touch targets, and horizontal overflow across Mobile (390px), Tablet (820px), Desktop (1440px), and Windows High Contrast Mode.
27
+ - **Zero-Dependency CLI:** Pure Node.js standard library with OASIS SARIF v2.1.0 output for GitHub Code Scanning.
28
+
29
+ ---
30
+
31
+ ## ⚡ Two-Level Workflow (Fast Path vs. Deep Path)
32
+
33
+ ME-DESIGN automatically adapts to the scope of your request:
34
+
35
+ ### 1. Fast Path — Focused Component & Style Tweaks
36
+ For small requests (*"fix button spacing"*, *"make this section responsive"*, *"adjust font hierarchy"*):
37
+ - **Inspect:** Reads only the target component and local styles.
38
+ - **Act:** Applies the minimal surgical change preserving business logic.
39
+ - **Verify:** Runs targeted linter without forcing design workshops or multi-question intake rituals.
40
+
41
+ ### 2. Deep Path — New Surfaces & Product Redesigns
42
+ For major projects (*"build GIS dashboard"*, *"design e-commerce checkout"*, *"modernize portal"*):
43
+ 1. **Context & Brief Intake:** Detects mode (`new` / `revamp` / `like`), product domain, and audience.
44
+ 2. **Design Direction:** Proposes a deliberate visual concept, compact color palette, and motion profile.
45
+ 3. **Information Architecture & Implementation:** Semantic HTML5, accessible components, and full state coverage.
46
+ 4. **Deterministic Verification:** Static linter audit + CDP headless browser matrix verification.
47
+
48
+ ---
49
+
50
+ ## 🖼️ Visual Showcase & Responsive Render Gallery
51
+
52
+ Pre-rendered directly by ME-DESIGN's Headless Chrome CDP Engine across Desktop (1440×900) and Mobile (390×844) viewports:
53
+
54
+ | Design System & Archetype | Desktop View (1440×900) | Mobile View (390×844) |
55
+ | :--- | :--- | :--- |
56
+ | **Cadastral Engineering QA/QC**<br>*(Archetype 38 — Geospatial Precision)* | <img src="examples/snapshots/cadastral-qaqc-slide-desktop-1440x900.png" width="480" alt="Cadastral QA/QC Dashboard"> | <img src="examples/snapshots/cadastral-qaqc-slide-mobile-390x844.png" width="160" alt="Cadastral QA/QC Mobile"> |
57
+ | **Linear Issue Board**<br>*(Archetype 06 — Linear Minimal & High-Density)* | <img src="examples/snapshots/linear-issue-board-desktop-1440x900.png" width="480" alt="Linear Issue Board"> | <img src="examples/snapshots/linear-issue-board-mobile-390x844.png" width="160" alt="Linear Mobile"> |
58
+ | **Spotify Web Player**<br>*(Archetype 21 — Decoupled 3-Pane Media Studio)* | <img src="examples/snapshots/spotify-web-player-desktop-1440x900.png" width="480" alt="Spotify Web Player"> | <img src="examples/snapshots/spotify-web-player-mobile-390x844.png" width="160" alt="Spotify Mobile"> |
59
+ | **Executive Saliency Report**<br>*(Archetype 02 — Swiss International Editorial)* | <img src="examples/snapshots/executive-summary-report-desktop-1440x900.png" width="480" alt="Executive Summary Report"> | <img src="examples/snapshots/executive-summary-report-mobile-390x844.png" width="160" alt="Executive Mobile"> |
23
60
 
24
61
  ---
25
62
 
26
63
  ## ⚔️ Multi-Dimensional Competitive Benchmark
27
64
 
28
- | Dimension | `medesign` (v1.4.0) | `ui-ux-pro-max-skill` | `pbakaus/impeccable` |
65
+ | Dimension | `medesign` (v1.7.0) | `ui-ux-pro-max-skill` | `pbakaus/impeccable` |
29
66
  | :--- | :--- | :--- | :--- |
30
67
  | **Execution Architecture** | **Autonomous Node.js CLI & Deterministic Engine** | Prompt-only System Text | Markdown Guidelines & Rules |
68
+ | **Brief Intake Protocol** | **Dual-Layer Auto-Intent Routing & 1-Click Cockpit Gate** | Free-form Prompting | Manual Instructions |
31
69
  | **Verification Gate** | **Mathematical Q-Score (0–100) + Hard Invariants** | Subjective LLM Self-Critique | Manual Inspection Checklist |
32
- | **Self-Healing Code Repair** | **Automatic AST/Regex Fixer (`medesign polish`)** | Re-prompting Prompt Loop | Manual Code Editing |
70
+ | **Self-Healing Code Repair** | **Deterministic Pattern & Style Fixer (`medesign polish`)** | Re-prompting Prompt Loop | Manual Code Editing |
33
71
  | **Conversational Modifiers** | **Instant Code Density (`bolder` / `quiet`)** | Chat Revision Re-rolls | None |
34
- | **Knowledge Discovery** | **Pure Node.js Search across 38 Archetypes & Presets** | Static Markdown Reading | Static Document Browsing |
72
+ | **Knowledge Discovery** | **Pure Node.js Search across 38 Archetypes & 74 Brands** | Static Markdown Reading | Static Document Browsing |
35
73
  | **Automated CI/CD Quality Gate** | **Native OASIS SARIF v2.1.0 for GitHub Code Scanning** | None | None |
36
74
  | **Perceptual Color Science** | **OKLCH / OKLab Gamut Mapping & `color-mix()`** | Standard Hex / sRGB Defaults | Hex / sRGB Recommendations |
37
75
  | **Headless Browser Matrix** | **Chrome DevTools Protocol (Real Contrast & 44px Hit-Targets)** | None | Manual Browser DevTools |
38
76
  | **Design Token Standards** | **Tailwind v4 `@theme`, W3C DTCG & CSS Custom Properties** | Unstructured CSS Snippets | None |
39
- | **Domain Archetype Depth** | **38 Decoupled Archetypes (HMI ISA-101, GIS Cadastre, Telemetry)** | Generic SaaS / E-commerce | General UI Polish Rules |
40
- | **Runtime Package Footprint** | **Zero-Dependency CLI (< 300 KB compressed on npm)** | Multi-file Prompt Repos | Docs / Repo Only |
77
+ | **Domain Archetype Depth** | **38 Decoupled Archetypes + 74 Brand Systems (HMI, GIS, Audio)** | Generic SaaS / E-commerce | General UI Polish Rules |
78
+ | **Runtime Package Footprint** | **Zero-Dependency CLI & Comprehensive Ruleset on npm** | Multi-file Prompt Repos | Docs / Repo Only |
41
79
 
42
80
  ---
43
81
 
@@ -54,7 +92,7 @@ ME-DESIGN Core Engine
54
92
 
55
93
  ---
56
94
 
57
- ## 📐 38 Production Archetypes (5-Axis Decoupled Matrix)
95
+ ## 📐 38 Production Archetypes & 74 Global Brand Systems
58
96
 
59
97
  ME-DESIGN decouples UI synthesis across 5 independent axes:
60
98
  **Operational Archetype × Visual Language × Spatial Model × Motion Profile × Governance Tier**
@@ -68,85 +106,90 @@ ME-DESIGN decouples UI synthesis across 5 independent axes:
68
106
  - **31. Mission Control HMI (ISA-101 Standard):** Tri-state alarms, greyscale base, operator decision priority.
69
107
  - **32. Geospatial Situation Awareness (GIS & Cadastre):** Map-centric 16:10 / 100dvh, linked selection tables, EPSG coordinates.
70
108
  - **33. CAD Precision Workbench:** Maximized canvas, floating command bar, geometric snap indicators.
71
- - **34. Telemetry & Signal Forensics:** Time-series scrubbing, stale sensor detection, gap indicators.
72
- - **35. Anomaly Triage & Incident Response:** Priority queue, severity vs confidence matrix.
73
- - **36. Field Survey & Offline Operations:** 52px touch targets, RTK fix status, offline sync queue.
74
- - **37. Spatiotemporal Change Detection:** Synchronized dual viewports, epoch time slider.
75
- - **38. Data Provenance & Survey QA/QC:** Observation lineage, error ellipses, legal timestamp seals.
109
+ - **74 Global Brand Multi-Pane Systems:** Pre-calibrated spatial layouts and design tokens for premier brands (Apple, Spotify, Linear, Tesla, Stripe, Bloomberg, GitHub, Vercel, Porsche, Teenage Engineering, etc.).
76
110
 
77
111
  ---
78
112
 
79
- ## 🚀 Quickstart: Running via `npx` (Zero Installation)
113
+ ## 📦 Installation & Global CLI
80
114
 
81
- Execute ME-DESIGN immediately without manual installation:
115
+ Install globally or execute instantly with `npx`:
82
116
 
83
117
  ```bash
84
- # 1. Discover archetypes, palettes, and typography for any domain query
85
- npx medesign search "cadastre survey"
86
- npx medesign search "apple hardware"
87
- npx medesign search "tesla telemetry"
118
+ # Direct execution without permanent installation
119
+ npx medesign <command>
88
120
 
89
- # 2. Self-healing code repair (auto-fixes MD005 focus rings, 100dvh, dead buttons, em-dashes)
90
- npx medesign polish path/to/index.html
121
+ # Or install globally
122
+ npm install -g medesign
123
+ ```
91
124
 
92
- # 3. Fine-tune visual density and tone directly in code
93
- npx medesign bolder path/to/index.html # Boost font weights, sharpen borders, raise contrast
94
- npx medesign quiet path/to/index.html # Soften font weights, reduce borders to hairlines
125
+ ### Verified CLI Commands
95
126
 
96
- # 4. Lint an HTML, JSX, or CSS file with static AST & invariant rules
97
- npx medesign lint path/to/index.html
127
+ ```text
128
+ ME-DESIGN CLI v1.7.0
129
+ Autonomous Design Engineering Toolkit & Automated Linter for AI Coding Assistants
98
130
 
99
- # 5. Lint and export OASIS SARIF v2.1.0 for GitHub Code Scanning
100
- npx medesign lint path/to/index.html --format sarif
131
+ USAGE:
132
+ medesign <command> [options]
101
133
 
102
- # 6. Run headless Chrome DevTools Protocol verification matrix
103
- # (Computes real contrast ratios, tab focus indicators, and 44px hit-targets)
104
- npx medesign audit path/to/index.html
134
+ COMMANDS:
135
+ search <query> Search 38 Archetypes & presets with discovery engine
136
+ Options: --json
105
137
 
106
- # 7. Export design tokens to Tailwind CSS v4 @theme, W3C DTCG, or CSS variables
107
- npx medesign tokens --preset apple --format tailwind --out ./tokens
138
+ polish <file> Self-healing repair for Hard Invariants (MD005, MD104, em-dash)
139
+ Options: --dry-run, --diff
108
140
 
109
- # 8. Verify system health, Node.js version, and headless browser availability
110
- npx medesign doctor
111
- ```
141
+ bolder <file> Boost visual density, font weights, and border contrast
112
142
 
113
- ### 🔎 Knowledge Discovery Engine (`medesign search`)
143
+ quiet <file> Softens visual density, font weights, and border treatments
114
144
 
115
- Query the 38 production archetypes and design system presets to get immediate, actionable styling recommendations:
145
+ lint <file> Lint HTML/CSS/JSX file with deterministic pattern & architectural rules
146
+ Options: --format <text|json|sarif>
147
+ --preset <apple|tesla|metha>
148
+ --config <path>
116
149
 
117
- ```bash
118
- # Human-focused Terminal Summary Card
119
- npx medesign search "cadastre survey"
150
+ audit <file> Run headless Chrome DevTools Protocol verification matrix
151
+ (Checks computed contrast, tab focus outline, 44px hit-targets across viewports)
152
+ Options: --json
120
153
 
121
- # Output structured JSON for AI agent orchestration
122
- npx medesign search "luxury fintech" --json
123
- ```
154
+ snapshot <file> Capture high-DPI rendered screenshots across responsive viewports
155
+ Options: --out <dir>, --og (1200x630 banner), --viewports <list>
124
156
 
125
- ```text
126
- ME-DESIGN Discovery Engine
127
- ────────────────────────────────────────
128
- Query "cadastre survey"
129
- Best Match Archetype 38: Cadastral Survey & QA/QC Workbench
130
- Preset Link metha (Metha Engineering Cockpit)
131
-
132
- DESIGN ARCHETYPE RECOMMENDATION
133
- Archetype Cadastral Survey & Data Provenance (38)
134
- Spatial Model 16:10 / 100dvh Map-Centric with Split Data Grid
135
- Primary Color Electric Cyan (oklch(0.85 0.18 200))
136
- Secondary Color Passed Emerald (oklch(0.72 0.18 145))
137
- Surface Contrast Ultra-Dark Obsidian (#0a0d14)
138
- Typography JetBrains Mono + IBM Plex Sans Thai
139
- Motion Profile Precision Linear (120ms max)
140
- ────────────────────────────────────────
157
+ tokens [export] Export preset design tokens to Tailwind v4 @theme, W3C DTCG, or CSS
158
+ Options: --preset <apple|tesla|metha|all>
159
+ --format <tailwind|dtcg|css|all>
160
+ --out <directory>
161
+
162
+ presets [list|get] Inspect available design system presets
163
+ Usage: medesign presets list
164
+ medesign presets get <preset-name>
165
+
166
+ test [options] Run deterministic test suite across fixtures
167
+ Options: --browser (runs both static pattern and headless browser matrix)
168
+
169
+ doctor Verify local environment, Node.js, and Chrome/CDP availability
170
+
171
+ help Display this help message
141
172
  ```
142
173
 
143
- ### 🛠️ Self-Healing Code Repair (`medesign polish`)
174
+ ---
175
+
176
+ ## 🛠️ Automated Quality Linter & Self-Healing Repair
144
177
 
145
- Automatically inspect and repair Hard Invariants in your HTML/CSS files without waiting for manual edits:
178
+ ### 🛡️ Deterministic Static Rules Linter (`medesign lint`)
146
179
 
147
- - **MD005:** Injects physical `:focus-visible` outlines and `@media (forced-colors: active)` support when `box-shadow` is used without an outline.
148
- - **MD104:** Replaces unstable `100vh` on containers with dynamic `100dvh` (`min-height: 100vh; min-height: 100dvh;`).
149
- - **MD004:** Injects hover and active states for buttons without defined interactive contracts.
180
+ ```bash
181
+ # Output human-readable terminal report
182
+ npx medesign lint path/to/dashboard.html
183
+
184
+ # Output SARIF 2.1.0 JSON format for GitHub Code Scanning
185
+ npx medesign lint path/to/dashboard.html --format sarif > medesign-results.sarif
186
+ ```
187
+
188
+ ### 🩹 Self-Healing Repair (`medesign polish`)
189
+
190
+ Automatically inspects and repairs hard invariants directly in code:
191
+ - **MD104:** Replaces raw unconstrained `100vh` with safe modern `100dvh` fallbacks.
192
+ - **MD005:** Replaces `outline: none` with physical `:focus-visible` rings and `@media (forced-colors: active)`.
150
193
  - **MD002:** Adds `@media (prefers-reduced-motion)` accessibility gates.
151
194
  - **MD201:** Cleans up decorative AI-tell em-dashes `—` (including entity `&mdash;`) into clean hyphens `-`.
152
195
 
@@ -179,31 +222,43 @@ npx medesign quiet path/to/dashboard.html
179
222
  ### The Terminal Quality Audit Card
180
223
 
181
224
  ```text
182
- ME-DESIGN v1.4.0
225
+ ME-DESIGN vNext
183
226
  Design Quality & Governance Audit
184
227
  ────────────────────────────────────────
185
- Target dashboard.tsx
186
- Archetype Geospatial Situation Awareness (32)
187
- Analysis Static AST & Semantic Rules
188
- Ruleset medesign-standard@1.4.0
228
+ Target accessibility-contrast-fail.html
229
+ Preset DEFAULT
230
+ Analysis Static Pattern & Heuristic Rules (Confidence Gated)
231
+ Ruleset medesign-standard@1.7.0
189
232
 
190
233
  QUALITY SCORE (Q = 0.30H + 0.25I + 0.20G + 0.15R + 0.10V)
191
- Hierarchy (H) 94.0 / 100
192
- Information (I) 90.0 / 100
193
- Geometry (G) 92.0 / 100
194
- Responsive (R) 88.0 / 100
195
- Visual Craft (V) 95.0 / 100
234
+ Hierarchy (H) 95.0 / 100
235
+ Information (I) 65.0 / 100
236
+ Geometry (G) 85.0 / 100
237
+ Responsive (R) 80.0 / 100
238
+ Visual Craft (V) 90.0 / 100
196
239
 
197
- Q-SCORE 91.8 / 100 [PASS]
240
+ Q-SCORE 82.8 / 100 [FAIL]
241
+ (Note: Q-Score is a static pattern heuristic, not a direct measurement of rendered layout)
198
242
 
199
243
  HARD INVARIANTS CHECKLIST
200
- PASS Keyboard Focus Ring Visibility (:focus-visible)
201
- PASS Reduced Motion Compliance (@media prefers-reduced-motion)
202
- PASS Anti-AI Tells: Zero Em-Dash Invariant
203
- PASS Predictable DOM Order (No unsemantic dense flow)
244
+ FAIL MD001: Keyboard Focus Ring Visibility (:focus-visible)
245
+ FAIL MD002: Reduced Motion Compliance (@media prefers-reduced-motion)
246
+ FAIL MD003: Isolated Hit-Target Area (No raw scale-95 crushing)
247
+ PASS MD004: Interactive State Contract (No dead buttons)
248
+ FAIL MD005: High Contrast Focus Visibility (forced-colors: active outline)
249
+
250
+ FINDINGS (5)
251
+ error [14:11] MD001 (hard-invariant) Missing visible focus indicator (:focus-visible) for interactive controls.
252
+ -> Remediation: Define :focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
253
+ error [20:7] MD002 (hard-invariant) Animations/transitions detected without @media (prefers-reduced-motion) compliance gate.
254
+ -> Remediation: Add @media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; } }
255
+ error [31:7] MD003 (hard-invariant) Detected raw scale(0.90-0.95) directly on interactive button container, collapsing touch hit-target.
256
+ -> Remediation: Isolate outer 44px hit-target container and scale only the inner .visual-surface using clamp(0.96, 1 - 2.5/max(W,H), 0.995).
257
+ error [14:5] MD005 (hard-invariant) Focus indicator relies on box-shadow or suppresses outline without replacement.
258
+ -> Remediation: Always specify a physical outline in focus styles: :focus-visible { outline: 2px solid Highlight; outline-offset: 2px; }
204
259
 
205
260
  ────────────────────────────────────────
206
- RESULT: PASS (Exit Code: 0)
261
+ RESULT: FAIL (4 hard invariant failures, Exit Code: 1)
207
262
  ```
208
263
 
209
264
  ---
@@ -212,12 +267,23 @@ RESULT: PASS (Exit Code: 0)
212
267
 
213
268
  ME-DESIGN provides shared rule adapters for all major agentic tools:
214
269
 
270
+ - **Google Antigravity:** Native Skill supported under `C:\Users\hotme\.gemini\config\skills\medesign\SKILL.md` (or workspace `.gemini/skills/medesign/SKILL.md`)
215
271
  - **Claude Code:** Copy `integrations/claude-code/SKILL.md` to `.claude/skills/medesign/SKILL.md`
216
272
  - **Cursor:** Copy `integrations/cursor/medesign.mdc` to `.cursor/rules/medesign.mdc`
217
- - **Google Antigravity:** Native Skill supported under `skills/medesign/SKILL.md`
273
+ - **Windsurf / OpenClaw / Generic Agents:** Link to root `SKILL.md` in `.agents/rules/` or `AGENTS.md`
274
+
275
+ ---
276
+
277
+ ## 📚 Architectural & Benchmark Documentation
278
+
279
+ - [Roadmap & Product Architecture](docs/roadmap/FRONTEND-DESIGN-SKILL-ROADMAP.md)
280
+ - [Competitive Benchmark Synthesis](docs/audit/COMPETITIVE-BENCHMARK.md)
281
+ - [Standardized 8-Task Benchmark Suite](docs/benchmark/BENCHMARK-SUITE.md)
282
+ - [Initial Source Audit](docs/audit/INITIAL-SOURCE-AUDIT.md)
283
+ - [Design Routing & Knowledge Guide](references/design-routing.md)
218
284
 
219
285
  ---
220
286
 
221
287
  ## 📄 License
222
288
 
223
- MIT License © 2026 Metha Triparamkit (Survey Engineering & Geoinformatics, Kasetsart University).
289
+ MIT License © 2026 Metha Tripraphankit (Survey Engineering & Geoinformatics, Kasetsart University).
package/SKILL.md ADDED
@@ -0,0 +1,169 @@
1
+ ---
2
+ name: medesign
3
+ description: "Design, build, improve, or review frontend UI/UX for websites and apps. Use when creating or refining pages, components, dashboards, and design systems for usability, visual craft, responsive layout, and a11y."
4
+ ---
5
+
6
+ # ME-DESIGN — Frontend Design & Engineering Skill
7
+
8
+ Help the user ship interfaces that are **specific to their product, easy to use, visually intentional, responsive, and technically safe**.
9
+
10
+ ME-DESIGN is not a fixed visual template. Choose design decisions from the brief, user task, content, brand, existing project and technical constraints. Use its references and tools as support—not as a substitute for judgement.
11
+
12
+ ## Operating principles
13
+
14
+ 1. **Understand the job before styling.** Identify the audience, primary user task, content and success condition from the request and repository. Ask only when a missing answer materially changes the work.
15
+ 2. **Inspect before changing.** For an existing project, inspect its framework, package scripts, components, tokens, routes, assets and nearby patterns. Reuse the established architecture unless there is a clear reason not to.
16
+ 3. **Design for this product.** Use the subject matter, audience, content and brand to create a visual direction. Avoid repeating a generic dashboard, three-card grid, gradient hero, dark theme, font pairing or rounded-card treatment by default.
17
+ 4. **Keep the user moving.** Prefer clear hierarchy, understandable copy, obvious actions, useful feedback, meaningful empty/error/loading states and predictable interaction.
18
+ 5. **Preserve behaviour.** Do not break business logic, data flow, routes, forms, permissions, state management or API contracts while changing presentation.
19
+ 6. **Use the smallest useful process.** A one-component fix does not need a full design workshop. A new product surface or substantial redesign deserves a deeper plan and review.
20
+ 7. **Be honest about verification.** Static lint, browser checks, screenshots and human design judgement are different evidence. Report only checks that actually ran.
21
+
22
+ ## Task routing
23
+
24
+ Choose the workflow from the user's intent. Natural-language requests are first-class; slash commands are optional shortcuts.
25
+
26
+ | User intent | Workflow |
27
+ |---|---|
28
+ | Create a new interface | Create |
29
+ | Improve or redesign an existing interface | Improve |
30
+ | Review an interface or find problems | Review |
31
+ | Adjust one specific quality dimension | Targeted craft |
32
+ | Find patterns, tokens or a visual direction | Design intelligence |
33
+ | Create slides, banners, logos or social graphics | Optional graphic-design references |
34
+
35
+ Read only the reference files needed for the task.
36
+
37
+ ## Fast path — small, clear changes
38
+
39
+ For focused requests such as "fix this spacing", "make the button clearer", or "make this section responsive":
40
+
41
+ 1. Inspect the relevant component and nearby styles.
42
+ 2. Identify the user's requested outcome and any project convention that matters.
43
+ 3. Make the smallest change that achieves it.
44
+ 4. Check the affected behaviour and run the most relevant available test or lint command.
45
+ 5. Briefly report what changed and what was checked.
46
+
47
+ Do not ask for a full brief, present unnecessary A/B directions, or refactor unrelated files.
48
+
49
+ ## Deep path — new surfaces or substantial redesigns
50
+
51
+ Use this for new pages, multi-section flows, major redesigns, or changes with important product/architecture decisions.
52
+
53
+ ### 1. Establish context
54
+ Read `references/brief-intake.md` when needed. Inspect the repository and identify:
55
+ - Product, audience and primary task
56
+ - Page/surface type and content hierarchy
57
+ - Existing design system, components and brand assets
58
+ - Framework, styling approach and relevant constraints
59
+ - Primary action and success state
60
+
61
+ If the brief is complete, proceed with reasonable assumptions. Ask one concise question only when the answer materially affects the design or implementation. (Fallback: หากไม่มี `ask_question` ให้ถามข้อความธรรมดาในแชต; หากไม่มี Node CLI ให้ตรวจทานด้วย 11 Craft Checklist ด้วยตนเอง)
62
+
63
+ ### 2. Choose a design direction
64
+ For a new or visibly redesigned surface, define a short direction before coding:
65
+ - One sentence describing the visual idea and why it fits this product
66
+ - A compact palette and type approach using project tokens where available
67
+ - Layout structure and hierarchy
68
+ - The distinctive element, and what should remain restrained
69
+
70
+ Offer alternatives only when the user asks or when there are genuinely different strategic directions. Do not force a direction pitch for small tasks.
71
+
72
+ ### 3. Plan the interface
73
+ Plan around the user's task, not a decorative component catalogue:
74
+ - Put the most important information and action where users can find them.
75
+ - Use real content and product-specific visuals whenever available.
76
+ - Choose density, navigation and layout appropriate to the surface.
77
+ - Include the relevant states: default, hover/focus, active, loading, empty, error, success and disabled—only where applicable.
78
+ - Consider mobile, keyboard use, long content and localization early.
79
+
80
+ ### 4. Implement in the existing stack
81
+ - Follow the repository's component and styling conventions.
82
+ - Prefer existing components and tokens over duplicate systems.
83
+ - Keep components understandable and avoid unnecessary abstraction.
84
+ - Use semantic HTML and accessible names.
85
+ - Make controls functional; do not ship decorative buttons that appear actionable.
86
+ - Avoid fake data, placeholder copy and unfinished visual slots unless the user explicitly requests a prototype.
87
+ - Do not add dependencies without a clear benefit.
88
+
89
+ ### 5. Review and refine
90
+ Review the result against the brief:
91
+ - Does the hierarchy communicate the primary task quickly?
92
+ - Does the visual direction feel specific rather than generic?
93
+ - Is the content clear and concise?
94
+ - Are spacing, typography, colour and alignment coherent?
95
+ - Are interaction states and feedback complete?
96
+ - Does the layout work at relevant viewport sizes?
97
+ - Did the change preserve existing behaviour?
98
+
99
+ If browser access is available, inspect rendered screenshots at relevant viewport sizes and fix visible problems. Use the quality gate below for the applicable checks.
100
+
101
+ ## Targeted craft workflows
102
+
103
+ Load only the relevant references:
104
+
105
+ - **Typography / Thai and Latin scripts:** `references/typography-thai-latin.md`
106
+ - **Layout, spacing and visual hierarchy:** `references/design-core.md`, `references/modern-craft-invariants.md`
107
+ - **Motion and interaction:** `references/motion-tokens.md`, `references/compositor-smoothness.md`
108
+ - **Accessibility and implementation review:** `references/quality-gate.md`, `references/redesign-audit.md`
109
+ - **Existing site retrofit:** `references/web-retrofit-protocol.md`
110
+ - **Component or modal:** `references/components.md`
111
+ - **Extract a visual system:** `references/style-extraction.md`
112
+ - **Brand inspiration:** `references/brand-design-tokens.md` or `references/style-extraction.md`
113
+ - **Archetype search:** `references/argon-design-archetypes.md`
114
+ - **Image/mockup to code:** `references/image-to-code.md`
115
+
116
+ Brand and style references are inspiration, not permission to copy proprietary assets or duplicate a site pixel-for-pixel. Extract general principles and create an original implementation that fits the user's brief.
117
+
118
+ ## Commands and tools
119
+
120
+ The CLI is optional support. Use it when it helps the current task; do not run every command by habit.
121
+
122
+ | Command | Use |
123
+ |---|---|
124
+ | `medesign search <query>` | Find relevant archetypes and design knowledge |
125
+ | `medesign lint <file>` | Run static source-pattern checks |
126
+ | `medesign audit <file>` | Run the available browser audit |
127
+ | `medesign polish <file> --dry-run` | Preview supported code transformations |
128
+ | `medesign snapshot <file>` | Capture rendered screenshots |
129
+ | `medesign tokens export` | Export preset tokens |
130
+ | `medesign presets list` | Inspect available presets |
131
+
132
+ Before applying an automatic repair, preview it when the change is broad or could alter layout/content. Review the diff. Never assume a transformation is safe merely because it is available.
133
+
134
+ ## Quality gate
135
+
136
+ Use `references/quality-gate.md` for the checks applicable to the deliverable (Squint Test, Grayscale, 10-State Matrix). ปิดท้ายด้วย `Gate: quality-gate.md - pass` เสมอ **เฉพาะข้อความที่ส่งมอบโค้ดเท่านั้น** (ข้อความเสนอทิศทาง A/B ไม่ต้องใส่ Gate) Separate results into:
137
+
138
+ - **Static checks:** source patterns and structural heuristics.
139
+ - **Browser checks:** rendered styles, geometry, viewport behaviour and interaction.
140
+ - **Design review:** task fit, hierarchy, visual distinctiveness and content clarity.
141
+ - **Unverified:** checks that could not be run.
142
+
143
+ A static Q-Score is a heuristic, not a direct measurement of visual quality or accessibility. Never claim browser verification if only static lint ran. If a tool is unavailable, say so and provide the best manual fallback.
144
+
145
+ Do not treat a visual preference—such as a particular font, dark palette, em-dash usage, Bento layout, gradient or motion style—as a universal accessibility invariant.
146
+
147
+ ## Delivery
148
+
149
+ For completed work, provide a concise summary:
150
+ - What changed and why
151
+ - Files or components affected
152
+ - Tests, lint, browser checks or screenshots actually run
153
+ - Any known limitation or remaining follow-up
154
+
155
+ Do not claim PASS for a check that did not run. Do not merge or publish changes unless the user explicitly asks.
156
+
157
+ ## Optional graphic-design routes
158
+
159
+ When the user explicitly requests a slide deck, banner, logo, social graphic, report or mockup, route to the corresponding reference rather than forcing the frontend workflow:
160
+
161
+ - Slides: `references/slides.md`
162
+ - Executive report: `references/executive-reports.md`
163
+ - Banner: `references/banner-sizes-and-styles.md`
164
+ - Social graphics: `references/social-photos-design.md`
165
+ - Logo / identity: `references/logo-design.md`, `references/cip-design.md`
166
+ - Icon: `references/icon-design.md`
167
+ - Mockup: `references/image-mockup-direction.md`
168
+
169
+ For those requests, follow the requested output format and use the relevant specialist instructions.