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 3 of 6
Where secrets live, and where they never go
builds on: Terminal basics: where you are and running things
- **Secrets** are API keys, passwords, tokens and database addresses that contain passwords. Anyone holding one can act, and spend, as you.
- They live in environment variables, `.env` or a local config file. Never in the code.
- Many projects use **git**, a tool that records every version of the project's files. A folder tracked by git is a **repository**, often uploaded to GitHub for others to download. Git keeps old versions in its history even after you delete a file.
- So list `.env`, and any config file holding secrets, in `.gitignore` (a file naming what git must skip). Share a `.env.example` that has the names but no values.
- Keep secrets out of screenshots, pasted chats, zips and logs.
- Leaked once? Revoke the key at the provider. Deleting the file doesn't undo the leak.
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.
- tokens
- Secret strings, similar to API keys or passwords, that a service issues to grant access.
- .env
- A plain text file of `NAME=value` lines, usually in the project root, that a library or tool loads into environment variables.
- .env.example
- A shareable copy of `.env` that lists the variable names with empty or dummy values, so others know what to fill in.
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