Skip to content

Instantly share code, notes, and snippets.

@cantis
Last active August 29, 2025 13:58
Show Gist options
  • Select an option

  • Save cantis/0c7d97b03dbb504c345c2e3a08421544 to your computer and use it in GitHub Desktop.

Select an option

Save cantis/0c7d97b03dbb504c345c2e3a08421544 to your computer and use it in GitHub Desktop.
My current default Github Copilot Instructions for Python Instructions

My Co-Pilot Instructions

Note: these are poroject specific and were generated by running the CHAT: Generate Workplace Instructions file from the command pallet.

Project Overview

Flask-based time tracking application with Bootstrap frontend, SQLite database, and Docker containerization. Uses Blueprint architecture with three main modules: home (entry management), reports (analytics), and admin (settings).

Architecture Patterns

  • Flask application factory in app/app.py with Blueprint registration
  • Time storage format: Mixed handling of both integer minutes-past-midnight and "HH:MM" strings (see parse_time_to_minutes() in reports.py)
  • Database models: SQLAlchemy with explicit __init__ methods for type hinting (see app/models.py)
  • Template structure: Base template with Bootstrap 5, header/footer includes, flash message handling

Development Workflow

  • Package management: uv for dependencies, PowerShell for commands
  • Testing: pytest with arrange/act/assert pattern, $env:PYTHONPATH='S:\TimeTracker'; pytest to run
  • Database: SQLite with Docker volume mounting to /app/data
  • CSS/JS: Inline in templates, sortable tables with time format conversion

Time Handling Specifics

# Always use parse_time_to_minutes() for mixed format support
def parse_time_to_minutes(value):
    # Handles both 480 (int) and "8:00" (str) formats

Testing Conventions

  • Use with app.app_context(): for database operations in tests
  • Import models locally in test functions to avoid circular imports
  • Direct route paths ("/reports/weekly") instead of url_for() to avoid Flask context issues

Code Style

  • PEP 8 naming, type annotations for functions/variables
  • Sorted imports per ruff style
  • Minimal docstrings for files, functions, classes
  • No logging unless specifically requested
  • | syntax for optional model fields
@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