agents-templated 2.2.18 → 2.2.20

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.
@@ -1,217 +1,217 @@
1
- ---
2
- title: "Frontend Development Guidelines"
3
- description: "Apply when building UI components, designing pages, creating forms, or implementing accessibility and responsive interfaces"
4
- alwaysApply: true
5
- version: "3.0.0"
6
- tags: ["frontend", "ui", "ux", "security", "accessibility"]
7
- globs:
8
- - "src/**/*"
9
- - "components/**/*"
10
- - "public/**/*"
11
- ---
12
-
13
- # Frontend Development Guidelines
14
-
15
- Technology-agnostic patterns for building secure, accessible user interfaces.
16
-
17
- ## Core Principles
18
-
19
- ### User Experience
20
- - **Responsive design** - Works on mobile, tablet, and desktop
21
- - **Progressive enhancement** - Content works without JavaScript when possible
22
- - **Fast performance** - Minimize blocking resources, lazy load non-critical content
23
- - **Accessibility** - WCAG 2.1 AA compliance for all users
24
- - **Error handling** - Clear, helpful error messages and graceful degradation
25
-
26
- ### Security
27
- - **Input validation** - Validate all user input on client and server
28
- - **Output encoding** - Escape data based on context (HTML, URL, CSS, JavaScript)
29
- - **No sensitive data** - Never include passwords, tokens, or secrets in client code
30
- - **Content Security Policy** - Restrict which resources can load
31
- - **HTTPS only** - Enforce in production environments
32
-
33
- ### Accessibility
34
- - **Semantic HTML** - Use appropriate elements for structure and meaning
35
- - **ARIA attributes** - Include when semantic HTML is insufficient
36
- - **Keyboard navigation** - Full functionality with keyboard only
37
- - **Color contrast** - WCAG AA standard contrast ratios
38
- - **Focus indicators** - Clear visual indicator of focused element
39
- - **Alt text** - Descriptive alt text for all meaningful images
40
- - **Form labels** - Associated labels for all form inputs
41
-
42
- ## Component Development
43
-
44
- ### Component Structure Pattern
45
-
46
- Component responsibilities:
47
- 1. Clear purpose - One thing the component does
48
- 2. Props interface - Document all inputs clearly
49
- 3. Error handling - Handle invalid inputs gracefully
50
- 4. Accessibility - Include ARIA and semantic attributes
51
- 5. Testing - Can be tested in isolation
52
-
53
- ### Component Patterns (Language-Agnostic)
54
-
55
- Component Naming:
56
- - File names: kebab-case (user-profile, navigation-bar)
57
- - Component names: PascalCase (UserProfile, NavigationBar)
58
-
59
- Component Organization:
60
- - Props at top
61
- - State management
62
- - Effects/lifecycle
63
- - Event handlers
64
- - Render/JSX at bottom
65
-
66
- ### Form Development
67
-
68
- Form Validation Pattern:
69
- 1. Define validation schema (JavaScript, Zod, Yup, etc.)
70
- 2. Validate on change for feedback
71
- 3. Validate on blur for efficiency
72
- 4. Show field-specific errors
73
- 5. Disable submit until valid
74
- 6. Validate on server before processing
75
-
76
- Form Accessibility:
77
- - Label associated with each input
78
- - Error messages linked to field
79
- - Required fields marked clearly
80
- - Tab order logical and visible
81
- - Focus management in forms
82
- - Error summary at top (optional)
83
-
84
- ### Responsive Design Patterns
85
-
86
- Breakpoint-based design:
87
- - Mobile first approach
88
- - Add complexity at larger sizes
89
- - Use media queries or responsive framework
90
- - Test on actual devices
91
- - Common breakpoints:
92
- - Mobile: 0-480px
93
- - Tablet: 481-768px
94
- - Desktop: 769-1024px
95
- - Wide: 1025px+
96
-
97
- ### State Management
98
-
99
- Choose ONE approach for consistency:
100
- - **Client-side**: Component state (useState, reactive variables)
101
- - **Context/Provider**: Shared state across components
102
- - **Centralized**: Redux, Vuex, Pinia, or similar
103
- - **Server state**: Load from API, cache locally
104
- - **Local storage**: Persistent browser storage
105
-
106
- Keep state:
107
- - As local as possible
108
- - Close to where used
109
- - Immutable when possible
110
- - Easy to reason about
111
-
112
- ## Design System & Styling
113
-
114
- ### CSS Approach Options
115
-
116
- Choose ONE approach:
117
- - **Utility classes** (Tailwind CSS, UnoCSS)
118
- - **Styled components** (styled-components, Emotion)
119
- - **CSS Modules** (scoped styles)
120
- - **BEM Convention** (Block-Element-Modifier)
121
- - **Atomic CSS** (Atomic design principles)
122
-
123
- Styling Principles:
124
- - Consistent spacing using scale (4px, 8px, 12px, etc.)
125
- - Limited color palette
126
- - Consistent font sizing
127
- - Consistent border radius
128
- - Consistent shadows
129
- - Dark/light mode support when needed
130
-
131
- ### Design Tokens
132
-
133
- Define design system tokens:
134
- - Colors: primary, secondary, danger, success, warning
135
- - Typography: font families, sizes, weights, line heights
136
- - Spacing: margin/padding scale (4px, 8px, 16px, 32px, etc.)
137
- - Shadows: subtle, regular, strong
138
- - Border radius: small, medium, large
139
- - Animations: duration, easing
140
-
141
- Use tokens consistently:
142
- - In components
143
- - In styles
144
- - In tests
145
- - In documentation
146
-
147
- ## Performance Optimization
148
-
149
- ### Image Optimization
150
- - Use appropriate formats (WebP, JPEG, PNG)
151
- - Provide multiple sizes (srcset)
152
- - Lazy load below the fold
153
- - Responsive images
154
- - Optimize file size
155
-
156
- ### Code Splitting
157
- - Split by route (page-based code splitting)
158
- - Split by feature (feature-based code splitting)
159
- - Split third-party libraries
160
- - Load libraries on demand
161
-
162
- ### Caching Strategy
163
- - Cache static assets (images, fonts, CSS, JS)
164
- - Cache API responses appropriately
165
- - Use service workers for offline support
166
- - Clear cache on deployment
167
-
168
- ## Accessibility Checklist
169
-
170
- Before releasing any UI:
171
-
172
- - [ ] Semantic HTML is used correctly
173
- - [ ] All images have descriptive alt text
174
- - [ ] Color contrast meets WCAG AA standards
175
- - [ ] Keyboard navigation works completely
176
- - [ ] Focus indicators are visible
177
- - [ ] Form inputs have associated labels
178
- - [ ] Error messages are clear and specific
179
- - [ ] Headings have correct hierarchy
180
- - [ ] ARIA attributes used when appropriate
181
- - [ ] Mobile layout is responsive
182
- - [ ] Text is readable at smaller sizes
183
- - [ ] Content structure makes sense without CSS
184
- - [ ] No information conveyed by color alone
185
-
186
- ## Browser Compatibility
187
-
188
- Support strategy:
189
- - Define minimum versions to support
190
- - Use feature detection or progressive enhancement
191
- - Test critical paths in target browsers
192
- - Provide fallbacks for older browsers
193
- - Use polyfills when appropriate
194
-
195
- ## Testing Frontend Components
196
-
197
- Unit tests:
198
- - Component renders with props
199
- - Event handlers work correctly
200
- - Error states display properly
201
- - Accessibility attributes present
202
-
203
- Integration tests:
204
- - Form submission workflow
205
- - Navigation between views
206
- - State updates across components
207
- - API integration
208
-
209
- E2E tests:
210
- - Critical user workflows
211
- - Happy path scenarios
212
- - Common error scenarios
213
- - Accessibility workflows
214
-
215
- ---
216
-
217
- Remember: Build user interfaces that work for everyone, load quickly, and provide excellent user experience.
1
+ ---
2
+ title: "Frontend Development Guidelines"
3
+ description: "Apply when building UI components, designing pages, creating forms, or implementing accessibility and responsive interfaces"
4
+ alwaysApply: true
5
+ version: "3.0.0"
6
+ tags: ["frontend", "ui", "ux", "security", "accessibility"]
7
+ globs:
8
+ - "src/**/*"
9
+ - "components/**/*"
10
+ - "public/**/*"
11
+ ---
12
+
13
+ # Frontend Development Guidelines
14
+
15
+ Technology-agnostic patterns for building secure, accessible user interfaces.
16
+
17
+ ## Core Principles
18
+
19
+ ### User Experience
20
+ - **Responsive design** - Works on mobile, tablet, and desktop
21
+ - **Progressive enhancement** - Content works without JavaScript when possible
22
+ - **Fast performance** - Minimize blocking resources, lazy load non-critical content
23
+ - **Accessibility** - WCAG 2.1 AA compliance for all users
24
+ - **Error handling** - Clear, helpful error messages and graceful degradation
25
+
26
+ ### Security
27
+ - **Input validation** - Validate all user input on client and server
28
+ - **Output encoding** - Escape data based on context (HTML, URL, CSS, JavaScript)
29
+ - **No sensitive data** - Never include passwords, tokens, or secrets in client code
30
+ - **Content Security Policy** - Restrict which resources can load
31
+ - **HTTPS only** - Enforce in production environments
32
+
33
+ ### Accessibility
34
+ - **Semantic HTML** - Use appropriate elements for structure and meaning
35
+ - **ARIA attributes** - Include when semantic HTML is insufficient
36
+ - **Keyboard navigation** - Full functionality with keyboard only
37
+ - **Color contrast** - WCAG AA standard contrast ratios
38
+ - **Focus indicators** - Clear visual indicator of focused element
39
+ - **Alt text** - Descriptive alt text for all meaningful images
40
+ - **Form labels** - Associated labels for all form inputs
41
+
42
+ ## Component Development
43
+
44
+ ### Component Structure Pattern
45
+
46
+ Component responsibilities:
47
+ 1. Clear purpose - One thing the component does
48
+ 2. Props interface - Document all inputs clearly
49
+ 3. Error handling - Handle invalid inputs gracefully
50
+ 4. Accessibility - Include ARIA and semantic attributes
51
+ 5. Testing - Can be tested in isolation
52
+
53
+ ### Component Patterns (Language-Agnostic)
54
+
55
+ Component Naming:
56
+ - File names: kebab-case (user-profile, navigation-bar)
57
+ - Component names: PascalCase (UserProfile, NavigationBar)
58
+
59
+ Component Organization:
60
+ - Props at top
61
+ - State management
62
+ - Effects/lifecycle
63
+ - Event handlers
64
+ - Render/JSX at bottom
65
+
66
+ ### Form Development
67
+
68
+ Form Validation Pattern:
69
+ 1. Define validation schema (JavaScript, Zod, Yup, etc.)
70
+ 2. Validate on change for feedback
71
+ 3. Validate on blur for efficiency
72
+ 4. Show field-specific errors
73
+ 5. Disable submit until valid
74
+ 6. Validate on server before processing
75
+
76
+ Form Accessibility:
77
+ - Label associated with each input
78
+ - Error messages linked to field
79
+ - Required fields marked clearly
80
+ - Tab order logical and visible
81
+ - Focus management in forms
82
+ - Error summary at top (optional)
83
+
84
+ ### Responsive Design Patterns
85
+
86
+ Breakpoint-based design:
87
+ - Mobile first approach
88
+ - Add complexity at larger sizes
89
+ - Use media queries or responsive framework
90
+ - Test on actual devices
91
+ - Common breakpoints:
92
+ - Mobile: 0-480px
93
+ - Tablet: 481-768px
94
+ - Desktop: 769-1024px
95
+ - Wide: 1025px+
96
+
97
+ ### State Management
98
+
99
+ Choose ONE approach for consistency:
100
+ - **Client-side**: Component state (useState, reactive variables)
101
+ - **Context/Provider**: Shared state across components
102
+ - **Centralized**: Redux, Vuex, Pinia, or similar
103
+ - **Server state**: Load from API, cache locally
104
+ - **Local storage**: Persistent browser storage
105
+
106
+ Keep state:
107
+ - As local as possible
108
+ - Close to where used
109
+ - Immutable when possible
110
+ - Easy to reason about
111
+
112
+ ## Design System & Styling
113
+
114
+ ### CSS Approach Options
115
+
116
+ Choose ONE approach:
117
+ - **Utility classes** (Tailwind CSS, UnoCSS)
118
+ - **Styled components** (styled-components, Emotion)
119
+ - **CSS Modules** (scoped styles)
120
+ - **BEM Convention** (Block-Element-Modifier)
121
+ - **Atomic CSS** (Atomic design principles)
122
+
123
+ Styling Principles:
124
+ - Consistent spacing using scale (4px, 8px, 12px, etc.)
125
+ - Limited color palette
126
+ - Consistent font sizing
127
+ - Consistent border radius
128
+ - Consistent shadows
129
+ - Dark/light mode support when needed
130
+
131
+ ### Design Tokens
132
+
133
+ Define design system tokens:
134
+ - Colors: primary, secondary, danger, success, warning
135
+ - Typography: font families, sizes, weights, line heights
136
+ - Spacing: margin/padding scale (4px, 8px, 16px, 32px, etc.)
137
+ - Shadows: subtle, regular, strong
138
+ - Border radius: small, medium, large
139
+ - Animations: duration, easing
140
+
141
+ Use tokens consistently:
142
+ - In components
143
+ - In styles
144
+ - In tests
145
+ - In documentation
146
+
147
+ ## Performance Optimization
148
+
149
+ ### Image Optimization
150
+ - Use appropriate formats (WebP, JPEG, PNG)
151
+ - Provide multiple sizes (srcset)
152
+ - Lazy load below the fold
153
+ - Responsive images
154
+ - Optimize file size
155
+
156
+ ### Code Splitting
157
+ - Split by route (page-based code splitting)
158
+ - Split by feature (feature-based code splitting)
159
+ - Split third-party libraries
160
+ - Load libraries on demand
161
+
162
+ ### Caching Strategy
163
+ - Cache static assets (images, fonts, CSS, JS)
164
+ - Cache API responses appropriately
165
+ - Use service workers for offline support
166
+ - Clear cache on deployment
167
+
168
+ ## Accessibility Checklist
169
+
170
+ Before releasing any UI:
171
+
172
+ - [ ] Semantic HTML is used correctly
173
+ - [ ] All images have descriptive alt text
174
+ - [ ] Color contrast meets WCAG AA standards
175
+ - [ ] Keyboard navigation works completely
176
+ - [ ] Focus indicators are visible
177
+ - [ ] Form inputs have associated labels
178
+ - [ ] Error messages are clear and specific
179
+ - [ ] Headings have correct hierarchy
180
+ - [ ] ARIA attributes used when appropriate
181
+ - [ ] Mobile layout is responsive
182
+ - [ ] Text is readable at smaller sizes
183
+ - [ ] Content structure makes sense without CSS
184
+ - [ ] No information conveyed by color alone
185
+
186
+ ## Browser Compatibility
187
+
188
+ Support strategy:
189
+ - Define minimum versions to support
190
+ - Use feature detection or progressive enhancement
191
+ - Test critical paths in target browsers
192
+ - Provide fallbacks for older browsers
193
+ - Use polyfills when appropriate
194
+
195
+ ## Testing Frontend Components
196
+
197
+ Unit tests:
198
+ - Component renders with props
199
+ - Event handlers work correctly
200
+ - Error states display properly
201
+ - Accessibility attributes present
202
+
203
+ Integration tests:
204
+ - Form submission workflow
205
+ - Navigation between views
206
+ - State updates across components
207
+ - API integration
208
+
209
+ E2E tests:
210
+ - Critical user workflows
211
+ - Happy path scenarios
212
+ - Common error scenarios
213
+ - Accessibility workflows
214
+
215
+ ---
216
+
217
+ Remember: Build user interfaces that work for everyone, load quickly, and provide excellent user experience.