telo3-ai 5.0.7 → 6.2.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.
- package/README.md +32 -791
- package/SKILL.md +36 -657
- package/bootstrap/TELO3.md +17 -0
- package/cli.js +223 -42
- package/hooks/inject-contract.mjs +23 -0
- package/hooks/session-start.example.json +15 -0
- package/index.js +48 -14
- package/package.json +32 -69
- package/references/accessibility-quality.md +92 -272
- package/references/ai-behavior.md +70 -332
- package/references/anti-slop.md +71 -0
- package/references/document-specification.md +110 -419
- package/references/legal-compliance.md +90 -395
- package/references/performance-quality.md +100 -351
- package/references/privacy-compliance.md +88 -464
- package/references/project-audit.md +79 -440
- package/references/security-quality.md +68 -220
- package/references/seo-quality.md +83 -339
- package/references/smart-skill-delegation.md +73 -419
- package/references/token-optimization.md +83 -450
- package/references/ui-quality.md +106 -481
- package/references/workflow.md +91 -447
- package/scripts/postinstall.mjs +27 -0
- package/src/activate.js +159 -0
- package/src/context.js +72 -0
- package/src/find-context.js +41 -0
- package/src/init.js +38 -0
- package/src/install.js +128 -0
- package/src/paths.js +20 -0
- package/src/status.js +30 -0
- package/src/tokens.js +10 -0
- package/src/validate.js +220 -0
- package/src/version.js +12 -0
- package/templates/architecture.md +17 -398
- package/templates/design.md +22 -631
- package/templates/memory.md +13 -351
- package/templates/prd.md +15 -295
- package/templates/rules.md +20 -600
- package/templates/tasks.md +10 -210
- package/AI-CONTEXT.md +0 -272
- package/ONBOARDING-SKILL.md +0 -738
- package/SKILL-METADATA.json +0 -237
- package/scripts/init-project-context.sh +0 -139
- package/scripts/validate-project-context.sh +0 -164
- package/skills/telo3/SKILL.md +0 -315
- package/skills/telo3-context/SKILL.md +0 -272
- package/skills/telo3-onboarding/SKILL.md +0 -738
package/templates/rules.md
CHANGED
|
@@ -1,619 +1,39 @@
|
|
|
1
|
-
|
|
1
|
+
<!-- Lean skeleton. Engineering standards the agent must follow. Grow only as needed.
|
|
2
|
+
Never put real secrets here — document that they live in env vars / a secret manager. -->
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
> **Last Updated:** [Date]
|
|
4
|
+
# Engineering Rules — [Project Name]
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
## Core Principles
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
- Understand before changing; inspect the actual code you will touch.
|
|
9
|
+
- Smallest diff that fulfills the request; reuse existing patterns and abstractions.
|
|
10
|
+
- No drive-by refactors, no unrequested features, no new dependencies without need.
|
|
11
|
+
- Verify changed behavior before claiming done; report what was and wasn't verified.
|
|
9
12
|
|
|
10
|
-
|
|
11
|
-
2. **Preserve existing patterns** — Follow established conventions unless there's a strong reason to diverge
|
|
12
|
-
3. **Scope changes narrowly** — Do not modify unrelated code
|
|
13
|
-
4. **Favor composition over duplication** — Reuse existing abstractions
|
|
14
|
-
5. **Justify dependencies** — Do not introduce new dependencies without clear benefit
|
|
15
|
-
6. **Protect working systems** — Do not replace working architecture without validated reasoning
|
|
16
|
-
7. **Be truthful** — Never fabricate functionality, statistics, testimonials, or compliance claims
|
|
13
|
+
## Coding Standards
|
|
17
14
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
## General Coding Rules
|
|
21
|
-
|
|
22
|
-
### Code Organization
|
|
23
|
-
- One component/function per file (exceptions for tightly coupled helpers)
|
|
24
|
-
- Group related functionality in directories
|
|
25
|
-
- Keep file length reasonable (prefer <300 lines; split when exceeding ~500)
|
|
26
|
-
- Extract complex logic into named functions
|
|
27
|
-
- Colocate related code (components, styles, tests)
|
|
28
|
-
|
|
29
|
-
### Naming Conventions
|
|
30
|
-
|
|
31
|
-
| Type | Convention | Example |
|
|
32
|
-
|------|------------|---------|
|
|
33
|
-
| Files (Components) | PascalCase | `UserProfile.tsx` |
|
|
34
|
-
| Files (Utilities) | camelCase or kebab-case | `formatDate.ts` or `format-date.ts` |
|
|
35
|
-
| Directories | kebab-case | `user-profile/` |
|
|
36
|
-
| Functions | camelCase | `getUserById()` |
|
|
37
|
-
| Classes | PascalCase | `UserService` |
|
|
38
|
-
| Constants | UPPER_SNAKE_CASE | `MAX_RETRY_COUNT` |
|
|
39
|
-
| Types/Interfaces | PascalCase | `UserProfile` |
|
|
40
|
-
| Boolean variables | is/has/should prefix | `isLoading`, `hasPermission` |
|
|
41
|
-
|
|
42
|
-
### Code Style
|
|
43
|
-
- Use descriptive, meaningful names (avoid abbreviations unless widely understood)
|
|
44
|
-
- Prefer explicit over clever
|
|
45
|
-
- Keep functions small and focused (single responsibility)
|
|
46
|
-
- Use early returns to reduce nesting
|
|
47
|
-
- Limit function parameters (prefer <4; use objects for more)
|
|
48
|
-
- Comment WHY, not WHAT (code should be self-documenting)
|
|
49
|
-
- Remove dead code and commented-out code
|
|
50
|
-
|
|
51
|
-
### Formatting
|
|
52
|
-
[Adjust based on your tooling]
|
|
53
|
-
|
|
54
|
-
- **Indentation:** 2 spaces (or 4 spaces for Python)
|
|
55
|
-
- **Line Length:** 80-120 characters (soft limit)
|
|
56
|
-
- **Quotes:** Single quotes for strings (or follow language conventions)
|
|
57
|
-
- **Semicolons:** [Required / Not required based on language/config]
|
|
58
|
-
- **Trailing Commas:** Yes (for multi-line)
|
|
59
|
-
- **Formatting Tool:** [Prettier, Biome, Black, etc.]
|
|
60
|
-
- **Linting Tool:** [ESLint, Biome, pylint, etc.]
|
|
61
|
-
|
|
62
|
-
---
|
|
63
|
-
|
|
64
|
-
## Component Architecture
|
|
65
|
-
|
|
66
|
-
### Component Organization (Frontend)
|
|
67
|
-
|
|
68
|
-
```typescript
|
|
69
|
-
// Component structure example
|
|
70
|
-
components/
|
|
71
|
-
├── ui/ # Base UI primitives (buttons, inputs)
|
|
72
|
-
├── features/ # Feature-specific components
|
|
73
|
-
└── layouts/ # Layout components (header, footer)
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
### Component Guidelines
|
|
77
|
-
- **Keep components focused** — Single responsibility
|
|
78
|
-
- **Prefer composition** — Build complex UI from simple components
|
|
79
|
-
- **Lift state judiciously** — Keep state as local as possible
|
|
80
|
-
- **Avoid prop drilling** — Use context or composition for deep props
|
|
81
|
-
- **Name components clearly** — `UserProfileCard` not `Card2`
|
|
82
|
-
- **Extract reusable logic** — Use custom hooks or utility functions
|
|
83
|
-
|
|
84
|
-
### Component File Structure
|
|
85
|
-
|
|
86
|
-
```typescript
|
|
87
|
-
// PreferredStructure.tsx
|
|
88
|
-
// 1. Imports
|
|
89
|
-
import { useState } from 'react';
|
|
90
|
-
import { Button } from '@/components/ui/button';
|
|
91
|
-
|
|
92
|
-
// 2. Types
|
|
93
|
-
interface Props {
|
|
94
|
-
userId: string;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// 3. Component
|
|
98
|
-
export function PreferredStructure({ userId }: Props) {
|
|
99
|
-
// Hooks
|
|
100
|
-
const [state, setState] = useState();
|
|
101
|
-
|
|
102
|
-
// Event handlers
|
|
103
|
-
const handleClick = () => {};
|
|
104
|
-
|
|
105
|
-
// Render
|
|
106
|
-
return <div>...</div>;
|
|
107
|
-
}
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
---
|
|
111
|
-
|
|
112
|
-
## TypeScript / JavaScript
|
|
113
|
-
|
|
114
|
-
### TypeScript Usage
|
|
115
|
-
- **Use TypeScript** for type safety
|
|
116
|
-
- **Prefer types over any** — Use `unknown` if type is truly unknown
|
|
117
|
-
- **Define interfaces for props and data models**
|
|
118
|
-
- **Use type inference** where obvious
|
|
119
|
-
- **Avoid type assertions** unless necessary (prefer type narrowing)
|
|
120
|
-
- **Use strict mode** — Enable `strict: true` in tsconfig.json
|
|
121
|
-
|
|
122
|
-
### Modern JavaScript
|
|
123
|
-
- Use `const` by default, `let` when reassignment needed, avoid `var`
|
|
124
|
-
- Prefer arrow functions for inline functions and callbacks
|
|
125
|
-
- Use destructuring for objects and arrays
|
|
126
|
-
- Use template literals for string interpolation
|
|
127
|
-
- Use optional chaining (`?.`) and nullish coalescing (`??`)
|
|
128
|
-
- Use async/await over raw promises
|
|
129
|
-
|
|
130
|
-
### Avoid
|
|
131
|
-
- Mutating function parameters
|
|
132
|
-
- Global variables
|
|
133
|
-
- Magic numbers (use named constants)
|
|
134
|
-
- Deep nesting (flatten with early returns)
|
|
135
|
-
- Callback hell (use async/await)
|
|
136
|
-
|
|
137
|
-
---
|
|
138
|
-
|
|
139
|
-
## Backend Development
|
|
140
|
-
|
|
141
|
-
### API Design
|
|
142
|
-
- **Use consistent naming** — RESTful conventions or GraphQL schema conventions
|
|
143
|
-
- **Version APIs** when necessary (`/api/v1/...`)
|
|
144
|
-
- **Return appropriate HTTP status codes**
|
|
145
|
-
- **Provide clear error messages** (without exposing sensitive details)
|
|
146
|
-
- **Document APIs** — OpenAPI/Swagger or GraphQL introspection
|
|
147
|
-
|
|
148
|
-
### Request Handling
|
|
149
|
-
1. **Validate input** — Never trust client input
|
|
150
|
-
2. **Authenticate** — Verify user identity if required
|
|
151
|
-
3. **Authorize** — Check permissions before data access
|
|
152
|
-
4. **Process request** — Execute business logic
|
|
153
|
-
5. **Handle errors gracefully** — Log and return appropriate response
|
|
154
|
-
6. **Return structured response** — Consistent format
|
|
155
|
-
|
|
156
|
-
### Business Logic
|
|
157
|
-
- Keep controllers thin (orchestration only)
|
|
158
|
-
- Extract business logic into service functions
|
|
159
|
-
- Make services testable (pure functions when possible)
|
|
160
|
-
- Separate concerns (data access, business logic, presentation)
|
|
161
|
-
|
|
162
|
-
---
|
|
163
|
-
|
|
164
|
-
## Database
|
|
165
|
-
|
|
166
|
-
### Query Practices
|
|
167
|
-
- **Use parameterized queries** — Prevent SQL injection
|
|
168
|
-
- **Use ORM features correctly** — Understand N+1 query problems
|
|
169
|
-
- **Index frequently queried fields**
|
|
170
|
-
- **Avoid SELECT \*** — Request only needed columns
|
|
171
|
-
- **Use transactions** for multi-step writes
|
|
172
|
-
- **Handle connection errors gracefully**
|
|
173
|
-
|
|
174
|
-
### Schema Design
|
|
175
|
-
- Use appropriate data types
|
|
176
|
-
- Define constraints (NOT NULL, UNIQUE, FOREIGN KEY)
|
|
177
|
-
- Create indexes strategically (read patterns vs. write performance)
|
|
178
|
-
- Document schema changes in migrations
|
|
179
|
-
- Use UUIDs or auto-increment for IDs (decide and be consistent)
|
|
180
|
-
|
|
181
|
-
### Migrations
|
|
182
|
-
- **Never edit applied migrations**
|
|
183
|
-
- **Test migrations** before applying to production
|
|
184
|
-
- **Write rollback migrations** where possible
|
|
185
|
-
- **Document breaking changes**
|
|
186
|
-
|
|
187
|
-
---
|
|
15
|
+
[TODO: language/style conventions, naming, file organization, error handling.]
|
|
188
16
|
|
|
189
17
|
## Validation
|
|
190
18
|
|
|
191
|
-
|
|
192
|
-
-
|
|
193
|
-
- **Use schema validation** — Zod, Yup, Joi, or similar
|
|
194
|
-
- **Validate types and formats** — Email, URL, phone, etc.
|
|
195
|
-
- **Validate bounds** — String length, number ranges
|
|
196
|
-
- **Sanitize input** — Strip/escape dangerous characters when necessary
|
|
197
|
-
- **Provide clear error messages** — Help users fix issues
|
|
198
|
-
|
|
199
|
-
### Example (Zod)
|
|
200
|
-
```typescript
|
|
201
|
-
import { z } from 'zod';
|
|
202
|
-
|
|
203
|
-
const userSchema = z.object({
|
|
204
|
-
email: z.string().email(),
|
|
205
|
-
age: z.number().min(18).max(120),
|
|
206
|
-
name: z.string().min(1).max(100),
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
// Validate
|
|
210
|
-
const result = userSchema.safeParse(input);
|
|
211
|
-
if (!result.success) {
|
|
212
|
-
// Handle validation errors
|
|
213
|
-
}
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
---
|
|
217
|
-
|
|
218
|
-
## Error Handling
|
|
219
|
-
|
|
220
|
-
### General Principles
|
|
221
|
-
- **Expect errors** — Don't assume everything works
|
|
222
|
-
- **Handle errors explicitly** — Don't swallow errors silently
|
|
223
|
-
- **Log errors appropriately** — Include context, exclude secrets
|
|
224
|
-
- **Show user-friendly messages** — Don't expose stack traces to users
|
|
225
|
-
- **Use error boundaries** (React) or global error handlers
|
|
226
|
-
|
|
227
|
-
### Error Levels
|
|
228
|
-
- **User-facing errors** — Form validation, 404, permissions
|
|
229
|
-
- **Recoverable errors** — Network issues, rate limits (retry)
|
|
230
|
-
- **Fatal errors** — Database down, critical service unavailable (alert)
|
|
231
|
-
|
|
232
|
-
### Logging
|
|
233
|
-
- **Log errors with context** — User ID, request ID, timestamp
|
|
234
|
-
- **Do not log secrets** — Passwords, tokens, API keys
|
|
235
|
-
- **Do not log PII unnecessarily** — Personal data, health info
|
|
236
|
-
- **Use structured logging** — JSON format for parsing
|
|
237
|
-
- **Use appropriate log levels** — Error, warn, info, debug
|
|
238
|
-
|
|
239
|
-
---
|
|
240
|
-
|
|
241
|
-
## Authentication & Authorization
|
|
242
|
-
|
|
243
|
-
### Authentication
|
|
244
|
-
- **Use established libraries** — NextAuth.js, Auth0, Passport, etc.
|
|
245
|
-
- **Hash passwords** — Use bcrypt, scrypt, or Argon2
|
|
246
|
-
- **Never store plaintext passwords**
|
|
247
|
-
- **Use secure session management** — HttpOnly cookies or secure JWT storage
|
|
248
|
-
- **Implement rate limiting** on auth endpoints
|
|
249
|
-
- **Support password reset** securely
|
|
250
|
-
|
|
251
|
-
### Authorization
|
|
252
|
-
- **Check permissions on every request**
|
|
253
|
-
- **Implement authorization at the API level** (don't rely on UI hiding)
|
|
254
|
-
- **Use principle of least privilege** — Grant minimum necessary permissions
|
|
255
|
-
- **Validate resource ownership** — Ensure user can access the resource
|
|
256
|
-
- **Document permission model** clearly
|
|
257
|
-
|
|
258
|
-
### Session Security
|
|
259
|
-
- Set `HttpOnly` flag on cookies
|
|
260
|
-
- Set `Secure` flag on cookies (HTTPS only)
|
|
261
|
-
- Set `SameSite` attribute (CSRF protection)
|
|
262
|
-
- Use reasonable session expiration
|
|
263
|
-
- Implement session invalidation on logout
|
|
264
|
-
|
|
265
|
-
---
|
|
19
|
+
- Validate all external input at the boundary (type, shape, range, length).
|
|
20
|
+
- Reject unexpected fields; never trust client-supplied identifiers for authorization.
|
|
266
21
|
|
|
267
22
|
## Security
|
|
268
23
|
|
|
269
|
-
|
|
270
|
-
-
|
|
271
|
-
-
|
|
272
|
-
-
|
|
273
|
-
- ✅ **DO:** Implement CSRF protection
|
|
274
|
-
- ❌ **DON'T:** Trust client-side validation alone
|
|
275
|
-
- ❌ **DON'T:** Use `eval()` or similar with user input
|
|
276
|
-
|
|
277
|
-
### Secrets Management
|
|
278
|
-
- **Never commit secrets** to version control
|
|
279
|
-
- **Use environment variables** for configuration
|
|
280
|
-
- **Use secret managers** for production (AWS Secrets Manager, etc.)
|
|
281
|
-
- **Rotate secrets regularly**
|
|
282
|
-
- **Limit secret access** (principle of least privilege)
|
|
283
|
-
- **Never log secrets**
|
|
284
|
-
|
|
285
|
-
### API Security
|
|
286
|
-
- Use HTTPS everywhere
|
|
287
|
-
- Implement rate limiting
|
|
288
|
-
- Validate `Content-Type` headers
|
|
289
|
-
- Set security headers (CSP, X-Frame-Options, etc.)
|
|
290
|
-
- Implement CORS correctly
|
|
291
|
-
- Use API keys or OAuth for third-party access
|
|
24
|
+
- Authorize every request server-side; scope queries to the owner/tenant.
|
|
25
|
+
- Hash passwords with argon2 or bcrypt; never store plaintext.
|
|
26
|
+
- Secrets come from environment variables / a secret manager — never hardcoded or committed.
|
|
27
|
+
- Use parameterized queries; encode output; set security headers.
|
|
292
28
|
|
|
293
|
-
|
|
294
|
-
- **Keep dependencies updated** — Regular security patches
|
|
295
|
-
- **Audit dependencies** — `npm audit`, Dependabot, Snyk
|
|
296
|
-
- **Minimize dependencies** — Fewer dependencies = smaller attack surface
|
|
297
|
-
- **Use lock files** — package-lock.json, yarn.lock, poetry.lock
|
|
298
|
-
- **Review new dependencies** — Check maintainership, license, activity
|
|
29
|
+
## Testing
|
|
299
30
|
|
|
300
|
-
|
|
31
|
+
[TODO: test framework, what must be covered, how to run. Verify changed behavior; skip re-verifying unrelated unchanged code.]
|
|
301
32
|
|
|
302
33
|
## Privacy
|
|
303
34
|
|
|
304
|
-
|
|
305
|
-
- **Collect only necessary data** — Minimize data collection
|
|
306
|
-
- **Document what data is collected** — In privacy policy and code comments
|
|
307
|
-
- **Obtain consent** where required by law
|
|
308
|
-
- **Provide opt-out mechanisms** where required
|
|
309
|
-
|
|
310
|
-
### Data Storage
|
|
311
|
-
- **Encrypt sensitive data at rest** — PII, health data, financial data
|
|
312
|
-
- **Use appropriate retention periods** — Delete data when no longer needed
|
|
313
|
-
- **Implement data deletion** — Support user deletion requests
|
|
314
|
-
- **Limit data access** — Only authorized personnel/services
|
|
315
|
-
|
|
316
|
-
### Third-Party Services
|
|
317
|
-
- **Audit third-party data sharing** — Know what data is sent where
|
|
318
|
-
- **Use privacy-friendly alternatives** when possible
|
|
319
|
-
- **Self-host resources** when appropriate (fonts, analytics)
|
|
320
|
-
- **Document third-party services** — In privacy policy and architecture docs
|
|
321
|
-
|
|
322
|
-
### Logging & Analytics
|
|
323
|
-
- **Do not log sensitive data** — Passwords, tokens, PII
|
|
324
|
-
- **Anonymize analytics** when possible
|
|
325
|
-
- **Mask sensitive form fields** in session replay
|
|
326
|
-
- **Respect Do Not Track** when appropriate
|
|
327
|
-
|
|
328
|
-
---
|
|
329
|
-
|
|
330
|
-
## Dependencies
|
|
331
|
-
|
|
332
|
-
### Adding Dependencies
|
|
333
|
-
- **Ask: Is this dependency necessary?**
|
|
334
|
-
- **Check: Is the package actively maintained?**
|
|
335
|
-
- **Check: Does it have known vulnerabilities?**
|
|
336
|
-
- **Check: Is the license compatible?**
|
|
337
|
-
- **Check: Is it well-documented?**
|
|
338
|
-
- **Consider: Bundle size impact** (for frontend)
|
|
339
|
-
|
|
340
|
-
### Dependency Hygiene
|
|
341
|
-
- Use exact or pinned versions for critical dependencies
|
|
342
|
-
- Update dependencies regularly (monthly or quarterly)
|
|
343
|
-
- Test after updating dependencies
|
|
344
|
-
- Remove unused dependencies
|
|
345
|
-
- Prefer well-established packages over new/unknown
|
|
346
|
-
|
|
347
|
-
---
|
|
35
|
+
[TODO: what data is collected, retention/deletion, third-party transfers. No invasive tracking without disclosure.]
|
|
348
36
|
|
|
349
37
|
## Git Practices
|
|
350
38
|
|
|
351
|
-
|
|
352
|
-
- **Write clear commit messages** — Describe what and why
|
|
353
|
-
- **Use conventional commits** (optional but recommended)
|
|
354
|
-
```
|
|
355
|
-
feat: add user profile page
|
|
356
|
-
fix: resolve login redirect issue
|
|
357
|
-
docs: update API documentation
|
|
358
|
-
refactor: simplify auth logic
|
|
359
|
-
```
|
|
360
|
-
- **Make atomic commits** — One logical change per commit
|
|
361
|
-
- **Avoid committing sensitive data** — Use `.gitignore`
|
|
362
|
-
|
|
363
|
-
### Branches
|
|
364
|
-
- Use feature branches for new work
|
|
365
|
-
- Keep branches short-lived
|
|
366
|
-
- Name branches descriptively (`feature/user-profile`, `fix/login-bug`)
|
|
367
|
-
- Don't commit directly to main/master
|
|
368
|
-
|
|
369
|
-
### Pull Requests
|
|
370
|
-
- Write descriptive PR titles and descriptions
|
|
371
|
-
- Request reviews from appropriate team members
|
|
372
|
-
- Address review feedback
|
|
373
|
-
- Ensure CI passes before merging
|
|
374
|
-
- Delete branches after merging
|
|
375
|
-
|
|
376
|
-
---
|
|
377
|
-
|
|
378
|
-
## Testing
|
|
379
|
-
|
|
380
|
-
[Adjust based on your testing strategy]
|
|
381
|
-
|
|
382
|
-
### Testing Strategy
|
|
383
|
-
- **Unit tests** — Test individual functions/components
|
|
384
|
-
- **Integration tests** — Test component/service interactions
|
|
385
|
-
- **E2E tests** — Test critical user flows
|
|
386
|
-
|
|
387
|
-
### Testing Guidelines
|
|
388
|
-
- Write tests for business logic
|
|
389
|
-
- Write tests for bug fixes (prevent regression)
|
|
390
|
-
- Mock external dependencies (APIs, databases)
|
|
391
|
-
- Use descriptive test names
|
|
392
|
-
- Follow AAA pattern (Arrange, Act, Assert)
|
|
393
|
-
- Aim for meaningful coverage (not 100% at all costs)
|
|
394
|
-
|
|
395
|
-
### Test Organization
|
|
396
|
-
```
|
|
397
|
-
src/
|
|
398
|
-
components/
|
|
399
|
-
Button.tsx
|
|
400
|
-
Button.test.tsx
|
|
401
|
-
lib/
|
|
402
|
-
formatDate.ts
|
|
403
|
-
formatDate.test.ts
|
|
404
|
-
```
|
|
405
|
-
|
|
406
|
-
---
|
|
407
|
-
|
|
408
|
-
## Performance
|
|
409
|
-
|
|
410
|
-
### Frontend Performance
|
|
411
|
-
- **Optimize images** — Use modern formats (WebP, AVIF), appropriate sizes
|
|
412
|
-
- **Lazy load** non-critical resources
|
|
413
|
-
- **Code split** large bundles
|
|
414
|
-
- **Minimize JavaScript** — Remove unused code
|
|
415
|
-
- **Use production builds** for deployment
|
|
416
|
-
- **Implement caching strategies**
|
|
417
|
-
|
|
418
|
-
### Backend Performance
|
|
419
|
-
- **Optimize database queries** — Use indexes, avoid N+1
|
|
420
|
-
- **Implement caching** where appropriate (Redis, in-memory)
|
|
421
|
-
- **Use pagination** for large datasets
|
|
422
|
-
- **Implement rate limiting** to protect resources
|
|
423
|
-
- **Profile slow endpoints** and optimize
|
|
424
|
-
|
|
425
|
-
### Measure First
|
|
426
|
-
- Don't optimize prematurely
|
|
427
|
-
- Use performance profiling tools
|
|
428
|
-
- Set performance budgets
|
|
429
|
-
- Monitor production performance
|
|
430
|
-
|
|
431
|
-
---
|
|
432
|
-
|
|
433
|
-
## Accessibility
|
|
434
|
-
|
|
435
|
-
### Semantic HTML
|
|
436
|
-
- Use appropriate HTML elements (`<button>`, `<nav>`, `<article>`)
|
|
437
|
-
- Use heading hierarchy (`<h1>` to `<h6>`)
|
|
438
|
-
- Use `<label>` for form inputs
|
|
439
|
-
- Use `<main>`, `<header>`, `<footer>` landmarks
|
|
440
|
-
|
|
441
|
-
### Keyboard Navigation
|
|
442
|
-
- All interactive elements must be keyboard accessible
|
|
443
|
-
- Maintain logical tab order
|
|
444
|
-
- Show visible focus states
|
|
445
|
-
- Support Escape to close modals
|
|
446
|
-
|
|
447
|
-
### Screen Readers
|
|
448
|
-
- Provide `alt` text for images
|
|
449
|
-
- Use `aria-label` when visual labels are insufficient
|
|
450
|
-
- Use `aria-describedby` for additional context
|
|
451
|
-
- Mark decorative images with `alt=""`
|
|
452
|
-
|
|
453
|
-
### Color & Contrast
|
|
454
|
-
- Ensure sufficient color contrast (WCAG AA: 4.5:1 for normal text)
|
|
455
|
-
- Don't rely on color alone to convey information
|
|
456
|
-
- Support high contrast mode
|
|
457
|
-
- Test with color blindness simulators
|
|
458
|
-
|
|
459
|
-
---
|
|
460
|
-
|
|
461
|
-
## SEO (for applicable projects)
|
|
462
|
-
|
|
463
|
-
### Meta Tags
|
|
464
|
-
- Unique `<title>` per page (50-60 characters)
|
|
465
|
-
- Unique `meta description` per page (150-160 characters)
|
|
466
|
-
- Canonical URLs to prevent duplicate content
|
|
467
|
-
- Open Graph tags for social sharing
|
|
468
|
-
- Twitter Card tags
|
|
469
|
-
|
|
470
|
-
### Content
|
|
471
|
-
- Use semantic HTML and heading hierarchy
|
|
472
|
-
- Write descriptive alt text for images
|
|
473
|
-
- Use descriptive link text (avoid "click here")
|
|
474
|
-
- Create meaningful URLs (kebab-case, descriptive)
|
|
475
|
-
|
|
476
|
-
### Technical SEO
|
|
477
|
-
- Generate `sitemap.xml`
|
|
478
|
-
- Configure `robots.txt`
|
|
479
|
-
- Implement structured data (Schema.org)
|
|
480
|
-
- Ensure fast page loads (Core Web Vitals)
|
|
481
|
-
- Ensure mobile responsiveness
|
|
482
|
-
|
|
483
|
-
---
|
|
484
|
-
|
|
485
|
-
## Legal & Compliance Awareness
|
|
486
|
-
|
|
487
|
-
> **Important:** This section is a decision-support tool, not legal advice. Verify applicable legal requirements with qualified counsel before claiming compliance.
|
|
488
|
-
|
|
489
|
-
### General Principles
|
|
490
|
-
- **Identify regulated functionality** — Know what might have legal implications
|
|
491
|
-
- **Determine applicable jurisdictions** — Laws vary by location
|
|
492
|
-
- **Distinguish technical from legal requirements**
|
|
493
|
-
- **Verify current law** — Regulations change
|
|
494
|
-
- **Document compliance efforts** — For audit trail
|
|
495
|
-
- **Never fabricate compliance claims**
|
|
496
|
-
|
|
497
|
-
### Common Considerations
|
|
498
|
-
|
|
499
|
-
#### Age Restrictions / Children
|
|
500
|
-
- If children may use the service, assess child privacy requirements
|
|
501
|
-
- Implement age verification if required
|
|
502
|
-
- Obtain parental consent where required by law
|
|
503
|
-
- Do not collect children's personal data in violation of applicable law
|
|
504
|
-
|
|
505
|
-
#### Marketing Emails
|
|
506
|
-
- Provide clear unsubscribe mechanism
|
|
507
|
-
- Honor unsubscribe requests promptly
|
|
508
|
-
- Include sender identification
|
|
509
|
-
- Include physical postal address where legally required
|
|
510
|
-
- Ensure truthful subject lines
|
|
511
|
-
|
|
512
|
-
#### Subscriptions / Auto-Renewals
|
|
513
|
-
- Clearly disclose price, billing frequency, renewal terms
|
|
514
|
-
- Display material terms near purchase decision
|
|
515
|
-
- Provide accessible cancellation mechanism
|
|
516
|
-
- Send renewal reminders where required by law
|
|
517
|
-
|
|
518
|
-
#### User-Generated Content / Copyright
|
|
519
|
-
- For U.S. services, consider DMCA compliance (designated agent, takedown process)
|
|
520
|
-
- Implement content moderation policies
|
|
521
|
-
- Respect copyright and intellectual property
|
|
522
|
-
|
|
523
|
-
#### Privacy & Data Protection
|
|
524
|
-
- Understand what data is collected and why
|
|
525
|
-
- Implement appropriate security controls
|
|
526
|
-
- Provide transparency (privacy policy)
|
|
527
|
-
- Support data deletion where required
|
|
528
|
-
- Obtain consent where required
|
|
529
|
-
|
|
530
|
-
See `references/legal-compliance.md` for detailed guidance.
|
|
531
|
-
|
|
532
|
-
---
|
|
533
|
-
|
|
534
|
-
## Documentation
|
|
535
|
-
|
|
536
|
-
### Code Documentation
|
|
537
|
-
- Document public APIs (JSDoc, docstrings)
|
|
538
|
-
- Explain complex algorithms
|
|
539
|
-
- Document non-obvious behavior
|
|
540
|
-
- Keep documentation in sync with code
|
|
541
|
-
|
|
542
|
-
### Project Documentation
|
|
543
|
-
- **README** — Project overview, setup, usage
|
|
544
|
-
- **Architecture docs** — System design and tech stack
|
|
545
|
-
- **API docs** — Endpoint documentation
|
|
546
|
-
- **Contributing guide** — How to contribute
|
|
547
|
-
|
|
548
|
-
### Context Documents
|
|
549
|
-
After meaningful changes, update relevant project context:
|
|
550
|
-
- `prd.md` — If requirements changed
|
|
551
|
-
- `architecture.md` — If architecture changed
|
|
552
|
-
- `rules.md` — If engineering standards changed
|
|
553
|
-
- `design.md` — If design patterns changed
|
|
554
|
-
- `tasks.md` — Mark completed tasks, add new ones
|
|
555
|
-
- `memory.md` — Document important decisions
|
|
556
|
-
|
|
557
|
-
---
|
|
558
|
-
|
|
559
|
-
## Refactoring
|
|
560
|
-
|
|
561
|
-
### When to Refactor
|
|
562
|
-
- When adding features to poorly structured code
|
|
563
|
-
- When fixing bugs caused by code complexity
|
|
564
|
-
- When code duplication hinders maintenance
|
|
565
|
-
- When performance is measurably inadequate
|
|
566
|
-
|
|
567
|
-
### When NOT to Refactor
|
|
568
|
-
- When code works and doesn't need to change
|
|
569
|
-
- As part of an unrelated feature
|
|
570
|
-
- Without tests to verify behavior preservation
|
|
571
|
-
- Without clear improvement goal
|
|
572
|
-
|
|
573
|
-
### Refactoring Guidelines
|
|
574
|
-
- Make small, incremental changes
|
|
575
|
-
- Test after each change
|
|
576
|
-
- Don't change behavior and refactor simultaneously
|
|
577
|
-
- Use version control to revert if needed
|
|
578
|
-
|
|
579
|
-
---
|
|
580
|
-
|
|
581
|
-
## Anti-Patterns to Avoid
|
|
582
|
-
|
|
583
|
-
### Code Anti-Patterns
|
|
584
|
-
- ❌ God objects / God functions (too much responsibility)
|
|
585
|
-
- ❌ Copy-paste programming (duplication without abstraction)
|
|
586
|
-
- ❌ Magic numbers (unnamed constants)
|
|
587
|
-
- ❌ Deep nesting (arrow code)
|
|
588
|
-
- ❌ Premature optimization
|
|
589
|
-
- ❌ Reinventing the wheel (ignoring established patterns)
|
|
590
|
-
|
|
591
|
-
### Architecture Anti-Patterns
|
|
592
|
-
- ❌ Big ball of mud (no structure)
|
|
593
|
-
- ❌ Golden hammer (using one pattern for everything)
|
|
594
|
-
- ❌ Lava flow (dead code nobody dares to remove)
|
|
595
|
-
- ❌ Tight coupling (components can't be separated)
|
|
596
|
-
|
|
597
|
-
### Team Anti-Patterns
|
|
598
|
-
- ❌ Not reading documentation before coding
|
|
599
|
-
- ❌ Ignoring existing patterns
|
|
600
|
-
- ❌ Modifying unrelated code in the same PR
|
|
601
|
-
- ❌ Committing secrets or sensitive data
|
|
602
|
-
- ❌ Breaking builds with untested changes
|
|
603
|
-
|
|
604
|
-
---
|
|
605
|
-
|
|
606
|
-
## Context-Specific Overrides
|
|
607
|
-
|
|
608
|
-
[Document any project-specific rules that override or extend these general guidelines]
|
|
609
|
-
|
|
610
|
-
- [Override 1]
|
|
611
|
-
- [Override 2]
|
|
612
|
-
|
|
613
|
-
---
|
|
614
|
-
|
|
615
|
-
## Document History
|
|
616
|
-
|
|
617
|
-
| Date | Author | Changes |
|
|
618
|
-
|------|--------|---------|
|
|
619
|
-
| [Date] | [Name] | Initial version |
|
|
39
|
+
[TODO: branch/commit conventions; never commit secrets or generated artifacts.]
|