ai-flow-dev 1.0.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.
- package/LICENSE +21 -0
- package/README.md +408 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +791 -0
- package/dist/cli.js.map +1 -0
- package/dist/fs-utils.d.ts +2 -0
- package/dist/fs-utils.d.ts.map +1 -0
- package/dist/fs-utils.js +46 -0
- package/dist/fs-utils.js.map +1 -0
- package/package.json +71 -0
- package/prompts/backend/flow-dev-feature.md +1318 -0
- package/prompts/backend/flow-dev-fix.md +903 -0
- package/prompts/backend/flow-dev-refactor.md +715 -0
- package/prompts/backend/flow-dev-review.md +401 -0
- package/prompts/backend/flow-dev-work.md +1129 -0
- package/prompts/backend/flow-docs-gen-phase-0.md +1840 -0
- package/prompts/backend/flow-docs-gen-phase-1.md +435 -0
- package/prompts/backend/flow-docs-gen-phase-2.md +460 -0
- package/prompts/backend/flow-docs-gen-phase-3.md +684 -0
- package/prompts/backend/flow-docs-gen-phase-4.md +516 -0
- package/prompts/backend/flow-docs-gen-phase-5.md +637 -0
- package/prompts/backend/flow-docs-gen-phase-6.md +465 -0
- package/prompts/backend/flow-docs-gen-phase-7.md +1207 -0
- package/prompts/backend/flow-docs-gen.md +820 -0
- package/prompts/backend/flow-docs-sync.md +526 -0
- package/prompts/backend/flow-project-init.md +248 -0
- package/prompts/backend/flow-project-roadmap.md +1159 -0
- package/prompts/frontend/flow-docs-gen-phase-0.md +494 -0
- package/prompts/frontend/flow-docs-gen-phase-1.md +449 -0
- package/prompts/frontend/flow-docs-gen-phase-2.md +983 -0
- package/prompts/frontend/flow-docs-gen-phase-3.md +685 -0
- package/prompts/frontend/flow-docs-gen-phase-4.md +480 -0
- package/prompts/frontend/flow-docs-gen-phase-5.md +483 -0
- package/prompts/frontend/flow-docs-gen-phase-6.md +570 -0
- package/prompts/frontend/flow-docs-gen-phase-7.md +582 -0
- package/prompts/frontend/flow-docs-gen.md +413 -0
- package/prompts/frontend/flow-docs-sync.md +561 -0
- package/prompts/mobile/flow-docs-gen-phase-0.md +387 -0
- package/prompts/mobile/flow-docs-gen-phase-1.md +530 -0
- package/prompts/mobile/flow-docs-gen-phase-2.md +584 -0
- package/prompts/mobile/flow-docs-gen-phase-3.md +659 -0
- package/prompts/mobile/flow-docs-gen-phase-4.md +363 -0
- package/prompts/mobile/flow-docs-gen-phase-5.md +369 -0
- package/prompts/mobile/flow-docs-gen-phase-6.md +490 -0
- package/prompts/mobile/flow-docs-gen-phase-7.md +407 -0
- package/prompts/mobile/flow-docs-gen.md +430 -0
- package/prompts/mobile/flow-docs-sync.md +634 -0
- package/templates/backend/.clauderules.template +111 -0
- package/templates/backend/.cursorrules.template +102 -0
- package/templates/backend/.env.example.template +122 -0
- package/templates/backend/README.template.md +200 -0
- package/templates/backend/ai-instructions.template.md +354 -0
- package/templates/backend/copilot-instructions.template.md +160 -0
- package/templates/backend/docs/api.template.md +251 -0
- package/templates/backend/docs/architecture.template.md +612 -0
- package/templates/backend/docs/business-flows.template.md +109 -0
- package/templates/backend/docs/code-standards.template.md +828 -0
- package/templates/backend/docs/contributing.template.md +163 -0
- package/templates/backend/docs/data-model.template.md +416 -0
- package/templates/backend/docs/operations.template.md +591 -0
- package/templates/backend/docs/testing.template.md +762 -0
- package/templates/backend/project-brief.template.md +176 -0
- package/templates/backend/specs/configuration.template.md +133 -0
- package/templates/backend/specs/security.template.md +422 -0
- package/templates/frontend/README.template.md +121 -0
- package/templates/frontend/ai-instructions.template.md +368 -0
- package/templates/frontend/docs/api-integration.template.md +390 -0
- package/templates/frontend/docs/components.template.md +567 -0
- package/templates/frontend/docs/error-handling.template.md +385 -0
- package/templates/frontend/docs/operations.template.md +123 -0
- package/templates/frontend/docs/performance.template.md +140 -0
- package/templates/frontend/docs/pwa.template.md +135 -0
- package/templates/frontend/docs/state-management.template.md +394 -0
- package/templates/frontend/docs/styling.template.md +779 -0
- package/templates/frontend/docs/testing.template.md +736 -0
- package/templates/frontend/project-brief.template.md +55 -0
- package/templates/frontend/specs/accessibility.template.md +111 -0
- package/templates/frontend/specs/configuration.template.md +520 -0
- package/templates/frontend/specs/security.template.md +197 -0
- package/templates/fullstack/README.template.md +282 -0
- package/templates/fullstack/ai-instructions.template.md +487 -0
- package/templates/fullstack/project-brief.template.md +197 -0
- package/templates/fullstack/specs/configuration.template.md +380 -0
- package/templates/mobile/AGENT.template.md +251 -0
- package/templates/mobile/README.template.md +195 -0
- package/templates/mobile/ai-instructions.template.md +221 -0
- package/templates/mobile/docs/app-store.template.md +163 -0
- package/templates/mobile/docs/architecture.template.md +100 -0
- package/templates/mobile/docs/native-features.template.md +137 -0
- package/templates/mobile/docs/navigation.template.md +81 -0
- package/templates/mobile/docs/offline-strategy.template.md +90 -0
- package/templates/mobile/docs/permissions.template.md +70 -0
- package/templates/mobile/docs/state-management.template.md +116 -0
- package/templates/mobile/docs/testing.template.md +146 -0
- package/templates/mobile/project-brief.template.md +97 -0
- package/templates/mobile/specs/build-configuration.template.md +116 -0
- package/templates/mobile/specs/deployment.template.md +114 -0
- package/templates/shared/AGENT.template.md +252 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# {{PROJECT_NAME}}
|
|
2
|
+
|
|
3
|
+
> {{PROJECT_DESCRIPTION}}
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 🚀 Quick Start
|
|
8
|
+
|
|
9
|
+
### Prerequisites
|
|
10
|
+
|
|
11
|
+
- Node.js {{NODE_VERSION}} or higher
|
|
12
|
+
- {{PACKAGE_MANAGER}} (npm/yarn/pnpm)
|
|
13
|
+
|
|
14
|
+
### Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# Clone the repository
|
|
18
|
+
git clone <repository-url>
|
|
19
|
+
cd {{PROJECT_NAME}}
|
|
20
|
+
|
|
21
|
+
# Install dependencies
|
|
22
|
+
{{PACKAGE_MANAGER}} install
|
|
23
|
+
|
|
24
|
+
# Start development server
|
|
25
|
+
{{PACKAGE_MANAGER}} run dev
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Environment Setup
|
|
29
|
+
|
|
30
|
+
Copy `.env.example` to `.env` and configure:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
cp .env.example .env
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
See `specs/configuration.md` for all environment variables.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## 📁 Project Structure
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
{{FOLDER_STRUCTURE}}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## 🛠️ Development
|
|
49
|
+
|
|
50
|
+
### Available Scripts
|
|
51
|
+
|
|
52
|
+
- `{{PACKAGE_MANAGER}} run dev` - Start development server
|
|
53
|
+
- `{{PACKAGE_MANAGER}} run build` - Build for production
|
|
54
|
+
- `{{PACKAGE_MANAGER}} run preview` - Preview production build
|
|
55
|
+
- `{{PACKAGE_MANAGER}} run test` - Run tests
|
|
56
|
+
- `{{PACKAGE_MANAGER}} run lint` - Run linter
|
|
57
|
+
- `{{PACKAGE_MANAGER}} run format` - Format code
|
|
58
|
+
|
|
59
|
+
### Tech Stack
|
|
60
|
+
|
|
61
|
+
- **Framework:** {{UI_FRAMEWORK}} {{UI_FRAMEWORK_VERSION}}
|
|
62
|
+
- **Build Tool:** {{BUILD_TOOL}}
|
|
63
|
+
- **Styling:** {{STYLING_APPROACH}}
|
|
64
|
+
- **State Management:** {{STATE_MANAGEMENT}}
|
|
65
|
+
- **Testing:** {{UNIT_TEST_FRAMEWORK}}, {{E2E_FRAMEWORK}}
|
|
66
|
+
|
|
67
|
+
See `ai-instructions.md` for complete tech stack.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## 📚 Documentation
|
|
72
|
+
|
|
73
|
+
**For AI Assistants:**
|
|
74
|
+
- `AGENT.md` - Start here for AI context
|
|
75
|
+
- `ai-instructions.md` - Tech stack and rules
|
|
76
|
+
|
|
77
|
+
**For Developers:**
|
|
78
|
+
- `docs/components.md` - Component architecture
|
|
79
|
+
- `docs/state-management.md` - State patterns
|
|
80
|
+
- `docs/styling.md` - Styling guidelines
|
|
81
|
+
- `docs/testing.md` - Testing strategy
|
|
82
|
+
- `specs/accessibility.md` - A11y requirements
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## 🧪 Testing
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# Run all tests
|
|
90
|
+
{{PACKAGE_MANAGER}} run test
|
|
91
|
+
|
|
92
|
+
# Run with coverage
|
|
93
|
+
{{PACKAGE_MANAGER}} run test:coverage
|
|
94
|
+
|
|
95
|
+
# Run E2E tests
|
|
96
|
+
{{PACKAGE_MANAGER}} run test:e2e
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## 🚢 Deployment
|
|
102
|
+
|
|
103
|
+
{{DEPLOYMENT_INSTRUCTIONS}}
|
|
104
|
+
|
|
105
|
+
See `docs/operations.md` for detailed deployment procedures.
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## 🤝 Contributing
|
|
110
|
+
|
|
111
|
+
See `docs/contributing.md` for contribution guidelines.
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## 📄 License
|
|
116
|
+
|
|
117
|
+
{{LICENSE}}
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
**Last Updated:** {{GENERATION_DATE}}
|
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
# AI Instructions - Frontend
|
|
2
|
+
|
|
3
|
+
> **CRITICAL:** Every AI assistant MUST read and follow this document before any work.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 🎯 Project Overview
|
|
8
|
+
|
|
9
|
+
**Name:** {{PROJECT_NAME}}
|
|
10
|
+
|
|
11
|
+
**Description:** {{PROJECT_DESCRIPTION}}
|
|
12
|
+
|
|
13
|
+
**Purpose:** {{PROBLEM_STATEMENT}}
|
|
14
|
+
|
|
15
|
+
**Target Users:** {{TARGET_USERS}}
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 🏗️ Tech Stack
|
|
20
|
+
|
|
21
|
+
### Frontend
|
|
22
|
+
|
|
23
|
+
- **UI Framework:** {{UI_FRAMEWORK}} {{UI_FRAMEWORK_VERSION}}
|
|
24
|
+
- **Meta Framework:** {{META_FRAMEWORK}}
|
|
25
|
+
- **Language:** {{LANGUAGE}} {{LANGUAGE_VERSION}}
|
|
26
|
+
- **Build Tool:** {{BUILD_TOOL}}
|
|
27
|
+
- **Package Manager:** {{PACKAGE_MANAGER}}
|
|
28
|
+
|
|
29
|
+
### UI & Components
|
|
30
|
+
|
|
31
|
+
- **Component Pattern:** {{COMPONENT_PATTERN}}
|
|
32
|
+
- **Component Library:** {{COMPONENT_LIBRARY}}
|
|
33
|
+
- **Form Management:** {{FORM_LIBRARY}}
|
|
34
|
+
- **Icon System:** {{ICON_SYSTEM}}
|
|
35
|
+
|
|
36
|
+
### State Management
|
|
37
|
+
|
|
38
|
+
- **State Solution:** {{STATE_MANAGEMENT}}
|
|
39
|
+
- **Data Fetching:** {{DATA_FETCHING}}
|
|
40
|
+
- **Cache Strategy:** {{CACHE_STRATEGY}}
|
|
41
|
+
|
|
42
|
+
### Styling
|
|
43
|
+
|
|
44
|
+
- **Styling Approach:** {{STYLING_APPROACH}}
|
|
45
|
+
- **CSS Preprocessor:** {{CSS_PREPROCESSOR}}
|
|
46
|
+
- **Design Tokens:** {{DESIGN_TOKENS}}
|
|
47
|
+
- **Theme Support:** {{THEME_SUPPORT}}
|
|
48
|
+
|
|
49
|
+
### Routing
|
|
50
|
+
|
|
51
|
+
- **Router:** {{ROUTING_LIBRARY}}
|
|
52
|
+
- **Route Strategy:** {{ROUTE_STRATEGY}}
|
|
53
|
+
|
|
54
|
+
### Testing
|
|
55
|
+
|
|
56
|
+
- **Unit Testing:** {{UNIT_TEST_FRAMEWORK}}
|
|
57
|
+
- **Component Testing:** {{COMPONENT_TEST_LIBRARY}}
|
|
58
|
+
- **E2E Testing:** {{E2E_FRAMEWORK}}
|
|
59
|
+
- **Coverage Target:** {{TEST_COVERAGE_TARGET}}
|
|
60
|
+
|
|
61
|
+
### Build & Deployment
|
|
62
|
+
|
|
63
|
+
- **Deployment:** {{DEPLOYMENT_PLATFORM}}
|
|
64
|
+
- **CI/CD:** {{CICD_PLATFORM}}
|
|
65
|
+
- **CDN:** {{CDN_PROVIDER}}
|
|
66
|
+
- **Analytics:** {{ANALYTICS_TOOL}}
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## 🏛️ Architecture
|
|
71
|
+
|
|
72
|
+
**Component Pattern:** {{COMPONENT_PATTERN}}
|
|
73
|
+
|
|
74
|
+
{{ARCHITECTURE_DESCRIPTION}}
|
|
75
|
+
|
|
76
|
+
**File Organization:** {{FILE_ORGANIZATION}}
|
|
77
|
+
|
|
78
|
+
**Folder Structure:**
|
|
79
|
+
```
|
|
80
|
+
{{FOLDER_STRUCTURE}}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## ❌ NEVER Rules
|
|
86
|
+
|
|
87
|
+
**YOU MUST NEVER:**
|
|
88
|
+
|
|
89
|
+
### Performance
|
|
90
|
+
|
|
91
|
+
- ❌ Import entire libraries - Use tree-shaking friendly imports
|
|
92
|
+
```typescript
|
|
93
|
+
// Bad
|
|
94
|
+
import _ from 'lodash';
|
|
95
|
+
// Good
|
|
96
|
+
import debounce from 'lodash/debounce';
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
- ❌ Render large lists without virtualization - Use react-window, vue-virtual-scroller
|
|
100
|
+
- ❌ Forget to memoize expensive computations - Use useMemo, computed
|
|
101
|
+
- ❌ Load all routes upfront - Use code splitting and lazy loading
|
|
102
|
+
- ❌ Use inline function props in render - Define outside or use useCallback (React)
|
|
103
|
+
- ❌ Skip image optimization - Use next/image, nuxt/image, or optimize manually
|
|
104
|
+
- ❌ Ignore bundle size - Monitor and optimize regularly
|
|
105
|
+
- ❌ Fetch data in loops - Batch requests or use GraphQL
|
|
106
|
+
|
|
107
|
+
### Accessibility (WCAG {{A11Y_COMPLIANCE}})
|
|
108
|
+
|
|
109
|
+
- ❌ Use divs for buttons - Use semantic HTML (`<button>`, `<a>`)
|
|
110
|
+
- ❌ Forget alt text on images - Every `<img>` needs descriptive alt
|
|
111
|
+
- ❌ Skip keyboard navigation support - All interactive elements must be keyboard accessible
|
|
112
|
+
- ❌ Ignore color contrast ratios - Minimum 4.5:1 for text (WCAG AA)
|
|
113
|
+
- ❌ Remove focus outlines without replacement - Provide visible focus indicators
|
|
114
|
+
- ❌ Skip ARIA labels on icon buttons - Use aria-label or sr-only text
|
|
115
|
+
- ❌ Use placeholder as label - Labels must be visible, not just placeholder
|
|
116
|
+
- ❌ Forget to test with screen readers - Test with NVDA, JAWS, or VoiceOver
|
|
117
|
+
|
|
118
|
+
### Security
|
|
119
|
+
|
|
120
|
+
- ❌ Trust user input - Sanitize everything to prevent XSS
|
|
121
|
+
```typescript
|
|
122
|
+
// Bad - XSS vulnerability
|
|
123
|
+
div.innerHTML = userInput;
|
|
124
|
+
// Good - sanitized
|
|
125
|
+
div.textContent = userInput;
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
- ❌ Store sensitive data in localStorage - Use httpOnly cookies for tokens
|
|
129
|
+
- ❌ Expose API keys in frontend code - Use environment variables + backend proxy
|
|
130
|
+
- ❌ Skip CSRF protection for forms - Use CSRF tokens
|
|
131
|
+
- ❌ Allow dangerous HTML in user content - Use DOMPurify or similar
|
|
132
|
+
- ❌ Log sensitive user data - Sanitize logs and avoid PII
|
|
133
|
+
- ❌ Use eval() or Function() constructor - Major security risk
|
|
134
|
+
- ❌ Ignore Content Security Policy - Configure CSP headers
|
|
135
|
+
|
|
136
|
+
### Code Quality
|
|
137
|
+
|
|
138
|
+
- ❌ Use inline styles (except dynamic values) - Use {{STYLING_APPROACH}}
|
|
139
|
+
- ❌ Create massive components (>300 lines) - Split into smaller components
|
|
140
|
+
- ❌ Mutate state directly - Use immutable updates
|
|
141
|
+
```typescript
|
|
142
|
+
// Bad (React)
|
|
143
|
+
state.items.push(newItem);
|
|
144
|
+
// Good
|
|
145
|
+
setState({ items: [...state.items, newItem] });
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
- ❌ Use `any` type in TypeScript - Always use proper types
|
|
149
|
+
- ❌ Nest ternary operators - Use if-else or early returns
|
|
150
|
+
- ❌ Put business logic in components - Extract to hooks, composables, or services
|
|
151
|
+
- ❌ Skip error boundaries - Wrap component trees with error handlers
|
|
152
|
+
- ❌ Leave console.log in production - Use proper logging or remove
|
|
153
|
+
|
|
154
|
+
### State Management
|
|
155
|
+
|
|
156
|
+
- ❌ Prop drill more than 2-3 levels - Use context, provide/inject, or state management
|
|
157
|
+
- ❌ Store derived data in state - Compute on the fly
|
|
158
|
+
- ❌ Forget to clean up subscriptions - Unsubscribe in useEffect cleanup, onUnmounted
|
|
159
|
+
- ❌ Use global state for everything - Keep state as local as possible
|
|
160
|
+
- ❌ Update state during render - Use effects or event handlers
|
|
161
|
+
|
|
162
|
+
### API Integration
|
|
163
|
+
|
|
164
|
+
- ❌ Make API calls directly in components - Use custom hooks, composables, or services
|
|
165
|
+
- ❌ Forget loading and error states - Always handle both
|
|
166
|
+
- ❌ Skip request cancellation - Cancel pending requests on unmount
|
|
167
|
+
- ❌ Expose backend errors to users - Show user-friendly messages
|
|
168
|
+
- ❌ Ignore rate limiting - Debounce/throttle frequent requests
|
|
169
|
+
|
|
170
|
+
### Styling
|
|
171
|
+
|
|
172
|
+
- ❌ Use !important unless absolutely necessary - Fix specificity instead
|
|
173
|
+
- ❌ Hardcode pixel values everywhere - Use design tokens, CSS variables
|
|
174
|
+
- ❌ Forget responsive design - Mobile-first approach
|
|
175
|
+
- ❌ Ignore dark mode support (if {{THEME_SUPPORT}} includes dark mode)
|
|
176
|
+
- ❌ Use RGB hex colors directly - Use CSS variables or design tokens
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## ✅ ALWAYS Rules
|
|
181
|
+
|
|
182
|
+
**YOU MUST ALWAYS:**
|
|
183
|
+
|
|
184
|
+
### Component Design
|
|
185
|
+
|
|
186
|
+
- ✅ Keep components focused on one responsibility
|
|
187
|
+
- ✅ Use TypeScript for type safety
|
|
188
|
+
- ✅ Write PropTypes or TypeScript interfaces for props
|
|
189
|
+
- ✅ Provide default props where sensible
|
|
190
|
+
- ✅ Document complex components with JSDoc
|
|
191
|
+
- ✅ Use meaningful, descriptive component names (PascalCase)
|
|
192
|
+
|
|
193
|
+
### Performance
|
|
194
|
+
|
|
195
|
+
- ✅ Implement code splitting for routes
|
|
196
|
+
```typescript
|
|
197
|
+
// React
|
|
198
|
+
const Dashboard = lazy(() => import('./Dashboard'));
|
|
199
|
+
// Vue
|
|
200
|
+
const Dashboard = defineAsyncComponent(() => import('./Dashboard.vue'));
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
- ✅ Optimize images (WebP format, lazy loading)
|
|
204
|
+
- ✅ Monitor Core Web Vitals: {{WEB_VITALS_TARGETS}}
|
|
205
|
+
- ✅ Use production builds for deployment
|
|
206
|
+
- ✅ Implement proper caching strategies
|
|
207
|
+
- ✅ Debounce search inputs and expensive operations
|
|
208
|
+
|
|
209
|
+
### Accessibility
|
|
210
|
+
|
|
211
|
+
- ✅ Use semantic HTML elements
|
|
212
|
+
- ✅ Add ARIA attributes when needed
|
|
213
|
+
- ✅ Ensure keyboard navigation works
|
|
214
|
+
- ✅ Test with keyboard only (Tab, Enter, Escape)
|
|
215
|
+
- ✅ Provide text alternatives for non-text content
|
|
216
|
+
- ✅ Use proper heading hierarchy (h1 → h2 → h3)
|
|
217
|
+
- ✅ Announce dynamic content changes to screen readers
|
|
218
|
+
|
|
219
|
+
### State Management
|
|
220
|
+
|
|
221
|
+
- ✅ Keep state as close as possible to where it's used
|
|
222
|
+
- ✅ Use {{STATE_MANAGEMENT}} for global state
|
|
223
|
+
- ✅ Normalize complex nested state
|
|
224
|
+
- ✅ Use {{DATA_FETCHING}} for server state
|
|
225
|
+
- ✅ Implement optimistic updates for better UX
|
|
226
|
+
|
|
227
|
+
### Error Handling
|
|
228
|
+
|
|
229
|
+
- ✅ Wrap component trees with error boundaries
|
|
230
|
+
- ✅ Show user-friendly error messages
|
|
231
|
+
- ✅ Log errors to monitoring service ({{MONITORING_TOOL}})
|
|
232
|
+
- ✅ Provide fallback UI for errors
|
|
233
|
+
- ✅ Handle network failures gracefully
|
|
234
|
+
|
|
235
|
+
### Testing
|
|
236
|
+
|
|
237
|
+
- ✅ Write tests for critical user paths
|
|
238
|
+
- ✅ Test component behavior, not implementation
|
|
239
|
+
- ✅ Mock external dependencies (API calls)
|
|
240
|
+
- ✅ Test accessibility (screen reader compatibility)
|
|
241
|
+
- ✅ Achieve {{TEST_COVERAGE_TARGET}} coverage minimum
|
|
242
|
+
- ✅ Run tests before committing
|
|
243
|
+
|
|
244
|
+
### Code Organization
|
|
245
|
+
|
|
246
|
+
- ✅ Follow {{COMPONENT_PATTERN}} structure
|
|
247
|
+
- ✅ Co-locate related files (component + styles + tests)
|
|
248
|
+
- ✅ Use absolute imports for cleaner code
|
|
249
|
+
- ✅ Extract reusable logic to custom hooks/composables
|
|
250
|
+
- ✅ Keep files under 300 lines
|
|
251
|
+
|
|
252
|
+
### Styling
|
|
253
|
+
|
|
254
|
+
- ✅ Use {{STYLING_APPROACH}} consistently
|
|
255
|
+
- ✅ Follow mobile-first responsive design
|
|
256
|
+
- ✅ Use CSS variables / design tokens for theming
|
|
257
|
+
- ✅ Ensure dark mode compatibility (if enabled)
|
|
258
|
+
- ✅ Test on multiple screen sizes
|
|
259
|
+
|
|
260
|
+
### Forms
|
|
261
|
+
|
|
262
|
+
- ✅ Use {{FORM_LIBRARY}} for complex forms
|
|
263
|
+
- ✅ Validate on blur and submit
|
|
264
|
+
- ✅ Show validation errors inline
|
|
265
|
+
- ✅ Disable submit during submission
|
|
266
|
+
- ✅ Provide clear error messages
|
|
267
|
+
- ✅ Use proper input types (email, tel, number)
|
|
268
|
+
|
|
269
|
+
### API Integration
|
|
270
|
+
|
|
271
|
+
- ✅ Use {{DATA_FETCHING}} for server data
|
|
272
|
+
- ✅ Handle loading, success, and error states
|
|
273
|
+
- ✅ Implement proper error messages
|
|
274
|
+
- ✅ Cache responses when appropriate
|
|
275
|
+
- ✅ Cancel requests on component unmount
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
## 🎨 Code Style
|
|
280
|
+
|
|
281
|
+
### Naming Conventions
|
|
282
|
+
|
|
283
|
+
- **Components:** PascalCase (`UserProfile.tsx`)
|
|
284
|
+
- **Hooks/Composables:** camelCase with prefix (`useAuth`, `useCounter`)
|
|
285
|
+
- **Utilities:** camelCase (`formatDate`, `validateEmail`)
|
|
286
|
+
- **Constants:** UPPER_SNAKE_CASE (`API_BASE_URL`)
|
|
287
|
+
- **CSS Classes:** {{CSS_NAMING_CONVENTION}}
|
|
288
|
+
|
|
289
|
+
### File Structure
|
|
290
|
+
|
|
291
|
+
```
|
|
292
|
+
{{FILE_STRUCTURE_EXAMPLE}}
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
### Import Order
|
|
296
|
+
|
|
297
|
+
1. External libraries (react, vue, etc.)
|
|
298
|
+
2. Internal libraries (@/components, @/hooks)
|
|
299
|
+
3. Relative imports (./Button, ../utils)
|
|
300
|
+
4. Styles
|
|
301
|
+
5. Types (if separate file)
|
|
302
|
+
|
|
303
|
+
---
|
|
304
|
+
|
|
305
|
+
## 🚀 Development Workflow
|
|
306
|
+
|
|
307
|
+
### Before Starting Any Task
|
|
308
|
+
|
|
309
|
+
1. Read this document completely
|
|
310
|
+
2. Check `docs/components.md` for component patterns
|
|
311
|
+
3. Review `docs/state-management.md` for state patterns
|
|
312
|
+
4. Check `docs/styling.md` for styling guidelines
|
|
313
|
+
|
|
314
|
+
### When Creating Components
|
|
315
|
+
|
|
316
|
+
1. Start with TypeScript interface for props
|
|
317
|
+
2. Implement component logic
|
|
318
|
+
3. Add styles using {{STYLING_APPROACH}}
|
|
319
|
+
4. Write component tests
|
|
320
|
+
5. Update Storybook/documentation (if applicable)
|
|
321
|
+
|
|
322
|
+
### When Adding Features
|
|
323
|
+
|
|
324
|
+
1. Design component hierarchy
|
|
325
|
+
2. Identify state needs (local vs global)
|
|
326
|
+
3. Plan API integration
|
|
327
|
+
4. Implement with tests
|
|
328
|
+
5. Test accessibility
|
|
329
|
+
6. Check performance impact
|
|
330
|
+
|
|
331
|
+
### Before Committing
|
|
332
|
+
|
|
333
|
+
- ✅ Run linter: `npm run lint`
|
|
334
|
+
- ✅ Run tests: `npm test`
|
|
335
|
+
- ✅ Build succeeds: `npm run build`
|
|
336
|
+
- ✅ No console.log statements
|
|
337
|
+
- ✅ No commented code
|
|
338
|
+
|
|
339
|
+
---
|
|
340
|
+
|
|
341
|
+
## 📊 Performance Targets
|
|
342
|
+
|
|
343
|
+
**Core Web Vitals:**
|
|
344
|
+
- LCP (Largest Contentful Paint): {{LCP_TARGET}}
|
|
345
|
+
- FID (First Input Delay): {{FID_TARGET}}
|
|
346
|
+
- CLS (Cumulative Layout Shift): {{CLS_TARGET}}
|
|
347
|
+
|
|
348
|
+
**Bundle Size:**
|
|
349
|
+
- Initial bundle: {{INITIAL_BUNDLE_TARGET}}
|
|
350
|
+
- Route bundles: {{ROUTE_BUNDLE_TARGET}}
|
|
351
|
+
|
|
352
|
+
---
|
|
353
|
+
|
|
354
|
+
## 🔗 Related Documents
|
|
355
|
+
|
|
356
|
+
- [Component Architecture](docs/components.md) - Component patterns and structure
|
|
357
|
+
- [State Management](docs/state-management.md) - State management guidelines
|
|
358
|
+
- [Styling Guide](docs/styling.md) - Styling conventions
|
|
359
|
+
- [Testing Strategy](docs/testing.md) - Testing approach
|
|
360
|
+
- [API Integration](docs/api-integration.md) - API communication patterns
|
|
361
|
+
- [Performance](docs/performance.md) - Performance optimization
|
|
362
|
+
- [Accessibility](specs/accessibility.md) - WCAG compliance details
|
|
363
|
+
|
|
364
|
+
---
|
|
365
|
+
|
|
366
|
+
**Last Updated:** {{GENERATION_DATE}}
|
|
367
|
+
|
|
368
|
+
**Framework:** {{UI_FRAMEWORK}} {{UI_FRAMEWORK_VERSION}}
|