@zigrivers/scaffold 2.1.1 → 2.28.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.
Files changed (100) hide show
  1. package/README.md +272 -59
  2. package/dist/project/frontmatter.d.ts.map +1 -1
  3. package/dist/project/frontmatter.js +4 -0
  4. package/dist/project/frontmatter.js.map +1 -1
  5. package/knowledge/core/adr-craft.md +53 -0
  6. package/knowledge/core/ai-memory-management.md +246 -0
  7. package/knowledge/core/api-design.md +4 -0
  8. package/knowledge/core/claude-md-patterns.md +254 -0
  9. package/knowledge/core/coding-conventions.md +246 -0
  10. package/knowledge/core/database-design.md +4 -0
  11. package/knowledge/core/design-system-tokens.md +465 -0
  12. package/knowledge/core/dev-environment.md +223 -0
  13. package/knowledge/core/domain-modeling.md +4 -0
  14. package/knowledge/core/eval-craft.md +1008 -0
  15. package/knowledge/core/multi-model-review-dispatch.md +250 -0
  16. package/knowledge/core/operations-runbook.md +37 -226
  17. package/knowledge/core/project-structure-patterns.md +231 -0
  18. package/knowledge/core/review-step-template.md +247 -0
  19. package/knowledge/core/{security-review.md → security-best-practices.md} +5 -1
  20. package/knowledge/core/task-decomposition.md +57 -34
  21. package/knowledge/core/task-tracking.md +225 -0
  22. package/knowledge/core/tech-stack-selection.md +214 -0
  23. package/knowledge/core/testing-strategy.md +63 -70
  24. package/knowledge/core/user-stories.md +69 -60
  25. package/knowledge/core/user-story-innovation.md +57 -0
  26. package/knowledge/core/ux-specification.md +5 -148
  27. package/knowledge/finalization/apply-fixes-and-freeze.md +165 -14
  28. package/knowledge/product/prd-craft.md +55 -34
  29. package/knowledge/review/review-adr.md +32 -0
  30. package/knowledge/review/{review-api-contracts.md → review-api-design.md} +34 -1
  31. package/knowledge/review/{review-database-schema.md → review-database-design.md} +27 -1
  32. package/knowledge/review/review-domain-modeling.md +33 -0
  33. package/knowledge/review/review-implementation-tasks.md +50 -0
  34. package/knowledge/review/review-operations.md +55 -0
  35. package/knowledge/review/review-prd.md +33 -0
  36. package/knowledge/review/review-security.md +53 -0
  37. package/knowledge/review/review-system-architecture.md +28 -0
  38. package/knowledge/review/review-testing-strategy.md +51 -0
  39. package/knowledge/review/review-user-stories.md +54 -0
  40. package/knowledge/review/{review-ux-spec.md → review-ux-specification.md} +37 -1
  41. package/methodology/custom-defaults.yml +32 -3
  42. package/methodology/deep.yml +32 -3
  43. package/methodology/mvp.yml +32 -3
  44. package/package.json +2 -1
  45. package/pipeline/architecture/review-architecture.md +18 -6
  46. package/pipeline/architecture/system-architecture.md +14 -2
  47. package/pipeline/consolidation/claude-md-optimization.md +73 -0
  48. package/pipeline/consolidation/workflow-audit.md +73 -0
  49. package/pipeline/decisions/adrs.md +14 -2
  50. package/pipeline/decisions/review-adrs.md +18 -5
  51. package/pipeline/environment/ai-memory-setup.md +70 -0
  52. package/pipeline/environment/automated-pr-review.md +70 -0
  53. package/pipeline/environment/design-system.md +73 -0
  54. package/pipeline/environment/dev-env-setup.md +65 -0
  55. package/pipeline/environment/git-workflow.md +71 -0
  56. package/pipeline/finalization/apply-fixes-and-freeze.md +1 -1
  57. package/pipeline/finalization/developer-onboarding-guide.md +1 -1
  58. package/pipeline/finalization/implementation-playbook.md +3 -3
  59. package/pipeline/foundation/beads.md +68 -0
  60. package/pipeline/foundation/coding-standards.md +68 -0
  61. package/pipeline/foundation/project-structure.md +69 -0
  62. package/pipeline/foundation/tdd.md +60 -0
  63. package/pipeline/foundation/tech-stack.md +74 -0
  64. package/pipeline/integration/add-e2e-testing.md +65 -0
  65. package/pipeline/modeling/domain-modeling.md +14 -2
  66. package/pipeline/modeling/review-domain-modeling.md +18 -5
  67. package/pipeline/parity/platform-parity-review.md +70 -0
  68. package/pipeline/planning/implementation-plan-review.md +56 -0
  69. package/pipeline/planning/{implementation-tasks.md → implementation-plan.md} +29 -9
  70. package/pipeline/pre/create-prd.md +13 -4
  71. package/pipeline/pre/innovate-prd.md +37 -8
  72. package/pipeline/pre/innovate-user-stories.md +38 -7
  73. package/pipeline/pre/review-prd.md +18 -6
  74. package/pipeline/pre/review-user-stories.md +23 -6
  75. package/pipeline/pre/user-stories.md +12 -2
  76. package/pipeline/quality/create-evals.md +102 -0
  77. package/pipeline/quality/operations.md +38 -13
  78. package/pipeline/quality/review-operations.md +17 -5
  79. package/pipeline/quality/review-security.md +17 -5
  80. package/pipeline/quality/review-testing.md +20 -8
  81. package/pipeline/quality/security.md +25 -3
  82. package/pipeline/quality/story-tests.md +73 -0
  83. package/pipeline/specification/api-contracts.md +17 -2
  84. package/pipeline/specification/database-schema.md +17 -2
  85. package/pipeline/specification/review-api.md +18 -6
  86. package/pipeline/specification/review-database.md +18 -6
  87. package/pipeline/specification/review-ux.md +19 -7
  88. package/pipeline/specification/ux-spec.md +29 -10
  89. package/pipeline/validation/critical-path-walkthrough.md +34 -7
  90. package/pipeline/validation/cross-phase-consistency.md +34 -7
  91. package/pipeline/validation/decision-completeness.md +34 -7
  92. package/pipeline/validation/dependency-graph-validation.md +34 -7
  93. package/pipeline/validation/implementability-dry-run.md +34 -7
  94. package/pipeline/validation/scope-creep-check.md +34 -7
  95. package/pipeline/validation/traceability-matrix.md +34 -7
  96. package/skills/multi-model-dispatch/SKILL.md +326 -0
  97. package/skills/scaffold-pipeline/SKILL.md +195 -0
  98. package/skills/scaffold-runner/SKILL.md +465 -0
  99. package/pipeline/planning/review-tasks.md +0 -38
  100. package/pipeline/quality/testing-strategy.md +0 -42
@@ -0,0 +1,465 @@
1
+ ---
2
+ name: design-system-tokens
3
+ description: Design token definitions, base component visual specs, dark mode patterns, and pattern library for building consistent UIs
4
+ topics: [design-system, tokens, colors, typography, spacing, components, dark-mode, pattern-library]
5
+ ---
6
+
7
+ ## Design Tokens
8
+
9
+ Design tokens are the atomic values that define the visual language. They are variables, not hard-coded values. Every visual property in the application references a token.
10
+
11
+ ### Color Tokens
12
+
13
+ **Brand colors:**
14
+
15
+ ```
16
+ --color-primary: #2563EB // Main brand/action color
17
+ --color-primary-hover: #1D4ED8 // Interactive state
18
+ --color-primary-active: #1E40AF // Pressed/active state
19
+ --color-primary-light: #DBEAFE // Backgrounds, subtle highlights
20
+ --color-primary-lighter: #EFF6FF // Very subtle tints
21
+
22
+ --color-secondary: #7C3AED // Supporting brand color
23
+ --color-secondary-hover: #6D28D9 // Interactive state
24
+ --color-secondary-light: #EDE9FE // Backgrounds
25
+ ```
26
+
27
+ **Neutral scale:**
28
+
29
+ ```
30
+ --color-neutral-50: #FAFAFA // Lightest background
31
+ --color-neutral-100: #F5F5F5 // Card backgrounds, zebra stripes
32
+ --color-neutral-200: #E5E5E5 // Borders, dividers
33
+ --color-neutral-300: #D4D4D4 // Disabled borders
34
+ --color-neutral-400: #A3A3A3 // Muted text, placeholders, disabled text
35
+ --color-neutral-500: #737373 // Secondary icons
36
+ --color-neutral-600: #525252 // Tertiary text
37
+ --color-neutral-700: #404040 // Secondary text
38
+ --color-neutral-800: #262626 // Dark backgrounds (dark mode cards)
39
+ --color-neutral-900: #171717 // Primary text, dark mode page background
40
+ ```
41
+
42
+ **Semantic colors:**
43
+
44
+ ```
45
+ --color-success: #16A34A // Success states, positive actions
46
+ --color-success-light: #DCFCE7 // Success backgrounds
47
+ --color-success-dark: #15803D // Success text on light backgrounds
48
+
49
+ --color-warning: #CA8A04 // Warning states, caution
50
+ --color-warning-light: #FEF9C3 // Warning backgrounds
51
+ --color-warning-dark: #A16207 // Warning text on light backgrounds
52
+
53
+ --color-error: #DC2626 // Error states, destructive actions
54
+ --color-error-light: #FEE2E2 // Error backgrounds
55
+ --color-error-dark: #B91C1C // Error text on light backgrounds
56
+
57
+ --color-info: #2563EB // Informational states
58
+ --color-info-light: #DBEAFE // Info backgrounds
59
+ ```
60
+
61
+ **Surface and overlay:**
62
+
63
+ ```
64
+ --color-surface: #FFFFFF // Card/panel surfaces
65
+ --color-overlay: rgba(0,0,0,0.5) // Modal/dialog backdrop
66
+ --color-focus-ring: rgba(37,99,235,0.5) // Focus indicator
67
+ ```
68
+
69
+ ### Typography Tokens
70
+
71
+ **Font families:**
72
+
73
+ ```
74
+ --font-family: 'Inter', system-ui, -apple-system, sans-serif
75
+ --font-family-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace
76
+ ```
77
+
78
+ **Font sizes (modular scale):**
79
+
80
+ ```
81
+ --text-xs: 0.75rem // 12px — fine print, labels, badges
82
+ --text-sm: 0.875rem // 14px — secondary text, table cells, help text
83
+ --text-base: 1rem // 16px — body text (default)
84
+ --text-lg: 1.125rem // 18px — subheadings, emphasis
85
+ --text-xl: 1.25rem // 20px — section titles
86
+ --text-2xl: 1.5rem // 24px — page titles
87
+ --text-3xl: 1.875rem // 30px — hero text, major headings
88
+ --text-4xl: 2.25rem // 36px — display headings (marketing, landing)
89
+ ```
90
+
91
+ **Font weights:**
92
+
93
+ ```
94
+ --font-weight-normal: 400 // Body text
95
+ --font-weight-medium: 500 // Buttons, labels, navigation
96
+ --font-weight-semibold: 600 // Subheadings, emphasis
97
+ --font-weight-bold: 700 // Headings, strong emphasis
98
+ ```
99
+
100
+ **Line heights:**
101
+
102
+ ```
103
+ --line-height-tight: 1.25 // Headings, single-line labels
104
+ --line-height-normal: 1.5 // Body text (default)
105
+ --line-height-relaxed: 1.75 // Long-form content, help text
106
+ ```
107
+
108
+ **Letter spacing:**
109
+
110
+ ```
111
+ --tracking-tight: -0.025em // Large headings
112
+ --tracking-normal: 0 // Body text
113
+ --tracking-wide: 0.025em // Uppercase labels, small caps
114
+ ```
115
+
116
+ ### Spacing Tokens
117
+
118
+ Based on a 4px base unit. Every spacing value in the application uses one of these tokens -- no arbitrary pixel values.
119
+
120
+ ```
121
+ --space-0: 0 // 0px — no spacing
122
+ --space-0.5: 0.125rem // 2px — hairline gaps
123
+ --space-1: 0.25rem // 4px — tight gaps (icon to label)
124
+ --space-1.5: 0.375rem // 6px — compact inline spacing
125
+ --space-2: 0.5rem // 8px — compact spacing (list items, badge padding)
126
+ --space-3: 0.75rem // 12px — default padding (buttons, inputs)
127
+ --space-4: 1rem // 16px — standard spacing (form fields, card padding)
128
+ --space-5: 1.25rem // 20px — medium gaps
129
+ --space-6: 1.5rem // 24px — section padding
130
+ --space-8: 2rem // 32px — large gaps (section spacing)
131
+ --space-10: 2.5rem // 40px — major section gaps
132
+ --space-12: 3rem // 48px — section separators
133
+ --space-16: 4rem // 64px — page-level spacing
134
+ --space-20: 5rem // 80px — hero section padding
135
+ --space-24: 6rem // 96px — page-level vertical rhythm
136
+ ```
137
+
138
+ ### Border and Shadow Tokens
139
+
140
+ **Border radii:**
141
+
142
+ ```
143
+ --radius-none: 0 // Sharp corners
144
+ --radius-sm: 0.25rem // 4px — subtle rounding (tags, badges)
145
+ --radius-md: 0.5rem // 8px — standard rounding (cards, inputs, buttons)
146
+ --radius-lg: 0.75rem // 12px — prominent rounding (modals, panels)
147
+ --radius-xl: 1rem // 16px — large containers, hero cards
148
+ --radius-full: 9999px // Pill shapes, avatars, toggles
149
+ ```
150
+
151
+ **Elevation (box shadows):**
152
+
153
+ ```
154
+ --shadow-sm: 0 1px 2px rgba(0,0,0,0.05) // Subtle lift (buttons, badges)
155
+ --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05) // Cards, dropdowns
156
+ --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.05) // Popovers, floating elements
157
+ --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.04) // Modals, dialogs
158
+ --shadow-inner: inset 0 2px 4px rgba(0,0,0,0.05) // Pressed states, input wells
159
+ ```
160
+
161
+ **Border widths:**
162
+
163
+ ```
164
+ --border-width-thin: 1px // Default borders (inputs, cards, dividers)
165
+ --border-width-medium: 2px // Focus rings, active tab indicators
166
+ --border-width-thick: 4px // Left-border accents on alerts
167
+ ```
168
+
169
+ ### Transition Tokens
170
+
171
+ ```
172
+ --transition-fast: 150ms ease // Hover states, color changes
173
+ --transition-base: 200ms ease // Most interactions
174
+ --transition-slow: 300ms ease // Layout shifts, modals appearing
175
+ --transition-spring: 300ms cubic-bezier(0.34, 1.56, 0.64, 1) // Playful bounces (optional)
176
+ ```
177
+
178
+ ## Dark Mode
179
+
180
+ When dark mode is required, define a parallel set of semantic tokens that switch based on the color scheme. Components reference semantic tokens, never raw color tokens directly.
181
+
182
+ ### Semantic Token Mapping
183
+
184
+ ```css
185
+ :root {
186
+ /* Surfaces */
187
+ --bg-primary: var(--color-neutral-50);
188
+ --bg-secondary: var(--color-neutral-100);
189
+ --bg-card: white;
190
+ --bg-input: white;
191
+ --bg-overlay: rgba(0, 0, 0, 0.5);
192
+
193
+ /* Text */
194
+ --text-primary: var(--color-neutral-900);
195
+ --text-secondary: var(--color-neutral-700);
196
+ --text-muted: var(--color-neutral-400);
197
+ --text-inverse: white;
198
+
199
+ /* Borders */
200
+ --border-default: var(--color-neutral-200);
201
+ --border-strong: var(--color-neutral-300);
202
+ --border-focus: var(--color-primary);
203
+
204
+ /* Shadows */
205
+ --shadow-color: rgba(0, 0, 0, 0.1);
206
+ }
207
+
208
+ @media (prefers-color-scheme: dark) {
209
+ :root {
210
+ /* Surfaces */
211
+ --bg-primary: var(--color-neutral-900);
212
+ --bg-secondary: #1a1a1a;
213
+ --bg-card: var(--color-neutral-800);
214
+ --bg-input: var(--color-neutral-800);
215
+ --bg-overlay: rgba(0, 0, 0, 0.7);
216
+
217
+ /* Text */
218
+ --text-primary: var(--color-neutral-50);
219
+ --text-secondary: var(--color-neutral-400);
220
+ --text-muted: var(--color-neutral-500);
221
+ --text-inverse: var(--color-neutral-900);
222
+
223
+ /* Borders */
224
+ --border-default: var(--color-neutral-700);
225
+ --border-strong: var(--color-neutral-600);
226
+ --border-focus: #60A5FA;
227
+
228
+ /* Shadows — reduced in dark mode, use border emphasis instead */
229
+ --shadow-color: rgba(0, 0, 0, 0.3);
230
+ }
231
+ }
232
+ ```
233
+
234
+ ### Dark Mode Implementation Rules
235
+
236
+ - **Always use semantic tokens** (`--bg-primary`, `--text-primary`) in components, never raw color tokens (`--color-neutral-900`). This makes dark mode automatic.
237
+ - **Test both modes**: Every visual change must be verified in both light and dark mode.
238
+ - **Avoid pure black backgrounds**: Use `--color-neutral-900` (#171717) instead of `#000000` -- pure black creates harsh contrast and eye strain.
239
+ - **Reduce shadow prominence in dark mode**: Shadows are less visible on dark backgrounds. Use border emphasis or subtle glow effects instead.
240
+ - **Adjust semantic color intensity**: Success, warning, and error colors may need lighter variants in dark mode for readability on dark surfaces.
241
+ - **Images and illustrations**: Consider providing dark-mode-optimized versions or applying CSS filters (e.g., `brightness(0.9)`) to prevent overly bright images on dark backgrounds.
242
+
243
+ ## Responsive Breakpoints
244
+
245
+ Define breakpoints as min-width values for mobile-first responsive design:
246
+
247
+ ```
248
+ --breakpoint-sm: 640px // Small devices (landscape phones)
249
+ --breakpoint-md: 768px // Tablets
250
+ --breakpoint-lg: 1024px // Laptops, small desktops
251
+ --breakpoint-xl: 1280px // Large desktops
252
+ --breakpoint-2xl: 1536px // Extra-large screens
253
+ ```
254
+
255
+ ### Breakpoint Usage
256
+
257
+ ```css
258
+ /* Mobile-first: base styles apply to all sizes */
259
+ .container { padding: var(--space-4); }
260
+
261
+ /* Tablet and up */
262
+ @media (min-width: 768px) {
263
+ .container { padding: var(--space-6); max-width: 768px; }
264
+ }
265
+
266
+ /* Desktop and up */
267
+ @media (min-width: 1024px) {
268
+ .container { padding: var(--space-8); max-width: 1024px; }
269
+ }
270
+
271
+ /* Large desktop */
272
+ @media (min-width: 1280px) {
273
+ .container { max-width: 1200px; }
274
+ }
275
+ ```
276
+
277
+ ### Responsive Patterns
278
+
279
+ - **Stack to grid**: Single-column on mobile, multi-column on desktop
280
+ - **Navigation collapse**: Full nav on desktop, hamburger menu below `--breakpoint-md`
281
+ - **Table adaptation**: Full table on desktop, card layout below `--breakpoint-md`
282
+ - **Touch targets**: Minimum 44x44px on touch devices (below `--breakpoint-lg`)
283
+ - **Font scaling**: Base size stays at 16px; heading sizes may reduce on mobile
284
+
285
+ ## Accessibility Requirements
286
+
287
+ ### Color Contrast
288
+
289
+ All text must meet WCAG 2.1 AA contrast requirements:
290
+ - **Normal text (< 18px)**: minimum 4.5:1 contrast ratio against background
291
+ - **Large text (>= 18px bold or >= 24px)**: minimum 3:1 contrast ratio
292
+ - **UI components and graphical objects**: minimum 3:1 against adjacent colors
293
+ - **Focus indicators**: must have 3:1 contrast against both the component and the background
294
+
295
+ ### Focus Indicators
296
+
297
+ Every interactive element must have a visible focus indicator:
298
+
299
+ ```css
300
+ :focus-visible {
301
+ outline: var(--border-width-medium) solid var(--border-focus);
302
+ outline-offset: 2px;
303
+ }
304
+ ```
305
+
306
+ - Do not remove focus outlines (`outline: none`) without providing an alternative
307
+ - Use `:focus-visible` (not `:focus`) to show focus rings only for keyboard navigation
308
+ - Focus ring must be visible in both light and dark mode
309
+
310
+ ### Touch Targets
311
+
312
+ - Minimum interactive element size: 44x44 CSS pixels (WCAG 2.5.5 Target Size)
313
+ - Minimum spacing between adjacent touch targets: 8px
314
+ - Clickable area may be larger than the visual element (use padding, not just visual size)
315
+
316
+ ### Motion and Animation
317
+
318
+ - Respect `prefers-reduced-motion`: disable non-essential animations
319
+ - Essential animations (loading spinners) should still play but with reduced motion
320
+ - Auto-playing animations should have a pause mechanism
321
+
322
+ ```css
323
+ @media (prefers-reduced-motion: reduce) {
324
+ *, *::before, *::after {
325
+ animation-duration: 0.01ms !important;
326
+ transition-duration: 0.01ms !important;
327
+ }
328
+ }
329
+ ```
330
+
331
+ ## Base Components
332
+
333
+ Define the standard appearance and behavior for every common component:
334
+
335
+ ### Buttons
336
+
337
+ **Variants:**
338
+ - **Primary**: Solid fill (`--color-primary` background, white text). Main call-to-action.
339
+ - **Secondary**: Subtle fill (`--color-neutral-100` background, `--text-primary` text). Secondary actions.
340
+ - **Outline**: Border only (`--border-default` border, `--text-primary` text). Tertiary actions.
341
+ - **Ghost**: No background or border. Minimal visual weight. Navigation, icon-only actions.
342
+ - **Destructive**: Red/danger (`--color-error` background, white text). Delete, remove, cancel actions.
343
+
344
+ **Sizes:**
345
+ - **sm**: 28px height, `--text-xs`, `--space-2` horizontal padding
346
+ - **md**: 36px height, `--text-sm`, `--space-3` horizontal padding (default)
347
+ - **lg**: 44px height, `--text-base`, `--space-4` horizontal padding
348
+
349
+ **States:**
350
+ - **Default**: Normal appearance
351
+ - **Hover**: Darker background (e.g., `--color-primary-hover`), cursor pointer
352
+ - **Active**: Even darker background (`--color-primary-active`), slight scale-down
353
+ - **Focused**: Focus ring visible (`--border-focus` outline)
354
+ - **Disabled**: Reduced opacity (0.5), no hover effects, `cursor: not-allowed`
355
+ - **Loading**: Label replaced with spinner, interaction disabled, maintains button width
356
+
357
+ ### Form Elements
358
+
359
+ **Text inputs and textareas:**
360
+ - Border: `--border-default`, `--radius-md`
361
+ - Focus: `--border-focus` with focus ring
362
+ - Error: `--color-error` border + error message below in `--color-error`
363
+ - Disabled: `--color-neutral-100` background, reduced opacity
364
+ - Height: 36px for inputs (matches button md)
365
+
366
+ **Labels:**
367
+ - Always visible (never use placeholder as the only label)
368
+ - Required indicator: asterisk or "(required)" text
369
+ - Associated with input via `for`/`id` or wrapping
370
+
371
+ **Help text:**
372
+ - Below input, `--text-xs`, `--text-muted` color
373
+ - Explains format expectations (e.g., "Must be at least 8 characters")
374
+
375
+ **Error messages:**
376
+ - Below input, `--text-xs`, `--color-error`
377
+ - Describes what went wrong and how to fix it (not just "Invalid")
378
+ - Replaces help text when error is active
379
+
380
+ **Select inputs and dropdowns:**
381
+ - Same dimensions and borders as text inputs
382
+ - Chevron indicator aligned right
383
+ - Option list uses `--shadow-lg` elevation
384
+
385
+ **Checkboxes and radio buttons:**
386
+ - Minimum 20x20px visual size, 44x44px touch target
387
+ - Checked state uses `--color-primary`
388
+ - Labels always to the right, clickable
389
+
390
+ ### Cards
391
+
392
+ - Background: `--bg-card`
393
+ - Border: `--border-default` or `--shadow-sm`
394
+ - Padding: `--space-4` to `--space-6`
395
+ - Border radius: `--radius-md`
396
+ - **Interactive cards**: hover state increases shadow (`--shadow-md`), cursor pointer
397
+ - **Header/footer sections**: separated by `--border-default` divider, visually distinct padding
398
+
399
+ ### Feedback Components
400
+
401
+ **Toast notifications:**
402
+ - Temporary, non-blocking, positioned top-right or bottom-center
403
+ - Auto-dismiss after 5 seconds with manual dismiss (X button)
404
+ - Variants: success (green), error (red), warning (yellow), info (blue)
405
+ - Includes icon + message + optional action link
406
+
407
+ **Alert banners:**
408
+ - Persistent until explicitly dismissed
409
+ - Full-width or contained within a section
410
+ - Left border accent (`--border-width-thick`) with semantic color
411
+ - Variants: info, warning, error, success
412
+
413
+ **Empty states:**
414
+ - Centered illustration or icon
415
+ - Explanatory heading and description text
416
+ - Call-to-action button ("Create your first [item]")
417
+ - Uses `--text-muted` for description
418
+
419
+ **Loading states:**
420
+ - **Skeleton loaders** (preferred for content areas): animated placeholder shapes matching content layout
421
+ - **Spinners** (for actions): 20px for inline, 32px for section, 48px for page-level
422
+ - **Progress bars** (for known-duration operations): determinate with percentage
423
+
424
+ ### Navigation
425
+
426
+ - **Header/navbar**: fixed or sticky, `--shadow-sm` or border-bottom, contains logo + primary nav + user menu
427
+ - **Sidebar**: collapsible on desktop, overlay on mobile, active item highlighted with `--color-primary-light` background
428
+ - **Breadcrumbs**: `--text-sm`, separator chevrons, current page not linked
429
+ - **Tabs**: underline style (active tab has `--color-primary` bottom border, `--border-width-medium`), equal or auto width
430
+ - **Pagination**: prev/next buttons + page numbers, disabled state for first/last, compact mode on mobile (prev/next only)
431
+
432
+ ### Data Display
433
+
434
+ - **Tables**: header row with `--bg-secondary` background, row hover state, sortable column headers with indicator icon, responsive (horizontal scroll or card layout on mobile)
435
+ - **Lists**: consistent item height and spacing (`--space-2` to `--space-3` between items), interactive items have hover state
436
+ - **Badges/tags**: `--radius-full`, `--text-xs`, `--space-1` vertical / `--space-2` horizontal padding, semantic color variants
437
+ - **Avatars**: `--radius-full`, sizes 24/32/40px, fallback shows initials on `--color-primary-light` background
438
+ - **Stats/metrics**: large value (`--text-2xl`, `--font-weight-bold`), label below (`--text-sm`, `--text-secondary`), optional trend indicator (up/down arrow with green/red)
439
+
440
+ ## Pattern Library
441
+
442
+ Document recurring UI patterns with implementation guidance:
443
+
444
+ - **Search with autocomplete**: Debounced input (300ms), dropdown results panel with `--shadow-lg`, keyboard navigation (arrow keys + Enter), "no results" state with suggestion, clear button (X) when input has value
445
+ - **Confirmation dialogs**: Modal with overlay, clearly states what will happen ("Delete 3 items? This cannot be undone."), "Cancel" as default/primary action (preventing accidents), destructive action in `--color-error`
446
+ - **Inline editing**: Click to edit transforms display text into input, Enter to save, Escape to cancel, loading indicator during save, validation feedback
447
+ - **Bulk actions**: Checkbox selection, "Select all" header checkbox, floating action toolbar appears when items selected, count indicator ("3 selected")
448
+ - **Wizard/stepper**: Numbered step indicator, completed steps show checkmark, back/next navigation, save progress between steps, summary step before final submit
449
+ - **Infinite scroll vs. pagination**: Use pagination for data tables and search results (users need to reference positions). Use infinite scroll for feeds and timelines (users scan sequentially).
450
+
451
+ ## Common Pitfalls
452
+
453
+ **Inconsistent spacing and typography.** Five different font sizes that are all "kind of like body text." Spacing that varies randomly between 12px and 17px with no system. Fix: define a spacing scale and type scale in the design system. Only use values from the scale.
454
+
455
+ **Hard-coded color values in components.** Using `#2563EB` directly in a component instead of `var(--color-primary)`. When the brand color changes, you must find-and-replace across the entire codebase. Fix: always reference tokens. Lint for hard-coded color/size values.
456
+
457
+ **Placeholder text as labels.** Using placeholder text instead of labels for form fields. Placeholders disappear when the user starts typing, leaving them with no indication of what the field expects. Fix: always use visible labels. Placeholders are supplementary hints, not replacements for labels.
458
+
459
+ **Ignoring touch targets on mobile.** Tiny links and buttons that require precise finger tapping. Fix: ensure all interactive elements meet minimum 44x44px touch target size on mobile.
460
+
461
+ **Dark mode as an afterthought.** Building the entire UI with hard-coded light colors, then trying to add dark mode later. Fix: use semantic tokens from day one. The cost is near-zero upfront and saves a complete restyle later.
462
+
463
+ **Missing reduced-motion support.** Animations that cause discomfort for users with vestibular disorders. Fix: always wrap non-essential animations in a `prefers-reduced-motion` check.
464
+
465
+ **Inconsistent elevation hierarchy.** A card inside a modal has a higher shadow than the modal itself, breaking the visual stacking order. Fix: define an elevation scale (sm < md < lg < xl) and assign levels consistently: page content (none), cards (sm), dropdowns (lg), modals (xl).
@@ -0,0 +1,223 @@
1
+ ---
2
+ name: dev-environment
3
+ description: Development environment setup patterns including Makefile conventions, live reload, and toolchain configuration
4
+ topics: [dev-environment, makefile, live-reload, env-files, toolchain, ci, git-hooks, scripts]
5
+ ---
6
+
7
+ # Dev Environment
8
+
9
+ A development environment should be reproducible, fast, and invisible. "It works on my machine" is a build system failure, not a developer excuse. This knowledge covers task runners, environment management, git hooks, CI integration, and toolchain patterns that make environments reliable across machines and team members.
10
+
11
+ ## Summary
12
+
13
+ ### Core Components
14
+
15
+ Every project needs four environment pillars:
16
+
17
+ 1. **Build Tool / Task Runner** — A single entry point for all project tasks. Makefile is the universal choice (works everywhere, zero dependencies). Language-specific alternatives: `package.json` scripts, `pyproject.toml`, `go` tool.
18
+ 2. **Environment Management** — `.env` files for local config, `.env.example` committed as documentation, validation at startup, sensible development defaults.
19
+ 3. **Git Hooks** — Pre-commit (fast checks: lint, format, type check). Pre-push (slower checks: full test suite). Installed by `make hooks`.
20
+ 4. **CI/CD Integration** — CI runs the same commands as local development. `make check` in CI, `make check` locally. No divergent CI-specific scripts.
21
+
22
+ ### Makefile as Universal Task Runner
23
+
24
+ Makefile provides: discoverable interface (`make help`), dependency management between targets, idempotent execution, parallel execution (`make -j4`), and universal availability on any Unix system with zero installation. Language-specific task runners complement but do not replace it — `make test` calls `npm test` or `pytest`, keeping the stable interface independent of underlying tools. If the underlying tool changes (e.g., Jest to Vitest), only the Makefile target body changes — not CI or documentation.
25
+
26
+ ### The Setup Contract
27
+
28
+ New developer from clone to green tests in three commands or fewer:
29
+ ```bash
30
+ git clone <repo>
31
+ make setup # Install dependencies, tools, hooks
32
+ make check # Verify everything works
33
+ ```
34
+
35
+ ### Branching Strategy Summary
36
+
37
+ **Trunk-Based**: All commits to main, feature flags for incomplete work. For small teams with strong tests and continuous deployment. **GitHub Flow**: Feature branches, PR review, squash merge. Best for most teams — simple and structured. **GitFlow**: Separate develop/release/hotfix branches. Only for scheduled releases or multi-version support. Most web apps do not need it.
38
+
39
+ ## Deep Guidance
40
+
41
+ ### Makefile Patterns
42
+
43
+ #### The Help Target
44
+
45
+ Every Makefile starts with self-documentation:
46
+
47
+ ```makefile
48
+ .DEFAULT_GOAL := help
49
+
50
+ .PHONY: help
51
+ help: ## Show available commands
52
+ @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
53
+ awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}'
54
+ ```
55
+
56
+ Every public target gets a `## Description` comment. Internal targets use `_` prefix and no description.
57
+
58
+ #### Standard Target Set
59
+
60
+ ```makefile
61
+ .PHONY: test lint format check setup clean hooks
62
+
63
+ test: ## Run test suite
64
+ npm test
65
+
66
+ lint: ## Run linters
67
+ npm run lint
68
+
69
+ format: ## Format code
70
+ npm run format
71
+
72
+ check: lint test ## Run all quality gates
73
+
74
+ setup: ## Install dependencies and hooks
75
+ npm install
76
+ $(MAKE) hooks
77
+
78
+ clean: ## Remove build artifacts
79
+ rm -rf dist/ node_modules/.cache/
80
+
81
+ hooks: ## Install git hooks
82
+ @mkdir -p .git/hooks
83
+ @cp scripts/pre-commit.sh .git/hooks/pre-commit
84
+ @cp scripts/pre-push.sh .git/hooks/pre-push
85
+ @chmod +x .git/hooks/pre-commit .git/hooks/pre-push
86
+ ```
87
+
88
+ #### Dependency Chains and Parallel Execution
89
+
90
+ Targets depend on other targets: `deploy: check build` runs lint, test, and build before deploying. For CI, parallelize independent targets: `$(MAKE) -j2 lint test`.
91
+
92
+ #### Variables and Platform Compatibility
93
+
94
+ Use `?=` for overridable variables: `TEST_FLAGS ?=` lets users run `make test TEST_FLAGS="--watch"`. Detect OS for platform-specific commands with `UNAME := $(shell uname -s)` and conditional blocks.
95
+
96
+ ### Environment Variable Management
97
+
98
+ #### The .env Pattern
99
+
100
+ ```
101
+ .env.example # Committed — documents all variables with safe placeholders
102
+ .env # Gitignored — local overrides
103
+ .env.test # Gitignored — test environment
104
+ .env.production # Never on disk — injected by deployment platform
105
+ ```
106
+
107
+ `.env.example` is documentation: every variable listed with explanatory comments and placeholder values.
108
+
109
+ #### Startup Validation
110
+
111
+ Validate all environment variables at startup, not at point of use. Fail fast with clear messages:
112
+
113
+ ```typescript
114
+ // src/config/env.ts — centralized env access
115
+ function requireEnv(key: string): string {
116
+ const value = process.env[key];
117
+ if (!value) throw new Error(`Missing required env var: ${key}`);
118
+ return value;
119
+ }
120
+
121
+ export const config = {
122
+ database: { url: requireEnv('DATABASE_URL') },
123
+ auth: { jwtSecret: requireEnv('JWT_SECRET') },
124
+ } as const;
125
+ ```
126
+
127
+ No `process.env.SOMETHING` scattered throughout the codebase. Python equivalent: use `pydantic_settings.BaseSettings` for typed validation with defaults.
128
+
129
+ ### Live Reload by Stack
130
+
131
+ | Stack | Tool | Command |
132
+ |-------|------|---------|
133
+ | Next.js / Vite | Built-in HMR | `next dev` / `vite dev` |
134
+ | Express/Fastify | tsx watch | `tsx watch src/server.ts` |
135
+ | FastAPI | uvicorn | `uvicorn app:app --reload` |
136
+ | Go | air | `air` |
137
+ | Shell | entr | `ls scripts/*.sh \| entr make test` |
138
+
139
+ For full-stack projects, run frontend and backend in parallel via `make dev` using `$(MAKE) -j2 dev-frontend dev-backend` or a process manager like `concurrently`.
140
+
141
+ ### Git Hook Strategies
142
+
143
+ #### Pre-Commit (Fast, Under 10 Seconds)
144
+
145
+ Check only staged files when possible:
146
+ - Formatting (run formatter check, fail if files would change)
147
+ - Linting (staged files only via `lint-staged`)
148
+ - Secrets scanning (detect accidentally committed API keys)
149
+ - File size limits (prevent accidental binary commits)
150
+
151
+ #### Pre-Push (Thorough, Under 60 Seconds)
152
+
153
+ Run the full quality gate:
154
+ - Complete test suite
155
+ - Full lint (all files, not just staged)
156
+ - Build verification
157
+
158
+ #### Installation
159
+
160
+ Single command: `make hooks`. Wrap whichever hook manager the project uses (husky, pre-commit, lefthook, or plain shell scripts).
161
+
162
+ ### CI/CD Integration
163
+
164
+ #### The Mirror Principle
165
+
166
+ CI runs `make check` — the exact same command developers run locally. If it passes locally, it passes in CI. No environment-specific surprises.
167
+
168
+ ```yaml
169
+ # .github/workflows/check.yml
170
+ jobs:
171
+ check:
172
+ runs-on: ubuntu-latest
173
+ steps:
174
+ - uses: actions/checkout@v4
175
+ - uses: actions/setup-node@v4
176
+ with: { node-version: 20, cache: npm }
177
+ - run: npm ci
178
+ - run: make check
179
+ ```
180
+
181
+ #### Caching
182
+
183
+ Cache dependencies keyed on lockfile hashes: `node_modules/` on `package-lock.json`, `.venv/` on `pyproject.toml`, `~/go/pkg/mod/` on `go.sum`.
184
+
185
+ #### Job Structure
186
+
187
+ Parallelize independent checks, gate dependent steps:
188
+ ```yaml
189
+ jobs:
190
+ lint: { steps: [checkout, setup, make lint] }
191
+ test: { steps: [checkout, setup, make test] }
192
+ build: { needs: [lint, test], steps: [checkout, setup, make build] }
193
+ ```
194
+
195
+ ### Branching Strategies — When to Use Each
196
+
197
+ #### Trunk-Based Development
198
+
199
+ All developers commit to `main`. Feature flags gate incomplete work. Releases cut directly from `main`. Requires: strong test suite, feature flag infrastructure, team discipline. Best for: small teams (1-5), continuous deployment. Risk: broken commits affect everyone immediately.
200
+
201
+ #### GitHub Flow
202
+
203
+ Feature branches from `main`, PRs with review, squash merge back. `main` is always deployable. Best for: most teams, most projects. Keep branches short (1-3 days), rebase frequently. Risk: long-lived branches diverge.
204
+
205
+ #### GitFlow
206
+
207
+ Separate `develop`, `release/*`, `hotfix/*`, `main` branches. Formalized release process. Best for: scheduled releases (mobile, enterprise), multiple supported versions. Risk: branch complexity, merge conflicts. Most web apps do not need this.
208
+
209
+ ### Common Anti-Patterns
210
+
211
+ **Scripts That Only Work on One OS**: `setup.sh` uses `apt-get`, breaks on macOS. Fix: detect OS and branch, or use devcontainers. Document OS-specific prerequisites.
212
+
213
+ **Missing Setup Documentation**: New developer spends a day figuring out the build. Fix: `make setup` automates everything possible. `docs/dev-setup.md` covers the rest. Test by having a new team member follow it verbatim.
214
+
215
+ **Hardcoded Paths**: Scripts reference `/Users/alice/projects/myapp/`. Fix: use relative paths or compute from `$(pwd)` / `$(dirname "$0")`. Never commit absolute paths.
216
+
217
+ **No Clean Target**: Build artifacts accumulate, stale caches cause mystery failures. Fix: `make clean` removes generated artifacts. `make pristine` removes everything including `node_modules/` for a full reset.
218
+
219
+ **CI Drift**: CI runs different commands than local dev. Fix: CI calls `make check`. If CI needs extras (artifact upload, deploy), those are separate steps after the quality gate. The gate itself is identical everywhere.
220
+
221
+ ## See Also
222
+
223
+ - [ai-memory-management](../core/ai-memory-management.md) — Environment setup affects memory hooks