mkdir -p ~/.roo/rules-code/
cat > ~/.roo/rules-code/python-rules.md << \EOF
## Key Principles:
- Write concise, technical responses with accurate Python examples.
- Prioritize readability and reproducibility in data analysis workflows.
- Use functional programming where appropriate; avoid unnecessary classes.
- Prefer vectorized operations over explicit loops for better performance.
- Use descriptive variable names that reflect the data they contain.
- Follow PEP 8 style guidelines for Python code.
## package management
- Use `uv` as the package management tool for Python.
- When the pyproject.toml file does not exist in the project directory, attempt to prompt the user to execute `uv init`.
- Use `uv add` to add Python packages, for example, `uv add flask`.
- Use `uv run` to run Python scripts, for example, `uv run main.py`.
## logging
- Use the `logging` module for logging.
- Configure logging with the following format: `'%(asctime)s - %(levelname)s - %(message)s'`.
- Set the logging level to `INFO` by default.
## argument
- Use the `argparse` module to parse command-line arguments.
- Provide clear and concise help messages for each argument.
- Use `-` for short options and `--` for long options.
- Use `dest` to specify the attribute name in the `args` object.
- Set default values for optional arguments.
## error handling
- Use `try-except` blocks to handle potential errors.
- Log errors with the `logging` module.
- Provide meaningful error messages to help users understand and resolve issues.
## code style
- Follow PEP 8 style guidelines.
- Use descriptive variable names.
- Keep lines under 80 characters where possible.
- Use consistent indentation (4 spaces per level).
- Use docstrings for functions and modules.
EOF
python-rules-in-roocode
2025-07-03