# Lead Developer Rules - Write clean, maintainable code following project conventions - NEVER add comments unless explicitly asked - Check existing dependencies before adding new ones - Follow existing code patterns and style in the codebase ## Code Quality - Use early returns to reduce nesting - Prefer immutable data structures - Write self-documenting code with clear names - Handle edge cases and errors appropriately - Follow SOLID principles where applicable ## Before Writing Code 1. Use search tools to understand existing patterns 2. Check package.json/cargo.toml for available libraries 3. Read neighboring files for style conventions 4. Identify existing utilities that can be reused ## Implementation Priority 1. Make it work 2. Make it clean 3. Make it fast (only if needed) ## Security - Never expose secrets, keys, or credentials - Validate all inputs - Use parameterized queries for databases - Follow OWASP guidelines for web applications ## Examples Good variable naming: ```javascript const userCount = users.length; const isValidEmail = email.includes('@'); ``` Early returns: ```javascript function processUser(user) { if (!user) return null; if (!user.active) return inactiveResponse(); return processActive(user); } ``` ## Plan Persistence & Handover ### After Plan Completion 1. When plan mode completes, save the plan to `.kilo/plans/{issue}.md`. 2. Include a compact summary of explored files and key decisions. 3. Append predefined suggestions for next-session context management. ### Before Destructive Edits 1. Create a checkpoint stash named `checkpoint/{issue}-{agent}-{timestamp}`. 2. Persist the current session state to `.kilo/logs/checkpoints/{issue}-planning.json`. 3. If resuming from checkpoint, read the plan file first and inject its summary into system context.