@champpaba/claude-agent-kit 1.0.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.
Files changed (80) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +561 -0
  3. package/bin/cli.js +61 -0
  4. package/lib/init.js +52 -0
  5. package/lib/update.js +73 -0
  6. package/package.json +47 -0
  7. package/template/.claude/CHANGELOG-v1.1.1.md +259 -0
  8. package/template/.claude/CLAUDE.md +329 -0
  9. package/template/.claude/agents/01-integration.md +797 -0
  10. package/template/.claude/agents/02-uxui-frontend.md +899 -0
  11. package/template/.claude/agents/03-test-debug.md +759 -0
  12. package/template/.claude/agents/04-frontend.md +1099 -0
  13. package/template/.claude/agents/05-backend.md +1217 -0
  14. package/template/.claude/agents/06-database.md +969 -0
  15. package/template/.claude/commands/agentsetup.md +1464 -0
  16. package/template/.claude/commands/cdev.md +327 -0
  17. package/template/.claude/commands/csetup.md +447 -0
  18. package/template/.claude/commands/cstatus.md +60 -0
  19. package/template/.claude/commands/cview.md +364 -0
  20. package/template/.claude/commands/psetup.md +101 -0
  21. package/template/.claude/contexts/design/accessibility.md +611 -0
  22. package/template/.claude/contexts/design/box-thinking.md +553 -0
  23. package/template/.claude/contexts/design/color-theory.md +498 -0
  24. package/template/.claude/contexts/design/index.md +247 -0
  25. package/template/.claude/contexts/design/layout.md +400 -0
  26. package/template/.claude/contexts/design/responsive.md +551 -0
  27. package/template/.claude/contexts/design/shadows.md +522 -0
  28. package/template/.claude/contexts/design/spacing.md +428 -0
  29. package/template/.claude/contexts/design/typography.md +465 -0
  30. package/template/.claude/contexts/domain/README.md +164 -0
  31. package/template/.claude/contexts/patterns/agent-coordination.md +388 -0
  32. package/template/.claude/contexts/patterns/agent-discovery.md +182 -0
  33. package/template/.claude/contexts/patterns/change-workflow.md +538 -0
  34. package/template/.claude/contexts/patterns/code-standards.md +515 -0
  35. package/template/.claude/contexts/patterns/development-principles.md +513 -0
  36. package/template/.claude/contexts/patterns/error-handling.md +478 -0
  37. package/template/.claude/contexts/patterns/error-recovery.md +365 -0
  38. package/template/.claude/contexts/patterns/frontend-component-strategy.md +365 -0
  39. package/template/.claude/contexts/patterns/git-workflow.md +207 -0
  40. package/template/.claude/contexts/patterns/logging.md +424 -0
  41. package/template/.claude/contexts/patterns/task-breakdown.md +452 -0
  42. package/template/.claude/contexts/patterns/task-classification.md +523 -0
  43. package/template/.claude/contexts/patterns/tdd-classification.md +516 -0
  44. package/template/.claude/contexts/patterns/testing.md +413 -0
  45. package/template/.claude/contexts/patterns/ui-component-consistency.md +304 -0
  46. package/template/.claude/contexts/patterns/validation-framework.md +776 -0
  47. package/template/.claude/lib/README.md +39 -0
  48. package/template/.claude/lib/agent-executor.md +258 -0
  49. package/template/.claude/lib/agent-router.md +572 -0
  50. package/template/.claude/lib/flags-updater.md +469 -0
  51. package/template/.claude/lib/tdd-classifier.md +345 -0
  52. package/template/.claude/lib/validation-gates.md +484 -0
  53. package/template/.claude/settings.local.json +42 -0
  54. package/template/.claude/templates/context-template.md +45 -0
  55. package/template/.claude/templates/flags-template.json +42 -0
  56. package/template/.claude/templates/phase-templates.json +124 -0
  57. package/template/.claude/templates/phases-sections/accessibility-test.md +17 -0
  58. package/template/.claude/templates/phases-sections/api-design.md +37 -0
  59. package/template/.claude/templates/phases-sections/backend-tests.md +16 -0
  60. package/template/.claude/templates/phases-sections/backend.md +37 -0
  61. package/template/.claude/templates/phases-sections/business-logic-validation.md +16 -0
  62. package/template/.claude/templates/phases-sections/component-tests.md +17 -0
  63. package/template/.claude/templates/phases-sections/contract-backend.md +16 -0
  64. package/template/.claude/templates/phases-sections/contract-frontend.md +16 -0
  65. package/template/.claude/templates/phases-sections/database.md +35 -0
  66. package/template/.claude/templates/phases-sections/documentation.md +17 -0
  67. package/template/.claude/templates/phases-sections/e2e-tests.md +16 -0
  68. package/template/.claude/templates/phases-sections/fix-implementation.md +17 -0
  69. package/template/.claude/templates/phases-sections/frontend-integration.md +18 -0
  70. package/template/.claude/templates/phases-sections/frontend-mockup.md +123 -0
  71. package/template/.claude/templates/phases-sections/manual-flow-test.md +15 -0
  72. package/template/.claude/templates/phases-sections/manual-ux-test.md +16 -0
  73. package/template/.claude/templates/phases-sections/refactor-implementation.md +17 -0
  74. package/template/.claude/templates/phases-sections/refactor.md +16 -0
  75. package/template/.claude/templates/phases-sections/regression-tests.md +15 -0
  76. package/template/.claude/templates/phases-sections/report.md +16 -0
  77. package/template/.claude/templates/phases-sections/responsive-test.md +16 -0
  78. package/template/.claude/templates/phases-sections/script-implementation.md +43 -0
  79. package/template/.claude/templates/phases-sections/test-coverage.md +16 -0
  80. package/template/.claude/templates/phases-sections/user-approval.md +14 -0
@@ -0,0 +1,247 @@
1
+ # Design System Hub
2
+
3
+ > 🎯 **Purpose**: Design Principal Index - Guide all design decisions with proper context
4
+
5
+ ---
6
+
7
+ ## 🧠 Design Decision Framework
8
+
9
+ **Before ANY design recommendation, ask:**
10
+
11
+ 1. **What type of decision?**
12
+ - Color/Palette
13
+ - Layout/Spacing
14
+ - Depth/Shadows
15
+ - Typography
16
+ - Component Structure
17
+ - Box Relationships
18
+
19
+ 2. **What context?**
20
+ - Project-specific design tokens (see `@/.claude/contexts/domain/[project]/design-tokens.md`)
21
+ - Universal design principles (this directory)
22
+
23
+ 3. **What's the user goal?**
24
+ - Usability (Can users complete tasks easily?)
25
+ - Accessibility (Can ALL users access content?)
26
+ - Aesthetics (Does it look professional and trustworthy?)
27
+
28
+ **Then route to:**
29
+ - **Color** → See `color-theory.md` for harmony, contrast, accessibility
30
+ - **Layout** → See `layout.md` + `box-thinking.md` for structure and flow
31
+ - **Depth** → See `shadows.md` for elevation and layering
32
+ - **Typography** → See `typography.md` for hierarchy and readability
33
+ - **Spacing** → See `spacing.md` for consistent gaps and rhythm
34
+ - **Responsive** → See `responsive.md` for behavior across devices
35
+ - **Accessibility** → See `accessibility.md` for WCAG compliance
36
+
37
+ ---
38
+
39
+ ## 📦 Box Thinking Framework
40
+
41
+ **Core Principle:** Every element is a box. Understand box relationships before writing code.
42
+
43
+ ### Box Analysis Method
44
+
45
+ > "Before building or improving this layout, take a step back and observe **every element on the screen** — navigation, headers, cards, buttons, sidebars, text blocks — everything that occupies space. Imagine **each of them as a box** and describe how they relate to one another: which boxes contain others, how they align, and how space flows between them."
46
+
47
+ ### Box Relationship Patterns
48
+
49
+ - **Container Boxes**: What contains what (hierarchy)
50
+ - **Adjacent Boxes**: Side-by-side relationships
51
+ - **Nested Boxes**: Parent-child relationships
52
+ - **Space Flow**: How space flows between boxes
53
+ - **Alignment Logic**: How boxes position relative to each other
54
+
55
+ ### Box Behavior in Responsive Context
56
+
57
+ > "Now, describe how this layout behaves when the screen or container changes size. Think in terms of movement, proportion, and flow, not pixels. Which sections move above or below others? Which expand, and which step back?"
58
+
59
+ **Box Movement Patterns:**
60
+ - **Stacking**: Horizontal → Vertical arrangement
61
+ - **Merging**: Multiple boxes → Single unified box
62
+ - **Prioritizing**: Important boxes maintain prominence
63
+ - **Compressing**: Boxes shrink but maintain relationships
64
+ - **Reorganizing**: Smart rules for box rearrangement
65
+
66
+ **See `box-thinking.md` for complete framework.**
67
+
68
+ ---
69
+
70
+ ## 🎨 Universal Design Principles
71
+
72
+ ### Color System
73
+
74
+ **60-30-10 Rule** (Industry standard for balanced color distribution)
75
+ - **60% Dominant**: Neutral colors (backgrounds, text) - Creates calm foundation
76
+ - **30% Secondary**: Supporting colors (secondary brand color, muted tones)
77
+ - **10% Accent**: Primary brand color for emphasis (CTAs, highlights)
78
+
79
+ **Color Harmony Types:**
80
+ - **Monochromatic**: Variations of single hue (most harmonious)
81
+ - **Complementary**: Opposite colors on color wheel (high contrast)
82
+ - **Analogous**: Adjacent colors (cohesive, natural)
83
+ - **Triadic**: 3 colors evenly spaced (vibrant, balanced)
84
+
85
+ **Accessibility Requirements:**
86
+ - Text on background: Minimum 4.5:1 contrast (WCAG AA)
87
+ - Large text (18pt+): Minimum 3:1 contrast
88
+ - UI components: Minimum 3:1 contrast
89
+
90
+ **See `color-theory.md` for complete color system.**
91
+
92
+ ---
93
+
94
+ ### Spacing System
95
+
96
+ **Base Unit Approach:**
97
+ ```css
98
+ --spacing: 0.25rem; /* 4px - Base spacing unit */
99
+ ```
100
+
101
+ **Scale (Multiples of base):**
102
+ - `1x` (0.25rem / 4px) - Tiny gaps
103
+ - `2x` (0.5rem / 8px) - Small gaps
104
+ - `3x` (0.75rem / 12px) - Medium gaps
105
+ - `4x` (1rem / 16px) - Default gaps
106
+ - `6x` (1.5rem / 24px) - Large gaps
107
+ - `8x` (2rem / 32px) - XL gaps
108
+ - `12x` (3rem / 48px) - XXL gaps
109
+
110
+ **See `spacing.md` for complete spacing system.**
111
+
112
+ ---
113
+
114
+ ### Shadow System
115
+
116
+ **3-Tier Elevation:**
117
+
118
+ **Level 1: Subtle** (Cards, Inputs)
119
+ ```css
120
+ --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
121
+ ```
122
+
123
+ **Level 2: Medium** (Dropdowns, Modals)
124
+ ```css
125
+ --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1),
126
+ 0 2px 4px -2px rgb(0 0 0 / 0.1);
127
+ ```
128
+
129
+ **Level 3: Large** (Overlays, Popovers)
130
+ ```css
131
+ --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1),
132
+ 0 4px 6px -4px rgb(0 0 0 / 0.1);
133
+ ```
134
+
135
+ **See `shadows.md` for complete shadow system.**
136
+
137
+ ---
138
+
139
+ ### Typography Hierarchy
140
+
141
+ **5-Level System:**
142
+
143
+ 1. **H1** (Display) - 2.5rem (40px) - Hero titles
144
+ 2. **H2** (Headline) - 2rem (32px) - Section titles
145
+ 3. **H3** (Title) - 1.5rem (24px) - Subsection titles
146
+ 4. **Body** (Text) - 1rem (16px) - Paragraphs, content
147
+ 5. **Small** (Caption) - 0.875rem (14px) - Labels, metadata
148
+
149
+ **Line Height Rules:**
150
+ - Headings: 1.2-1.3 (tight for impact)
151
+ - Body text: 1.5-1.6 (comfortable reading)
152
+ - Small text: 1.4-1.5 (legible but compact)
153
+
154
+ **See `typography.md` for complete typography system.**
155
+
156
+ ---
157
+
158
+ ### Responsive Behavior
159
+
160
+ **3-Tier Breakpoint System:**
161
+
162
+ ```css
163
+ /* Mobile-first approach */
164
+ --breakpoint-sm: 640px; /* Tablets */
165
+ --breakpoint-md: 768px; /* Small laptops */
166
+ --breakpoint-lg: 1024px; /* Desktops */
167
+ ```
168
+
169
+ **Layout Flow Rules:**
170
+ - Mobile (< 640px): Stack all boxes vertically
171
+ - Tablet (640-1024px): Partial side-by-side, smart stacking
172
+ - Desktop (> 1024px): Full multi-column layouts
173
+
174
+ **See `responsive.md` for complete responsive patterns.**
175
+
176
+ ---
177
+
178
+ ## 🔍 When to Use Each File
179
+
180
+ | Need | File | Purpose |
181
+ |------|------|---------|
182
+ | Choose colors for new feature | `color-theory.md` | Color harmony, contrast, accessibility |
183
+ | Set spacing between elements | `spacing.md` | Consistent gaps, rhythm, whitespace |
184
+ | Add shadows to cards/modals | `shadows.md` | Elevation, depth, layering |
185
+ | Define text hierarchy | `typography.md` | Font sizes, weights, line heights |
186
+ | Plan component layout | `layout.md` + `box-thinking.md` | Box structure, alignment |
187
+ | Make responsive design | `responsive.md` | Breakpoints, movement patterns |
188
+ | Ensure accessibility | `accessibility.md` | WCAG compliance, keyboard nav |
189
+
190
+ ---
191
+
192
+ ## 🎯 Quick Start Checklist
193
+
194
+ **For every new UI component:**
195
+
196
+ - [ ] **Box Structure** - Identify all boxes and their relationships
197
+ - [ ] **Color** - Apply 60-30-10 rule, check contrast (4.5:1 min)
198
+ - [ ] **Spacing** - Use multiples of base unit (0.25rem)
199
+ - [ ] **Typography** - Follow 5-level hierarchy
200
+ - [ ] **Shadows** - Use 3-tier elevation system
201
+ - [ ] **Responsive** - Test all 3 breakpoints (mobile, tablet, desktop)
202
+ - [ ] **Accessibility** - Keyboard navigation, screen reader support
203
+
204
+ ---
205
+
206
+ ## 📖 Design System Files
207
+
208
+ ```
209
+ design/
210
+ ├── index.md (this file) # Design hub and decision framework
211
+ ├── color-theory.md # Color harmony, contrast, accessibility
212
+ ├── spacing.md # Spacing scale, rhythm, whitespace
213
+ ├── shadows.md # 3-tier shadow system
214
+ ├── typography.md # Font hierarchy, sizes, weights
215
+ ├── layout.md # Layout patterns, alignment
216
+ ├── responsive.md # Breakpoints, responsive behavior
217
+ ├── box-thinking.md # Box analysis framework
218
+ └── accessibility.md # WCAG compliance, a11y patterns
219
+ ```
220
+
221
+ ---
222
+
223
+ ## 🔗 Project-Specific Design
224
+
225
+ **Universal principles (this directory) + Project tokens (domain folder)**
226
+
227
+ **Project design tokens go in:**
228
+ ```
229
+ .claude/contexts/domain/[project-name]/design-tokens.md
230
+ ```
231
+
232
+ **Example:**
233
+ ```css
234
+ /* domain/ecommerce/design-tokens.md */
235
+ --primary: #3B82F6; /* Blue - Trust */
236
+ --secondary: #10B981; /* Green - Success */
237
+ --accent: #F59E0B; /* Amber - Urgency */
238
+ ```
239
+
240
+ **How agents use this:**
241
+ 1. Load universal principles (design/)
242
+ 2. Load project tokens (domain/[project]/)
243
+ 3. Apply principles with project colors
244
+
245
+ ---
246
+
247
+ **💡 Remember: Think in boxes, design with purpose, implement with consistency!**
@@ -0,0 +1,400 @@
1
+ # Layout Patterns
2
+
3
+ > **Purpose:** Common layout structures and alignment strategies
4
+
5
+ ---
6
+
7
+ ## Core Layout Principles
8
+
9
+ 1. **Box Model First** - Understand all elements as boxes (see `box-thinking.md`)
10
+ 2. **Flex for 1D** - Use flexbox for single-axis layouts (rows or columns)
11
+ 3. **Grid for 2D** - Use CSS Grid for multi-axis layouts (rows AND columns)
12
+ 4. **Responsive by Default** - Design mobile-first, enhance for larger screens
13
+
14
+ ---
15
+
16
+ ## Common Layout Patterns
17
+
18
+ ### 1. Stack (Vertical)
19
+
20
+ **Use for:** Form fields, article content, vertical lists
21
+
22
+ ```css
23
+ .stack {
24
+ display: flex;
25
+ flex-direction: column;
26
+ gap: var(--spacing-4); /* 16px */
27
+ }
28
+
29
+ /* Variants */
30
+ .stack-tight {
31
+ gap: var(--spacing-2); /* 8px */
32
+ }
33
+
34
+ .stack-loose {
35
+ gap: var(--spacing-8); /* 32px */
36
+ }
37
+ ```
38
+
39
+ **HTML:**
40
+ ```html
41
+ <div class="stack">
42
+ <div>Item 1</div>
43
+ <div>Item 2</div>
44
+ <div>Item 3</div>
45
+ </div>
46
+ ```
47
+
48
+ ---
49
+
50
+ ### 2. Inline (Horizontal)
51
+
52
+ **Use for:** Button groups, breadcrumbs, navigation
53
+
54
+ ```css
55
+ .inline {
56
+ display: flex;
57
+ flex-direction: row;
58
+ gap: var(--spacing-4); /* 16px */
59
+ align-items: center; /* Vertical centering */
60
+ }
61
+
62
+ /* Variants */
63
+ .inline-start {
64
+ justify-content: flex-start; /* Left-aligned */
65
+ }
66
+
67
+ .inline-center {
68
+ justify-content: center; /* Centered */
69
+ }
70
+
71
+ .inline-end {
72
+ justify-content: flex-end; /* Right-aligned */
73
+ }
74
+
75
+ .inline-between {
76
+ justify-content: space-between; /* Space between items */
77
+ }
78
+ ```
79
+
80
+ ---
81
+
82
+ ### 3. Sidebar Layout
83
+
84
+ **Use for:** Dashboard, admin panels, documentation
85
+
86
+ ```css
87
+ .sidebar-layout {
88
+ display: grid;
89
+ grid-template-columns: 250px 1fr; /* Fixed sidebar + fluid main */
90
+ gap: var(--spacing-6); /* 24px */
91
+ min-height: 100vh;
92
+ }
93
+
94
+ @media (max-width: 768px) {
95
+ .sidebar-layout {
96
+ grid-template-columns: 1fr; /* Stack on mobile */
97
+ }
98
+ }
99
+ ```
100
+
101
+ **HTML:**
102
+ ```html
103
+ <div class="sidebar-layout">
104
+ <aside class="sidebar">Sidebar</aside>
105
+ <main class="main-content">Main Content</main>
106
+ </div>
107
+ ```
108
+
109
+ ---
110
+
111
+ ### 4. Holy Grail Layout
112
+
113
+ **Use for:** Classic web pages (header, sidebar, content, footer)
114
+
115
+ ```css
116
+ .holy-grail {
117
+ display: grid;
118
+ grid-template-areas:
119
+ "header header header"
120
+ "sidebar main aside"
121
+ "footer footer footer";
122
+ grid-template-columns: 200px 1fr 200px;
123
+ grid-template-rows: auto 1fr auto;
124
+ min-height: 100vh;
125
+ gap: var(--spacing-4);
126
+ }
127
+
128
+ .header { grid-area: header; }
129
+ .sidebar { grid-area: sidebar; }
130
+ .main { grid-area: main; }
131
+ .aside { grid-area: aside; }
132
+ .footer { grid-area: footer; }
133
+
134
+ @media (max-width: 1024px) {
135
+ .holy-grail {
136
+ grid-template-areas:
137
+ "header"
138
+ "main"
139
+ "sidebar"
140
+ "aside"
141
+ "footer";
142
+ grid-template-columns: 1fr;
143
+ }
144
+ }
145
+ ```
146
+
147
+ ---
148
+
149
+ ### 5. Card Grid
150
+
151
+ **Use for:** Product listings, portfolios, image galleries
152
+
153
+ ```css
154
+ .card-grid {
155
+ display: grid;
156
+ grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
157
+ gap: var(--spacing-6); /* 24px */
158
+ }
159
+
160
+ /* Auto-fill: Creates as many columns as fit */
161
+ /* minmax(300px, 1fr): Min 300px, max equal width */
162
+ ```
163
+
164
+ **Responsive Behavior:**
165
+ - Mobile: 1 column
166
+ - Tablet: 2 columns
167
+ - Desktop: 3-4 columns (auto-adjusts)
168
+
169
+ ---
170
+
171
+ ### 6. Center Element
172
+
173
+ **Use for:** Modals, empty states, landing hero sections
174
+
175
+ ```css
176
+ /* Flexbox method */
177
+ .center-flex {
178
+ display: flex;
179
+ justify-content: center;
180
+ align-items: center;
181
+ min-height: 100vh;
182
+ }
183
+
184
+ /* Grid method */
185
+ .center-grid {
186
+ display: grid;
187
+ place-items: center; /* Shorthand for center both axes */
188
+ min-height: 100vh;
189
+ }
190
+
191
+ /* Absolute positioning (legacy) */
192
+ .center-absolute {
193
+ position: absolute;
194
+ top: 50%;
195
+ left: 50%;
196
+ transform: translate(-50%, -50%);
197
+ }
198
+ ```
199
+
200
+ ---
201
+
202
+ ### 7. Header with Navigation
203
+
204
+ **Use for:** Site headers, app nav bars
205
+
206
+ ```css
207
+ .header {
208
+ display: flex;
209
+ justify-content: space-between;
210
+ align-items: center;
211
+ padding: var(--spacing-4) var(--spacing-6);
212
+ background: white;
213
+ box-shadow: var(--shadow-sm);
214
+ }
215
+
216
+ .nav {
217
+ display: flex;
218
+ gap: var(--spacing-6);
219
+ }
220
+
221
+ @media (max-width: 768px) {
222
+ .nav {
223
+ display: none; /* Hide on mobile (use hamburger menu) */
224
+ }
225
+ }
226
+ ```
227
+
228
+ ---
229
+
230
+ ### 8. Container (Max-Width)
231
+
232
+ **Use for:** Constraining content width for readability
233
+
234
+ ```css
235
+ .container {
236
+ max-width: 1280px; /* Desktop max width */
237
+ margin-left: auto;
238
+ margin-right: auto;
239
+ padding-left: var(--spacing-6); /* 24px */
240
+ padding-right: var(--spacing-6);
241
+ }
242
+
243
+ /* Variants */
244
+ .container-narrow {
245
+ max-width: 768px; /* Blog posts, forms */
246
+ }
247
+
248
+ .container-wide {
249
+ max-width: 1536px; /* Dashboards, wide layouts */
250
+ }
251
+ ```
252
+
253
+ **Optimal Reading Widths:**
254
+ - Text content: 65-75 characters per line (~768px)
255
+ - Dashboard: 1280-1536px
256
+ - Full-width: No max-width (use sparingly)
257
+
258
+ ---
259
+
260
+ ## Alignment Strategies
261
+
262
+ ### Flexbox Alignment
263
+
264
+ **Main Axis (justify-content):**
265
+ ```css
266
+ .flex-start { justify-content: flex-start; } /* Left/Top */
267
+ .flex-center { justify-content: center; } /* Center */
268
+ .flex-end { justify-content: flex-end; } /* Right/Bottom */
269
+ .flex-between { justify-content: space-between; } /* Space between */
270
+ .flex-around { justify-content: space-around; } /* Space around */
271
+ ```
272
+
273
+ **Cross Axis (align-items):**
274
+ ```css
275
+ .items-start { align-items: flex-start; } /* Top/Left */
276
+ .items-center { align-items: center; } /* Center */
277
+ .items-end { align-items: flex-end; } /* Bottom/Right */
278
+ .items-stretch { align-items: stretch; } /* Stretch to fill */
279
+ ```
280
+
281
+ ### Grid Alignment
282
+
283
+ ```css
284
+ /* Place items (both axes) */
285
+ .place-center { place-items: center; }
286
+ .place-start { place-items: start; }
287
+ .place-end { place-items: end; }
288
+
289
+ /* Justify/align individual item */
290
+ .justify-self-center { justify-self: center; }
291
+ .align-self-center { align-self: center; }
292
+ ```
293
+
294
+ ---
295
+
296
+ ## Z-Index Layering
297
+
298
+ **Standard Z-Index Scale:**
299
+
300
+ ```css
301
+ :root {
302
+ --z-base: 1; /* Base content */
303
+ --z-dropdown: 10; /* Dropdowns, popovers */
304
+ --z-sticky: 20; /* Sticky headers */
305
+ --z-modal-backdrop: 100; /* Modal overlays */
306
+ --z-modal: 110; /* Modal content */
307
+ --z-popover: 200; /* Tooltips, toasts */
308
+ --z-notification: 1000; /* Notifications (top layer) */
309
+ }
310
+ ```
311
+
312
+ **Usage:**
313
+ ```css
314
+ .content { z-index: var(--z-base); }
315
+ .dropdown { z-index: var(--z-dropdown); }
316
+ .modal-backdrop { z-index: var(--z-modal-backdrop); }
317
+ .modal { z-index: var(--z-modal); }
318
+ .toast { z-index: var(--z-notification); }
319
+ ```
320
+
321
+ ---
322
+
323
+ ## Aspect Ratios
324
+
325
+ **Use for:** Images, videos, cards with consistent proportions
326
+
327
+ ```css
328
+ /* Modern approach (aspect-ratio property) */
329
+ .aspect-square { aspect-ratio: 1 / 1; } /* 1:1 */
330
+ .aspect-video { aspect-ratio: 16 / 9; } /* 16:9 */
331
+ .aspect-portrait { aspect-ratio: 3 / 4; } /* 3:4 */
332
+
333
+ /* Legacy approach (padding-bottom hack) */
334
+ .aspect-ratio-16-9 {
335
+ position: relative;
336
+ padding-bottom: 56.25%; /* 9/16 = 0.5625 */
337
+ }
338
+
339
+ .aspect-ratio-16-9 > * {
340
+ position: absolute;
341
+ top: 0;
342
+ left: 0;
343
+ width: 100%;
344
+ height: 100%;
345
+ }
346
+ ```
347
+
348
+ ---
349
+
350
+ ## Best Practices
351
+
352
+ ### DO:
353
+ - ✅ Use flexbox for 1D layouts
354
+ - ✅ Use grid for 2D layouts
355
+ - ✅ Design mobile-first (stack by default)
356
+ - ✅ Use semantic HTML (header, main, aside, footer)
357
+ - ✅ Constrain content width for readability
358
+ - ✅ Use CSS custom properties for spacing
359
+ - ✅ Test on all screen sizes
360
+
361
+ ### DON'T:
362
+ - ❌ Use floats for layouts (legacy technique)
363
+ - ❌ Use fixed pixel widths (not responsive)
364
+ - ❌ Nest too many layout containers (keep it flat)
365
+ - ❌ Forget semantic HTML
366
+ - ❌ Use arbitrary z-index values (100, 9999)
367
+ - ❌ Overcomplicate layouts (KISS principle)
368
+
369
+ ---
370
+
371
+ ## Quick Reference
372
+
373
+ **Layout Techniques:**
374
+ | Pattern | Technique | Use Case |
375
+ |---------|-----------|----------|
376
+ | Stack | Flexbox (column) | Vertical lists, forms |
377
+ | Inline | Flexbox (row) | Horizontal groups, nav |
378
+ | Sidebar | Grid (2 columns) | Admin panels, docs |
379
+ | Card Grid | Grid (auto-fill) | Products, galleries |
380
+ | Center | Flexbox/Grid | Modals, empty states |
381
+
382
+ **Container Widths:**
383
+ | Type | Max Width | Use Case |
384
+ |------|-----------|----------|
385
+ | Narrow | 768px | Blog posts, forms |
386
+ | Default | 1280px | Standard pages |
387
+ | Wide | 1536px | Dashboards |
388
+ | Full | none | Landing pages |
389
+
390
+ **Z-Index Layers:**
391
+ | Layer | Z-Index | Element Type |
392
+ |-------|---------|--------------|
393
+ | Base | 1 | Content |
394
+ | Dropdown | 10 | Dropdowns, popovers |
395
+ | Modal | 100-110 | Modals, overlays |
396
+ | Notification | 1000 | Toasts, alerts |
397
+
398
+ ---
399
+
400
+ **💡 Remember:** Good layout is invisible. Users should focus on content, not structure!