General cybersecurity tips such as updating software, using strong passwords and spotting phishing still apply. An AI coding agent adds new risks on top: it reads your files, runs commands, installs packages and acts on text from the web. These eight tips cover that gap. The skills named under each one are listed in our security skills collection.
1. Keep secrets out of prompts and .env reach
An agent can read any file it can open, and whatever it reads becomes context that may be logged or sent to a model provider. Do not paste API keys into a chat, and do not leave a real .env where the agent works. Use a separate development key with a low spending limit, and add a deny rule for secret files in your agent’s permission settings (Claude Code supports rules such as Read(./.env)).
Turn on push protection or a scanner such as gitleaks so a key that slips into a commit is caught before it leaves your machine. If a key ever appeared in a prompt, a log or a commit, rotate it. Deleting the line does not un-leak it.
Skills that help: Security Audit
2. Review agent-written code like a stranger’s pull request
Agents write code that compiles and passes the tests they wrote themselves, which is not the same as safe code. Read the diff for string-built SQL, disabled certificate checks, wildcard CORS, hard-coded credentials, new network calls and tests that were weakened to go green.
Ask for small diffs so a human can actually read them, and run a second pass with a review skill that reports findings with severity and evidence. A fixed report format makes it obvious when something was skipped.
Skills that help: Code Review and Quality, Code Reviewer
3. Check every dependency the agent adds
Language models sometimes suggest a package name that does not exist, and attackers register such names. Before accepting a new dependency, confirm the name, the publisher and the download history on the registry, commit the lockfile, and install in CI with the locked command (npm ci, pip with hashes, cargo --locked).
Run npm audit, pip-audit or your ecosystem’s equivalent on every pull request, and read install scripts for anything new. A short threat-model pass on the whole project catches the supply-chain paths that a line-by-line review misses.
Skills that help: Security Audit, 007
4. Give agents least-privilege tokens
Use a fine-grained personal access token limited to one repository, read-only unless the task must push, with a short expiry. Prefer a dedicated bot account over your own, never hand the agent production credentials, and keep cloud keys for a sandbox project only.
The same rule applies to CI: scope the workflow’s GITHUB_TOKEN permissions explicitly instead of inheriting broad defaults.
Skills that help: Agentic Actions Auditor
5. Treat MCP servers and tool permissions as code you run
An MCP server or plugin runs with your permissions. Install only ones you can trace to a maintainer you trust, read what tools they expose, and pin versions. Keep approval prompts on for shell commands, file deletion, git push and deploys; allow-list narrow commands instead of approving everything.
Content the agent reads, such as a web page, an issue or a README, can contain instructions aimed at the agent. That is prompt injection. Do not let an agent that holds write access process untrusted text unattended, and audit CI jobs where an agent reacts to issues or pull requests from outsiders.
Skills that help: Agentic Actions Auditor
6. Run the agent in a sandbox
A container or devcontainer limits what a mistaken or manipulated agent can reach: your home directory, SSH keys and browser profile stay outside it. Mount only the project, pass in only the secrets the task needs, and throw the container away afterwards.
Skills that help: Devcontainer Setup
7. Confirm that fixes really fixed the finding
When an audit lists ten problems and an agent says it fixed them, check each commit against its finding. A fix can move the bug, miss a second code path or add a regression. Keep the audit report and verify each item closed, not just that the tests pass.
Skills that help: Fix Review
8. Protect your developer accounts: phishing and MFA
Your GitHub, cloud and package-registry logins are worth more than any single repository, because they let an attacker publish code as you. Use passkeys or a hardware security key for them, since these resist phishing in a way SMS codes and one-time passwords do not. Store passwords in a password manager so it will not autofill on a look-alike domain.
Never approve an unexpected login prompt, check the address before you authorize an OAuth app, and treat urgent “your token expired” emails as suspect. These are the same basics that CISA and university security offices recommend; they matter more when one account can ship code.