I’ve been using the Gemini CLI a lot lately for my coding projects. I really like how it helps me work faster right inside my terminal. But when I first started, I didn’t always get the best results. Over time, I’ve learned some simple tricks that make a huge difference. If you use the Gemini CLI, I want to share my top 10 pro tips. If you are ready, then let’s get started.
My Top 10 Pro Tips for Using the Gemini CLI
1. Always Open Your Project Folder First
This is a super important step I always do! Before I run the gemini command, I make sure I am already inside my project folder. This helps Gemini get the right view of my code and load the right GEMINI.md file. It saves me time and helps keep other files, which are not part of the project, private.
2. Craft Clear, Specific Prompts
Gemini itself tells you to be specific for the best results, and I agree. Poor prompts often fail because they lack context. For example:
# Vague prompt (not recommended)
help me fix my UI
Instead, be explicit about what you want and break the task into steps. You can even instruct Gemini to wait for your confirmation:
# Better prompt with context and checklist request
When I tap on a chat message, save that portion of the UI as an image. Provide TypeScript code to implement this feature. Create a step‑by‑step checklist and ask for my approval before editing any files.
3. Ask for a Plan Before Changes
Press enter or click to view image in full size
If I’m worried about using too many tokens (or just want to be careful), I ask Gemini to “generate the plan” first. This gives me a clear list of what it’s going to change. If I see a mistake in the plan, I can ask Gemini to fix the plan before it starts changing my files. This saves a lot of time!
4. Provide Persistent Context with GEMINI.md
To give Gemini CLI background knowledge about your project, create a .gemini folder in your repository and add a GEMINI.md file.
I use the /init command to create a GEMINI.md. In this file, I document all the important aspects of my project, such as style guides, audience details, and instructions for running tests. Gemini uses this info from the very first time it launches.
If I change the file, I just use the /memory refresh command to update Gemini's knowledge about the project.
/memory refresh
# verify it’s saved
/memory show
5. Use Shell Mode for Quick Terminal Commands
In the interactive session, you can toggle shell mode by pressing !. For example:
gemini
# inside Gemini CLI
! # enters shell mode
pwd # prints the current directory
ls # lists files
! # exits shell mode (or press Esc)
Shell mode executes commands locally and feeds the output back into the conversation context.
6. Use /memory add for Quick Context Update
For fast notes, like a database port number or an API URL, I use the /memory add command. This is a quick way to add specific details to Gemini's memory, and it's faster than opening and editing the GEMINI.md file every time.
# store a decision
/memory add "The database port is 123 and we decided to use Boostrap CSS."
# verify it’s saved
/memory show
7. Search the web with @search
The built‑in @search tool fetches information from the web or external sources. For instance, if you need to investigate a known issue on GitHub:
@search "https://github.com/google-gemini/gemini-cli/"
Gemini fetches the issue and uses it as context to answer your question. You can also search by keyword:
@search "How to fix 'Cannot find module' error in Node.js?"
Or I just tell the assistant to “search the web,” and it’s smart enough to handle the rest!
8. Custom Slash Commands
If you often ask the same type of question, define a custom slash command. Suppose you regularly need a planning template. Create a directory and TOML file:
# create the commands folder
mkdir .gemini/commands
# create a toml file
touch .gemini/commands/plan.toml
Inside the file, add the description and prompt.
description = "Generate a concise plan from requirements"
prompt = """
You are a project planner. Based on the following requirements, generate a numbered plan with deliverables, time estimates and testing tasks.
Requirements: {{args}}
"""
Now you can use the /plan command inside Gemini.
/plan "Add user authentication and registration to the TODO app."
9. Use Non-Interactive Mode for Single Questions
When I need a quick answer and don’t want to start the full chat mode, I use the gemini -p command. I just passed my question with the command and got a single, fast response right in my terminal. For example:
gemini -p "summarize the main points of gemini.md"
10. Enable Checkpoints (My Undo Button!)
This is my favorite safety feature. I enable checkpointing in my settings.json file. This is like a "save button" or a small Git commit before Gemini makes any changes. If the project breaks after a change, I can just use the /restore command to see the list of saved snapshots and roll back to a previous, working version of my files.
Video Tutorial: Gemini CLI Top 10 Tips
If you want to see these commands in action, please watch my video tutorial.
Watch on YouTube: Gemini CLI Tips
Conclusion
The CLI is a powerful tool, but these small steps are what really make it fast and reliable for me. I hope these tips help you get the most out of it, too!
Cheers! ;)


Top comments (1)
Some comments may only be visible to logged-in visitors. Sign in to view all comments.