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.
Keeping secrets out of the agent's reach
card 5 of 6
A project set up so keys stay out
builds on: What never to let an agent touch, What the agent can and cannot see
`.gitignore` keeps `.env` out of git. `git check-ignore .env` confirms it: it prints the name only if the file is ignored. `.env.example` lists the variable names with placeholders, so the agent never needs the real file. The deny rules use Claude Code's format, where `Read(./secrets/**)` covers every file under `secrets/`. Other tools have their own, for example Cursor's `.cursorignore`. Deny rules block the agent's file-reading tool, but a shell command like `cat .env` can still get through, so keep answering no.
$ cat .gitignore
.env
$ cat .env.example
WEATHER_KEY=<your-test-key>
$ cat .claude/settings.json
{"permissions": {"deny": [
"Read(./.env)",
"Read(./secrets/**)"
]}}
$ git check-ignore .env
.env
Terms on this card
- .env
- A file in a project that holds environment variables, often secrets like API keys, loaded when the app starts.
- .env.example
- A copy of `.env` with the same variable names but placeholder values, safe to share and commit.
- git
- A tool that keeps a project's history by saving snapshots of its files.
- .gitignore
- A file listing files git should never track, so they can't be accidentally committed or pushed.
- git check-ignore
- A git command that prints a file's name if `.gitignore` rules exclude it, confirming it won't be committed.
Lesson goal: Explain how secrets leak: the agent reads `.env`, prints keys in logs, commits them, or sends them to the model provider. Use ignore and deny rules, test keys and separate credentials so the agent never needs the real ones. ·
the whole lesson