Created
June 8, 2025 08:13
-
-
Save take0x/74ed8be6d9cdd3b08d49a7520cc12486 to your computer and use it in GitHub Desktop.
Development guidelines for Cursor rules
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Development Guidelines | |
## Code Quality Standards | |
### Language and Documentation | |
- Write all code, comments, and docstrings in English only (no Japanese) | |
- Use clear, descriptive variable and function names | |
- Add comprehensive docstrings for all public functions and classes | |
- Include type hints for all function parameters and return values | |
### Type Safety | |
- Never use `Any` type - always specify concrete types | |
- Use mypy for static type checking to ensure type safety | |
### Code Style and Linting | |
- Resolve all linter errors before completing any task | |
- Follow PEP 8 style guidelines | |
- Use Ruff for code formatting and linting | |
- Use mypy for static type checking | |
- Maintain consistent import ordering (use isort) | |
- Prefer pathlib over os.path for file operations | |
### Configuration and Constants | |
- Never hardcode values - use configuration files, environment variables, or constants | |
- Define all magic numbers and strings as named constants at module level | |
- Use environment variables for runtime configuration (API keys, URLs, file paths) | |
- Store application settings in configuration files (YAML, TOML, or JSON) | |
- Group related constants in dedicated modules or classes | |
- Make configuration values easily discoverable and documented | |
## Architecture and Design | |
### Dependency Management | |
- Use `uv` for all dependency management (never pip, pip-tools, or poetry) | |
- Pin dependency versions in pyproject.toml | |
- Keep dependencies minimal and well-justified | |
- Separate dev dependencies from runtime dependencies | |
### Error Handling | |
- Use specific exception types rather than generic Exception | |
- Provide meaningful error messages with context | |
- Log errors appropriately with proper log levels | |
- Handle edge cases gracefully | |
### Performance Considerations | |
- Implement caching where appropriate (following existing cache system) | |
- Use efficient data structures and algorithms | |
- Profile performance-critical code paths | |
- Consider memory usage for large datasets | |
## Project-Specific Guidelines | |
### OpenAI API Integration | |
- Handle API rate limits and errors gracefully | |
- Implement proper retry logic with exponential backoff | |
- Validate API responses before processing | |
- Use environment variables for API configuration | |
### File I/O and Data Handling | |
- Use pathlib for all file operations | |
- Validate file formats and content before processing | |
- Handle missing files and directories gracefully | |
- Implement proper cleanup for temporary files | |
### Logging and Debugging | |
- Use structured logging with appropriate levels | |
- Include context information in log messages | |
- Support debug mode for detailed troubleshooting | |
- Respect user-configured log levels | |
### CLI Interface | |
- Provide clear help messages and examples | |
- Validate user input and provide helpful error messages | |
- Support both interactive and batch processing modes | |
## Security Considerations | |
- Never commit API keys or sensitive data | |
- Validate all external inputs | |
- Use secure file permissions for cache and output files | |
- Follow principle of least privilege for file operations |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment