Security guide

Cybersecurity Tips for Developers and Teams Using AI Coding Agents

Good cybersecurity tips for developers using AI coding agents come down to four habits: keep secrets out of the agent’s reach, review its code like a stranger’s pull request, give it only the permissions the task needs, and protect your own accounts with phishing-resistant MFA. The tips below are concrete, and each one names a security skill that helps.

Updated November 2026

Cybersecurity tips for working with AI coding agents

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.

Which security skill covers which risk

Each row pairs a risk from the list above with the listed skill built for it. Account hygiene (tip 8) is a habit, so no skill is listed for it.

RiskWhat the skill checksSkill
Leaked keys and risky code pathsEvidence-backed audit that executes code only in a sandboxSecurity Audit
Weak design and OWASP-class bugsThreat model plus an OWASP Top 10 pass across the project007
Unsafe agent-written diffsSeverity-labelled review with a fixed report and verdictCode Review and Quality
Pull requests against team standardsStandards, anti-patterns and a quality reportCode Reviewer
Fixes that do not close the findingEach fix commit compared with the finding it claims to fixFix Review
AI agents in CI abused through issues or PRsAudit of agent workflows for attack vectorsAgentic Actions Auditor
Agent reaching your whole machineIsolated devcontainer for the agent’s workspaceDevcontainer Setup

Security skills are code too: read before you install

A skill is a SKILL.md file and sometimes scripts that your agent follows with your permissions, so apply tip 5 to skills as well. Open the skill page, check the upstream source and read what it runs. To install one, put its folder in .claude/skills/ for Claude Code or .agents/skills/ for Antigravity and Codex; the install guide has the details. For a short list of skills worth having first, see best Antigravity skills, or browse the full security and code review skills.

Frequently asked questions

What are the most important cybersecurity tips for AI coding agents?
Keep secrets out of prompts and .env files the agent can read, review every diff the agent writes, check each new dependency, give tokens the least privilege that works, and run the agent in a sandbox with approval prompts on for risky commands.
Can an AI coding agent leak my API keys?
It can if the key is in a file it reads or in a prompt you paste, because that text becomes context that may be logged or sent to a model provider. Use throwaway development keys, deny reads on secret files, and rotate any key that has appeared in a prompt or commit.
What is prompt injection and why does it matter for developers?
Prompt injection is hidden or plain text in content an agent reads, such as an issue, a web page or a README, that tries to steer the agent. It matters when the agent can run commands or push code, so limit its permissions and do not run it unattended on untrusted input.
Which security skills on Antigravity Skills cover these tips?
Security Audit, 007, Code Review and Quality, Code Reviewer, Fix Review, Agentic Actions Auditor and Devcontainer Setup, all listed in the security skills collection. Read each skill page before installing so you know what it runs.
Is MFA enough to protect a developer account?
MFA helps a lot, but not all MFA is equal. Passkeys and hardware security keys resist phishing, while SMS codes and one-time passwords can be handed to a fake login page. Use them for GitHub, cloud and package-registry accounts first.
Cybersecurity Tips for Developers Using AI Coding Agents