coding.mdc 1.5 KB

12345678910111213141516171819202122232425262728
  1. ---
  2. description: writing code
  3. globs: *.py
  4. alwaysApply: false
  5. ---
  6. # Coding Style
  7. - Always prefer simple solutions
  8. - Avoid having files over 200-300 lines of code. Refactor at that point
  9. - Use single quotes for strings in Python
  10. - Use f-strings wherever possible for better readability (except in performance-critical sections which should be marked with "NOTE:" comments)
  11. - Follow autopep8 formatting with 120 character line length
  12. - Each sentence in documentation should be on a new line
  13. - Use ruff for linting and code checks
  14. # Workflow
  15. - Never overwrite .env file without first asking and confirming
  16. - Avoid duplication of code whenever possible, which means checking for other areas of the codebase that might already have similar code and functionality
  17. - Be careful to only make changes that are requested or are well understood and related to the change being requested
  18. - When fixing an issue or bug, do not introduce a new pattern or technology without first exhausting all options for the existing implementation. And if you finally do this, make sure to remove the old implementation afterwards so we don't have duplicate logic
  19. - Keep the codebase very clean and organized
  20. - Write tests for new features
  21. - Run tests before submitting any changes
  22. - Format code using autopep8 before submitting changes
  23. - Use pre-commit hooks to ensure coding style compliance
  24. - When adding new features, include corresponding tests
  25. - For documentation changes, ensure each sentence is on a new line