AI Code Generation
Definition
AI code generation means asking a model for a program and getting back source: a component, a script, or a complete page of HTML with its styling and behaviour included. Assistants are strongest on self-contained front-end work, where the whole result fits in one file and can be judged by looking at it. They are weakest on anything depending on context they cannot see, such as your database schema or the quirks of an internal service. What comes out is ordinary code — no runtime of its own, no licence oddity, no tie to the tool that wrote it — so once you have the file the model is out of the loop. Results vary with how specific the request was, which is why people iterate rather than prompt once and accept it.
Why It Matters
For a lot of small web work the bottleneck was never the idea, it was two days of setup. Generating a page cuts that to about ten minutes, which changes what is worth attempting at all: an internal calculator, a one-off landing page, a chart for Thursday's board meeting. The risk moves as well. Generated code can be confidently wrong, can pull a library from a source you have not checked, and can quietly embed a key you pasted into the chat earlier. Read it before you publish it, exactly as you would read a colleague's pull request.
How It Works
You describe what you want, the model writes a file, you run it and say what was wrong. Most assistants render the result straight away in a preview frame, so the loop takes seconds rather than builds. Since the model cannot install packages while writing, it reaches for a CDN — Tailwind or React arriving through a script tag — instead of a dependency tree, which happens to be exactly what a static host can serve. When the page is right you export it: one HTML document, or a folder with an index.html and its assets. Publishing after that is a file upload, and the code is yours to edit by hand from then on.
Real-World Example
An operations manager needs a shift-swap form for twenty staff and has no developer time to ask for. She describes the rules in a chat, gets a single HTML file back, corrects two things about how overtime is counted, and publishes it at shift-swaps.99helpers.site. Submissions post to a form endpoint her team already had; everything else runs in the browser. The work took an afternoon, and hosting it cost nothing.
Common Mistakes
- ✕Publishing generated code without reading it — a confident-looking page can hide a broken calculation or a credential you did not mean to share
- ✕Asking for a full application with a database and expecting a static file to deliver one; the generated front end is real, the back end it assumes is not
- ✕Pinning nothing, so a library loaded at a floating version can change behaviour under a page you have not touched in months
Related Terms
Vibe Coding
Vibe coding is building software by describing what you want in ordinary language and iterating on whatever the model returns, judging the result by whether it behaves correctly rather than by reading every line of the code.
Generated HTML
Generated HTML is markup produced by a program or a model rather than typed by a person. From a browser's point of view it is indistinguishable from hand-written HTML, and a static host serves it the same way.
Prompt-to-App
Prompt-to-app describes tools that turn a written description of an application into something you can run — usually a working web page produced in one pass, then refined by asking for changes.
AI Artifact
An AI artifact is a self-contained piece of work an AI assistant produces and renders in its own panel beside the conversation — commonly a web page, a small app, a document or a chart. Most are a single file, which is why they can be put on the open web with very little work.
Build Step
A build step is the command that turns source files into the folder a web server can actually serve. It runs before publishing, produces an output folder, and is not part of the live site.
Put a file online in seconds
Drop in a document, an image, a page or a whole static website and share the link — free, with no build step and no server to set up.
Host a file free →