Code generation
Build small apps in Canvas, import your code so answers fit your repo, and choose between Gemini CLI and Antigravity CLI.
-
How Do You Build a Small App in Gemini Canvas? Click Add Files, then Canvas, and describe the app. Level 2: Context
- 1Use it in the preview
- 2Show console for errors
- 3Select & ask on one part
Then try the app again -
Gemini CLI or Antigravity CLI: Which Should You Use? If you're on a free account or Google AI Pro or Ultra, use Antigravity CLI, run with agy. Level 2: Context
- May 19, 2026Move announced
- Jun 18, 2026Gemini CLI cutoffstops serving Google AI Pro and Ultra
- Oct 13, 2026Antigravity in the macOS app
-
How Do You Get Gemini to Write Code That Fits Your Repo? Import the code rather than describing it, then ask for a plan that names real files before you ask for any code. Level 3: Workflows
- 1Import Code
- 2Ask for a plan
- 3Approve one change
- 4Paste and test
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.
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.