Go from never having used a coding agent to working productively and safely with one. The learner should understand what an agent is and how it differs from a chat assistant. They should choose a tool, set up a protected first project, describe tasks the agent can do well, and follow and verify its work. They should recover from bad changes, manage context, and plan bigger changes. They should also use tests as the definition of done and run everyday workflows (bug fixes, features, writing tests, codebase exploration, scripts, small tools, refactors). Throughout, they should keep secrets and systems safe and keep their own understanding growing instead of outsourcing it.
Recovering from a bad change
card 3 of 6
Pick the recovery that fits
builds on: Commit before every task: checkpoints, Undoing with git: discard, reset, revert, Recognising when the agent goes in circles
First look: `git status` shows uncommitted edits. `git log --oneline` shows which commits came after the checkpoint.
- **Bad edits uncommitted, the rest worth keeping:** `git restore <file>` on just the bad files.
- **Whole attempt bad, even with commits made during it:** `git reset --hard <checkpoint>`. Everything after it is lost for good.
- **One bad commit with good commits after it:** `git revert <commit>`.
Restore and reset never remove new untracked files. `git clean` does that (next card).
Terms on this card
- commit
- A saved snapshot of all your project's files in git, with a short message and an ID (hash) you can return to.
- checkpoint
- A commit (or tool snapshot) made right before a task, so you can return to that exact known-good state.
- uncommitted
- Changes to files that exist on disk but are not yet saved in any git commit.
- untracked
- A file git has never recorded in a commit, such as a brand-new file. `git status --short` marks it with `??`.
- git status
- Command that lists files changed since the last commit, plus untracked files. `--short` shows one line per file: ` M` modified, `??` untracked.
Lesson goal: Given a broken state, choose the right recovery: discard uncommitted edits, return to the last checkpoint, or revert a specific commit. Then restart with a better prompt instead of piling fixes onto a bad attempt. ·
the whole lesson