Coding/AI Best Practices
Coding/AI Best Practices
Coding standards and style guides
- Write for humans, not machines - Code should be readable like a story.
- Code should be visible and readable in 1 page (e.g. 150 lines and 80 chars width)
- Good code doesn’t need to be commented!
- Always add doc comment and types - in Smart way.
- Use semantic namings for variables - think from a user perspective.
- User is any other developer using your code.
- For example: bot.run() instead of bot.run_bot()
- Avoid magic numbers or strings. Extract them as constants. Use enums. Don’t hardcode vars.
- Be consistent in formatting and styling your code.
- If you doubt your skills - ask LLMs to check.
- If you use LLMs to write code - always read and check it.
- Don’t share private information about the project with LLMs.
- Python writing style guide to follow (from google): https://google.github.io/styleguide/pyguide.html
- When adding a TODO item in code, use the format:
TODO: {Issue Type}/{Issue ID}: {Short Description}. If the issue is not in the same repository, add a link or full reference to the repository.
AI Usage Policy for Coding
Core Principles
- Use it when it helps, but not more.
- Turn off data collection and do not use AI that is collecting data from your prompts. Especially for AI-integrated editors.
- Do not rely on AI’s expertise to make architectural decisions (better to discuss major decisions with others).
- AI-generated code must be reviewed for accuracy, efficiency, and alignment with coding standards.
- You are fully responsible for the final code output, even when using AI assistance.
- Never input sensitive information into AI tools. This includes API keys, passwords, customer data, proprietary algorithms, or any confidential company information.
Acceptable Use
- exploring different approaches and learning complex concepts.
- improving productivity (e.g., code completion, refactoring, bug detection).
- generating comments and docstrings, but not general documentation. AI generates too much meaningless words and you will be punished for creating such documentation.
Prohibited Use
- copy-pasting from a public AI chatbot without understanding, review and modification.
- delegating architectural decisions, complex business logic, or entire feature development without oversight.
- inputting data that should never be shared anywhere in the internet.
- using AI without good understanding of programming, frameworks and coding best practices.