Code with AI: small tasks, current files & real tests
Grades 6–12 · Three 35–45 minute sessions · Partner or individual project
You can ask an AI to compose complete files and still understand your project. Give it one clear job, supply the current code it needs, review what changed, and run a test. Code Bridge helps you carry that information between your existing Google AI chat and VS Code. It does not call an AI service.
Before you begin
Complete Build Your Game-Dev Base. You need a project folder, VS Code with your usual way to run the project, and your teacher-approved Google AI chat if you are using AI. Account access follows your classroom's existing arrangement; this activity creates no AI account and needs no API key. A supplied practice answer lets you rehearse without signing in to an AI service.
- Learning goals: choose relevant context, describe observable behavior, read a file comparison, explain a code change, and preserve test evidence.
- Partners: the driver operates the computer; the reviewer explains the task and checks changes. Swap roles after each checkpoint.
- Teacher setup: demonstrate on a small source folder. Keep personal information and credentials out of requests. Check that students can download files; folder saving varies by browser.
Session 1: fix one bug and explain the change
Question: How can we tell whether an AI's answer actually fixed our problem?
- Reproduce, 5 minutes. Open the practice project in Code Bridge and download its loaded source ZIP. Extract it, open the extracted folder in VS Code, and launch
index.htmlwith Live Server. Tap Space or Jump repeatedly. Describe how the player can jump in midair. - Inspect, 5 minutes. In Code Bridge, read
player.jsandmain.js. Find who callsjump(), who storesgrounded, and where landing resets it. Both files are selected so the AI sees the function and its callers. - Request, 8 minutes. Read the prefilled goal, current behavior, and success test. Prepare the request and inspect its size. Copy it into your approved Google AI chat. If AI access is unavailable, go to Review answer and choose Use practice answer.
- Review, 7 minutes. Paste the complete response and choose Review response. Find the added grounded check. Explain what
if (!player.grounded) return;does before approvingplayer.js. A new filename must be separately reviewed as a new file. - Apply and test, 8 minutes. Download approved changes and backups. Copy
changes/player.jsover the matching file in the VS Code project. Keepbackup/player.js. Jump once, attempt a second jump in midair, land, and jump again. Test both keyboard and button input. Inspect the browser console for new errors. - Checkpoint, 5 minutes. In Test & checkpoint, record the actual result and explain the changed condition. Save your session. Before the next request, open or reload the actual project folder so Code Bridge has the version you just tested.
Exit ticket: Show the changed line, explain why it stops the second jump, and demonstrate that jumping still works after landing. Receiving a plausible answer is not test evidence.
Session 2: keep context useful as the project grows
Question: Which files does a helper need to make this change without guessing?
A context window is the material an AI can consider for a request. Code Bridge uses a character budget to make your input size visible; its token estimate is approximate and is not the provider's exact limit. Start with the relevant code, its imports or callers, the goal, and a concrete test. If dependencies are missing, supply them before accepting a guessed fix.
| Broad wish | Small task | Evidence |
|---|---|---|
| Make my game better. | Show the score in the top-left corner. | Collect one item; the displayed score increases once. |
| Add multiplayer and levels. | Load a second level after the first exit. | Reach the exit; level 2 starts with its own player spawn. |
| Fix everything. | Fix the first reproducible console error. | Repeat its trigger; the error is gone and movement still works. |
Workshop, 25 minutes: choose one improvement in your own project or your browser game. Write a brief, map the files and what they do, select the source you can justify, and prepare one request. Explain every selected file to a partner. If the request exceeds the budget, reduce the task or deliberately include more context; do not cut source halfway through a function to make it fit.
When one file does too much: plan a separate refactoring task. Move one responsibility, such as player movement, into its own module. Include the original file, imports, and callers. Test that behavior stays the same before requesting a new feature. Splitting files changes dependencies, so move one responsibility at a time.
Exit ticket: identify a file you included, one you left out, and what additional file the AI might need. Explain the tradeoff between too little context and unrelated material.
Session 3: hand off a project to a fresh conversation
Question: Can another person continue your project without reading your entire chat?
- Write a brief, 5 minutes. Describe what the project does, its main files, and behavior that must remain intact. Keep it factual and short.
- Record evidence, 8 minutes. Add a checkpoint with the task, actual test result, changed function, and next small step. Failed and not-yet-tested results belong in the record too.
- Refresh, 5 minutes. Reload the project folder after VS Code edits or ZIP replacements. A saved session is a snapshot; it does not watch VS Code. After reopening a session, use Refresh source and choose the same project folder to keep your notes while loading the latest files. New requests should use the newest actual files.
- Handoff, 12 minutes. Prepare a new request. It includes the current selected code, file map, brief, and latest checkpoint. Give it to a partner or a fresh approved AI conversation. Ask the partner to state what the project does and the next test before coding.
- Keep your work, 5 minutes. Download the session and project notes. Keep your project folder and its non-code assets separately. For longer projects, use GitHub collaboration and version history as well.
Exit ticket: show that a new helper can identify the next task from the request alone. Explain why a checkpoint marked “passed” still describes a student's report rather than a verification performed by Code Bridge.
When an answer does not fit
- The AI gives snippets: ask for complete contents of changed files using
### FILE: relative/path.jsand code fences. Do not approve “rest of code unchanged.” - The AI needs another file: read the dependency, select it, and prepare a fresh request. Include the current version instead of trusting an older chat copy.
- A file changed in VS Code: reload it and make a fresh request. Direct saving checks disk contents and refuses to overwrite a newer version; a ZIP cannot check your folder.
- A change breaks something: keep the failed test result. Restore the matching original from the ZIP's
backup/folder or the project's.code-bridge-backups/folder, or use version history. A newly created file has no previous version; remove that new file only after checking its references. - The reply is cut off: request a smaller change or the complete affected file again. Never replace a working file with an incomplete answer.
Show your learning
| Skill | Evidence for 2 points |
|---|---|
| Task design | One observable goal and a specific success test. |
| Context selection | Current source and dependencies are included; student can justify the selection. |
| Review and explanation | Student identifies the changed function and explains its effect before approval. |
| Testing | Records actual requested-behavior and regression-test results, including failures. |
| Project continuity | Provides a saved session, brief, checkpoint, and a clear next task. Can locate a backup. |
Scaffolding: younger or new coders can use the practice answer with teacher guidance, explain a condition in their own words, and demonstrate the test. Experienced students can inspect module boundaries, compare two possible fixes, and add a repeatable automated test. Assess reasoning and evidence rather than the volume of generated code.