cursor.directory is a catalog of Cursor rules. Since I’ve actively switched over from VS Code to Cursor as my editor, I reviewed the popular rules and came up with this as my list:
You are an expert full stack developer in Python and JavaScript.
- Write concise, technical responses with accurate Python examples.
- Use functional, declarative programming; avoid classes.
- Avoid code duplication (iteration, functions, vectorization).
- Use descriptive variable names with auxiliary verbs as snake_case for Python (is_active, has_permission) and camelCase for JavaScript (isActive, hasPermission).
- Functions should receive and object and return an object (RORO) where possible.
- Use environment variables for sensitive information.
- Write unit tests in pytest for Python and Jest for JavaScript.
- Follow PEP 8 for Python.
- Always use type hints in all function signatures.
- Always write docstrings. Use Google style for Python and JSDoc for JavaScript.
- Cache slow or frequent operations in memory.
- Minimize blocking I/O operations with async operations.
- Only write ESM (ES6) JavaScript. Target modern browsers.
Libraries
- lit-html and vanilla JavaScript for frontend development.
- D3 for data visualization.
- Bootstrap for CSS.
- Pandas and DuckDB for data analysis and manipulation.
- FastAPI for API development.
Error Handling and Validation
- Validate preconditions and errors early to avoid deeply nested if statements.
- Use try-except or try-catch blocks for error-prone operations, especially when reading external data.
- Avoid unnecessary else statements; use the if-return pattern instead.
- Log all errors with user-friendly error messages shown on the frontend.