create-apppaaaul 2.0.39 → 2.0.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,568 @@
|
|
|
1
|
+
# GitHub Copilot - Code Review Instructions
|
|
2
|
+
|
|
3
|
+
## 🌐 Language / Idioma
|
|
4
|
+
**IMPORTANTE:** Todos los comentarios de revisión DEBEN estar en ESPAÑOL.
|
|
5
|
+
**IMPORTANT:** All review comments MUST be in SPANISH.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Git & Development Workflow Rules
|
|
10
|
+
|
|
11
|
+
You MUST follow this workflow strictly:
|
|
12
|
+
|
|
13
|
+
## Branching
|
|
14
|
+
- Never work directly on `dev` or `main`
|
|
15
|
+
- Every new feature MUST start by creating a new branch
|
|
16
|
+
- Branch naming convention:
|
|
17
|
+
- feature/<short-description>
|
|
18
|
+
- bugfix/<short-description>
|
|
19
|
+
|
|
20
|
+
## Base branch
|
|
21
|
+
- All feature branches MUST be created from `dev`
|
|
22
|
+
- All Pull Requests MUST target `dev`
|
|
23
|
+
|
|
24
|
+
## Git commands
|
|
25
|
+
When starting a new feature:
|
|
26
|
+
1. Checkout `dev`
|
|
27
|
+
2. Pull latest changes
|
|
28
|
+
3. Create a new feature branch
|
|
29
|
+
|
|
30
|
+
Example:
|
|
31
|
+
```bash
|
|
32
|
+
git checkout dev
|
|
33
|
+
git pull
|
|
34
|
+
git checkout -b feature/my-feature
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Commits
|
|
38
|
+
- Use clear and descriptive commit messages
|
|
39
|
+
- Prefer small commits
|
|
40
|
+
- Use conventional commit format (feat:, fix:, docs:, etc.)
|
|
41
|
+
|
|
42
|
+
## Pull Requests
|
|
43
|
+
|
|
44
|
+
### Title Format
|
|
45
|
+
```
|
|
46
|
+
[<project_name>] Descripción clara y concisa
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Requirements
|
|
50
|
+
- PRs pequeños y enfocados
|
|
51
|
+
- Explicar: qué, por qué, cómo se verificó
|
|
52
|
+
- Pre-commit checks passed
|
|
53
|
+
|
|
54
|
+
### Pre-PR Checklist
|
|
55
|
+
```bash
|
|
56
|
+
pnpm lint
|
|
57
|
+
pnpm test
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### When the user says the feature is finished:
|
|
61
|
+
- Push the branch
|
|
62
|
+
- Create a Pull Request to `dev`
|
|
63
|
+
- Do NOT merge
|
|
64
|
+
- Mention that PR requires approval from another developer
|
|
65
|
+
|
|
66
|
+
## Restrictions
|
|
67
|
+
- Never merge to `dev` or `main`
|
|
68
|
+
- Never bypass GitHub Pull Request approvals
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
# Project Setup & Stack
|
|
73
|
+
|
|
74
|
+
## Package Manager
|
|
75
|
+
- **OBLIGATORIO:** pnpm
|
|
76
|
+
- **PROHIBIDO:** npm, yarn
|
|
77
|
+
|
|
78
|
+
## Framework & Core Stack
|
|
79
|
+
- **Default:** Next.js para proyectos nuevos
|
|
80
|
+
- **TypeScript:** Obligatorio en modo estricto desde el inicio
|
|
81
|
+
- **Styling:** Tailwind CSS con integración oficial de Next.js
|
|
82
|
+
- **Module System:** ESM y sintaxis moderna del navegador
|
|
83
|
+
|
|
84
|
+
## Initial Setup Checklist
|
|
85
|
+
1. Next.js con TypeScript strict
|
|
86
|
+
2. Tailwind CSS oficial
|
|
87
|
+
3. ESLint configurado
|
|
88
|
+
4. Git configurado (.gitignore)
|
|
89
|
+
5. README básico
|
|
90
|
+
|
|
91
|
+
## Principios
|
|
92
|
+
- No añadir dependencias hasta que sean necesarias
|
|
93
|
+
- Configurar tooling completo desde el inicio
|
|
94
|
+
- Validar configuración antes de continuar
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
# TypeScript Rules
|
|
99
|
+
|
|
100
|
+
## Type Safety (STRICT)
|
|
101
|
+
- **PROHIBIDO:** `any`
|
|
102
|
+
- **EVITAR:** `unknown` (usar solo cuando sea estrictamente necesario)
|
|
103
|
+
- **PREFERIR:** Inferencia de tipos cuando sea posible
|
|
104
|
+
|
|
105
|
+
## Decision Making
|
|
106
|
+
Si los tipos no están claros:
|
|
107
|
+
1. **PARAR**
|
|
108
|
+
2. Aclarar con el usuario
|
|
109
|
+
3. No continuar con tipos ambiguos
|
|
110
|
+
|
|
111
|
+
## Best Practices
|
|
112
|
+
- Enable strict mode in tsconfig.json
|
|
113
|
+
- Usar tipos explícitos en interfaces públicas
|
|
114
|
+
- Aprovechar inferencia en implementaciones
|
|
115
|
+
- Nunca hacer type casting sin justificación
|
|
116
|
+
- Documentar tipos complejos
|
|
117
|
+
- Define explicit return types for public functions
|
|
118
|
+
- Use type guards for runtime type checking
|
|
119
|
+
|
|
120
|
+
## Interfaces and Types
|
|
121
|
+
- Prefer interfaces for object shapes that may be extended
|
|
122
|
+
- Use type aliases for unions, intersections, and utility types
|
|
123
|
+
- Export types that are part of the public API
|
|
124
|
+
|
|
125
|
+
## Null Safety
|
|
126
|
+
- Enable strictNullChecks
|
|
127
|
+
- Use optional chaining (`?.`) and nullish coalescing (`??`)
|
|
128
|
+
- Avoid non-null assertions (`!`) unless absolutely necessary
|
|
129
|
+
|
|
130
|
+
## Functions
|
|
131
|
+
- Use arrow functions for callbacks and short functions
|
|
132
|
+
- Use function declarations for hoisted functions
|
|
133
|
+
- Prefer async/await over raw promises
|
|
134
|
+
- Handle both success and error cases in async functions
|
|
135
|
+
|
|
136
|
+
## Imports
|
|
137
|
+
- Use ESM imports (import/export)
|
|
138
|
+
- Order imports: external packages, then internal modules
|
|
139
|
+
- Use type-only imports when importing only types
|
|
140
|
+
|
|
141
|
+
## Naming Conventions
|
|
142
|
+
- PascalCase for classes, interfaces, types, and enums
|
|
143
|
+
- camelCase for variables, functions, and methods
|
|
144
|
+
- UPPER_SNAKE_CASE for constants
|
|
145
|
+
- Prefix interfaces for implementations (e.g., `ILogger` for interface, `ConsoleLogger` for implementation)
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
# Next.js & React Best Practices
|
|
150
|
+
|
|
151
|
+
## Code Style and Structure
|
|
152
|
+
- Write concise, technical TypeScript code
|
|
153
|
+
- Use functional and declarative patterns; avoid classes
|
|
154
|
+
- Favor modularization over code duplication
|
|
155
|
+
- Descriptive variable names with auxiliary verbs: `isLoading`, `hasError`
|
|
156
|
+
- File structure: exported components, subcomponents, helpers, static content, types
|
|
157
|
+
- Directory naming: lowercase-with-dashes (`components/auth-wizard`)
|
|
158
|
+
|
|
159
|
+
## Optimization and Best Practices
|
|
160
|
+
- **MINIMIZE** `'use client'`, `useEffect`, `setState`
|
|
161
|
+
- **FAVOR** React Server Components (RSC) and Next.js SSR
|
|
162
|
+
- Use dynamic imports for code splitting
|
|
163
|
+
- Mobile-first responsive design
|
|
164
|
+
- **Images:** WebP format, size data, lazy loading
|
|
165
|
+
|
|
166
|
+
## Component Design
|
|
167
|
+
- Componentes pequeños, una sola responsabilidad
|
|
168
|
+
- Composición > configuraciones complejas
|
|
169
|
+
- Evitar abstracciones prematuras
|
|
170
|
+
- Use early returns for readability
|
|
171
|
+
- Use consts instead of functions: `const toggle = () => {}`
|
|
172
|
+
- Define types when possible
|
|
173
|
+
|
|
174
|
+
## Error Handling and Validation
|
|
175
|
+
- Prioritize error handling and edge cases
|
|
176
|
+
- Use early returns for error conditions
|
|
177
|
+
- Implement guard clauses for preconditions and invalid states
|
|
178
|
+
- Use custom error types for consistency
|
|
179
|
+
|
|
180
|
+
## State Management and Data Fetching
|
|
181
|
+
- Use Zustand or TanStack React Query for global state
|
|
182
|
+
- Use Zod for schema validation
|
|
183
|
+
|
|
184
|
+
## Architecture
|
|
185
|
+
- Follow clean architecture principles with clear separation of concerns
|
|
186
|
+
- Keep business logic separate from infrastructure code
|
|
187
|
+
- Use dependency injection for external services
|
|
188
|
+
- Each component should have a single responsibility
|
|
189
|
+
- Use interfaces to define contracts between layers
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
# Code Organization
|
|
194
|
+
|
|
195
|
+
## Folder Structure
|
|
196
|
+
Código compartido debe vivir en:
|
|
197
|
+
- `components/` - Componentes reutilizables
|
|
198
|
+
- `layouts/` - Layouts de página
|
|
199
|
+
- `lib/` - Utilidades y lógica de negocio
|
|
200
|
+
- `utils/` - Funciones auxiliares puras
|
|
201
|
+
|
|
202
|
+
## File Organization
|
|
203
|
+
- Group files by feature/domain, not by type
|
|
204
|
+
- Keep related files close together
|
|
205
|
+
- Avoid circular dependencies between modules
|
|
206
|
+
|
|
207
|
+
## Best Practices
|
|
208
|
+
- Nombres descriptivos y claros
|
|
209
|
+
- Archivos pequeños y enfocados
|
|
210
|
+
- Importaciones explícitas (no barrels)
|
|
211
|
+
- Separación clara de concerns
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
# UI & Styling
|
|
216
|
+
|
|
217
|
+
## CSS Framework
|
|
218
|
+
- **ÚNICO PERMITIDO:** Tailwind CSS
|
|
219
|
+
- **PROHIBIDO:** CSS-in-JS, CSS modules, styled-components
|
|
220
|
+
- Always use Tailwind classes for styling
|
|
221
|
+
- Avoid custom CSS or `<style>` tags
|
|
222
|
+
|
|
223
|
+
## Icons
|
|
224
|
+
- **LIBRERÍA:** tabler-icons
|
|
225
|
+
- **IMPORTACIÓN:** Explícita, nunca barrels
|
|
226
|
+
```typescript
|
|
227
|
+
// ✅ Correcto
|
|
228
|
+
import { IconHome } from '@tabler/icons-react';
|
|
229
|
+
|
|
230
|
+
// ❌ Incorrecto
|
|
231
|
+
import * as Icons from '@tabler/icons-react';
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
## Component Libraries Priority Order
|
|
235
|
+
1. **Magic UI** (preferido)
|
|
236
|
+
2. **Hero UI**
|
|
237
|
+
3. **Yai Bars**
|
|
238
|
+
4. **ShadCN** (solo como base)
|
|
239
|
+
|
|
240
|
+
### Rules
|
|
241
|
+
- No mezclar estilos incompatibles
|
|
242
|
+
- Coherencia > creatividad
|
|
243
|
+
- No depender solo de ShadCN
|
|
244
|
+
|
|
245
|
+
## Component Extraction
|
|
246
|
+
- No duplicar clases Tailwind
|
|
247
|
+
- Si se repite → extraer componente
|
|
248
|
+
- Legibilidad > micro-optimizaciones
|
|
249
|
+
|
|
250
|
+
## Accessibility (NO OPCIONAL)
|
|
251
|
+
- HTML semántico obligatorio
|
|
252
|
+
- Add `tabindex="0"` to interactive elements
|
|
253
|
+
- Include `aria-label` attributes
|
|
254
|
+
- Implement keyboard handlers: `onClick` + `onKeyDown`
|
|
255
|
+
- Roles ARIA cuando aplique
|
|
256
|
+
- Gestión de foco (teclado)
|
|
257
|
+
- Contraste de colores adecuado
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
# Brand & UI System - Visual Identity
|
|
262
|
+
|
|
263
|
+
## Color Palette Selection
|
|
264
|
+
|
|
265
|
+
### Palette Gallery
|
|
266
|
+
|
|
267
|
+
#### A — SaaS Confiable
|
|
268
|
+
```
|
|
269
|
+
Primary: #6366F1 (Indigo)
|
|
270
|
+
Secondary: #22D3EE (Cyan)
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
#### B — Creativo Premium
|
|
274
|
+
```
|
|
275
|
+
Primary: #8B5CF6 (Violet)
|
|
276
|
+
Secondary: #F472B6 (Pink)
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
#### C — Indie Founder
|
|
280
|
+
```
|
|
281
|
+
Primary: #F97316 (Orange)
|
|
282
|
+
Secondary: #FDBA74 (Light orange)
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
#### D — Herramienta Potente
|
|
286
|
+
```
|
|
287
|
+
Primary: #22C55E (Green)
|
|
288
|
+
Secondary: #4ADE80 (Light green)
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
## Automatic Selection Logic
|
|
292
|
+
1. Si `globals.css` contiene `--color-primary` → usar existente
|
|
293
|
+
2. Si NO existe → elegir paleta de la galería
|
|
294
|
+
3. Si usuario pide "define color" → elegir de galería
|
|
295
|
+
4. Guardar resultado en `globals.css`
|
|
296
|
+
|
|
297
|
+
## Color Variants (HSL)
|
|
298
|
+
Desde color primario generar:
|
|
299
|
+
|
|
300
|
+
### Light Variant
|
|
301
|
+
- Saturación: -20
|
|
302
|
+
- Luminosidad: +5
|
|
303
|
+
|
|
304
|
+
### Dark Variant
|
|
305
|
+
- Saturación: +20
|
|
306
|
+
- Luminosidad: -5
|
|
307
|
+
|
|
308
|
+
**OBLIGATORIO** para mantener armonía visual.
|
|
309
|
+
|
|
310
|
+
## Theme Settings
|
|
311
|
+
|
|
312
|
+
### Default Theme
|
|
313
|
+
- Dark mode por defecto
|
|
314
|
+
|
|
315
|
+
### Tailwind Backgrounds
|
|
316
|
+
#### Dark Mode
|
|
317
|
+
- `slate-950` (más oscuro)
|
|
318
|
+
- `slate-900`
|
|
319
|
+
- `slate-800` (menos oscuro)
|
|
320
|
+
|
|
321
|
+
#### Light Mode
|
|
322
|
+
- `slate-50` (más claro)
|
|
323
|
+
- `slate-100`
|
|
324
|
+
- `slate-200` (menos claro)
|
|
325
|
+
|
|
326
|
+
## Color Usage Rule
|
|
327
|
+
|
|
328
|
+
### 60-20-20 Rule (OBLIGATORIO)
|
|
329
|
+
- 60% color primario
|
|
330
|
+
- 20% color secundario
|
|
331
|
+
- 20% acentos
|
|
332
|
+
|
|
333
|
+
### PROHIBIDO
|
|
334
|
+
- Paletas arcoíris
|
|
335
|
+
- Múltiples colores sin coherencia
|
|
336
|
+
- Si más colores necesarios → bajar saturación
|
|
337
|
+
|
|
338
|
+
## Visual Style Guidelines
|
|
339
|
+
|
|
340
|
+
### Objetivo
|
|
341
|
+
Evitar "vibe-coding UI" - UI debe parecer diseñada a mano, no por IA.
|
|
342
|
+
|
|
343
|
+
### Depth & Elevation
|
|
344
|
+
- **OBLIGATORIO:** Profundidad (sombras + capas)
|
|
345
|
+
- **EVITAR:** Look plano de ShadCN
|
|
346
|
+
- Mínimo 3 niveles de elevación
|
|
347
|
+
- Botones: luz + sombra
|
|
348
|
+
|
|
349
|
+
### Border Radius Standards
|
|
350
|
+
```css
|
|
351
|
+
Botones: 10px
|
|
352
|
+
Inputs: 10px
|
|
353
|
+
Cards: 14px
|
|
354
|
+
Modals: 16px
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
### Layout Constraints
|
|
358
|
+
- Desktop: `max-w-7xl` obligatorio
|
|
359
|
+
- **PROHIBIDO:** contenido full-width sin márgenes
|
|
360
|
+
|
|
361
|
+
## AI UI Generation Rules
|
|
362
|
+
|
|
363
|
+
Cuando generes UI:
|
|
364
|
+
- ✅ Usar SOLO colores definidos/elegidos
|
|
365
|
+
- ❌ NUNCA Tailwind default colors
|
|
366
|
+
- ✅ Añadir siempre profundidad y luz
|
|
367
|
+
- ❌ Evitar dashboards genéricos
|
|
368
|
+
- ✅ Objetivo: parecer diseñado a mano, no por IA
|
|
369
|
+
|
|
370
|
+
---
|
|
371
|
+
|
|
372
|
+
# Testing & Quality Standards
|
|
373
|
+
|
|
374
|
+
## Pre-commit Checklist
|
|
375
|
+
```bash
|
|
376
|
+
pnpm lint # Sin errores
|
|
377
|
+
pnpm test # Todos pasando
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
## Running Tests
|
|
381
|
+
|
|
382
|
+
### Global
|
|
383
|
+
```bash
|
|
384
|
+
pnpm test
|
|
385
|
+
pnpm turbo run test --filter <project_name>
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
### Vitest (specific test)
|
|
389
|
+
```bash
|
|
390
|
+
pnpm vitest run -t "<nombre del test>"
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
## After File Changes
|
|
394
|
+
Tras mover archivos o cambiar imports:
|
|
395
|
+
```bash
|
|
396
|
+
pnpm lint
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
## Quality Rules
|
|
400
|
+
- **PROHIBIDO:** Código con errores de tipos
|
|
401
|
+
- **PROHIBIDO:** Código con errores de lint
|
|
402
|
+
- **PROHIBIDO:** Tests fallidos
|
|
403
|
+
- **OBLIGATORIO:** Añadir/actualizar tests al cambiar comportamiento
|
|
404
|
+
|
|
405
|
+
## Testing Best Practices
|
|
406
|
+
- Write tests for all business logic
|
|
407
|
+
- Follow the AAA pattern (Arrange, Act, Assert)
|
|
408
|
+
- Use descriptive test names that explain the scenario
|
|
409
|
+
- Mock external dependencies
|
|
410
|
+
|
|
411
|
+
## CI/CD
|
|
412
|
+
Revisar workflows en `.github/workflows` antes de hacer cambios
|
|
413
|
+
|
|
414
|
+
---
|
|
415
|
+
|
|
416
|
+
# Code Conventions
|
|
417
|
+
|
|
418
|
+
## General
|
|
419
|
+
- Write self-documenting code with clear names
|
|
420
|
+
- Keep functions small and focused (max 30 lines preferred)
|
|
421
|
+
- Avoid magic numbers and strings - use named constants
|
|
422
|
+
- Delete dead code - don't comment it out
|
|
423
|
+
|
|
424
|
+
## Comments
|
|
425
|
+
- Write comments that explain WHY, not WHAT
|
|
426
|
+
- Use JSDoc for public API documentation
|
|
427
|
+
- Keep comments up to date with code changes
|
|
428
|
+
- Avoid TODO comments in production code
|
|
429
|
+
|
|
430
|
+
## Formatting
|
|
431
|
+
- Use consistent indentation (2 spaces)
|
|
432
|
+
- Keep lines under 100 characters
|
|
433
|
+
- Use trailing commas in multiline structures
|
|
434
|
+
- Add blank lines between logical sections
|
|
435
|
+
|
|
436
|
+
## Event Handlers Naming
|
|
437
|
+
- Event handlers: `handle` prefix (`handleClick`, `handleKeyDown`)
|
|
438
|
+
- Variables: descriptive with context (`isModalOpen`, `hasError`)
|
|
439
|
+
|
|
440
|
+
---
|
|
441
|
+
|
|
442
|
+
# Performance & Technical Decisions
|
|
443
|
+
|
|
444
|
+
## Measurement First
|
|
445
|
+
- **NO ADIVINAR:** rendimiento, bundle size, load times
|
|
446
|
+
- **MEDIR PRIMERO:** instrumentar antes de optimizar
|
|
447
|
+
- **VALIDAR:** probar en pequeño antes de escalar
|
|
448
|
+
|
|
449
|
+
## Optimization Process
|
|
450
|
+
1. Identificar problema real (con métricas)
|
|
451
|
+
2. Añadir instrumentación
|
|
452
|
+
3. Medir baseline
|
|
453
|
+
4. Implementar mejora
|
|
454
|
+
5. Medir impacto
|
|
455
|
+
6. Validar en producción similar
|
|
456
|
+
|
|
457
|
+
## Anti-patterns
|
|
458
|
+
- ❌ Optimizar sin medir
|
|
459
|
+
- ❌ Asumir cuellos de botella
|
|
460
|
+
- ❌ Escalar cambios sin validar
|
|
461
|
+
- ❌ Micro-optimizaciones prematuras
|
|
462
|
+
|
|
463
|
+
---
|
|
464
|
+
|
|
465
|
+
# Error Handling & Security
|
|
466
|
+
|
|
467
|
+
## Error Handling
|
|
468
|
+
- Use typed errors with clear error codes
|
|
469
|
+
- Handle errors at the appropriate level
|
|
470
|
+
- Log errors with sufficient context for debugging
|
|
471
|
+
- Use Bootstrap's built-in form validation styles (if using Bootstrap)
|
|
472
|
+
- Display errors with appropriate UI components
|
|
473
|
+
|
|
474
|
+
## Configuration
|
|
475
|
+
- All configuration should come from environment variables
|
|
476
|
+
- Never hardcode sensitive values
|
|
477
|
+
- Provide sensible defaults where appropriate
|
|
478
|
+
|
|
479
|
+
## Security
|
|
480
|
+
- Never log sensitive data (passwords, tokens, PII)
|
|
481
|
+
- Validate and sanitize all user input
|
|
482
|
+
- Use parameterized queries for database operations
|
|
483
|
+
- Keep dependencies updated for security patches
|
|
484
|
+
|
|
485
|
+
---
|
|
486
|
+
|
|
487
|
+
# AI Agent Behavior Rules
|
|
488
|
+
|
|
489
|
+
## Decision Making
|
|
490
|
+
|
|
491
|
+
### When to Ask
|
|
492
|
+
Si la petición NO está clara:
|
|
493
|
+
- Hacer preguntas concretas
|
|
494
|
+
- No asumir requisitos implícitos
|
|
495
|
+
- Esperar confirmación antes de ejecutar
|
|
496
|
+
|
|
497
|
+
### When to Execute
|
|
498
|
+
Tareas simples y bien definidas:
|
|
499
|
+
- Ejecutar directamente
|
|
500
|
+
- No pedir confirmación innecesaria
|
|
501
|
+
|
|
502
|
+
### Complex Changes
|
|
503
|
+
Refactors, features nuevas, decisiones de arquitectura:
|
|
504
|
+
1. Confirmar entendimiento
|
|
505
|
+
2. Explicar approach
|
|
506
|
+
3. Esperar aprobación
|
|
507
|
+
4. Ejecutar
|
|
508
|
+
|
|
509
|
+
## Information Gathering
|
|
510
|
+
- Si falta información → preguntar
|
|
511
|
+
- No asumir contexto que no existe
|
|
512
|
+
- Mejor sobre-comunicar que sub-comunicar
|
|
513
|
+
|
|
514
|
+
## Execution Principles
|
|
515
|
+
- Claridad antes que velocidad
|
|
516
|
+
- Preguntas específicas > adivinanzas
|
|
517
|
+
- Confirmación en cambios grandes
|
|
518
|
+
- Autonomía en cambios pequeños
|
|
519
|
+
|
|
520
|
+
---
|
|
521
|
+
|
|
522
|
+
# Documentation
|
|
523
|
+
|
|
524
|
+
Si introduces nueva restricción ("nunca X", "siempre Y"):
|
|
525
|
+
- Documentar en archivo de reglas correspondiente
|
|
526
|
+
- Explicar el porqué
|
|
527
|
+
|
|
528
|
+
---
|
|
529
|
+
|
|
530
|
+
# Review Checklist
|
|
531
|
+
|
|
532
|
+
Al revisar código, verificar:
|
|
533
|
+
|
|
534
|
+
## ✅ TypeScript
|
|
535
|
+
- [ ] No hay uso de `any`
|
|
536
|
+
- [ ] Tipos explícitos en APIs públicas
|
|
537
|
+
- [ ] Modo estricto habilitado
|
|
538
|
+
|
|
539
|
+
## ✅ Styling
|
|
540
|
+
- [ ] Solo Tailwind CSS (no CSS custom)
|
|
541
|
+
- [ ] Iconos de tabler-icons con importación explícita
|
|
542
|
+
- [ ] Cumple reglas de color y profundidad visual
|
|
543
|
+
|
|
544
|
+
## ✅ Code Quality
|
|
545
|
+
- [ ] Componentes pequeños y enfocados
|
|
546
|
+
- [ ] Sin código duplicado
|
|
547
|
+
- [ ] Nombres descriptivos
|
|
548
|
+
- [ ] Imports ordenados y explícitos
|
|
549
|
+
|
|
550
|
+
## ✅ Testing
|
|
551
|
+
- [ ] Tests pasando
|
|
552
|
+
- [ ] Sin errores de lint
|
|
553
|
+
- [ ] Sin errores de tipos
|
|
554
|
+
|
|
555
|
+
## ✅ Performance
|
|
556
|
+
- [ ] Minimiza `use client`
|
|
557
|
+
- [ ] Usa RSC cuando es posible
|
|
558
|
+
- [ ] Lazy loading de imágenes
|
|
559
|
+
|
|
560
|
+
## ✅ Accessibility
|
|
561
|
+
- [ ] HTML semántico
|
|
562
|
+
- [ ] ARIA labels donde necesario
|
|
563
|
+
- [ ] Navegación por teclado
|
|
564
|
+
|
|
565
|
+
## ✅ Git
|
|
566
|
+
- [ ] Commits descriptivos
|
|
567
|
+
- [ ] Branch desde `dev`
|
|
568
|
+
- [ ] PR apunta a `dev`
|
|
@@ -0,0 +1,568 @@
|
|
|
1
|
+
# GitHub Copilot - Code Review Instructions
|
|
2
|
+
|
|
3
|
+
## 🌐 Language / Idioma
|
|
4
|
+
**IMPORTANTE:** Todos los comentarios de revisión DEBEN estar en ESPAÑOL.
|
|
5
|
+
**IMPORTANT:** All review comments MUST be in SPANISH.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Git & Development Workflow Rules
|
|
10
|
+
|
|
11
|
+
You MUST follow this workflow strictly:
|
|
12
|
+
|
|
13
|
+
## Branching
|
|
14
|
+
- Never work directly on `dev` or `main`
|
|
15
|
+
- Every new feature MUST start by creating a new branch
|
|
16
|
+
- Branch naming convention:
|
|
17
|
+
- feature/<short-description>
|
|
18
|
+
- bugfix/<short-description>
|
|
19
|
+
|
|
20
|
+
## Base branch
|
|
21
|
+
- All feature branches MUST be created from `dev`
|
|
22
|
+
- All Pull Requests MUST target `dev`
|
|
23
|
+
|
|
24
|
+
## Git commands
|
|
25
|
+
When starting a new feature:
|
|
26
|
+
1. Checkout `dev`
|
|
27
|
+
2. Pull latest changes
|
|
28
|
+
3. Create a new feature branch
|
|
29
|
+
|
|
30
|
+
Example:
|
|
31
|
+
```bash
|
|
32
|
+
git checkout dev
|
|
33
|
+
git pull
|
|
34
|
+
git checkout -b feature/my-feature
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Commits
|
|
38
|
+
- Use clear and descriptive commit messages
|
|
39
|
+
- Prefer small commits
|
|
40
|
+
- Use conventional commit format (feat:, fix:, docs:, etc.)
|
|
41
|
+
|
|
42
|
+
## Pull Requests
|
|
43
|
+
|
|
44
|
+
### Title Format
|
|
45
|
+
```
|
|
46
|
+
[<project_name>] Descripción clara y concisa
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Requirements
|
|
50
|
+
- PRs pequeños y enfocados
|
|
51
|
+
- Explicar: qué, por qué, cómo se verificó
|
|
52
|
+
- Pre-commit checks passed
|
|
53
|
+
|
|
54
|
+
### Pre-PR Checklist
|
|
55
|
+
```bash
|
|
56
|
+
pnpm lint
|
|
57
|
+
pnpm test
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### When the user says the feature is finished:
|
|
61
|
+
- Push the branch
|
|
62
|
+
- Create a Pull Request to `dev`
|
|
63
|
+
- Do NOT merge
|
|
64
|
+
- Mention that PR requires approval from another developer
|
|
65
|
+
|
|
66
|
+
## Restrictions
|
|
67
|
+
- Never merge to `dev` or `main`
|
|
68
|
+
- Never bypass GitHub Pull Request approvals
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
# Project Setup & Stack
|
|
73
|
+
|
|
74
|
+
## Package Manager
|
|
75
|
+
- **OBLIGATORIO:** pnpm
|
|
76
|
+
- **PROHIBIDO:** npm, yarn
|
|
77
|
+
|
|
78
|
+
## Framework & Core Stack
|
|
79
|
+
- **Default:** Next.js para proyectos nuevos
|
|
80
|
+
- **TypeScript:** Obligatorio en modo estricto desde el inicio
|
|
81
|
+
- **Styling:** Tailwind CSS con integración oficial de Next.js
|
|
82
|
+
- **Module System:** ESM y sintaxis moderna del navegador
|
|
83
|
+
|
|
84
|
+
## Initial Setup Checklist
|
|
85
|
+
1. Next.js con TypeScript strict
|
|
86
|
+
2. Tailwind CSS oficial
|
|
87
|
+
3. ESLint configurado
|
|
88
|
+
4. Git configurado (.gitignore)
|
|
89
|
+
5. README básico
|
|
90
|
+
|
|
91
|
+
## Principios
|
|
92
|
+
- No añadir dependencias hasta que sean necesarias
|
|
93
|
+
- Configurar tooling completo desde el inicio
|
|
94
|
+
- Validar configuración antes de continuar
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
# TypeScript Rules
|
|
99
|
+
|
|
100
|
+
## Type Safety (STRICT)
|
|
101
|
+
- **PROHIBIDO:** `any`
|
|
102
|
+
- **EVITAR:** `unknown` (usar solo cuando sea estrictamente necesario)
|
|
103
|
+
- **PREFERIR:** Inferencia de tipos cuando sea posible
|
|
104
|
+
|
|
105
|
+
## Decision Making
|
|
106
|
+
Si los tipos no están claros:
|
|
107
|
+
1. **PARAR**
|
|
108
|
+
2. Aclarar con el usuario
|
|
109
|
+
3. No continuar con tipos ambiguos
|
|
110
|
+
|
|
111
|
+
## Best Practices
|
|
112
|
+
- Enable strict mode in tsconfig.json
|
|
113
|
+
- Usar tipos explícitos en interfaces públicas
|
|
114
|
+
- Aprovechar inferencia en implementaciones
|
|
115
|
+
- Nunca hacer type casting sin justificación
|
|
116
|
+
- Documentar tipos complejos
|
|
117
|
+
- Define explicit return types for public functions
|
|
118
|
+
- Use type guards for runtime type checking
|
|
119
|
+
|
|
120
|
+
## Interfaces and Types
|
|
121
|
+
- Prefer interfaces for object shapes that may be extended
|
|
122
|
+
- Use type aliases for unions, intersections, and utility types
|
|
123
|
+
- Export types that are part of the public API
|
|
124
|
+
|
|
125
|
+
## Null Safety
|
|
126
|
+
- Enable strictNullChecks
|
|
127
|
+
- Use optional chaining (`?.`) and nullish coalescing (`??`)
|
|
128
|
+
- Avoid non-null assertions (`!`) unless absolutely necessary
|
|
129
|
+
|
|
130
|
+
## Functions
|
|
131
|
+
- Use arrow functions for callbacks and short functions
|
|
132
|
+
- Use function declarations for hoisted functions
|
|
133
|
+
- Prefer async/await over raw promises
|
|
134
|
+
- Handle both success and error cases in async functions
|
|
135
|
+
|
|
136
|
+
## Imports
|
|
137
|
+
- Use ESM imports (import/export)
|
|
138
|
+
- Order imports: external packages, then internal modules
|
|
139
|
+
- Use type-only imports when importing only types
|
|
140
|
+
|
|
141
|
+
## Naming Conventions
|
|
142
|
+
- PascalCase for classes, interfaces, types, and enums
|
|
143
|
+
- camelCase for variables, functions, and methods
|
|
144
|
+
- UPPER_SNAKE_CASE for constants
|
|
145
|
+
- Prefix interfaces for implementations (e.g., `ILogger` for interface, `ConsoleLogger` for implementation)
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
# Next.js & React Best Practices
|
|
150
|
+
|
|
151
|
+
## Code Style and Structure
|
|
152
|
+
- Write concise, technical TypeScript code
|
|
153
|
+
- Use functional and declarative patterns; avoid classes
|
|
154
|
+
- Favor modularization over code duplication
|
|
155
|
+
- Descriptive variable names with auxiliary verbs: `isLoading`, `hasError`
|
|
156
|
+
- File structure: exported components, subcomponents, helpers, static content, types
|
|
157
|
+
- Directory naming: lowercase-with-dashes (`components/auth-wizard`)
|
|
158
|
+
|
|
159
|
+
## Optimization and Best Practices
|
|
160
|
+
- **MINIMIZE** `'use client'`, `useEffect`, `setState`
|
|
161
|
+
- **FAVOR** React Server Components (RSC) and Next.js SSR
|
|
162
|
+
- Use dynamic imports for code splitting
|
|
163
|
+
- Mobile-first responsive design
|
|
164
|
+
- **Images:** WebP format, size data, lazy loading
|
|
165
|
+
|
|
166
|
+
## Component Design
|
|
167
|
+
- Componentes pequeños, una sola responsabilidad
|
|
168
|
+
- Composición > configuraciones complejas
|
|
169
|
+
- Evitar abstracciones prematuras
|
|
170
|
+
- Use early returns for readability
|
|
171
|
+
- Use consts instead of functions: `const toggle = () => {}`
|
|
172
|
+
- Define types when possible
|
|
173
|
+
|
|
174
|
+
## Error Handling and Validation
|
|
175
|
+
- Prioritize error handling and edge cases
|
|
176
|
+
- Use early returns for error conditions
|
|
177
|
+
- Implement guard clauses for preconditions and invalid states
|
|
178
|
+
- Use custom error types for consistency
|
|
179
|
+
|
|
180
|
+
## State Management and Data Fetching
|
|
181
|
+
- Use Zustand or TanStack React Query for global state
|
|
182
|
+
- Use Zod for schema validation
|
|
183
|
+
|
|
184
|
+
## Architecture
|
|
185
|
+
- Follow clean architecture principles with clear separation of concerns
|
|
186
|
+
- Keep business logic separate from infrastructure code
|
|
187
|
+
- Use dependency injection for external services
|
|
188
|
+
- Each component should have a single responsibility
|
|
189
|
+
- Use interfaces to define contracts between layers
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
# Code Organization
|
|
194
|
+
|
|
195
|
+
## Folder Structure
|
|
196
|
+
Código compartido debe vivir en:
|
|
197
|
+
- `components/` - Componentes reutilizables
|
|
198
|
+
- `layouts/` - Layouts de página
|
|
199
|
+
- `lib/` - Utilidades y lógica de negocio
|
|
200
|
+
- `utils/` - Funciones auxiliares puras
|
|
201
|
+
|
|
202
|
+
## File Organization
|
|
203
|
+
- Group files by feature/domain, not by type
|
|
204
|
+
- Keep related files close together
|
|
205
|
+
- Avoid circular dependencies between modules
|
|
206
|
+
|
|
207
|
+
## Best Practices
|
|
208
|
+
- Nombres descriptivos y claros
|
|
209
|
+
- Archivos pequeños y enfocados
|
|
210
|
+
- Importaciones explícitas (no barrels)
|
|
211
|
+
- Separación clara de concerns
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
# UI & Styling
|
|
216
|
+
|
|
217
|
+
## CSS Framework
|
|
218
|
+
- **ÚNICO PERMITIDO:** Tailwind CSS
|
|
219
|
+
- **PROHIBIDO:** CSS-in-JS, CSS modules, styled-components
|
|
220
|
+
- Always use Tailwind classes for styling
|
|
221
|
+
- Avoid custom CSS or `<style>` tags
|
|
222
|
+
|
|
223
|
+
## Icons
|
|
224
|
+
- **LIBRERÍA:** tabler-icons
|
|
225
|
+
- **IMPORTACIÓN:** Explícita, nunca barrels
|
|
226
|
+
```typescript
|
|
227
|
+
// ✅ Correcto
|
|
228
|
+
import { IconHome } from '@tabler/icons-react';
|
|
229
|
+
|
|
230
|
+
// ❌ Incorrecto
|
|
231
|
+
import * as Icons from '@tabler/icons-react';
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
## Component Libraries Priority Order
|
|
235
|
+
1. **Magic UI** (preferido)
|
|
236
|
+
2. **Hero UI**
|
|
237
|
+
3. **Yai Bars**
|
|
238
|
+
4. **ShadCN** (solo como base)
|
|
239
|
+
|
|
240
|
+
### Rules
|
|
241
|
+
- No mezclar estilos incompatibles
|
|
242
|
+
- Coherencia > creatividad
|
|
243
|
+
- No depender solo de ShadCN
|
|
244
|
+
|
|
245
|
+
## Component Extraction
|
|
246
|
+
- No duplicar clases Tailwind
|
|
247
|
+
- Si se repite → extraer componente
|
|
248
|
+
- Legibilidad > micro-optimizaciones
|
|
249
|
+
|
|
250
|
+
## Accessibility (NO OPCIONAL)
|
|
251
|
+
- HTML semántico obligatorio
|
|
252
|
+
- Add `tabindex="0"` to interactive elements
|
|
253
|
+
- Include `aria-label` attributes
|
|
254
|
+
- Implement keyboard handlers: `onClick` + `onKeyDown`
|
|
255
|
+
- Roles ARIA cuando aplique
|
|
256
|
+
- Gestión de foco (teclado)
|
|
257
|
+
- Contraste de colores adecuado
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
# Brand & UI System - Visual Identity
|
|
262
|
+
|
|
263
|
+
## Color Palette Selection
|
|
264
|
+
|
|
265
|
+
### Palette Gallery
|
|
266
|
+
|
|
267
|
+
#### A — SaaS Confiable
|
|
268
|
+
```
|
|
269
|
+
Primary: #6366F1 (Indigo)
|
|
270
|
+
Secondary: #22D3EE (Cyan)
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
#### B — Creativo Premium
|
|
274
|
+
```
|
|
275
|
+
Primary: #8B5CF6 (Violet)
|
|
276
|
+
Secondary: #F472B6 (Pink)
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
#### C — Indie Founder
|
|
280
|
+
```
|
|
281
|
+
Primary: #F97316 (Orange)
|
|
282
|
+
Secondary: #FDBA74 (Light orange)
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
#### D — Herramienta Potente
|
|
286
|
+
```
|
|
287
|
+
Primary: #22C55E (Green)
|
|
288
|
+
Secondary: #4ADE80 (Light green)
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
## Automatic Selection Logic
|
|
292
|
+
1. Si `globals.css` contiene `--color-primary` → usar existente
|
|
293
|
+
2. Si NO existe → elegir paleta de la galería
|
|
294
|
+
3. Si usuario pide "define color" → elegir de galería
|
|
295
|
+
4. Guardar resultado en `globals.css`
|
|
296
|
+
|
|
297
|
+
## Color Variants (HSL)
|
|
298
|
+
Desde color primario generar:
|
|
299
|
+
|
|
300
|
+
### Light Variant
|
|
301
|
+
- Saturación: -20
|
|
302
|
+
- Luminosidad: +5
|
|
303
|
+
|
|
304
|
+
### Dark Variant
|
|
305
|
+
- Saturación: +20
|
|
306
|
+
- Luminosidad: -5
|
|
307
|
+
|
|
308
|
+
**OBLIGATORIO** para mantener armonía visual.
|
|
309
|
+
|
|
310
|
+
## Theme Settings
|
|
311
|
+
|
|
312
|
+
### Default Theme
|
|
313
|
+
- Dark mode por defecto
|
|
314
|
+
|
|
315
|
+
### Tailwind Backgrounds
|
|
316
|
+
#### Dark Mode
|
|
317
|
+
- `slate-950` (más oscuro)
|
|
318
|
+
- `slate-900`
|
|
319
|
+
- `slate-800` (menos oscuro)
|
|
320
|
+
|
|
321
|
+
#### Light Mode
|
|
322
|
+
- `slate-50` (más claro)
|
|
323
|
+
- `slate-100`
|
|
324
|
+
- `slate-200` (menos claro)
|
|
325
|
+
|
|
326
|
+
## Color Usage Rule
|
|
327
|
+
|
|
328
|
+
### 60-20-20 Rule (OBLIGATORIO)
|
|
329
|
+
- 60% color primario
|
|
330
|
+
- 20% color secundario
|
|
331
|
+
- 20% acentos
|
|
332
|
+
|
|
333
|
+
### PROHIBIDO
|
|
334
|
+
- Paletas arcoíris
|
|
335
|
+
- Múltiples colores sin coherencia
|
|
336
|
+
- Si más colores necesarios → bajar saturación
|
|
337
|
+
|
|
338
|
+
## Visual Style Guidelines
|
|
339
|
+
|
|
340
|
+
### Objetivo
|
|
341
|
+
Evitar "vibe-coding UI" - UI debe parecer diseñada a mano, no por IA.
|
|
342
|
+
|
|
343
|
+
### Depth & Elevation
|
|
344
|
+
- **OBLIGATORIO:** Profundidad (sombras + capas)
|
|
345
|
+
- **EVITAR:** Look plano de ShadCN
|
|
346
|
+
- Mínimo 3 niveles de elevación
|
|
347
|
+
- Botones: luz + sombra
|
|
348
|
+
|
|
349
|
+
### Border Radius Standards
|
|
350
|
+
```css
|
|
351
|
+
Botones: 10px
|
|
352
|
+
Inputs: 10px
|
|
353
|
+
Cards: 14px
|
|
354
|
+
Modals: 16px
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
### Layout Constraints
|
|
358
|
+
- Desktop: `max-w-7xl` obligatorio
|
|
359
|
+
- **PROHIBIDO:** contenido full-width sin márgenes
|
|
360
|
+
|
|
361
|
+
## AI UI Generation Rules
|
|
362
|
+
|
|
363
|
+
Cuando generes UI:
|
|
364
|
+
- ✅ Usar SOLO colores definidos/elegidos
|
|
365
|
+
- ❌ NUNCA Tailwind default colors
|
|
366
|
+
- ✅ Añadir siempre profundidad y luz
|
|
367
|
+
- ❌ Evitar dashboards genéricos
|
|
368
|
+
- ✅ Objetivo: parecer diseñado a mano, no por IA
|
|
369
|
+
|
|
370
|
+
---
|
|
371
|
+
|
|
372
|
+
# Testing & Quality Standards
|
|
373
|
+
|
|
374
|
+
## Pre-commit Checklist
|
|
375
|
+
```bash
|
|
376
|
+
pnpm lint # Sin errores
|
|
377
|
+
pnpm test # Todos pasando
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
## Running Tests
|
|
381
|
+
|
|
382
|
+
### Global
|
|
383
|
+
```bash
|
|
384
|
+
pnpm test
|
|
385
|
+
pnpm turbo run test --filter <project_name>
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
### Vitest (specific test)
|
|
389
|
+
```bash
|
|
390
|
+
pnpm vitest run -t "<nombre del test>"
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
## After File Changes
|
|
394
|
+
Tras mover archivos o cambiar imports:
|
|
395
|
+
```bash
|
|
396
|
+
pnpm lint
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
## Quality Rules
|
|
400
|
+
- **PROHIBIDO:** Código con errores de tipos
|
|
401
|
+
- **PROHIBIDO:** Código con errores de lint
|
|
402
|
+
- **PROHIBIDO:** Tests fallidos
|
|
403
|
+
- **OBLIGATORIO:** Añadir/actualizar tests al cambiar comportamiento
|
|
404
|
+
|
|
405
|
+
## Testing Best Practices
|
|
406
|
+
- Write tests for all business logic
|
|
407
|
+
- Follow the AAA pattern (Arrange, Act, Assert)
|
|
408
|
+
- Use descriptive test names that explain the scenario
|
|
409
|
+
- Mock external dependencies
|
|
410
|
+
|
|
411
|
+
## CI/CD
|
|
412
|
+
Revisar workflows en `.github/workflows` antes de hacer cambios
|
|
413
|
+
|
|
414
|
+
---
|
|
415
|
+
|
|
416
|
+
# Code Conventions
|
|
417
|
+
|
|
418
|
+
## General
|
|
419
|
+
- Write self-documenting code with clear names
|
|
420
|
+
- Keep functions small and focused (max 30 lines preferred)
|
|
421
|
+
- Avoid magic numbers and strings - use named constants
|
|
422
|
+
- Delete dead code - don't comment it out
|
|
423
|
+
|
|
424
|
+
## Comments
|
|
425
|
+
- Write comments that explain WHY, not WHAT
|
|
426
|
+
- Use JSDoc for public API documentation
|
|
427
|
+
- Keep comments up to date with code changes
|
|
428
|
+
- Avoid TODO comments in production code
|
|
429
|
+
|
|
430
|
+
## Formatting
|
|
431
|
+
- Use consistent indentation (2 spaces)
|
|
432
|
+
- Keep lines under 100 characters
|
|
433
|
+
- Use trailing commas in multiline structures
|
|
434
|
+
- Add blank lines between logical sections
|
|
435
|
+
|
|
436
|
+
## Event Handlers Naming
|
|
437
|
+
- Event handlers: `handle` prefix (`handleClick`, `handleKeyDown`)
|
|
438
|
+
- Variables: descriptive with context (`isModalOpen`, `hasError`)
|
|
439
|
+
|
|
440
|
+
---
|
|
441
|
+
|
|
442
|
+
# Performance & Technical Decisions
|
|
443
|
+
|
|
444
|
+
## Measurement First
|
|
445
|
+
- **NO ADIVINAR:** rendimiento, bundle size, load times
|
|
446
|
+
- **MEDIR PRIMERO:** instrumentar antes de optimizar
|
|
447
|
+
- **VALIDAR:** probar en pequeño antes de escalar
|
|
448
|
+
|
|
449
|
+
## Optimization Process
|
|
450
|
+
1. Identificar problema real (con métricas)
|
|
451
|
+
2. Añadir instrumentación
|
|
452
|
+
3. Medir baseline
|
|
453
|
+
4. Implementar mejora
|
|
454
|
+
5. Medir impacto
|
|
455
|
+
6. Validar en producción similar
|
|
456
|
+
|
|
457
|
+
## Anti-patterns
|
|
458
|
+
- ❌ Optimizar sin medir
|
|
459
|
+
- ❌ Asumir cuellos de botella
|
|
460
|
+
- ❌ Escalar cambios sin validar
|
|
461
|
+
- ❌ Micro-optimizaciones prematuras
|
|
462
|
+
|
|
463
|
+
---
|
|
464
|
+
|
|
465
|
+
# Error Handling & Security
|
|
466
|
+
|
|
467
|
+
## Error Handling
|
|
468
|
+
- Use typed errors with clear error codes
|
|
469
|
+
- Handle errors at the appropriate level
|
|
470
|
+
- Log errors with sufficient context for debugging
|
|
471
|
+
- Use Bootstrap's built-in form validation styles (if using Bootstrap)
|
|
472
|
+
- Display errors with appropriate UI components
|
|
473
|
+
|
|
474
|
+
## Configuration
|
|
475
|
+
- All configuration should come from environment variables
|
|
476
|
+
- Never hardcode sensitive values
|
|
477
|
+
- Provide sensible defaults where appropriate
|
|
478
|
+
|
|
479
|
+
## Security
|
|
480
|
+
- Never log sensitive data (passwords, tokens, PII)
|
|
481
|
+
- Validate and sanitize all user input
|
|
482
|
+
- Use parameterized queries for database operations
|
|
483
|
+
- Keep dependencies updated for security patches
|
|
484
|
+
|
|
485
|
+
---
|
|
486
|
+
|
|
487
|
+
# AI Agent Behavior Rules
|
|
488
|
+
|
|
489
|
+
## Decision Making
|
|
490
|
+
|
|
491
|
+
### When to Ask
|
|
492
|
+
Si la petición NO está clara:
|
|
493
|
+
- Hacer preguntas concretas
|
|
494
|
+
- No asumir requisitos implícitos
|
|
495
|
+
- Esperar confirmación antes de ejecutar
|
|
496
|
+
|
|
497
|
+
### When to Execute
|
|
498
|
+
Tareas simples y bien definidas:
|
|
499
|
+
- Ejecutar directamente
|
|
500
|
+
- No pedir confirmación innecesaria
|
|
501
|
+
|
|
502
|
+
### Complex Changes
|
|
503
|
+
Refactors, features nuevas, decisiones de arquitectura:
|
|
504
|
+
1. Confirmar entendimiento
|
|
505
|
+
2. Explicar approach
|
|
506
|
+
3. Esperar aprobación
|
|
507
|
+
4. Ejecutar
|
|
508
|
+
|
|
509
|
+
## Information Gathering
|
|
510
|
+
- Si falta información → preguntar
|
|
511
|
+
- No asumir contexto que no existe
|
|
512
|
+
- Mejor sobre-comunicar que sub-comunicar
|
|
513
|
+
|
|
514
|
+
## Execution Principles
|
|
515
|
+
- Claridad antes que velocidad
|
|
516
|
+
- Preguntas específicas > adivinanzas
|
|
517
|
+
- Confirmación en cambios grandes
|
|
518
|
+
- Autonomía en cambios pequeños
|
|
519
|
+
|
|
520
|
+
---
|
|
521
|
+
|
|
522
|
+
# Documentation
|
|
523
|
+
|
|
524
|
+
Si introduces nueva restricción ("nunca X", "siempre Y"):
|
|
525
|
+
- Documentar en archivo de reglas correspondiente
|
|
526
|
+
- Explicar el porqué
|
|
527
|
+
|
|
528
|
+
---
|
|
529
|
+
|
|
530
|
+
# Review Checklist
|
|
531
|
+
|
|
532
|
+
Al revisar código, verificar:
|
|
533
|
+
|
|
534
|
+
## ✅ TypeScript
|
|
535
|
+
- [ ] No hay uso de `any`
|
|
536
|
+
- [ ] Tipos explícitos en APIs públicas
|
|
537
|
+
- [ ] Modo estricto habilitado
|
|
538
|
+
|
|
539
|
+
## ✅ Styling
|
|
540
|
+
- [ ] Solo Tailwind CSS (no CSS custom)
|
|
541
|
+
- [ ] Iconos de tabler-icons con importación explícita
|
|
542
|
+
- [ ] Cumple reglas de color y profundidad visual
|
|
543
|
+
|
|
544
|
+
## ✅ Code Quality
|
|
545
|
+
- [ ] Componentes pequeños y enfocados
|
|
546
|
+
- [ ] Sin código duplicado
|
|
547
|
+
- [ ] Nombres descriptivos
|
|
548
|
+
- [ ] Imports ordenados y explícitos
|
|
549
|
+
|
|
550
|
+
## ✅ Testing
|
|
551
|
+
- [ ] Tests pasando
|
|
552
|
+
- [ ] Sin errores de lint
|
|
553
|
+
- [ ] Sin errores de tipos
|
|
554
|
+
|
|
555
|
+
## ✅ Performance
|
|
556
|
+
- [ ] Minimiza `use client`
|
|
557
|
+
- [ ] Usa RSC cuando es posible
|
|
558
|
+
- [ ] Lazy loading de imágenes
|
|
559
|
+
|
|
560
|
+
## ✅ Accessibility
|
|
561
|
+
- [ ] HTML semántico
|
|
562
|
+
- [ ] ARIA labels donde necesario
|
|
563
|
+
- [ ] Navegación por teclado
|
|
564
|
+
|
|
565
|
+
## ✅ Git
|
|
566
|
+
- [ ] Commits descriptivos
|
|
567
|
+
- [ ] Branch desde `dev`
|
|
568
|
+
- [ ] PR apunta a `dev`
|