@minhduydev/mdpi 0.4.0 → 0.4.1

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.
@@ -0,0 +1,343 @@
1
+ ---
2
+ description: Full frontend feature workflow — design analysis → deslop → architecture → craft polish → parallel implementation → hardening → quality audit (7 phases)
3
+ ---
4
+
5
+ # frontend-feature-workflow
6
+
7
+ Multi-agent workflow for building production-quality frontend features. Chains 7 phases: design analysis, baseline cleanup, component architecture, craft polish, parallel implementation, hardening, and quality audit.
8
+
9
+ ## Args
10
+
11
+ - `feature` (required) — The frontend feature or component to build
12
+ - `mockup` (optional) — URL or path to Figma mockup, screenshot, or design reference
13
+
14
+ ## Phases
15
+
16
+ ### Phase 1: Design Analysis
17
+
18
+ - **Agent:** vision
19
+ - **Concurrency:** 1
20
+ - **Depends on:** —
21
+ - **Tool:** `subagent` (single mode)
22
+ - **Skill:** `figma` (if mockup provided), `mockup-to-code` (if screenshot provided)
23
+
24
+ **Pre-Flight: Load DESIGN.md + aesthetic skills.** Before analyzing any mockup or design file: (1) read `.pi/DESIGN.md` (fallback: `.pi/templates/DESIGN.md`) to load project mood, color palette, typography scale, and design constraints; (2) load `frontend-design` and `design-taste-frontend` skills via `/skill:frontend-design` and `/skill:design-taste-frontend`. Use DESIGN.md prose as the aesthetic anchor — the Overview section's specific reference sets the tone for all subsequent design decisions.
25
+
26
+ Also load `design-taste-frontend` and `frontend-design` skills — they enforce the aesthetic rules that translate DESIGN.md's prose into concrete component styling decisions.
27
+
28
+ **Prompt:**
29
+
30
+ ```
31
+ Analyze the design for: {feature}.
32
+
33
+ If a mockup is provided ({mockup}):
34
+ - Extract layout structure (grid, sections, spacing patterns)
35
+ - Identify all visual components (buttons, cards, inputs, navigation)
36
+ - Extract color palette (primary, accent, neutrals, semantic tokens)
37
+ - Identify typography (font families, sizes, weights, hierarchy)
38
+ - Note responsive breakpoint behavior
39
+ - Identify animation/motion patterns
40
+ - Flag any accessibility concerns in the design
41
+
42
+ If no mockup is provided:
43
+ - Based on the feature description, recommend a layout structure
44
+ - Suggest component decomposition
45
+ - Propose a color palette (OKLCH tokens preferred)
46
+ - Recommend typography pairings
47
+
48
+ Return findings in this format:
49
+
50
+ ## Layout Structure
51
+ - [Grid/stack/split-screen description]
52
+
53
+ ## Components Identified
54
+ | Component | Type | States | Priority |
55
+ |-----------|------|--------|----------|
56
+ | [name] | [button/card/form/...] | [default, hover, active, disabled, loading, error] | [P0/P1/P2] |
57
+
58
+ ## Design Tokens
59
+ - Colors: [primitive + semantic tokens]
60
+ - Typography: [font stack, scale, weights]
61
+ - Spacing: [scale reference]
62
+ - Motion: [animation patterns]
63
+
64
+ ## Accessibility Notes
65
+ - [Potential issues or considerations]
66
+ ```
67
+
68
+ ### Phase 2: Baseline Cleanup
69
+
70
+ - **Agent:** general
71
+ - **Concurrency:** 1
72
+ - **Depends on:** Phase 1
73
+ - **Tool:** `subagent` (single mode)
74
+ - **Skill:** `baseline-ui`
75
+
76
+ **Prompt:**
77
+
78
+ ```
79
+ Apply the baseline-ui deslop pass to the feature: {feature}.
80
+
81
+ Using the design analysis from Phase 1 ({phase_1_output}):
82
+
83
+ 1. Scan existing code (if any) or scaffold for:
84
+ - MUST violations: purple gradients, banned fonts (Inter/Roboto/Arial), emojis, h-screen, div onClick
85
+ - SHOULD violations: inconsistent spacing, raw color values, missing semantic tokens
86
+ - NEVER violations: pure black (#000), centered hero with high variance, 3-column identical cards
87
+
88
+ 2. Apply fixes for each violation found. Use the before/after patterns from baseline-ui.
89
+
90
+ 3. Verify all MUST rules pass after fixes.
91
+
92
+ Return the list of fixes applied and verification results.
93
+ ```
94
+
95
+ ### Phase 3: Component Architecture
96
+
97
+ - **Agent:** plan
98
+ - **Concurrency:** 1
99
+ - **Depends on:** Phase 2
100
+ - **Tool:** `subagent` (single mode)
101
+ - **Skill:** `frontend-design`
102
+
103
+ **Prompt:**
104
+
105
+ ```
106
+ Plan the component architecture for: {feature}.
107
+
108
+ Based on the design analysis ({phase_1_output}) and baseline cleanup ({phase_2_output}):
109
+
110
+ 1. Decompose the feature into components:
111
+ - Page-level components (layout containers)
112
+ - Section components (feature areas)
113
+ - Shared/primitive components (reusable across sections)
114
+ - Leaf components (specific interactive elements)
115
+
116
+ 2. For each component, specify:
117
+ - Props interface (TypeScript)
118
+ - State requirements (local, lifted, context, server)
119
+ - Loading/empty/error state design
120
+ - Accessibility requirements (ARIA roles, keyboard handling)
121
+ - Data dependencies
122
+
123
+ 3. Define the component tree with parent-child relationships.
124
+
125
+ 4. Identify which components can be built in parallel (no shared state, no parent-child dependency).
126
+
127
+ Return the architecture plan in this format:
128
+
129
+ ## Component Tree
130
+ ```
131
+ PageLayout
132
+ ├── Header
133
+ │ ├── Navigation
134
+ │ └── UserMenu
135
+ ├── MainContent
136
+ │ ├── SectionA
137
+ │ │ ├── ComponentA1
138
+ │ │ └── ComponentA2
139
+ │ └── SectionB
140
+ │ └── ComponentB1
141
+ └── Footer
142
+ ```
143
+
144
+ ## Component Specs
145
+ ### [ComponentName]
146
+ - **Type:** [page/section/shared/leaf]
147
+ - **Props:** [TypeScript interface]
148
+ - **State:** [local/lifted/context/server]
149
+ - **States:** [loading, empty, error, default]
150
+ - **Accessibility:** [ARIA, keyboard, focus]
151
+ - **Data:** [dependencies]
152
+
153
+ ## Parallel Build Groups
154
+ - Group 1: [components that can be built simultaneously]
155
+ - Group 2: [components that can be built simultaneously]
156
+ ```
157
+
158
+ ### Phase 4: Craft Polish
159
+
160
+ - **Agent:** general
161
+ - **Concurrency:** 1
162
+ - **Depends on:** Phase 3
163
+ - **Tool:** `subagent` (single mode)
164
+ - **Skill:** `ui-craft-principles`, `oklch-color-workflow`
165
+
166
+ **Prompt:**
167
+
168
+ ```
169
+ Apply craft polish to the component architecture for: {feature}.
170
+
171
+ Using the architecture plan ({phase_3_output}) and design tokens ({phase_1_output}):
172
+
173
+ 1. Verify and enhance color tokens using OKLCH:
174
+ - Convert any HEX/RGB tokens to OKLCH
175
+ - Check gamut for all colors
176
+ - Generate 50-950 scale for primary and accent
177
+ - Define semantic tokens from primitives
178
+ - Verify contrast ratios (4.5:1 min for text)
179
+
180
+ 2. Apply craft principles to each component:
181
+ - Concentric border-radius (outer = inner + padding)
182
+ - Optical text alignment (-0.05em margin for visual centering)
183
+ - Multi-shadow layering (not single box-shadow)
184
+ - Interruptible animations (spring-based, not duration-based)
185
+ - Tabular numbers for data displays
186
+ - Hit areas ≥ 44px for interactive elements
187
+ - Focus ring offset (outline-offset: 2px)
188
+
189
+ 3. Define motion specs:
190
+ - Animation duration hierarchy (100ms/200ms/300ms/500ms)
191
+ - Easing: exponential only (cubic-bezier(0.16, 1, 0.3, 1))
192
+ - prefers-reduced-motion handling
193
+
194
+ Return the enhanced design specs with before/after for each craft improvement.
195
+ ```
196
+
197
+ ### Phase 5: Parallel Implementation
198
+
199
+ - **Agent:** general
200
+ - **Concurrency:** Dynamic: 1..5
201
+ - **Notes:** One subagent per build group from Phase 3.
202
+ - **Depends on:** Phase 4
203
+ - **Tool:** `subagent` (parallel mode)
204
+ - **Skill:** `frontend-ui-engineering`, `react-best-practices`
205
+
206
+ **Prompt:**
207
+
208
+ ```
209
+ Implement the components for build group: [assigned group] in feature: {feature}.
210
+
211
+ Using the architecture plan ({phase_3_output}) and craft polish specs ({phase_4_output}):
212
+
213
+ 1. For each component in your assigned group:
214
+ - Implement the component with full TypeScript types
215
+ - Handle all states: loading, empty, error, default, active, disabled
216
+ - Apply all craft principles from the polish phase
217
+ - Use semantic HTML and ARIA attributes
218
+ - Add keyboard navigation support
219
+ - Use the exact design tokens (colors, spacing, typography)
220
+
221
+ 2. Follow frontend-ui-engineering patterns:
222
+ - Composition over configuration
223
+ - Colocate component files (component + test + types)
224
+ - Separate data fetching from presentation
225
+ - Components < 200 lines; split if larger
226
+
227
+ 3. Apply react-best-practices:
228
+ - Server Components by default, Client Components only for interactivity
229
+ - Memoize expensive computations
230
+ - Optimize re-renders
231
+
232
+ Return each component implementation with its test file.
233
+ ```
234
+
235
+ ### Phase 6: Hardening
236
+
237
+ - **Agent:** general
238
+ - **Concurrency:** 1
239
+ - **Depends on:** Phase 5
240
+ - **Tool:** `subagent` (single mode)
241
+ - **Skill:** `production-hardening`, `fixing-accessibility`
242
+
243
+ **Prompt:**
244
+
245
+ ```
246
+ Apply production hardening to the implemented feature: {feature}.
247
+
248
+ Using the implemented components ({phase_5_output}):
249
+
250
+ 1. Production hardening checklist:
251
+ - Text overflow: add truncation, word-break for long content
252
+ - i18n readiness: 30% text expansion allowance, RTL support
253
+ - Error states: what happened + why + how to fix
254
+ - Empty states: don't show blank screens, provide guidance
255
+ - Loading states: skeleton loaders matching exact layout
256
+ - Input validation: HTML5 + JS, sanitization, max lengths
257
+ - Edge cases: 0 items, 1 item, many items, very long names, missing images
258
+ - Cross-browser: -webkit-appearance, scrollbar styling, safe area insets
259
+
260
+ 2. Accessibility fixes (WCAG 2.1 AA):
261
+ - Keyboard navigation: all interactive elements reachable via Tab
262
+ - Focus management: visible focus indicators, trap in modals
263
+ - ARIA labels: all icon buttons, form inputs labeled
264
+ - Color contrast: verify 4.5:1 for text, 3:1 for UI elements
265
+ - Heading hierarchy: logical H1-H6, no skipped levels
266
+ - Touch targets: minimum 44x44px
267
+ - Screen reader: meaningful content and structure
268
+
269
+ Return hardening report with each issue found and fix applied.
270
+ ```
271
+
272
+ ### Phase 7: Quality Audit
273
+
274
+ - **Agent:** review
275
+ - **Concurrency:** 1
276
+ - **Depends on:** Phase 6
277
+ - **Tool:** `subagent` (single mode)
278
+ - **Skill:** `ui-quality-audit`
279
+
280
+ **Prompt:**
281
+
282
+ ```
283
+ Run a 5-dimension quality audit on the completed feature: {feature}.
284
+
285
+ Using all previous phase outputs:
286
+
287
+ Score each dimension 0-4:
288
+
289
+ 1. **Accessibility** (0-4): keyboard, ARIA, contrast, focus, semantic HTML
290
+ 2. **Performance** (0-4): bundle size, render performance, animation perf, image optimization
291
+ 3. **Theming** (0-4): token consistency, dark mode, color contrast, typography scale
292
+ 4. **Responsive** (0-4): breakpoints, touch targets, content reflow, viewport meta
293
+ 5. **Anti-patterns** (0-4): AI fingerprints, dead code, over-engineering, inconsistent patterns
294
+
295
+ For each finding, tag severity:
296
+ - **P0**: Ship blocker — must fix before release
297
+ - **P1**: Must fix this release
298
+ - **P2**: Should fix
299
+ - **P3**: Nice to have
300
+
301
+ Return the complete audit report with total score /20 and per-dimension breakdown.
302
+
303
+ ## Overall Score: X/20
304
+
305
+ ## Dimension Breakdown
306
+ | Dimension | Score | P0 | P1 | P2 | P3 |
307
+ |-----------|-------|----|----|----|-----|
308
+ | Accessibility | X/4 | N | N | N | N |
309
+ | Performance | X/4 | N | N | N | N |
310
+ | Theming | X/4 | N | N | N | N |
311
+ | Responsive | X/4 | N | N | N | N |
312
+ | Anti-patterns | X/4 | N | N | N | N |
313
+
314
+ ## Findings
315
+ ### [P0/P1/P2/P3] [Title]
316
+ - **Dimension:** [name]
317
+ - **Location:** [file:line]
318
+ - **Issue:** [description]
319
+ - **Fix:** [recommendation]
320
+ ```
321
+
322
+ ---
323
+
324
+ ## Final Synthesis (Main Agent)
325
+
326
+ After all 7 phases complete, the main agent:
327
+
328
+ 1. **Aggregates** the quality audit ({phase_7_output}) and all phase outputs
329
+ 2. **Verifies** P0 issues are resolved (re-run Phase 7 if needed)
330
+ 3. **Compiles** the final summary:
331
+ - Feature delivered vs spec
332
+ - Quality score /20
333
+ - Open issues (P1-P3)
334
+ - Files created/modified
335
+ 4. **Reports** to the user with the complete results
336
+
337
+ ## Notes
338
+
339
+ - **Empty mockup guard:** If no mockup provided, Phase 1 focuses on recommendation rather than extraction
340
+ - **Skip guard:** If Phase 2 finds no violations, report clean and proceed to Phase 3
341
+ - **Parallel safety:** Phase 5 groups must have no shared files; if conflicts detected, fall back to sequential
342
+ - **Score gate:** Quality score < 12/20 triggers re-hardening (Phase 6) before final synthesis
343
+ - All phases use project's design tokens and conventions as established in Phase 1
@@ -69,7 +69,7 @@ Score-gated, review-driven feedback loop for high-risk features. Runs iterative
69
69
  "findings": [
70
70
  { "severity": "critical", "file": "src/auth.ts:42", "finding": "...", "suggestion": "..." }
71
71
  ],
72
- "suggested_action": "fix" | "ask_user" | "proceed"
72
+ "suggested_action": "fix" | "ask_user_question" | "proceed"
73
73
  }
74
74
  ```
75
75
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minhduydev/mdpi",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "CLI to scaffold and manage a Pi coding-agent kit (.pi/) in any repo",
5
5
  "keywords": [
6
6
  "pi",