Gemini · Coding

Code generation

Build small apps in Canvas, import your code so answers fit your repo, and choose between Gemini CLI and Antigravity CLI.

Gemini code generation

Three ways to generate code

Each route suits a different size of job. Use the Gemini app with Import Code when the new code has to fit an existing repo, and you're happy to paste and test it yourself. Use Canvas for a small standalone tool you can check by using it. Use Antigravity when you want an agent to change the files and run them. Starting in the wrong place is the most common way to lose time here.

What to check in any of them

Generated code looks finished whether it's right or not, so build in a check. In the app, ask for a plan that names real paths, then open them. In Canvas, run a test case you worked out by hand, and use Show console for errors. With an agent, tell it to wait for your OK before it edits anything.

Frequently asked
Can Gemini write code for free?

Yes. The free Gemini app and Canvas both write code, and Antigravity has a $0 plan with basic weekly limits. The free app's 32k token window limits how much existing code it can take into account.

Can Gemini edit the files in my repo?

Google's upload help describes importing code for analysis in the app, not writing back to your repo. For an agent that changes files and runs commands, Google points to Antigravity, which is also built into the Gemini macOS app.

Why does Gemini invent functions that don't exist?

Often because the code wasn't in its context, either because it wasn't attached or because it didn't fit the window. Import the relevant files, ask for a plan with file paths first, and tell it to say when it can't find something.