Lessons
1 · Understanding Modern AI
2 · Talking to AI Effectively
3 · AI for Learning
4 · AI for Work and Productivity
5 · AI for Developers
- 17AI Coding Assistants: Modes, Strengths and Your Responsibility
- 18Use AI to Understand Code, Codebases, APIs and Documentation
- 19How to Use AI to Debug Code Safely
- 20Testing, Reviewing and Refactoring AI-Generated Code
- 21Security and Licensing Risks of AI-Generated Code
- 22Vibe Coding vs Responsible AI-Assisted Building
6 · AI for Career Growth
7 · Research, Verification and Responsible AI
8 · Automation and AI Agents
Lesson 17 · AI for Developers
AI Coding Assistants: Modes, Strengths and Your Responsibility
Autocomplete, chat, edit mode, agents and review bots all promise faster coding. This article explains what each mode does, how to give it the context it needs, what the evidence says about speed and security, and the responsibilities that stay with you no matter who typed the code.
For
Students and developers who use or are about to use AI coding assistants and want to use them effectively without giving up engineering judgment.
Level
Before you start
Read Prompt Fundamentals (article 6) and Give AI the Right Context (article 7). Some programming experience helps.
On this page
Key takeaways
- Coding assistants come in modes: inline completion, chat, edit, agent and review. Each sees different context and carries different risk.
- Their output improves when you provide relevant files, precise names, examples or tests, and a small, well-defined task.
- Evidence on productivity is mixed and context-dependent. One randomised study of experienced developers found tasks took longer with AI in that setting, so measure your own results rather than assuming speed-ups.
- Studies have found AI-assisted code can be less secure, and developers more confident in it. Review and test everything you accept.
- You remain responsible for correctness, security, performance, maintainability, licensing, testing and architecture, whoever or whatever wrote the first draft.
Every developer who has used a coding assistant has had both experiences. The one where a tedious twenty-line function appears fully formed, correct on the first run, and you feel a little giddy. And the one where a function appears fully formed, compiles, passes the one test you wrote, and ships a bug that surfaces three weeks later at an awkward time.
The tool is the same in both cases. What differs is what the developer did before and after the suggestion appeared. This module is about that "before and after".
What you will learn
#- The main modes of coding assistants and what each is for.
- How to give them the context they need.
- What research says about speed and security, and what it does not say.
- The responsibilities that stay with you.
- A responsible, repeatable workflow.
The modes
#Products change their names and bundle features differently, so think in modes. GitHub's documentation for Copilot gives a representative list: suggestions as you type, answering questions about code, editing or refactoring on request, reviewing code and pull requests, and an agent mode in which you describe a goal and the tool works through multiple steps. Other assistants offer the same ideas in other packages.
Mode | What it does | Context it sees | Typical risk |
|---|---|---|---|
Inline completion | Suggests the next line or block as you type | Nearby code and open files | Accepting plausible but wrong code at speed |
Chat (ask) | Answers questions and explains code | What you select, attach or point to | Confident explanations that are slightly wrong |
Edit | Changes selected code or a file on request | The selection, maybe more files | Edits that are larger than you intended or quietly change behaviour |
Agent | Plans and executes multi-step changes, may run commands and tests | Possibly the whole repository and a terminal | Many changes at once, unintended side effects, actions with real consequences |
Review | Comments on a diff or pull request | The diff and some surrounding context | False reassurance, and missed issues |
A rough rule: the more autonomous the mode, the more you must constrain it and the more you must review. Agents are covered conceptually in Module 8. In coding they appear as agent modes, which can edit files and run commands, so the permissions you give them matter.
Context is the biggest lever
#A coding assistant can only work from what it sees. GitHub's own prompting advice amounts to a list of context habits:
- Start with the broad goal, then list specific requirements.
- Provide examples, such as sample inputs and outputs, or unit tests, which GitHub notes work well as concrete targets.
- Break large tasks into smaller steps.
- Be specific. Refer to a function by its name instead of "this".
- Supply relevant context, such as keeping pertinent files open and selecting the code in question.
- Iterate, treating an unhelpful answer as a starting point.
- Keep your code clean. Clear names and comments help the tool as much as they help people.
Turn that into a prompt:
Context: a Python 3.11 Flask app. The function parse_due_date(text) inutils/dates.py turns user input into a date.Task: extend it to also accept "tomorrow" and "next friday", keeping existingformats working.Constraints: no new dependencies; do not change function signatures; do notedit any other file; follow the existing naming style.Examples: "2026-10-05" -> 2026-10-05; "tomorrow" (today is 2026-10-05) ->2026-10-06; "someday" -> raise ValueError.First, list the edge cases you think matter and any questions. Then give thechange as a diff.It is the same four-element brief as in article 6, with code-specific context: language version, files, signatures, constraints and examples. "List edge cases and questions first" invites the assistant to expose its assumptions before writing code.
What the evidence says, carefully
#Two kinds of claims dominate discussions: that AI makes developers faster, and that it makes code worse. Both deserve a careful reading of what was actually measured.
Speed
#A 2025 randomised controlled trial by METR studied 16 experienced open-source developers working on 246 tasks in repositories they knew well, with and without AI tools available (mostly Cursor Pro with Claude 3.5 and 3.7 Sonnet at the time). The authors reported that allowing AI increased completion time by 19 percent, while the developers had expected a 20 percent speed-up. They list caveats, including a small sample, a specific setting (experienced developers on mature projects they knew well) and that experimental artefacts cannot be ruled out.
What you can fairly conclude is limited. It does not show that AI slows down everyone, or that it will do so with today's tools. It does show that feeling faster is not the same as being faster, and that benefits depend on the person, the task and the codebase. Beginners learning a new framework, or developers writing boilerplate, are different situations. The honest approach is to measure: time a few comparable tasks with and without assistance.
Security
#Two studies, both from earlier versions of these tools:
- "Asleep at the Keyboard?" (Pearce et al.) tested GitHub Copilot across 89 scenarios involving well-known high-risk weakness categories, producing 1,689 programs, and found that approximately 40 percent were vulnerable.
- "Do Users Write More Insecure Code with AI Assistants?" (Perry et al.) found that participants with an AI assistant wrote significantly less secure code than those without, yet were more likely to believe their code was secure. Participants who trusted the assistant less and engaged more with the prompts produced fewer security flaws.
Tools have changed since these were run, so do not quote the numbers as current. Still, the two lessons have held up well in practice: plausible code can be insecure, and confidence rises faster than correctness. Article 21 covers this in depth.
Your responsibilities do not move
#Responsibility | What the assistant can do | What you must do |
|---|---|---|
Correctness | Draft logic, suggest cases | Define "correct", run tests, check edge cases |
Security | Flag some issues | Review for vulnerabilities, secrets and unsafe patterns; run scanners |
Performance | Suggest alternatives | Measure with realistic data |
Maintainability | Follow your style when shown | Ensure it fits the codebase and that others can read it |
Licensing | Often nothing reliable | Know your tool's settings and your organisation's policy (article 21) |
Testing | Draft tests | Check that tests test something real (article 20) |
Architecture | Offer options | Decide, with the constraints of your system in mind |
Confidentiality | Nothing | Use only approved tools, never paste secrets or proprietary code where not allowed |
GitHub's documentation reflects this: it describes reviewing and applying suggestions as the developer's role, and says that for agent work you remain responsible for reviewing and approving.
A responsible workflow
#- Understand the task first. Write the acceptance criteria in one or two sentences before you prompt. If you cannot, the assistant cannot either.
- Work in small steps. One function, one change, one test.
- Provide context and constraints, as above, including what not to change.
- Ask for assumptions and edge cases before the code, not after.
- Read every line you accept. If you cannot explain it, do not commit it. Simon Willison's rule of thumb is that he does not commit code to his repository if he could not explain exactly what it does to somebody else.
- Run it. Tests, linters, type checks and a manual try-out.
- Review the diff as if a stranger wrote it, because in effect one did.
- Commit in small units, with messages that describe what you understand the change to do.
- Note what the assistant got wrong. That tells you where to be careful next time.
Learners versus experienced developers
#- If you are learning, the attempt-first rules of Module 3 apply strongly. Writing code yourself is how you learn to read it. How to Learn Programming When AI Can Already Write Code discusses the balance.
- If you are experienced, your strongest contribution is in specification, review and architecture. Delegate the boilerplate and keep the judgment.
- If you lead a team, agree on a policy: which tools are approved, what may be pasted, how AI-assisted code is reviewed and how it is disclosed, if at all.
Common mistakes
#- Accepting suggestions because they compile.
- Prompting vaguely ("fix this") and letting the tool choose the approach.
- Letting an agent loose on a whole repository without version control, small steps or review.
- Believing you are faster without measuring.
- Pasting secrets, tokens or proprietary code into unapproved tools.
- Using AI-written tests as proof that the AI-written code is right (article 20).
- Not telling anyone, when your team expects disclosure.
Exercises
#Exercise 1
Match the mode
#Which mode fits best: (a) writing the next line of a loop, (b) asking "what does this regex do?", (c) "rename this function everywhere and update the tests", (d) a second opinion on a pull request?
Exercise 2: Improve the prompt
#Rewrite "make the login faster" into a prompt with context, task, constraints, examples and a request for assumptions. Invent plausible details.
Exercise 3: Interpret the evidence
#A colleague says, "A study proved that AI makes developers 19 percent slower." Write a fair response in three sentences.
Exercise 4: Plan a measurement
#Design a small experiment to test whether an assistant makes you faster at a kind of task you do often. Include how you will keep the comparison fair.
Show solutionHide solution
(a) Inline completion. (b) Chat. (c) Edit or agent mode. It spans several places, so use version control, review the full diff and run the tests. (d) Review mode, plus your own review. A tool can raise points, but it should not be the only reviewer.
Exercise 2
Show solutionHide solution
One possibility:
Context: a Node.js Express app. POST /login takes about 800 ms. Profiling showsmost of it is a database query in auth/findUser.js that scans the users table byemail. The email column has no index.Task: suggest how to make the lookup faster.Constraints: PostgreSQL 15; no new dependencies; do not change the API response;migration must be reversible.Examples: the query currently is SELECT * FROM users WHERE email = $1.First, tell me what other things could make login slow that I should rule out,and which assumptions you are making. Then propose the change.The improved prompt names the actual problem (a scan), the environment, the limits and an acceptance idea. It also asks the assistant to question the premise, since "login is slow" might have causes other than the query.
Exercise 3
Show solutionHide solution
"The study you mean (METR, 2025) found that 16 experienced developers working on repositories they knew well took 19 percent longer with AI tools allowed, even though they expected to be faster. The authors note caveats, including a small sample and a specific setting, so it does not show that AI slows everyone down or that today's tools behave the same way. What it does suggest is that feeling faster is not proof of being faster, so it is worth measuring."
Exercise 4
Show solutionHide solution
An example: choose one kind of task (writing small data-cleaning functions). Over two weeks, take 10 comparable tasks of similar size. Randomly assign five to "with AI" and five to "without" (flip a coin before looking at the task). Time each from start to tests passing and reviewed, not to "first draft". Record the number of bugs found afterwards.
To be fair: do not choose which tasks get AI based on how hard they seem; use the same definition of "done"; and include the time spent prompting and reviewing. With ten tasks you cannot reach firm conclusions, but you will learn about your own patterns, which matters more than a headline number.
Where to go next
#- Next: Use AI to Understand Code, Codebases, APIs and Documentation uses assistants for reading, which is often safer and more valuable than writing.
- For debugging, go to How to Use AI to Debug Code Safely.
- For security, see Security and Licensing Risks of AI-Generated Code.
Sources & further reading
- Technology
- AI
- #AI
- #AI coding
- #developers
- #generative AI
- #productivity
- #prompt engineering
- #responsible AI
- #software security
Connected lessons
References
Linked from 6 guides
Other pages in the library that point here.
Keep reading
More in Technology →Guide · Technology
Writing Better AI Prompts: A Practical Guide
Guide · Technology
Using AI Tools at Work Without Getting Into Trouble
Course · Career
Off-Campus Placements With AI: From Zero to Offer

