docs: add Agent Rules section to IMPLEMENTATION.md

Added key principles and constraints:
- React 19 optimization (no useCallback/useMemo)
- Code conventions (no comments, type-first)
- Architecture patterns (hook composition, refs)
- Documentation standards

These rules guide all implementation decisions and ensure consistency.
This commit is contained in:
2025-10-22 19:08:54 +01:00
parent 1409dcf012
commit 38b9b4b694
+29
View File
@@ -8,6 +8,35 @@ We are porting vim-sudoku from the old architecture (src_old) to follow the unif
---
## Agent Rules
These are the key principles and constraints that guide this implementation:
### React 19 Optimization
- **No `useCallback` or `useMemo`**: React 19's compiler automatically optimizes, making these hooks unnecessary
- Use plain functions instead of wrapped callbacks
- React will handle memoization automatically
- Cleaner, more readable code
### Code Conventions
- **No comments**: Code should be self-documenting unless explicitly requested
- **Type-first approach**: Define types before implementation
- **Explicit imports**: Always import types with `import type`
- **Return type annotations**: Use `ReturnType<typeof hookName>` for hook return types
### Architecture Patterns
- **Hook composition**: Small, focused hooks composed together
- **Ref-based state**: Use refs for non-reactive state, useState for reactive
- **Module organization**: Each hook module has types.ts, implementation, and index.ts
- **Follow vim-maze patterns**: Maintain consistency across games
### Documentation
- **Update IMPLEMENTATION.md**: After every iteration
- **Clear commit messages**: Describe what, why, and how
- **Track issues and solutions**: Document problems encountered and fixes
---
## Iteration 1: Preparation & Planning
**Date**: 2025-01-22