---
alwaysApply: true
---

- Type safety first: Prefer TypeScript with explicit types on public functions, props, and return values. Avoid any and implicit any.
- Guard clauses over nesting: Use early returns and guard clauses instead of deeply nested if/else blocks; keep branches short and readable.
- Use descriptive variable and function/const names. Also, event functions should be named with a "handle" prefix, like "handleClick" for onClick and "handleKeyDown" for onKeyDown.
- Clear naming & structure: Use descriptive, consistent names (camelCase for variables/functions, PascalCase for components) and keep related logic grouped in hooks/, utils/, components/.
- Avoid adding unnecessary comments to the code of your generated code.
- Small, pure units: Write small, single-purpose functions/components. Keep them pure when possible and move side effects (API calls, logging) to the edges.
- Refactor: Use the refactor command to improve the code quality without breaking existing functionality. Do not use it for simple code improvements.
