AI Coding Assistants and Agentic Coding
AI coding assistants write, explain and fix code. In 2026 many of them are agents that can read your whole project, run commands and make changes across many files.
From Autocomplete to Agents
| Level | What it does | You still must... |
|---|---|---|
| Autocomplete | Suggests the next lines as you type | Accept or reject each suggestion |
| Chat in the editor | Explains code, writes functions on request | Copy, read and test the code |
| Coding agent | Reads files, edits many files, runs tests and commands in a loop | Give clear tasks, review every change, approve risky commands |
An agentic coding tool works like the agent loop from the AI Agents Tutorial: it plans, uses tools (read file, edit file, run tests), looks at the result, and repeats until the task is done or it gets stuck.
For an overview of the tools and prompts for everyday coding help, see AI Coding Assistants in the AI Tools Tutorial and Prompts for Coding.
Give the Agent a Good Task
A coding agent is like a fast new team member who does not know your project. Good tasks have:
- The goal: what should work when it is done
- The place: which files or folders
- The limits: what it must not change
- The check: how to prove it works (usually a test command)
Weak: "fix the cart". Strong: "In cart.py, orders above Rs 5,000 should get a 10% discount. Do not change other files. Add tests for 4,999, 5,000 and 6,000 and make sure python -m pytest passes."
Project Rules in a File
Most coding agents read a plain text instructions file in your project, often named AGENTS.md or a similar name your tool's documentation gives. It tells every session the rules of your project:
Example
# Project rules for AI assistants
- This is a Django 5 project. Python 3.12.
- Run tests with: python manage.py test
- Prices are integers in rupees. Never use floats for money.
- Do not edit files in /migrations by hand.
- Never commit .env or any API key.
- Keep functions short and add a test for every bug fix.This saves you from repeating the same instructions every time, and makes the agent's work more consistent.
Always Review: A Real Example
You ask an assistant: "Write a function that gives a 10% discount on orders above Rs 5,000." It returns code that looks fine. Do not trust it until you test the edges:
Example
# Code an assistant wrote for "apply a 10% discount on orders above Rs 5,000"
def final_price(total):
if total > 5000:
return total * 0.9
return total
# Your own tests: check the edges, not only the easy case
tests = [(1000, 1000), (5000, 5000), (6000, 5400), (0, 0), (-50, None)]
for amount, expected in tests:
got = final_price(amount)
status = "ok" if got == expected else "CHECK"
print(f"{status:<6} final_price({amount}) = {got}, expected {expected}")ok final_price(1000) = 1000, expected 1000 ok final_price(5000) = 5000, expected 5000 ok final_price(6000) = 5400.0, expected 5400 ok final_price(0) = 0, expected 0 CHECK final_price(-50) = -50, expected None
Two problems appear. A negative total is accepted silently, and the price comes back as a float (5400.0), which can cause rounding errors with money. You ask the assistant to fix both, and you keep the tests:
Example
def final_price(total):
if total < 0:
raise ValueError("total cannot be negative")
if total > 5000:
return round(total * 0.9)
return total
assert final_price(1000) == 1000
assert final_price(5000) == 5000 # exactly 5,000 gets no discount
assert final_price(6000) == 5400
try:
final_price(-50)
print("missing check!")
except ValueError as e:
print("Rejected:", e)
print("All tests passed")Rejected: total cannot be negative All tests passed
A Safe Workflow for Agentic Coding
- Use Git. Commit before the agent starts, so you can undo everything. See the Git Tutorial.
- Work on a branch, never directly on the main code of a live project.
- Ask for a plan first for big tasks, and read it before saying yes.
- Keep the approval prompts on for commands that delete, deploy or install.
- Read the diff. Every changed line is your responsibility.
- Run the tests yourself, and add new ones for anything the agent changed.
Watch for packages you have never heard of. Assistants sometimes suggest a package name that does not exist or is not the popular one. Check it on the official package site before you install it.
Will You Still Need to Learn Coding?
Yes. AI makes good programmers faster, but someone must decide what to build, judge whether the code is correct and secure, and fix it when it breaks. Beginners should first write code by hand to learn, then use AI to go faster.
Exercise
Exercise
A coding agent finished a task and says "all done". What should you do next?
