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.
Environment variables and where secrets live
card 2 of 6
Programs read secrets from outside the code
builds on: Terminal basics: where you are and running things
Every program you start gets a set of named text values from the terminal that launched it. These are **environment variables**. The script reads one by name, e.g. `os.environ["WEATHER_API_KEY"]`. The code stays the same for everyone, and each person supplies their own key.
A `.env` file is a plain text file of `NAME=value` lines that a library loads into environment variables. **Config files** like `config.yaml` can hold secrets too.
Terms on this card
- environment variables
- Named text values (like `HOME` or `WEATHER_API_KEY`) that a program receives from the terminal or system that started it, and can read by name.
- Secrets
- Any value that grants access: API keys, passwords, tokens, or database addresses that include a password.
- .env
- A plain text file of `NAME=value` lines, usually in the project root, that a library or tool loads into environment variables.
- Config files
- Files like `config.yaml` or `settings.json` that hold a program's settings. Sometimes these include passwords or keys.
- os.environ
- Python's way of reading environment variables by name inside a program.
Lesson goal: Explain how API keys and passwords usually reach a program: environment variables, `.env` files and config files. Explain why these files must stay out of git and out of anything you share. ·
the whole lesson