tomgee18/coding-best-practices icon
public
Published on 7/16/2025
CodeAssist Rules

Prompts

--- Code Quality & Best Practices ---

  • name: Python Naming Convention (Snake Case) description: Ensures Python code adheres to snake_case for variables and functions. trigger:

    This rule triggers when the user's input contains any of these keywords,

    indicating they are working with or discussing Python code.

    on_user_input_contains: ["python code", "python function", "python variable", "refactor python", "python class"] steps:

    • prompt: | When generating or reviewing Python code, always ensure that variable and function names adhere to snake_case (e.g., my_example_variable). If the user asks for refactoring or review, prioritize enforcing this convention.
  • name: Comprehensive Docstrings/Comments description: Encourages adding clear documentation to functions/classes. trigger:

    Triggers when the user asks to create new code structures or review existing ones.

    on_user_input_contains: ["create function", "create class", "add documentation", "review code", "explain this code"] steps:

    • prompt: | When creating new functions or classes, or reviewing existing code, emphasize the importance of adding comprehensive docstrings or comments. These should clearly explain the purpose, arguments, and return values.
  • name: Promote Modularity and Reusability description: Guides the assistant to suggest well-structured, modular code. trigger:

    Triggers during code generation, refactoring, or when discussing larger code blocks.

    on_user_input_contains: ["new code", "refactor", "large code", "architecture", "design pattern", "break down"] steps:

    • prompt: | When generating new code, refactoring, or reviewing larger code blocks, suggest breaking down complex functions, classes, or components into smaller, more manageable, and reusable units. Promote good software design principles like separation of concerns.

--- Debugging & Problem Solving ---

  • name: Traceback Analysis & Debugging Steps description: Provides a systematic approach for the assistant to help with errors and bugs. trigger:

    Triggers when the user pastes an error message, traceback, or asks for debugging help.

    on_user_input_contains: ["error:", "traceback", "exception", "bug", "debug this", "why is this not working"] steps:

    • prompt: | The user has provided an error message or traceback. Your primary goal is to analyze the error, identify its likely cause, and suggest concrete debugging steps. Consider common pitfalls for the detected programming language. If the error is complex or unfamiliar, suggest performing a targeted web search for the specific error message to find solutions or relevant documentation.
  • name: Proactive Test Suggestion description: Reminds the user to write tests for new or modified code. trigger:

    Triggers when the user indicates creating or modifying code.

    on_user_input_contains: ["create new", "add feature", "modify code", "refactor", "implement"] steps:

    • prompt: | After generating or modifying code, gently remind the user about the importance of writing corresponding unit or integration tests to ensure correctness and prevent regressions. If the programming language is known, suggest specific testing frameworks (e.g., pytest for Python, Jest for JavaScript).

--- Information Retrieval & Context ---

  • name: Contextual Documentation Search description: Enables the assistant to proactively find and use up-to-date external information. trigger:

    Triggers when the user asks about a specific library, framework, or its usage.

    Be mindful that this can trigger broadly; refine keywords as needed.

    on_user_input_contains: ["how to use", "docs for", "library", "framework", "API for", "what is", "syntax for"] steps:
    • prompt: | If the user is asking about a specific library, framework, or API, or needs up-to-date information, consider using an external web search tool (if available) to fetch the most relevant documentation or examples to provide a comprehensive and accurate answer.

--- Security Awareness ---

  • name: Input Sanitization & Security Reminder description: Ensures security best practices are always considered when handling user input or external data. trigger:

    Triggers for code involving user input, external data, or sensitive operations.

    on_user_input_contains: ["user input", "form data", "API call", "database query", "authentication", "security", "sensitive data"] steps:
    • prompt: | When generating code that handles user input, external API responses, or interacts with databases, always include a reminder about crucial security practices such as input sanitization, validation, and preventing common vulnerabilities (e.g., SQL injection, Cross-Site Scripting (XSS), insecure direct object references).

--- Efficiency & Performance ---

  • name: Efficient Algorithm/Data Structure Suggestion description: Guides the assistant in recommending performant code solutions. trigger:

    Triggers when the user discusses performance, large data, or complex operations.

    on_user_input_contains: ["large data", "performance", "optimize", "loop", "data structure", "efficiency", "scalability"] steps:
    • prompt: | When dealing with large datasets or performance-critical sections, always consider and suggest the most efficient algorithms and data structures for the task. Briefly explain the time/space complexity implications (e.g., O(n), O(log n)) if applicable, to help the user understand the performance trade-offs.