Skip to content

Ready-to-use GitHub Copilot demo kit with intentional bugs, TODOs, and security vulnerabilities. Complete test suite (227+ tests, 93% coverage) + reset script for live test generation demos. Perfect for trainers showcasing AI-assisted development.

License

Notifications You must be signed in to change notification settings

SQLtattoo/GH-300-GitHub-Copilot-Demos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ GitHub Copilot Demo Starter Kit

A comprehensive, ready-to-use demonstration kit showcasing GitHub Copilot's capabilities across code completion, bug detection, test generation, refactoring, security analysis, and more.

πŸ“‹ Table of Contents

🎯 Overview

This demo kit is designed for trainers, presenters, and teams who want to showcase GitHub Copilot's powerful AI-assisted development capabilities. It includes:

  • 3 Python modules with intentional bugs, TODOs, and optimization opportunities
  • Comprehensive test suite demonstrating test generation capabilities
  • Step-by-step trainer script with interactive guidance
  • Detailed demo guide covering 10 key capability areas
  • Automated setup for consistent environment configuration

Duration: 45-90 minutes (flexible)
Skill Level: Beginner to Advanced
Prerequisites: Python 3.8+, VS Code, GitHub Copilot extension

⚠️ Note: This repository intentionally contains bugs and insecure patterns (e.g., eval, path traversal) for demonstration purposes only.

🧠 Choosing the Right Copilot Model

GitHub Copilot supports multiple AI models, each optimized for different tasks (speed, cost, deep reasoning, strict code generation, or agent workflows).

To help you choose the right model during the demo, refer to the visual decision guide:

πŸ‘‰ Copilot Model Decision Tree

Tip for presenters:

  • Default to Balanced models for most demos
  • Switch to Deep-Reasoning models for architecture or complex bugs
  • Use Code-Focused models for large refactors or migrations
  • Use Agent-Strong models when demonstrating multi-file changes or Copilot Agents

⚑ Quick Start

# 1. Clone or download this repository
cd "GH-300-GitHub-Copilot-Demos"

# 2. Run the setup script
.\setup_demo.ps1

# 3. Open in VS Code
code .

That's it! The setup script will:

  • βœ… Create and activate a virtual environment
  • βœ… Install all dependencies
  • βœ… Configure VS Code settings
  • βœ… Verify the installation
  • βœ… Create quick reference guides

πŸ’‘ For Presenters: The main branch has complete tests (227+). Use .\reset_for_demo.ps1 before demos to showcase Copilot's test generation capabilities. Script backs up tests automatically and creates minimal stubs. After demos: git checkout . to restore.

πŸ“¦ What's Included

Python Modules (with Intentional Issues)

  • calculator.py - Arithmetic operations with:

    • Empty list bugs
    • Duplicate constants
    • Missing error handling
    • Edge case issues
    • Incomplete implementations (TODOs)
  • data_processor.py - Data operations with:

    • O(nΒ²) performance problems
    • Security vulnerabilities (eval)
    • Missing type hints
    • Edge case bugs
  • file_handler.py - File I/O with:

    • Path traversal vulnerabilities
    • Missing error handling
    • Encoding issues
    • Incomplete implementations

Test Suite

  • test_calculator.py - 15 comprehensive test cases
  • test_data_processor.py - 17 test cases with edge cases
  • test_file_handler.py - 16 test cases including mocks
  • test_runner.py - Unified test runner

Demo Materials

  • setup_demo.ps1 - Automated environment setup
  • QUICK_REFERENCE.md - Auto-generated cheat sheet
  • requirements-test.txt - Python dependencies

πŸŽͺ Demo Capabilities

1. Code Completion & Generation (15 min)

  • Function completion from comments
  • Multi-line code generation
  • Alternative suggestions
  • Context-aware implementations

2. Bug Detection & Fixing (15 min)

  • Empty list handling
  • Edge case identification
  • Input validation
  • Defensive programming

3. Code Refactoring (10 min)

  • Eliminate duplication
  • Performance optimization (O(nΒ²) β†’ O(n))
  • Design pattern improvements
  • Code smell detection

4. Test Generation (15 min)

  • Automated test creation
  • Edge case coverage
  • Mock object generation
  • Test debugging

5. Documentation (10 min)

  • Docstring generation
  • Parameter documentation
  • Usage examples
  • Behavior explanations

6. Security Analysis (10 min)

  • Code injection detection (eval)
  • Path traversal vulnerabilities
  • Input validation gaps
  • Secure alternatives

7. Learning & Explanation (5 min)

  • Code explanation
  • Pattern alternatives
  • Best practice suggestions

πŸ› οΈ Setup Instructions

Prerequisites

Automated Setup

# Basic setup
.\setup_demo.ps1

# Skip test verification (faster)
.\setup_demo.ps1 -SkipTests

# Force recreate environment
.\setup_demo.ps1 -Force

Manual Setup (if needed)

# Create virtual environment
python -m venv .venv

# Activate it
.\.venv\Scripts\Activate.ps1

# Install dependencies
pip install -r requirements-test.txt

# Verify installation
python test_runner.py

🎬 Running the Demo

Using the Test Suite

pytest

This provides:

  • βœ… 227 comprehensive test cases
  • βœ… 93% code coverage
  • βœ… Security vulnerability tests
  • βœ… Performance validation
  • βœ… HTML coverage reports

Manual Exploration

  1. Review the improved codebase
  2. Check TRANSFORMATION_GUIDE.md for the full journey
  3. Run tests to verify everything works
  4. Review CHANGELOG.md for all changes

Custom Demo

Pick and choose sections based on:

  • Time available
  • Audience skill level
  • Specific interests (security, testing, performance)

πŸ“ Project Structure

GitHub Copilot Demos Starter/
β”œβ”€β”€ calculator.py              # Module 1: Arithmetic operations
β”œβ”€β”€ data_processor.py          # Module 2: Data operations
β”œβ”€β”€ file_handler.py            # Module 3: File I/O
β”œβ”€β”€ data_table.py              # Module 4: Table component
β”œβ”€β”€ logger.py                  # Centralized logging
β”œβ”€β”€ main.py                    # Entry point
β”‚
β”œβ”€β”€ tests/                     # Test suite (227 tests)
β”‚   β”œβ”€β”€ test_calculator.py     # Calculator tests (80+)
β”‚   β”œβ”€β”€ test_data_processor.py # Data processor tests (60+)
β”‚   β”œβ”€β”€ test_file_handler.py   # File handler tests (50+)
β”‚   β”œβ”€β”€ test_data_table.py     # Data table tests (70+)
β”‚   β”œβ”€β”€ test_logger.py         # Logger tests (40+)
β”‚   └── conftest.py            # Shared fixtures
β”‚
β”œβ”€β”€ setup_demo.ps1             # Automated setup script
β”œβ”€β”€ pytest.ini                 # Test configuration
β”œβ”€β”€ TRANSFORMATION_GUIDE.md    # Complete improvement journey
β”œβ”€β”€ CHANGELOG.md               # All changes documented
β”œβ”€β”€ QUICK_REFERENCE.md         # Quick commands reference
β”œβ”€β”€ README.md                  # This file
β”œβ”€β”€ requirements-test.txt      # Python dependencies
β”‚
β”œβ”€β”€ .venv/                     # Virtual environment (created by setup)
β”œβ”€β”€ .vscode/                   # VS Code settings (created by setup)
β”‚   └── settings.json          # Python & testing configuration
β”‚
└── __pycache__/               # Python cache (auto-generated)

πŸ§ͺ Testing Commands

# Run all tests
python test_runner.py

# Run specific test file
python -m pytest test_calculator.py -v

# Run specific test class
python -m pytest test_calculator.py::TestCalculator -v

# Run specific test method
python -m pytest test_calculator.py::TestCalculator::test_average -v

# Run with coverage
pytest --cov=. --cov-report=html

# View coverage report
start htmlcov/index.html

🎯 Key Demo Locations

Bugs to Fix

File Line Issue Demo Type
calculator.py ~62 Empty list in average() Bug Detection
calculator.py ~68-75 Duplicate PI constant Refactoring
calculator.py ~80 Missing error handling Code Quality
calculator.py ~96 No empty check Edge Cases
data_processor.py ~41 O(nΒ²) performance Optimization
data_processor.py ~57 eval() security risk Security
file_handler.py ~49 Path traversal Security

TODOs to Complete

File Line Task Demo Type
calculator.py ~27 Implement multiply() Code Completion
calculator.py ~30 Implement divide() Code Completion
calculator.py ~46 Implement square_root() Code Generation
calculator.py ~81 Implement factorial() Code Generation
data_processor.py ~19 is_palindrome() Code Completion
file_handler.py ~32 write_text_file() Code Completion

πŸ’‘ Copilot Commands Reference

Editor Shortcuts

  • Accept: Tab
  • Alternatives: Ctrl + Enter
  • Next/Previous: Alt + ] / Alt + [
  • Inline Chat: Ctrl + I
  • Dismiss: Esc

Chat Commands

  • /explain - Explain selected code
  • /fix - Fix problems
  • /tests - Generate tests
  • /doc - Add documentation
  • /optimize - Improve performance

Copilot Chat

  • Right-click β†’ "Copilot" menu
  • Or open from sidebar (Ctrl + Shift + I)

πŸ”§ Troubleshooting

Copilot Not Suggesting?

  1. Check status bar - Copilot icon should be visible
  2. Verify extension is enabled
  3. Try Ctrl + Enter to force suggestions
  4. Check GitHub Copilot subscription is active

Virtual Environment Issues?

# Recreate environment
.\setup_demo.ps1 -Force

# Manual activation
.\.venv\Scripts\Activate.ps1

# Verify activation
python -c "import sys; print(sys.prefix)"

Tests Failing?

# Reinstall dependencies
pip install -r requirements-test.txt --force-reinstall

# Check Python version
python --version  # Should be 3.8+

# Run with verbose output
python -m pytest -vv

Import Errors?

# Ensure virtual environment is activated
.\.venv\Scripts\Activate.ps1

# Verify modules exist
python -c "import calculator; import data_processor; import file_handler"

PowerShell Execution Policy?

# If scripts won't run
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

# Or run with bypass
powershell -ExecutionPolicy Bypass -File .\setup_demo.ps1

πŸŽ“ Tips for Presenters

Before the Demo

  • Run setup_demo.ps1 and verify everything works
  • Review QUICK_REFERENCE.md
  • Test Copilot connection
  • Adjust timing based on audience
  • Prepare backup examples

During the Demo

  • βœ… Start with simple examples, progress to complex
  • βœ… Show both successes and limitations
  • βœ… Ask audience for input on solutions
  • βœ… Pause for questions regularly
  • βœ… Emphasize real-world applicability

πŸ’‘ Reset Tip:
If you need to revert the project to its original broken state during a live demo:

git checkout .
git clean -fd

Interactive Elements

  • Ask audience to suggest fixes
  • Show multiple Copilot alternatives
  • Demonstrate live debugging
  • Compare manual vs AI-assisted coding time

πŸ“Š Learning Outcomes

After completing this demo, participants will understand:

  1. How to use Copilot effectively for daily development
  2. When to trust vs verify AI suggestions
  3. Best practices for prompting Copilot
  4. Security implications of AI-generated code
  5. Testing strategies with AI assistance
  6. Code quality improvements through AI
  7. Documentation automation capabilities
  8. Learning opportunities from AI explanations

🀝 Contributing

Found a bug? Have a suggestion? Want to add more demo scenarios?

  1. File an issue describing the problem/enhancement
  2. Fork the repository
  3. Make your changes
  4. Submit a pull request

πŸ“„ License

This demo kit is provided as-is for educational purposes. Feel free to use, modify, and distribute for training and demonstration purposes.

πŸ™ Acknowledgments

Created for demonstrating GitHub Copilot capabilities in professional development environments.


πŸ“ž Support

For questions or issues:

  1. Check TROUBLESHOOTING section above
  2. Consult QUICK_REFERENCE.md for commands

Ready to showcase GitHub Copilot? πŸš€

Run .\setup_demo.ps1 to get started!

About

Ready-to-use GitHub Copilot demo kit with intentional bugs, TODOs, and security vulnerabilities. Complete test suite (227+ tests, 93% coverage) + reset script for live test generation demos. Perfect for trainers showcasing AI-assisted development.

Topics

Resources

License

Stars

Watchers

Forks