Basic Intructions
Documentation for Public
MAIN DIRECTIVE
- Work on one file at a time (multiple simultaneous edits cause corruption)
- Development phase: backward compatibility not required
- Keep educational conversation to a minimum while coding
- Verify information before making changes
- Preserve existing code structures
- Provide concise and relevant responses
- Verify all information before making changes
- Your code must be minimal world-class solution that meets all specifications. Your code changes should be specific and complete. Think through the problem step-by-step.
You will be penalized if you:
- Skip steps in your thought process
- Add placeholders or TODOs for other developers
- Deliver code that is not production-ready
LARGE FILES PROTOCOL (>300 lines)
MANDATORY PLANNING
- Create detailed plan BEFORE editing
- Include: functions to modify, order of changes, dependencies, number of edits
- Format: "Edit Plan → Numbered sequence"
- After each edit: "✅ Completed edit [#] of [total]"
CONVENTIONS AND STRUCTURE
Naming
- Files: kebab-case (
user-service.ts) - Classes: PascalCase (
UserService) - Interfaces: PascalCase +
I(IUser) - Properties/methods: camelCase (
getUserData)
File Suffixes
- Services:
.service.ts - Types:
.types.ts - Utilities:
.utils.ts - Tests:
.test.ts - Mocks:
.mock.ts
MANDATORY PRINCIPLES
SOLID + DRY + KISS (Always mandatory)
- SRP: One responsibility per class/function
- OCP: Extensible without modifying existing code
- ISP: Specific interfaces, not general ones
- DIP: Dependency injection, depend on abstractions
- DRY: Extract common logic to utilities
- KISS: Simple and direct solutions
TECHNICAL RESTRICTIONS
Forbidden
setTimeout(use RxJS operators:delay,debounceTime)any(useSafeAnyonly if absolutely necessary)- Promises (prefer RxJS Observables)
- Direct object mutation
Mandatory
- RxJS for reactivity
- Strict TypeScript types
- Immutability
- Consistent error handling with
try/catchand RxJScatchError
TESTING
- Arrange-Act-Assert pattern
- Minimum 80% coverage
- Unit tests for services and critical functions
- No TypeScript warnings
CODE QUALITY
- Functions: max 20-30 lines
- Classes: max 200-300 lines
- Parameters: max 3-4 per function
- Organized imports: external libraries → core types → services → relative
ERROR MANAGEMENT
export class ErrorHandler {
static handle(error: unknown): IErrorResult {
// Consistent error handling
}
}
OPTIMIZATION
- Use caching when applicable
- Memoization for expensive calculations
- RxJS stream composition
- Extract complex logic to specialized services
REFACTORING
- Split large files into logical modules
- Maintain functionality in intermediate states
- Consider temporary duplication as a valid step
- Update exports/imports when necessary