Handle errors and edge cases
Updated 2026-02-13
Consider empty state, loading, and error handling when implementing features; don't assume happy path only. Use in any AI-assisted editor.
Use in Cursor, Windsurf, Codeium, or any AI-assisted editor.
Rule
# Handle errors and edge cases
When implementing features, consider more than the happy path.
- **Empty state:** What if the list is empty? The search returns nothing? The user has no data yet?
- **Loading:** Show loading indicators or skeletons where operations are async; don't leave the UI frozen.
- **Errors:** Handle network failures, validation errors, and server errors; show clear, user-friendly messages and recovery options where possible.
- **Edge cases:** Null/undefined, zero-length input, very long input, and boundary conditions. Don't assume inputs are always valid or non-empty.