Useful Prompts

Prompts you can paste into opencode in your Codespace. Set up the agent first with the AI Pairing unit.

Sync with the class repo

Use this when a new lecture notebook is posted, or when the Sync fork button on GitHub tells you to discard your commits. It saves your work, gets the new files from the class repo, and pushes everything to your fork.

Sync my Codespace with the class repo and push my work. Do not lose any of my work.

1. Run git status. If there are any changed or new files, stage them all and commit
   with the message "save my work before sync".
2. Run gh repo sync. If it succeeds, go to step 6.
3. If it fails because of diverging changes, do NOT run it again with --force. Instead,
   run git fetch upstream, then merge upstream/main into my current branch. If there
   is no remote named upstream, stop and tell me.
4. If a notebook (.ipynb) in notebooks/ or exercises/ has a conflict, do not edit inside the file. Keep my version
   under the original name. Save the class version next to it with "-new" added
   before .ipynb. Then mark the conflict resolved.
5. Commit the merge.
6. Push to origin.
7. Show me a short list: files that came in from the class repo, and any "-new" files
   you made. Stop after that. Do not delete anything. Do not force push.

If you see a -new file, open it next to your own copy to see what changed.

Submit an assignment

Use this when a notebook is done and you need to turn it in. It pushes the notebook to your fork and gives you the link to paste into Canvas. Change the notebook path first, like exercises/10-marginal-effect-exercise.ipynb.

Help me turn in <NOTEBOOK-PATH>.

1. Check that the notebook file exists and has saved outputs. If the cells have no
   outputs, stop and tell me to run all cells and save with Ctrl+S.
2. Run git status. Stage the notebook. If pixi.toml or pixi.lock changed, stage them too.
   Do not stage anything else.
3. Commit with the message "complete <NOTEBOOK-PATH>".
4. Push to origin. If the push is rejected, stop and tell me. Do not force push.
5. Print the link to the notebook on my fork on GitHub. It looks like
   https://github.com/<my-username>/codespace/blob/main/<NOTEBOOK-PATH>
   Get my username from the origin remote.

Open the link to make sure the notebook shows its outputs. Then paste the link into the Canvas assignment.

Clean up .gitignore

Use this once. Some files are made by tools as you work, like notebook checkpoints and the pixi environment. They do not belong in your repo. This prompt tells git to ignore them, and removes any that were already committed.

Update the .gitignore file at the root of this repo. If it does not exist, create it.
Keep every line that is already there. Add these lines if they are missing:

.ipynb_checkpoints/
.pixi/
__pycache__/
.Rhistory
.RData
.Rproj.user/
.DS_Store

Then find any files that match these patterns and are already tracked by git. Run
git rm -r --cached on each one. This removes them from git but keeps them on disk.
Do not delete anything from disk.

Stage .gitignore, commit with the message "clean up gitignore", and push to origin.
Show me a short list of the files you removed from git.