In this categoryGemini ยท 24
- How to Install the Gemini CLI and Run Your First PromptStart
- How to Get a Gemini API Key from Google AI Studio
- How to Call the Gemini API from Python
- How to Give Gemini CLI Project Context with a GEMINI.md File
- How to Choose the Right Gemini Model for Coding Tasks
- How to Fix a Bug in Your Codebase with the Gemini CLI
- How to Set Up Gemini Code Assist in VS Code
- How to Stream Gemini Responses in Node.js
- How to Feed a Long Document into Gemini's Long Context
- How to Run the Gemini CLI Non-Interactively in Scripts
- How to Analyze a Video File with the Gemini API
- How to Connect an MCP Server to the Gemini CLI
- How to Fix Common Gemini CLI Authentication Errors
- How to Cache Long Context in the Gemini API to Cut Costs
- How to Summarize a YouTube Video with Gemini
- How to Analyze PDFs and Docs in the Gemini Chat App
- How to Extract Data from Images and Screenshots with Gemini
- How to Generate a Short Video with Veo in Gemini
- How to Ground Gemini Answers in Your Own Documents
- How to Use Gemini Inside Google Docs to Draft Faster
How to Give Gemini CLI Project Context with a GEMINI.md File
Create a GEMINI.md memory file so the Gemini CLI knows your project conventions on every run.
The Gemini CLI reads a file named GEMINI.md and loads it as standing instructions, the same way Claude Code reads CLAUDE.md. Use it to record your stack, coding style, and rules so you do not repeat yourself in every prompt. This guide shows where to put it and what to write.
What you need
- The Gemini CLI installed and signed in
- A code project you work in regularly
- A text editor
- About 5 minutes
Step 1: Create GEMINI.md at the project root
Add a file named GEMINI.md in the top folder of your repository. The CLI picks it up automatically whenever you run gemini from that folder or any subfolder. Keep it short and specific, since every word counts against context.
# Project: Invoice API
## Stack
- Node 20, Express, TypeScript
- PostgreSQL via Prisma
- Tests with Vitest
## Conventions
- Use named exports, never default exports.
- All money values are stored in integer cents.
- Never edit files under prisma/migrations by hand.
## Commands
- Run tests: npm test
- Type check: npm run typecheckStep 2: Confirm the CLI loaded it
Start the CLI and run the /memory show command. It prints the combined instructions currently in context, including your GEMINI.md. If it is empty, you are probably running from a folder above the file.
Step 3: Layer global and folder context
You can keep personal defaults in ~/.gemini/GEMINI.md and project rules in the repo file. Subfolders can have their own GEMINI.md too. The CLI merges them, with the most specific file taking priority, so a frontend folder can add UI rules on top of the root file.
Result
Every prompt now starts with your project context baked in. Instead of explaining your stack each time, you can ask Add a discount field to invoices and trust that the agent already knows to store money as integer cents and avoid editing migrations.
Watch related tutorials
16:12
3:58:44
12:00
09:00
15:21
11:32New guides in your inbox
Fresh step-by-step how-to guides as we publish them. One email a week, no more.