An instructional sandbox demonstrating how to use GitHub Copilot across multiple languages & contexts: Python (notebook), Lua (LÖVE2D game), and guidance for scaffolding a small React medical app.
File | Purpose |
---|---|
copilot_lesson.ipynb |
Interactive lesson: concepts, ethics, shortcuts, and hands‑on Copilot exercises (BMI calculator, class design, LÖVE2D + React prompts). |
main.lua |
Entry point for the LÖVE2D mini game exercise (you'll iteratively build or replace contents using Copilot Chat). |
README.md |
You are here—overview, setup, and usage instructions. |
Using this workspace you will:
- Understand what GitHub Copilot & Copilot Chat can (and cannot) do.
- Practice comment‑to‑code and inline chat driven development in Python.
- Build / iterate on a simple LÖVE2D (Lua) game loop with AI assistance.
- Plan a basic React “medical records” interface (prompts & workflow guidance).
- Reflect on ethical, licensing, and integrity considerations when using AI.
Open copilot_lesson.ipynb
inside VS Code / Codespaces. It walks you through:
- Copilot basics & activation
- Keyboard shortcuts & chat slash commands (
/explain
,/fix
,/tests
,/doc
,/optimize
) - Responsible use & academic integrity reminders
- Guided Python exercises (BMI, dosage function, patient record class)
- Prompt patterns for iterative refinement
- Exercises for Lua (game) and React (medical app UI)
Tip: Use inline chat (
Ctrl+I
) right inside a code cell or file to request specific functionality without leaving your context.
This project uses LÖVE—a lightweight 2D game framework.
Inside the dev container, run:
DISPLAY=:0 love .
Why DISPLAY=:0
? The container needs an X display target. In Codespaces with a GUI / forwarded display extension this directs LÖVE's window to the expected display. If you're running locally outside the container you can usually just run:
love .
- Open
main.lua
. - Clear or simplify existing content.
- Ask Copilot Chat: “Create a LÖVE2D game with a bouncing ball that changes color on edge collisions.”
- Run the command above to test.
- Iterate: add player control, scoring, particles, etc., by prompting Chat (e.g., “Add arrow key control” / “Add a trail effect”).
In the notebook you’ll:
- Implement
calculate_bmi
and a dosage calculator. - Write tests (prompt Copilot: “/tests generate pytest tests for this function”).
- Design a
PatientRecords
class (ask for validation rules, stats, or docstrings).
Try these while your cursor is in a code cell:
- “Add input validation & raise ValueError for invalid height.”
- “Refactor to a dataclass.”
- “Generate edge case tests.”
The notebook guides you to start a new React app (outside this minimal repo). Suggested flow:
- Ask: “Scaffold a React app for a simple patient dashboard (no backend).”
- Follow up: “Add a component to filter patients by condition and show basic stats.”
- Ask for accessibility improvements: “Ensure ARIA roles and keyboard navigation.”
Scenario | Strategy |
---|---|
Unsure of API | Write a high‑level comment, pause for suggestion. |
Need refactor | Select code → /optimize or ask “Simplify and explain.” |
Understanding unfamiliar code | Highlight → /explain |
Generate tests | Select function → /tests |
Fix an error | Select block / file → /fix |
Multi‑file change reasoning | Use @workspace + describe the goal. |
- Review every suggestion—don’t blindly accept.
- Avoid pasting sensitive or proprietary data into prompts.
- Cite Copilot usage if required by course policy.
- Run security & logic reviews (especially for medical / regulated contexts).
.
├── copilot_lesson.ipynb # Guided lesson & exercises
├── main.lua # Lua game entry point (build via Copilot)
└── README.md # Documentation
- Add a
requirements.txt
if you formalize Python dependencies. - Create a
tests/
folder and persist generated pytest tests. - Add a starter
main.lua
template with comments for each LÖVE callback. - Scaffold a separate React subfolder (
/react-app
) once ready.
Issue | Check |
---|---|
No Copilot suggestions | Is extension enabled / signed in? Rate limit? |
LÖVE window not appearing | DISPLAY variable / GUI forwarding support |
Chat can’t reference files | Ensure they are saved & opened; use @workspace . |
Repetitive suggestions | Rephrase prompt: include intent + constraints. |
No explicit license included yet—add one (e.g., MIT) before distributing. Remember: you are responsible for reviewing and validating all AI‑assisted code.
Happy experimenting! Try stretching each exercise: add scoring to the game, persist patient data, or benchmark alternative implementations suggested by Copilot.