claude-skill-lord 2.0.2 → 2.0.4

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,949 @@
1
+ # Code Standards & Codebase Structure
2
+
3
+ **Last Updated**: 2025-10-26
4
+ **Version**: 1.8.0
5
+ **Applies To**: All code within ClaudeKit Engineer project
6
+
7
+ ## Overview
8
+
9
+ This document defines coding standards, file organization patterns, naming conventions, and best practices for ClaudeKit Engineer. All code must adhere to these standards to ensure consistency, maintainability, and quality.
10
+
11
+ ## Core Development Principles
12
+
13
+ ### YANGI (You Aren't Gonna Need It)
14
+ - Avoid over-engineering and premature optimization
15
+ - Implement features only when needed
16
+ - Don't build infrastructure for hypothetical future requirements
17
+ - Start simple, refactor when necessary
18
+
19
+ ### KISS (Keep It Simple, Stupid)
20
+ - Prefer simple, straightforward solutions
21
+ - Avoid unnecessary complexity
22
+ - Write code that's easy to understand and modify
23
+ - Choose clarity over cleverness
24
+
25
+ ### DRY (Don't Repeat Yourself)
26
+ - Eliminate code duplication
27
+ - Extract common logic into reusable functions/modules
28
+ - Use composition and abstraction appropriately
29
+ - Maintain single source of truth
30
+
31
+ ## File Organization Standards
32
+
33
+ ### Directory Structure
34
+
35
+ ```
36
+ project-root/
37
+ ├── .claude/ # Claude Code configuration
38
+ │ ├── agents/ # Agent definitions (*.md)
39
+ │ ├── commands/ # Slash commands (*.md)
40
+ │ │ ├── [category]/ # Nested command categories
41
+ │ │ └── [command].md # Individual commands
42
+ │ ├── hooks/ # Git hooks and scripts
43
+ │ ├── skills/ # Reusable knowledge modules
44
+ │ │ └── [skill-name]/ # Individual skill directories
45
+ │ │ ├── SKILL.md # Skill definition
46
+ │ │ └── references/ # Supporting materials
47
+ │ └── workflows/ # Workflow definitions
48
+ ├── .opencode/ # OpenCode configuration
49
+ │ ├── agent/ # OpenCode agent definitions
50
+ │ └── command/ # OpenCode commands
51
+ ├── .github/ # GitHub-specific files
52
+ │ └── workflows/ # CI/CD workflows
53
+ ├── docs/ # Project documentation
54
+ │ ├── research/ # Research reports
55
+ │ └── *.md # Core documentation files
56
+ ├── guide/ # User guides
57
+ ├── plans/ # Implementation plans
58
+ │ ├── reports/ # Agent communication reports
59
+ │ └── templates/ # Plan templates
60
+ ├── src/ # Source code (if applicable)
61
+ ├── tests/ # Test suites (if applicable)
62
+ ├── .gitignore # Git ignore patterns
63
+ ├── CLAUDE.md # Claude-specific instructions
64
+ ├── README.md # Project overview
65
+ ├── package.json # Node.js dependencies
66
+ └── LICENSE # License file
67
+ ```
68
+
69
+ ### File Naming Conventions
70
+
71
+ **Agent Definitions** (`.claude/agents/`, `.opencode/agent/`):
72
+ - Format: `[agent-name].md`
73
+ - Use kebab-case: `code-reviewer.md`, `docs-manager.md`
74
+ - Descriptive, role-based names
75
+ - Examples: `planner.md`, `tester.md`, `git-manager.md`
76
+
77
+ **Commands** (`.claude/commands/`, `.opencode/command/`):
78
+ - Format: `[command-name].md` or `[category]/[command-name].md`
79
+ - Use kebab-case for names
80
+ - Group related commands in subdirectories
81
+ - Examples:
82
+ - `plan.md`
83
+ - `fix/ci.md`
84
+ - `design/screenshot.md`
85
+ - `git/cm.md`
86
+
87
+ **Skills** (`.claude/skills/`):
88
+ - Format: `[skill-name]/SKILL.md`
89
+ - Use kebab-case for directory names
90
+ - Main file always named `SKILL.md`
91
+ - Supporting files in `references/` or `scripts/`
92
+ - Examples:
93
+ - `better-auth/SKILL.md`
94
+ - `cloudflare-workers/SKILL.md`
95
+ - `mongodb/SKILL.md`
96
+
97
+ **Documentation** (`docs/`):
98
+ - Format: `[document-purpose].md`
99
+ - Use kebab-case with descriptive names
100
+ - Examples:
101
+ - `project-overview-pdr.md`
102
+ - `codebase-summary.md`
103
+ - `code-standards.md`
104
+ - `system-architecture.md`
105
+
106
+ **Reports** (`plans/<plan-name>/reports/`):
107
+ - Format: `YYMMDD-from-[agent]-to-[agent]-[task]-report.md`
108
+ - Use date prefix for chronological sorting
109
+ - Clear source and destination agents
110
+ - Examples:
111
+ - `251026-from-planner-to-main-auth-implementation-report.md`
112
+ - `251026-from-tester-to-debugger-test-failures-report.md`
113
+
114
+ **Plans** (`plans/`):
115
+ - Format: `YYMMDD-[feature-name]-plan.md`
116
+ - Use date prefix for version tracking
117
+ - Descriptive feature names in kebab-case
118
+ - Examples:
119
+ - `251026-user-authentication-plan.md`
120
+ - `251026-database-migration-plan.md`
121
+
122
+ **Research Reports** (`plans/<plan-name>/research/`):
123
+ - Format: `YYMMDD-[research-topic].md`
124
+ - Date prefix for tracking
125
+ - Clear topic description
126
+ - Examples:
127
+ - `251026-oauth2-implementation-strategies.md`
128
+ - `251026-performance-optimization-techniques.md`
129
+
130
+ ## File Size Management
131
+
132
+ ### Hard Limits
133
+ - **Maximum file size**: 500 lines of code
134
+ - Files exceeding 500 lines MUST be refactored
135
+ - Exception: Auto-generated files (with clear marking)
136
+
137
+ ### Refactoring Strategies
138
+
139
+ **When file exceeds 500 lines**:
140
+ 1. **Extract Utility Functions**: Move to separate `utils/` directory
141
+ 2. **Component Splitting**: Break into smaller, focused components
142
+ 3. **Service Classes**: Extract business logic to dedicated services
143
+ 4. **Module Organization**: Group related functionality into modules
144
+
145
+ **Example Refactoring**:
146
+ ```
147
+ Before:
148
+ user-service.js (750 lines)
149
+
150
+ After:
151
+ services/
152
+ ├── user-service.js (200 lines) # Core service
153
+ ├── user-validation.js (150 lines) # Validation logic
154
+ └── user-repository.js (180 lines) # Database operations
155
+ utils/
156
+ └── password-hasher.js (80 lines) # Utility functions
157
+ ```
158
+
159
+ ## Naming Conventions
160
+
161
+ ### Variables & Functions
162
+
163
+ **JavaScript/TypeScript**:
164
+ - **Variables**: camelCase
165
+ ```javascript
166
+ const userName = 'John Doe';
167
+ const isAuthenticated = true;
168
+ ```
169
+
170
+ - **Functions**: camelCase
171
+ ```javascript
172
+ function calculateTotal(items) { }
173
+ const getUserById = (id) => { };
174
+ ```
175
+
176
+ - **Classes**: PascalCase
177
+ ```javascript
178
+ class UserService { }
179
+ class AuthenticationManager { }
180
+ ```
181
+
182
+ - **Constants**: UPPER_SNAKE_CASE
183
+ ```javascript
184
+ const MAX_RETRY_COUNT = 3;
185
+ const API_BASE_URL = 'https://api.example.com';
186
+ ```
187
+
188
+ - **Private Members**: Prefix with underscore
189
+ ```javascript
190
+ class Database {
191
+ _connectionPool = null;
192
+ _connect() { }
193
+ }
194
+ ```
195
+
196
+ ### Files & Directories
197
+
198
+ **Source Files**:
199
+ - **JavaScript/TypeScript**: kebab-case
200
+ ```
201
+ user-service.js
202
+ authentication-manager.ts
203
+ api-client.js
204
+ ```
205
+
206
+ - **React Components**: PascalCase
207
+ ```
208
+ UserProfile.jsx
209
+ AuthenticationForm.tsx
210
+ NavigationBar.jsx
211
+ ```
212
+
213
+ - **Test Files**: Match source file name + `.test` or `.spec`
214
+ ```
215
+ user-service.test.js
216
+ authentication-manager.spec.ts
217
+ ```
218
+
219
+ **Directories**: kebab-case
220
+ ```
221
+ src/
222
+ ├── components/
223
+ ├── services/
224
+ ├── utils/
225
+ ├── api-clients/
226
+ └── test-helpers/
227
+ ```
228
+
229
+ ### API Design
230
+
231
+ **REST Endpoints**:
232
+ - Use kebab-case for URLs
233
+ - Plural nouns for collections
234
+ - Resource IDs in path parameters
235
+
236
+ ```
237
+ GET /api/users
238
+ GET /api/users/:id
239
+ POST /api/users
240
+ PUT /api/users/:id
241
+ DELETE /api/users/:id
242
+ GET /api/users/:userId/posts
243
+ ```
244
+
245
+ **Request/Response Fields**:
246
+ - Use camelCase for JSON properties
247
+ ```json
248
+ {
249
+ "userId": 123,
250
+ "userName": "john_doe",
251
+ "emailAddress": "john@example.com",
252
+ "isVerified": true,
253
+ "createdAt": "2025-10-26T00:00:00Z"
254
+ }
255
+ ```
256
+
257
+ ## Code Style Guidelines
258
+
259
+ ### General Formatting
260
+
261
+ **Indentation**:
262
+ - Use 2 spaces (not tabs)
263
+ - Consistent indentation throughout file
264
+ - No trailing whitespace
265
+
266
+ **Line Length**:
267
+ - Preferred: 80-100 characters
268
+ - Hard limit: 120 characters
269
+ - Break long lines logically
270
+
271
+ **Whitespace**:
272
+ - One blank line between functions/methods
273
+ - Two blank lines between classes
274
+ - Space after keywords: `if (`, `for (`, `while (`
275
+ - No space before function parentheses: `function name(`
276
+
277
+ ### Comments & Documentation
278
+
279
+ **File Headers** (Optional but recommended):
280
+ ```javascript
281
+ /**
282
+ * User Service
283
+ *
284
+ * Handles user authentication, registration, and profile management.
285
+ *
286
+ * @module services/user-service
287
+ * @author ClaudeKit
288
+ * @version 1.0.0
289
+ */
290
+ ```
291
+
292
+ **Function Documentation**:
293
+ ```javascript
294
+ /**
295
+ * Authenticates a user with email and password
296
+ *
297
+ * @param {string} email - User's email address
298
+ * @param {string} password - User's password
299
+ * @returns {Promise<User>} Authenticated user object
300
+ * @throws {AuthenticationError} If credentials are invalid
301
+ */
302
+ async function authenticateUser(email, password) {
303
+ // Implementation
304
+ }
305
+ ```
306
+
307
+ **Inline Comments**:
308
+ - Explain WHY, not WHAT
309
+ - Complex logic requires explanation
310
+ - TODO comments include assignee and date
311
+ ```javascript
312
+ // TODO(john, 2025-10-26): Optimize this query for large datasets
313
+ const users = await db.query('SELECT * FROM users');
314
+
315
+ // Cache miss - fetch from database
316
+ const user = await fetchUserFromDB(userId);
317
+ ```
318
+
319
+ ### Error Handling
320
+
321
+ **Always Use Try-Catch**:
322
+ ```javascript
323
+ async function processPayment(orderId) {
324
+ try {
325
+ const order = await getOrder(orderId);
326
+ const payment = await chargeCard(order.total);
327
+ await updateOrderStatus(orderId, 'paid');
328
+ return payment;
329
+ } catch (error) {
330
+ logger.error('Payment processing failed', { orderId, error });
331
+ throw new PaymentError('Failed to process payment', { cause: error });
332
+ }
333
+ }
334
+ ```
335
+
336
+ **Error Types**:
337
+ - Create custom error classes for domain errors
338
+ - Include context and cause
339
+ - Provide actionable error messages
340
+
341
+ ```javascript
342
+ class ValidationError extends Error {
343
+ constructor(message, field) {
344
+ super(message);
345
+ this.name = 'ValidationError';
346
+ this.field = field;
347
+ }
348
+ }
349
+ ```
350
+
351
+ **Error Logging**:
352
+ - Log errors with context
353
+ - Use appropriate log levels
354
+ - Never expose sensitive data in logs
355
+
356
+ ```javascript
357
+ logger.error('Database query failed', {
358
+ query: sanitizeQuery(query),
359
+ params: sanitizeParams(params),
360
+ error: error.message
361
+ });
362
+ ```
363
+
364
+ ## Security Standards
365
+
366
+ ### Input Validation
367
+
368
+ **Validate All Inputs**:
369
+ ```javascript
370
+ function createUser(userData) {
371
+ // Validate required fields
372
+ if (!userData.email || !userData.password) {
373
+ throw new ValidationError('Email and password required');
374
+ }
375
+
376
+ // Sanitize inputs
377
+ const email = sanitizeEmail(userData.email);
378
+ const password = userData.password; // Never log passwords
379
+
380
+ // Validate formats
381
+ if (!isValidEmail(email)) {
382
+ throw new ValidationError('Invalid email format');
383
+ }
384
+
385
+ if (password.length < 8) {
386
+ throw new ValidationError('Password must be at least 8 characters');
387
+ }
388
+ }
389
+ ```
390
+
391
+ ### Sensitive Data Handling
392
+
393
+ **Never Commit Secrets**:
394
+ - Use environment variables for API keys, credentials
395
+ - Add `.env*` to `.gitignore`
396
+ - Use secret management systems in production
397
+
398
+ **Never Log Sensitive Data**:
399
+ ```javascript
400
+ // BAD
401
+ logger.info('User login', { email, password }); // Never log passwords
402
+
403
+ // GOOD
404
+ logger.info('User login', { email }); // OK to log email
405
+ ```
406
+
407
+ **Sanitize Database Queries**:
408
+ ```javascript
409
+ // Use parameterized queries
410
+ const user = await db.query(
411
+ 'SELECT * FROM users WHERE email = $1',
412
+ [email]
413
+ );
414
+
415
+ // Never concatenate user input
416
+ // BAD: const user = await db.query(`SELECT * FROM users WHERE email = '${email}'`);
417
+ ```
418
+
419
+ ## Testing Standards
420
+
421
+ ### Test File Organization
422
+
423
+ ```
424
+ tests/
425
+ ├── unit/ # Unit tests
426
+ │ ├── services/
427
+ │ └── utils/
428
+ ├── integration/ # Integration tests
429
+ │ └── api/
430
+ ├── e2e/ # End-to-end tests
431
+ └── fixtures/ # Test data
432
+ ```
433
+
434
+ ### Test Naming
435
+
436
+ ```javascript
437
+ describe('UserService', () => {
438
+ describe('authenticateUser', () => {
439
+ it('should return user when credentials are valid', async () => {
440
+ // Test implementation
441
+ });
442
+
443
+ it('should throw AuthenticationError when password is incorrect', async () => {
444
+ // Test implementation
445
+ });
446
+
447
+ it('should throw ValidationError when email is missing', async () => {
448
+ // Test implementation
449
+ });
450
+ });
451
+ });
452
+ ```
453
+
454
+ ### Test Coverage Requirements
455
+
456
+ - **Unit tests**: > 80% code coverage
457
+ - **Integration tests**: Critical user flows
458
+ - **E2E tests**: Happy paths and edge cases
459
+ - **Error scenarios**: All error paths tested
460
+
461
+ ### Test Best Practices
462
+
463
+ - **Arrange-Act-Assert** pattern
464
+ - **Independent tests** (no test dependencies)
465
+ - **Descriptive test names** (behavior, not implementation)
466
+ - **Test one thing** per test
467
+ - **Use fixtures** for complex test data
468
+ - **Mock external dependencies**
469
+
470
+ ## Git Standards
471
+
472
+ ### Commit Messages
473
+
474
+ **Format**: Conventional Commits
475
+ ```
476
+ type(scope): description
477
+
478
+ [optional body]
479
+
480
+ [optional footer]
481
+ ```
482
+
483
+ **Types**:
484
+ - `feat`: New feature (minor version bump)
485
+ - `fix`: Bug fix (patch version bump)
486
+ - `docs`: Documentation changes
487
+ - `refactor`: Code refactoring
488
+ - `test`: Test additions/changes
489
+ - `ci`: CI/CD changes
490
+ - `chore`: Maintenance tasks
491
+ - `perf`: Performance improvements
492
+ - `style`: Code style changes
493
+
494
+ **Examples**:
495
+ ```
496
+ feat(auth): add OAuth2 authentication support
497
+
498
+ Implements OAuth2 flow with Google and GitHub providers.
499
+ Includes token refresh and revocation.
500
+
501
+ Closes #123
502
+
503
+ ---
504
+
505
+ fix(api): resolve timeout in database queries
506
+
507
+ Optimized slow queries and added connection pooling.
508
+
509
+ ---
510
+
511
+ docs: update installation guide with Docker setup
512
+ ```
513
+
514
+ **Rules**:
515
+ - Subject line: imperative mood, lowercase, no period
516
+ - Max 72 characters for subject
517
+ - Blank line between subject and body
518
+ - Body: explain WHY, not WHAT
519
+ - Footer: reference issues, breaking changes
520
+ - No AI attribution or signatures
521
+
522
+ ### Branch Naming
523
+
524
+ **Format**: `type/description`
525
+
526
+ **Types**:
527
+ - `feature/` - New features
528
+ - `fix/` - Bug fixes
529
+ - `refactor/` - Code refactoring
530
+ - `docs/` - Documentation updates
531
+ - `test/` - Test improvements
532
+
533
+ **Examples**:
534
+ ```
535
+ feature/oauth-authentication
536
+ fix/database-connection-timeout
537
+ refactor/user-service-cleanup
538
+ docs/api-reference-update
539
+ test/integration-test-suite
540
+ ```
541
+
542
+ ### Pre-Commit Checklist
543
+
544
+ - ✅ No secrets or credentials
545
+ - ✅ No debug code or console.logs
546
+ - ✅ All tests pass locally
547
+ - ✅ Code follows style guidelines
548
+ - ✅ No linting errors
549
+ - ✅ Files under 500 lines
550
+ - ✅ Conventional commit message
551
+
552
+ ## Documentation Standards
553
+
554
+ ### Code Documentation
555
+
556
+ **Self-Documenting Code**:
557
+ - Clear variable and function names
558
+ - Logical code organization
559
+ - Minimal comments needed
560
+
561
+ **When to Comment**:
562
+ - Complex algorithms or business logic
563
+ - Non-obvious optimizations
564
+ - Workarounds for bugs/limitations
565
+ - Public API functions
566
+ - Configuration options
567
+
568
+ ### Markdown Documentation
569
+
570
+ **Structure**:
571
+ ```markdown
572
+ # Document Title
573
+
574
+ Brief overview paragraph
575
+
576
+ ## Section 1
577
+
578
+ Content with examples
579
+
580
+ ## Section 2
581
+
582
+ More content
583
+
584
+ ## See Also
585
+
586
+ - [Related Doc](./related.md)
587
+ ```
588
+
589
+ **Formatting**:
590
+ - Use ATX-style headers (`#`, `##`, `###`)
591
+ - Code blocks with language specification
592
+ - Tables for structured data
593
+ - Lists for sequential items
594
+ - Links for cross-references
595
+
596
+ **Code Blocks**:
597
+ ````markdown
598
+ ```javascript
599
+ function example() {
600
+ return 'example';
601
+ }
602
+ ```
603
+ ````
604
+
605
+ ## Agent-Specific Standards
606
+
607
+ ### Agent Definition Files
608
+
609
+ **Frontmatter**:
610
+ ```yaml
611
+ ---
612
+ name: agent-name
613
+ description: Brief description of agent purpose and when to use it
614
+ mode: subagent | all
615
+ model: anthropic/claude-sonnet-4-20250514
616
+ temperature: 0.1
617
+ ---
618
+ ```
619
+
620
+ **Required Sections**:
621
+ 1. Agent role and responsibilities
622
+ 2. Core capabilities
623
+ 3. Workflow process
624
+ 4. Output requirements
625
+ 5. Quality standards
626
+ 6. Communication protocols
627
+
628
+ ### Command Definition Files
629
+
630
+ **Frontmatter**:
631
+ ```yaml
632
+ ---
633
+ name: command-name
634
+ description: What this command does
635
+ ---
636
+ ```
637
+
638
+ **Argument Handling**:
639
+ - `$ARGUMENTS` - All arguments as single string
640
+ - `$1`, `$2`, `$3` - Individual positional arguments
641
+
642
+ **Example**:
643
+ ```markdown
644
+ ---
645
+ name: plan
646
+ description: Create implementation plan for given task
647
+ ---
648
+
649
+ Planning task: $ARGUMENTS
650
+
651
+ Using planner agent to research and create comprehensive plan for: $1
652
+ ```
653
+
654
+ ### Skill Definition Files
655
+
656
+ **Structure**:
657
+ ```markdown
658
+ # Skill Name
659
+
660
+ Guide for using [Technology] - brief description
661
+
662
+ ## When to Use
663
+
664
+ - List of use cases
665
+ - Scenarios where skill applies
666
+
667
+ ## Core Concepts
668
+
669
+ Key concepts and terminology
670
+
671
+ ## Implementation Guide
672
+
673
+ Step-by-step instructions
674
+
675
+ ## Examples
676
+
677
+ Practical examples
678
+
679
+ ## Best Practices
680
+
681
+ Recommendations and tips
682
+
683
+ ## Common Pitfalls
684
+
685
+ Mistakes to avoid
686
+
687
+ ## Resources
688
+
689
+ - Official docs
690
+ - Tutorials
691
+ - References
692
+ ```
693
+
694
+ ## Hook Implementation Standards
695
+
696
+ ### Scout Block Hook Architecture
697
+
698
+ **Cross-Platform Design Pattern**:
699
+ - **Dispatcher Pattern**: Single Node.js entry point delegates to platform-specific implementations
700
+ - **Platform Detection**: Use `process.platform` for automatic selection
701
+ - **Security-First**: Input validation, sanitized errors, safe execution
702
+
703
+ **File Organization**:
704
+ ```
705
+ .claude/hooks/
706
+ ├── scout-block.js # Node.js dispatcher (cross-platform entry)
707
+ ├── scout-block.sh # Bash implementation (Unix)
708
+ ├── scout-block.ps1 # PowerShell implementation (Windows)
709
+ ├── test-scout-block.sh # Unix test suite
710
+ └── test-scout-block.ps1 # Windows test suite
711
+ ```
712
+
713
+ **Implementation Requirements**:
714
+ - **Node.js Dispatcher**:
715
+ - Read stdin synchronously
716
+ - Validate JSON structure before parsing
717
+ - Check platform via `process.platform`
718
+ - Execute platform-specific script with piped input
719
+ - Handle errors with exit codes (0 = success, 2 = error)
720
+
721
+ - **Platform-Specific Scripts**:
722
+ - Parse JSON input (use Node.js for consistency, avoid jq dependency)
723
+ - Validate command structure and content
724
+ - Apply pattern matching for blocked paths
725
+ - Return appropriate exit codes
726
+ - Provide clear error messages
727
+
728
+ **Security Standards**:
729
+ ```javascript
730
+ // Input validation
731
+ if (!hookInput || hookInput.trim().length === 0) {
732
+ console.error('ERROR: Empty input');
733
+ process.exit(2);
734
+ }
735
+
736
+ // JSON structure validation
737
+ const data = JSON.parse(hookInput);
738
+ if (!data.tool_input || typeof data.tool_input.command !== 'string') {
739
+ console.error('ERROR: Invalid JSON structure');
740
+ process.exit(2);
741
+ }
742
+ ```
743
+
744
+ **Testing Standards**:
745
+ - Test both allowed and blocked patterns
746
+ - Validate error handling (invalid JSON, empty input, missing fields)
747
+ - Cross-platform test coverage
748
+ - Clear pass/fail indicators
749
+
750
+ ## Configuration File Standards
751
+
752
+ ### package.json
753
+
754
+ **Required Fields**:
755
+ - name, version, description
756
+ - repository (with URL)
757
+ - author, license
758
+ - engines (Node version >= 18.0.0)
759
+ - scripts (test, lint, etc.)
760
+
761
+ **Best Practices**:
762
+ - Use semantic versioning
763
+ - Specify exact dependency versions for stability
764
+ - Include keywords for discoverability
765
+ - Use `files` field to control published content
766
+ - Specify minimum Node.js version (18.0.0+)
767
+
768
+ ### .gitignore
769
+
770
+ **Standard Exclusions**:
771
+ ```
772
+ # Dependencies
773
+ node_modules/
774
+ package-lock.json (for libraries)
775
+
776
+ # Environment
777
+ .env
778
+ .env.*
779
+ !.env.example
780
+
781
+ # Build outputs
782
+ dist/
783
+ build/
784
+ *.log
785
+
786
+ # IDE
787
+ .vscode/
788
+ .idea/
789
+ *.swp
790
+
791
+ # OS
792
+ .DS_Store
793
+ Thumbs.db
794
+
795
+ # Testing
796
+ coverage/
797
+ *.test.js.snap
798
+
799
+ # Temporary
800
+ tmp/
801
+ temp/
802
+ *.tmp
803
+ ```
804
+
805
+ ## Performance Standards
806
+
807
+ ### Code Performance
808
+
809
+ **Optimization Priorities**:
810
+ 1. Correctness first
811
+ 2. Readability second
812
+ 3. Performance third (when needed)
813
+
814
+ **Common Optimizations**:
815
+ - Use appropriate data structures
816
+ - Avoid unnecessary loops
817
+ - Cache expensive computations
818
+ - Lazy load when possible
819
+ - Debounce/throttle frequent operations
820
+
821
+ **Example**:
822
+ ```javascript
823
+ // Cache expensive operations
824
+ const memoize = (fn) => {
825
+ const cache = new Map();
826
+ return (...args) => {
827
+ const key = JSON.stringify(args);
828
+ if (cache.has(key)) return cache.get(key);
829
+ const result = fn(...args);
830
+ cache.set(key, result);
831
+ return result;
832
+ };
833
+ };
834
+
835
+ const expensiveCalculation = memoize((n) => {
836
+ // Complex calculation
837
+ return result;
838
+ });
839
+ ```
840
+
841
+ ### File I/O
842
+
843
+ - Use async operations
844
+ - Stream large files
845
+ - Batch writes when possible
846
+ - Clean up file handles
847
+
848
+ ## Quality Assurance
849
+
850
+ ### Code Review Checklist
851
+
852
+ **Functionality**:
853
+ - ✅ Implements required features
854
+ - ✅ Handles edge cases
855
+ - ✅ Error handling complete
856
+ - ✅ Input validation present
857
+
858
+ **Code Quality**:
859
+ - ✅ Follows naming conventions
860
+ - ✅ Adheres to file size limits
861
+ - ✅ DRY principle applied
862
+ - ✅ KISS principle followed
863
+ - ✅ Well-structured and organized
864
+
865
+ **Security**:
866
+ - ✅ No hardcoded secrets
867
+ - ✅ Input sanitization
868
+ - ✅ Proper authentication/authorization
869
+ - ✅ Secure dependencies
870
+
871
+ **Testing**:
872
+ - ✅ Unit tests included
873
+ - ✅ Integration tests for flows
874
+ - ✅ Edge cases tested
875
+ - ✅ Error paths covered
876
+
877
+ **Documentation**:
878
+ - ✅ Code comments where needed
879
+ - ✅ API documentation updated
880
+ - ✅ README updated if needed
881
+ - ✅ Changelog entry added
882
+
883
+ ## Enforcement
884
+
885
+ ### Automated Checks
886
+
887
+ **Pre-Commit**:
888
+ - Commitlint (conventional commits)
889
+ - Secret scanning
890
+ - File size validation
891
+
892
+ **Pre-Push**:
893
+ - Linting (ESLint, Prettier)
894
+ - Unit tests
895
+ - Type checking
896
+
897
+ **CI/CD**:
898
+ - All tests
899
+ - Build verification
900
+ - Coverage reports
901
+ - Security scans
902
+
903
+ ### Manual Review
904
+
905
+ **Code Review Focus**:
906
+ - Architecture and design decisions
907
+ - Complex logic correctness
908
+ - Security implications
909
+ - Performance considerations
910
+ - Maintainability and readability
911
+
912
+ ## Exceptions
913
+
914
+ **When to Deviate**:
915
+ - Performance-critical code (document reasons)
916
+ - External library constraints
917
+ - Generated code (mark clearly)
918
+ - Legacy code (plan refactoring)
919
+
920
+ **Documentation Required**:
921
+ ```javascript
922
+ /**
923
+ * EXCEPTION: File exceeds 500 lines
924
+ * REASON: Critical performance optimization requires monolithic structure
925
+ * TODO: Refactor when performance is no longer critical
926
+ * DATE: 2025-10-26
927
+ */
928
+ ```
929
+
930
+ ## References
931
+
932
+ ### Internal Documentation
933
+ - [Project Overview PDR](./project-overview-pdr.md)
934
+ - [Codebase Summary](./codebase-summary.md)
935
+ - [System Architecture](./system-architecture.md)
936
+
937
+ ### External Standards
938
+ - [Conventional Commits](https://conventionalcommits.org/)
939
+ - [Semantic Versioning](https://semver.org/)
940
+ - [Keep a Changelog](https://keepachangelog.com/)
941
+ - [OWASP Top 10](https://owasp.org/www-project-top-ten/)
942
+
943
+ ### Related Projects
944
+ - [Claude Code Documentation](https://docs.claude.com/)
945
+ - [Open Code Documentation](https://opencode.ai/docs)
946
+
947
+ ## Unresolved Questions
948
+
949
+ None. All code standards are well-defined and documented.