Agentic coding is a way of writing software where you give an AI agent a goal and it carries out the work in steps: reading your code, editing files, running commands and tests, and adjusting based on the results. Your job shifts from typing code to directing the work, setting up checks and reviewing what the agent produces.
Anthropic's documentation describes Claude Code as "an agentic coding environment" and spells out the change: "Instead of writing code yourself and asking Claude to review it, you describe what you want and Claude figures out how to build it." This guide explains what that means in practice and how to do it well with Claude Code, Codex, Cursor and similar tools.
How is agentic coding different from using AI autocomplete or chat?
AI help for programmers has come in roughly three forms, and many tools now offer all of them.
| Style | What the AI does | Who drives | Example |
|---|---|---|---|
| Autocomplete | Predicts the next line or edit as you type | You, line by line | Cursor Tab, inline suggestions |
| Chat | Answers questions and writes snippets you copy in | You, snippet by snippet | Asking a chatbot to write a function |
| Agentic | Takes a goal, reads the project, edits files, runs commands, checks results | The agent, within limits you set | Claude Code, Codex, Cursor Agent |
The difference is who takes the actions. Claude Code's best practices put it this way: "Unlike a chatbot that answers questions and waits, Claude Code can read your files, run commands, make changes, and autonomously work through problems while you watch, redirect, or step away entirely."
Anthropic's post Building effective agents explains why code is a natural fit: "Code solutions are verifiable through automated tests," and agents "can iterate on solutions using test results as feedback." For the basics of how an agent works under the hood, see what is an AI coding agent.
What does an agentic coding session look like?
Claude Code's How Claude Code works describes the loop as three phases: "gather context, take action, and verify results." The agent repeats them, "chaining dozens of actions together and course-correcting along the way."
On top of that loop, Anthropic recommends a four-step workflow for anything non-trivial:
- Explore. Let the agent read the relevant code without changing anything. In Claude Code, plan mode does this: "Claude reads files and answers questions without making changes."
- Plan. Ask for a written plan: which files change, and how.
- Implement. Approve the plan and let the agent write the code, run the tests and fix failures.
- Commit. Have the agent write a descriptive commit message and open a pull request.
A real exchange might look like this:
read /src/auth and understand how we handle sessions and login.
also look at how we manage environment variables for secrets.
I want to add Google OAuth. What files need to change?
What's the session flow? Create a plan.
implement the OAuth flow from your plan. write tests for the
callback handler, run the test suite and fix any failures.
Those prompts come from Anthropic's best practices page. You do not need the full ritual for small jobs. The same page says: "If you could describe the diff in one sentence, skip the plan." See Claude Code plan mode for how the mode works.
What makes agentic coding work well?
Four habits separate productive agentic coding from frustrating sessions.
Give the agent a way to check its work
It is the first item in Anthropic's best practices: "Give Claude a check it can run: tests, a build, a screenshot to compare." Without one, "you become the verification loop: every mistake waits for you to notice it." Ask the agent to show evidence too, such as the test output or the command it ran, rather than just saying it is done.
Be specific
Agents infer a lot, but they cannot read your mind. Name the file, the scenario and what "done" looks like.
weak: the build is failing
strong: the build fails with this error: [paste error]. fix it and verify the build succeeds. address the root cause, don't suppress the error
Manage the context window
An agent's working memory fills as it reads files and runs commands. Anthropic's docs call the context window "the most important resource to manage." Start fresh between unrelated tasks, keep project rules in CLAUDE.md or AGENTS.md, and use subagents for research. The full picture is in context engineering.
Steer early
You do not have to wait for the agent to finish. In Claude Code, pressing Esc stops it immediately, and typing a correction while it works queues the message so it adjusts before its next step.
Which tools support agentic coding?
Many major coding tools now include an agent mode. They differ mainly in where the agent runs.
- Claude Code runs in your terminal, IDE, a desktop app or the browser. Anthropic describes it as "an agentic coding tool that reads your codebase, edits files, runs commands, and integrates with your development tools."
- Codex from OpenAI runs on your computer as a CLI, an IDE extension or a desktop app, and as a cloud agent that runs tasks in the cloud, according to its GitHub README.
- Cursor Agent works inside the Cursor editor; Cursor's docs describe it as able to "complete complex coding tasks independently, run terminal commands, and edit code."
- Gemini CLI is Google's open-source terminal agent.
- GitHub Copilot cloud agent can, in GitHub's words, "research a repository, plan changes, and implement them in the background" in a cloud environment, starting from the agents panel, a conversation, or an issue or pull request.
For head-to-head comparisons, see Claude Code vs Cursor and Codex vs Claude Code.
What are the risks of agentic coding?
Handing an AI the ability to run commands brings real risks, and the vendors say so.
- Wrong but plausible code. Tests catch some mistakes, not all. Anthropic notes that "human review remains crucial for ensuring solutions align with broader system requirements."
- Destructive actions. An agent can delete files or run commands with side effects. Checkpoints help with file edits, but Claude Code's docs point out that "Actions that affect remote systems (databases, APIs, deployments) can't be checkpointed."
- Prompt injection. Instructions hidden in a web page, issue or dependency file can hijack an agent. OpenAI's Codex docs list "Prompt injection from untrusted web content" first among the risks of giving the agent internet access. See prompt injection in coding agents.
- Cost and usage. Long agent sessions use a lot of tokens. See Claude Code cost.
The defenses are the same across tools: keep permission prompts or a sandbox on (see Claude Code permissions and Codex approvals and sandbox), work on a branch, and review every diff before it merges.
How do you build a repeatable agentic workflow?
The prompts and procedures that work for you are worth keeping. Many teams turn them into Agent Skills, folders with a SKILL.md that the agent loads when relevant, or save them as reusable prompts. Kipt keeps both as Markdown in a private GitHub repo you own and installs every skill into Claude Code or Codex with one command: npx skills add https://github.com/<you>/<repo>.git --all -g. The free SKILL.md generator turns a single prompt into a skill in your browser.
For more workflow advice, read Claude Code best practices and Claude Code tips.