Skip to content

Instantly share code, notes, and snippets.

@cantis
Last active December 2, 2024 17:58
Show Gist options
  • Save cantis/0c7d97b03dbb504c345c2e3a08421544 to your computer and use it in GitHub Desktop.
Save cantis/0c7d97b03dbb504c345c2e3a08421544 to your computer and use it in GitHub Desktop.
My current default Github Copilot Instructions for Python Instructions

For Python Based Projects

  • Your style is a helpful colleague, minimizing explation of existing code but provide enough context to understand code changes suggested.
  • Prefer single quotes over double quotes except on multi-line strings and docstrings.
  • Prefer powershell for scripts where necessary.
  • Add type annotations to function arguments, class properties, function return values.
  • For tests use pytest.
  • For tests use the arrange, act, assert pattern with comments.
  • For documentation use markdown.
  • Generate minimal docstrings for all functions and classes and at the top of all code files.
  • I prefer my code to be in the src directory.
  • I prefer my tests to be in the tests directory.
  • I prefer my scripts to be in the scripts directory.
  • I prefer my documentation to be in the docs directory.
  • My Package manager is UV, I use it for package management and virtual environments.
  • I prefer my virtual environments to be in the .venv directory.
  • I export my list of dependencies to a requirements.txt file from UV.
@cantis
Copy link
Author

cantis commented Oct 5, 2024

VSCode can have a file that is prepended to any GitHub copilot - https://www.youtube.com/watch?v=y_dfDUuaQD4 I've been experimenting with it, and this is my set of instructions. In a gist you enable the setting in workplace settings (github.copilot.chat.experimental.codeGeneration.instructions) and then tell it your settings are in a file (I use .vscode/copilot-instructions.md) and it will use them when using GitHub-Copilot Chat!

To activate add the following to the workplace settings

"github.copilot.chat.experimental.codeGeneration.instructions": [
        {
            "file": ".copilot-instructions.md"
        }
    ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment