Developing with AI

All tutorials

A practical guide for developers

Developing with AI without losing control

AI can help you understand code, prepare a first draft, explore alternatives and handle repetitive tasks. It can also introduce errors or changes that do not match what you wanted.

This guide shows how to try AI in software development: from model basics and practical use cases to prompts, agents, MCP and skills. The approach is hands-on: give it a clear task, inspect what it produces and verify the result in your project.

This guide is about using AI while developing software. Building applications that integrate AI models or APIs is a different path with its own topics.

Opening illustration for the Developing with AI without losing control guide

1. The basics: what an AI model does

In this guide, AI mainly means assistants built on large language models (LLMs), used to generate or analyse text and code. An LLM processes text as units called tokens and generates a response one piece at a time, using the context it receives and patterns learned during training.

The model by itself does not open your project or run code. An application can connect it to files and tools, but even then a plausible answer is not automatically correct or suitable for the project.

It helps to distinguish the model from the assistant that uses it. A chat may only reply with text; an assistant connected to an editor may also read files or propose changes; an agent may have tools to edit files, run commands or consult external services. These capabilities depend on the application and the permissions you grant it.

What can go wrong

  • Invented answers: it may mention functions, APIs or conventions that do not exist in your project.
  • Missing context: if it cannot see relevant files or rules, it may suggest a solution that conflicts with the rest of the code.
  • Results to verify: code that looks correct may contain bugs, unhandled cases or security risks.

Treat the answer as a proposal: be clear about what it should do, check what information it relies on and verify its behaviour before adding it to the project.

2. AI and programming: tasks and limits

Writing code yourself and getting help from AI are two ways of working that you can combine. The choice depends on the task and on how well you can check the result.

  • Write or fix the code yourself when the change is small, you already know the solution or you want to practise the fundamentals.
  • Ask for an explanation when you encounter unfamiliar code or an error you cannot interpret yet. Then compare the answer with the project and its documentation.
  • Use AI to explore options or prepare a first draft when the task is clear and you can evaluate the alternatives.

Examples from software development

  • Code review: ask it to look for defects, edge cases or risks in a change. A review helps find problems; it does not certify that the code is correct.
  • Refactoring: ask it to make code easier to read while preserving its behaviour; then inspect the diff and check important cases.
  • Documentation: ask for a draft based on current code or notes, then verify names, steps and claims.

To learn, try solving a small exercise before asking for the answer. Comparing your attempt with an explanation teaches more than copying code you cannot yet read.

3. Before the prompt: the specification

Before asking for code, clarify what should happen. If the idea is still vague, the assistant has to fill in the gaps with its own decisions, and you may get a solution that does not meet your needs.

Before generating anything, turn the intuition into a small specification. Four lines are enough, one per question:

  • Purpose: what problem does this change solve, for the user or for the project?
  • Boundaries: which files and behaviours may the AI touch, and which must it leave alone?
  • Success criteria: how, concretely, will you verify that the change works?
  • Project style: which existing conventions must it respect?

In practice, a complete specification can be as small as this:

Purpose: stop the contact form submitting with an invalid email.
Boundaries: js/form.js only; do not touch the markup or the CSS.
Success: bad input → message under the field; valid input → normal submission.
Style: no external libraries, pure functions, names consistent with the rest of the file.

These few lines make your request clearer and give you a criterion for assessing the answer.

4. Coding assistants and agents

Coding tools with AI offer different levels of help. Names and features change; recognising the type of workflow helps you choose without tying yourself to one product.

  • Suggestions as you type: complete or propose short pieces of code. They are handy for small tasks, but you still need to read what you accept.
  • Chat in the editor: answers questions and suggests changes to a selection or file, with the code nearby.
  • Coding agent: it can analyse several files and, if granted access, edit them or run commands. Before starting, define the task and check which actions need your approval.

How to choose a tool

Start with the editor and workflow you already know. Then check four things: which files and services the assistant can see; whether you can inspect changes before applying them; which commands or actions it can run; and how your code and data are handled. Consider cost and compatibility with your project too.

To learn, use a small project or a copy and keep changes easy to undo. You do not need to start with an agent: a chat that explains a function may be more useful than automation that changes many files.

5. Context, MCP and skills

Context is what separates a textbook answer from an answer for your project. Without context, even the best model produces code that could belong to any codebase in the world. But the opposite excess is just as bad: dump half a project and a jumble of instructions into the chat and the model loses the thread and starts mixing things up.

The rule is: do not give everything, give what is needed. When you ask for a change, always include:

  • the file or the section involved;
  • the current behaviour and the desired one;
  • the conventions already present in the project (names, structure, recurring patterns);
  • the technical constraints: framework in use, forbidden libraries, browsers to support, existing CSS style;
  • how you will verify the change once it is applied.

For a recurring project, you can collect essential rules in an instruction file: structure, conventions, limits and useful commands. The name and format depend on the tool; do not assume every assistant reads them automatically.

"Before changing any code, read the files involved, summarise the current behaviour and propose a short plan. Keep the existing style, do not add dependencies and change only the files that need changing."

Skills: reusable instructions

A skill collects a procedure to reuse for a type of task, such as checking a page before release. It may contain instructions, examples and, in some systems, supporting files or scripts. It does not add new abilities to the assistant by itself: it explains when and how to follow that procedure. Formats and support vary between tools.

MCP: connecting an assistant to other tools

MCP is an open protocol that lets compatible AI applications connect to external data sources and tools. For example, a connection may let an assistant consult documentation or search a service. MCP provides the connection; it does not decide whether an answer is correct or replace a skill that explains how to do the task.

Before enabling a connection, check which data it exposes and what actions it allows. Write access or command execution needs more care than read-only search. Connect only services whose source, permissions and revocation process you understand.

6. Writing effective prompts

A prompt is a set of instructions for a task. To make it useful, clarify the result you want, add the context needed and state the constraints that affect the solution. You do not need to assign the assistant a role or fill in a fixed template every time.

If the format matters, show an example or request a specific output, such as a list of test cases. If the task is large, split it into steps and check each result before moving on.

[Context] The project uses Vite, JavaScript and CSS. The form checks email and password.
[Goal] Write a JS function to validate both fields.
[Constraints] Do not use external libraries. The password must be at least 8 characters and contain a digit.
[Output and checks] Return { isValid: boolean, error: string } and show 3 input/output examples.

The request does not make AI infallible, but it reduces the decisions left to guesswork. Examples help when you need a particular format or behaviour; for a simple question, a clear sentence is often enough.

Before sending it, ask yourself how you will check the answer. If you cannot verify it or it contains too many goals, clarify the criterion or split it into smaller tasks.

7. Working in small steps

When a request includes many changes, it is harder to tell which change caused a problem. Breaking the work into small steps makes each result easier to read and check.

Use these four rules as a reminder while you work:

The rules of the method

Rule 1: take small, isolated steps

Never a whole feature in one answer. Ask for one piece at a time: a function, a component, a fix, a contained refactor. The measure is this: if you can read and try the result in a few minutes, the size is right; if you need half an hour just to understand what changed, it was too much.

Rule 2: Git is your parachute

Before generating significant changes, make a clean commit or open a temporary branch. If the direction turns out to be wrong, you go back with one command instead of reconstructing from memory. The paradox is only apparent: Git makes you bolder in experiments precisely because it protects you from the ones that go badly.

Rule 3: read and understand BEFORE saving

Do not accept a suggestion because it “looks plausible” — plausibility is exactly what models excel at, including when they are wrong. Reread the code, check the names, look at what it imports, verify that it follows the project's style. And if a line is not clear to you, stop and ask a targeted question:

"Explain this line simply and tell me which edge cases it might not handle."

Rule 4: diagnose first, then ask the AI

When something breaks, resist the urge to paste the error into the chat with a “why doesn't this work?”. Take the first diagnostic step yourself: console, logs, the line involved, the last change you made. Then bring the AI that precise point, with the context already narrowed. The less noise you give it, the more useful the answer — and in the meantime you will have kept your debugging muscle in shape, which stays yours.

Diagram of the AI-assisted development workflow
Side by side: the blind workflow, accepting everything without reading (left), and the small-steps workflow with verification (right).

8. The 8-step pipeline: from brief to finished project

A request like “make me a landing page for a gym” leaves many decisions open: content, structure, styling and file organisation. Before generating code, clarify the choices that will affect the result.

The sequence below divides the work into 8 steps. Adapt it to the size of the project: each step produces a result to read and check before moving on.

Stages of the work

The same assistant can help at different stages. State the task and expected result; you do not need to turn every request into a character:

Stages of AI-assisted work

Define

Clarify the goal, content and constraints before asking for code changes.

Build

Make small, readable changes one part at a time.

Review

Ask it to look for bugs and edge cases, then check its suggestions yourself.

Verify

Open the project, run tests or manual checks, and compare the result with the goal.

The pipeline, step by step

The example below uses a gym landing page. You can adapt the sequence to other projects: define, build, verify. Do not move to the next step until you have checked the current result.

STEP 1 — The brief: you design, you do not program

The first prompt does not ask for code: it asks for a design. Page structure, user experience, how the sections are organised. The explicit prohibition (“do not write code”) is the most important part of the request: without it, the model jumps straight to implementation.

"Let's design a template for a gym. I want a professional landing page made up of Home, About, Services, Pricing, Trainer, Contact. Do not write code. Define the structure, the UX and how the content is organised."

Before moving on: read the proposal as a client would. Is every section needed? Is anything missing? Cut and correct now — every ambiguity that survives the brief will come back multiplied in the code.

STEP 2 — The architecture: the file tree

With the content structure validated, ask for it to be translated into a folder layout. The criterion to impose is single responsibility: each file does one thing, and its name says which.

"Create the folder tree for a Vite project using HTML, CSS and vanilla JavaScript. Every file must have one precise responsibility."

The result is a modular, tidy structure that is easy to navigate:

src/
├── assets/
│   ├── images/
│   └── icons/
├── css/
│   ├── base.css
│   ├── layout.css
│   ├── components.css
│   └── utilities.css
├── js/
│   ├── main.js
│   ├── menu.js
│   ├── slider.js
│   └── form.js
└── index.html

Before moving on: ask yourself whether you could explain what each file is for. If you could not justify one of them, ask the AI to justify it or remove it: architecture gets fixed now, not once ten of them exist.

STEP 3 — The project's hard rules

Before the first line of code, write down the non-negotiable rules. This is not bureaucracy: without explicit constraints the model slides towards its generic habits, and the quality of the code gets decided by chance instead of by you.

"Before you start writing code, follow these rules:
- Using !important in the CSS is forbidden
- No duplicated CSS
- No inline JavaScript
- Use descriptive names
- Comment only where it helps
- Avoid workarounds
- If you find a structural problem, propose a solution instead of adding more code."

The last rule is the most valuable: it authorises the AI to stop and flag an underlying problem, instead of burying it under a patch.

STEP 4 — One section at a time

Here the building begins, and here you need the most discipline. No massive requests like “build me the whole site”: one section per request, HTML and CSS together, in blocks you can read from start to finish.

  • "Create the HTML structure and the CSS for the Hero section only."
  • "Now move on to the navbar (header)."
  • "Now do the Services section."

Before moving on: open the page in a browser and look at the section you just built, on mobile too. Every approved section becomes stable ground for the next one to rest on.

STEP 5 — The JavaScript, last

Interactivity only arrives once the structure and layout are complete and stable. The reason is practical: JavaScript hooks into the markup, and any later markup change risks breaking logic that is already written. Here too, one component at a time:

  • the mobile menu;
  • the content slider;
  • the effects on form submission or on scroll.

Before moving on: try each component you add, including a few “wrong” uses — double clicks, empty fields, resizing the window.

STEP 6 — Refactoring and cleanup

When everything works, ask for a focused review. State what to check and ask for reasons behind each suggestion before applying it. For a refactor, also say that behaviour must stay the same.

"Check these files for duplicated code, redundant CSS and possible bugs. For each issue, identify the relevant part and suggest a contained change. Do not edit files or change behaviour."

Before moving on: commit before applying the refactor (that is Rule 2's parachute), then check that everything works exactly as it did.

STEP 7 — Optimisation

Only now, on a clean project, is it worth investing in polish: optimising earlier means shining up code that may well get thrown away.

  • Cut redundant CSS and JavaScript.
  • Optimise the loading of images and external resources.
  • Check SEO, tag accessibility and how it responds on different screens.

STEP 8 — The final review: thinking about six months from now

For the final review, ask about specific problems and supporting evidence, not for a general judgement about the project:

"Review these changes. Look for regressions, unhandled edge cases and accessibility problems. For each finding, identify the line or behaviour involved and explain how to verify it. If there is not enough evidence, say so."

Assess each finding before acting on it. A longer list is not automatically a better review.

Diagram of the 8-step development pipeline
The full pipeline: 8 steps in sequence, from the brief to the final review, each closed by a check.
Why this approach makes the difference

Every step produces a small result that you have read and approved before building on top of it. That is the difference between the pipeline and “build me the whole site”: at the end you do not just have a project that works, you have a project you understand. And when in six months you need to add a feature, you will be working on a tidy, modular base — not inside thousands of chaotic lines generated in one go, that nobody ever really answered for.

9. Reviewing the generated code: quality control stays yours

The decisive moment is not when the AI writes the code: it is when you decide whether that code deserves to enter the project. The review is where you genuinely take the wheel back — skipping it turns every suggestion into an act of faith.

For every change you receive, go through five aspects:

  • Consistency: does it follow the style, names and structures already in the project?
  • Boundary: did it change only what was needed, or did it touch areas nobody asked about?
  • Behaviour: does it handle empty states, errors, edge cases and unexpected input?
  • Maintainability: in a month's time, will you still understand why that solution exists?
  • Verification: have you run tests, a build or manual checks proportionate to the change's risk?

And if something does not add up, do not ask for a generic “fix everything” — that is the fastest way to make things worse. Ask for a narrow diagnosis: which file is involved, what the likely cause is, which alternatives exist and which has least impact on the project. Then you choose.

10. Why technical fundamentals matter

To check a solution generated by AI, you need to read the code and understand at least the behaviour you expect. Fundamentals are not about competing with a model; they help you avoid depending on an answer you cannot evaluate.

  • HTML, CSS and JavaScript help you understand what changes in a page's interface and behaviour.
  • Git lets you compare and undo changes you do not want to keep.
  • Tests and debugging tools help you check behaviour, even when the code looks correct.

If you are starting out, use AI to explain a concept or an error too. Then try solving a small variation yourself: it is a practical way to check whether you understood.

11. Skills that transfer to other projects

The workflow here also applies when you change editor, language or project type: clarify the result, provide the needed context, keep the task bounded and check the change. It does not make every project the same: APIs, data, accessibility and security need checks specific to the project.

This guide uses front-end examples, but you can apply the same method to back-end code, mobile apps or internal tools. The technical knowledge needed to judge the result changes; it is still useful to distinguish a plausible answer from a verified solution.

12. The daily checklist

At this point the theory has to become habit. This is the sequence to repeat on every AI-assisted change — seven moves that become automatic after a week:

  • Save a clean state with Git before asking for significant changes;
  • Always state the technologies, constraints and files involved;
  • Define the expected result before generating the solution;
  • Ask for changes that are small, verifiable and consistent with the task;
  • Reread the generated code before integrating it;
  • Try the change locally, with manual or automated tests;
  • Format, clean up and commit only when the result is clear.

The principle behind the list is a single one: AI should take weight off you, not clarity. Leave it the repetitive slog, the first draft, the detailed analysis. Keep architecture, judgement, direction and final responsibility for yourself.

13. Where to go next

To continue, start with the practical guides and consult the official sources for the protocols mentioned here:

14. Quick reference (cheat sheet)

Before sending a request, check these points. You do not need all of them for every task:

Prompt blockWhat to writePractical example
1. GoalDescribe the result you need."Find why the form accepts an invalid email."
2. Context / StackSpecify the technologies and the code style."The project uses HTML5, plain CSS, no frameworks..."
3. ConstraintsState what it must respect or leave unchanged."Change js/form.js only; do not add libraries."
4. Check and formatRequest a useful output format and decide how to check it."Explain the issue and suggest three cases to try."

15. Practical challenge: put yourself to the test

The best way to lock the method in is to use it straight away, on a small, real case:

Challenge goal:

Ask AI to make a JavaScript function easier to read, understand the proposal and check that important cases still work.

Step-by-step instructions:
  1. Pick a somewhat convoluted JavaScript function — your own or one you found — that contains calculations or data transformations.
  2. State the expected behaviour, useful context and what must stay unchanged. Ask for an explanation along with the code.
  3. Review the proposal and compare it with the original function before applying it.
  4. Try at least three cases, such as a negative value, an empty string and a missing value. Keep the change only if the result is correct and understandable.

16. Check what you have learned (quiz)

Test what you have learned in this guide with a quick 10-question multiple-choice quiz.