gemini-cli-best-practice

April 28, 2026 ยท View on GitHub

from vibe coding to agentic engineering โ€” practice makes gemini perfect

updated with Gemini CLI GitHub Stars

Best Practice Implemented Orchestration Workflow Gemini Taylor Community Click on these badges below to see the actual sources
= Agents ยท = Skills ยท = Commands

Gemini CLI mascot jumping

๐Ÿง  CONCEPTS

FeatureLocationDescription
Subagents.gemini/agents/<name>.mdBest Practice Implemented Specialized actors with isolated context, scoped tools, and custom system prompts ยท auto-delegate or explicit @agent invocation ยท built-ins: codebase_investigator, cli_help, generalist, browser_agent (v0.38.1+)
Agent Skills.gemini/skills/<name>/SKILL.mdBest Practice Implemented First-class primitive (v0.23.0+) โ€” name + description only frontmatter, optional scripts/ / references/ / assets/ subfolders ยท progressive disclosure via activate_skill tool with user consent ยท Workspace > User > Extension precedence
Commands.gemini/commands/<name>.tomlBest Practice Implemented TOML prompt templates with {{args}}, !{shell}, and @path injection. Sub-folders create namespaces (git/commit.toml โ†’ /git:commit).
Workflow.gemini/commands/weather-orchestrator.tomlOrchestration Workflow Command โ†’ Agent โ†’ Skill
MCP Servers.gemini/settings.json โ†’ mcpServersModel Context Protocol integrations (Playwright, Context7, Google Workspace, Figma, GitHub, custom).
Extensionsgemini extensions install <name>Distributable bundles of commands + MCP servers + scoped GEMINI.md.
MemoryGEMINI.md, .gemini/GEMINI.md, ~/.gemini/GEMINI.mdBest Practice Implemented Tree-merged memory with @path imports and /memory runtime commands.
Settings.gemini/settings.jsonBest Practice Implemented Hierarchical config: flags > env vars > local > project > user > defaults.
Checkpointing--checkpointing, /restorePre-edit file snapshots with session-local rollback.
CLI Startup Flagsgemini [flags]Best Practice Flags, subcommands (gemini mcp add, gemini extensions install), and environment variables.
AI TermsAgentic Engineering ยท Context Engineering ยท Vibe Coding
Official DocsGemini Gemini CLI ยท Gemini API ยท MCP

๐Ÿ”ฅ Hot

FeatureWhereDescription
YOLO Mode beta--yolo / -yAuto-approves every tool call โ€” sandbox/CI only, never on your workstation
Headless Modegemini -p "<prompt>"One-shot invocation; pipes through stdin/stdout for CI/cron
Checkpointing--checkpointing + /restoreFile-level undo for exploratory refactors
Multi-directory--include-directories ../otherReason across multiple repos in one session
@path injectioninside prompts & commandsMultimodal โ€” @file.png, @file.pdf, @file.mp3 all work
Shell passthrough!cmd (single) or ! (persistent)Run shell without leaving Gemini
/compressbuilt-inSummarizes the chat to free context window
/chat save / /chat resumebuilt-inMulti-session conversation persistence
IDE integrationVS Code / JetBrains pluginsDiffs and code context pipe into the CLI
GitHub Actionsgoogle-gemini/gemini-cli-actionGemini-driven PR review and triage in CI
Extensionsgemini extensions installCommunity packs with commands + MCP servers bundled
Google Workspace MCPgoogle-workspace MCP serverPaste a Docs/Sheets link, get a summary
Sandbox betaGEMINI_SANDBOX=1Container / macOS Seatbelt isolation for file/shell tools
Telemetry (local)telemetry.target: "local"Offline observability for tool calls and tokens
Vertex AI authselectedAuthType: "vertex-ai"Enterprise-grade auth with GCP IAM

section divider

Orchestration Workflow

See orchestration-workflow for implementation details of the Command โ†’ Agent โ†’ Skill pattern โ€” built on Gemini CLI's TOML commands, native subagents (v0.38.1+), and first-class Agent Skills (v0.23.0+).

Command โ†’ Tool โ†’ Output

How to Use

gemini
/weather-orchestrator

Gemini asks for your unit, fetches the temperature from Open-Meteo, writes an SVG card, and prints the paths. The full command prompt: .gemini/commands/weather-orchestrator.toml.

section divider

โš™๏ธ DEVELOPMENT WORKFLOWS

All major workflows converge on the same architectural pattern: Research โ†’ Plan โ†’ Execute โ†’ Review โ†’ Ship.

Nameโ˜…Workflow
Superpowers171kbrainstorming โ†’ writing-plans โ†’ subagent-driven-development โ†’ test-driven-development โ†’ requesting-code-review โ†’ finishing-a-development-branch5314
Everything Claude Code167k/ecc:plan โ†’ /tdd โ†’ /code-review โ†’ /security-scan โ†’ /e2e โ†’ merge48143230
Spec Kit92k/speckit.constitution โ†’ /speckit.specify โ†’ /speckit.plan โ†’ /speckit.tasks โ†’ /speckit.implement09+0
gstack86k/office-hours โ†’ /plan-ceo-review โ†’ /plan-eng-review โ†’ /plan-design-review โ†’ implement โ†’ /review โ†’ /qa โ†’ /ship โ†’ /land-and-deploy0037
Get Shit Done58k/gsd-new-project โ†’ /gsd-discuss-phase โ†’ /gsd-plan-phase โ†’ /gsd-execute-phase โ†’ /gsd-verify-work โ†’ /gsd-ship โ†’ /gsd-complete-milestone331220
BMAD-METHOD46kbmad-product-brief โ†’ bmad-create-prd โ†’ bmad-create-architecture โ†’ bmad-create-epics-and-stories โ†’ bmad-sprint-planning โ†’ bmad-create-story โ†’ bmad-dev-story โ†’ bmad-code-review โ†’ bmad-retrospective0039
OpenSpec44k/opsx:propose โ†’ /opsx:apply โ†’ /opsx:archive0110
oh-my-claudecode31k/deep-interview โ†’ /team โ†’ team-plan โ†’ team-prd โ†’ team-exec โ†’ team-verify โ†’ team-fix โ†’ /ralph โ†’ merge19037
Compound Engineering16k/ce-ideate โ†’ /ce-brainstorm โ†’ /ce-plan โ†’ /ce-work โ†’ /ce-code-review โ†’ /ce-compound โ†’ repeat50444

Note: yellow tags are sub-loops โ€” steps that repeat inside a parent step (e.g. per task, per story, or until a verify condition passes).

Others

  • Taylor Mullen (Creator of Gemini CLI) Workflow โ€” Taylor ยท GitHub ยท X ยท Gemini CLI repo
  • Addy Osmani (Google DevRel) Workflow โ€” 29 Tips Addy ยท source ยท X

section divider

๐Ÿ’ก TIPS AND TRICKS (29+)

๐Ÿšซ๐Ÿ‘ถ = do not babysit

Memory ยท GEMINI.md ยท Agents ยท Skills ยท Commands ยท MCP ยท Context ยท Safety ยท Automation ยท Cost & Observability

Community

โ–  Memory & Persistence (4)

TipSource
store project-specific instructions in GEMINI.md for zero-prompt context โ€” auto-loaded every sessionAddy
/memory add <fact> ยท /memory show ยท /memory refresh for runtime facts โ€” volatile but beats retypingAddy
/chat save <tag> + /chat resume <tag> for parallel multi-day threads โ€” context survives across days ๐Ÿšซ๐Ÿ‘ถAddy
/compress at ~50% context before auto-compact fires at the model's least intelligent pointAddy

GEMINI.md (3)

GEMINI.md and its nested variants hold persistent context. Keep them focused โ€” the same lazy-loading pattern Claude Code uses applies here.

TipSource
keep each GEMINI.md under ~200 lines โ€” longer files dilute attention and the model starts ignoring rulesGemini
for monorepos, push scoped instructions into per-package GEMINI.md files rather than one mega root file โ€” ancestor + descendant loading covers the treeGemini
use @path imports inside GEMINI.md to pull in style guides or build docs โ€” cheaper and more reliable than pasting content inlineGemini

Agents (5)

TipSource
delegate long, tool-heavy work to the built-in codebase_investigator โ€” 20 file reads + 12 greps stay in the child's context, only the final report returns ๐Ÿšซ๐Ÿ‘ถGemini
use @agent_name in the prompt to force a specific subagent โ€” auto-delegation via description: matching works, but explicit is more reliable for orchestrated flowsTaylor
scope tools: tightly โ€” read-only allowlist for audit agents, no MCP for offline agents ยท tools: ["*"] means the agent can do anything, scope explicitlyGemini
write a specific description: โ€” it's what the main agent reads to decide when to delegate ยท "helpful assistant" gets ignored, "Reviews diffs for SQLi/XSS/SSRF before merging auth PRs" gets routedGemini
drop temperature: 0.2 for review / audit agents; let generators run at 1.0 โ€” deterministic reviewers, creative generatorsGemini

Skills (5)

TipSource
treat the skill description: as a trigger, not a summary โ€” "Use this skill to X. It handles Y. Activate when Z." routes reliablyGemini
skills are folders, not files โ€” use scripts/, references/, assets/ subdirectories for progressive disclosure so activation is cheapGemini
include scripts and asset templates in skills so the model composes rather than reconstructs boilerplate each timeGemini
don't put skills that fetch data โ€” use subagents for fetching ยท skills are procedural (render, review, migrate)Gemini
precedence is Workspace > User > Extension โ€” rename on name collisions instead of relying on shadowingGemini

Commands (4)

TipSource
TOML slash commands in .gemini/commands/ โ€” namespace with sub-folders ยท git/commit.toml โ†’ /git:commitAddy
inject shell output at load time with !{cmd} instead of asking the model to run it โ€” deterministic and the prompt reads the result directlyGemini
~/.gemini/settings.json for cross-project personal defaults; project-level .gemini/settings.json for team-sharedAddy
if you do something more than once a day, turn it into a skill or command โ€” build /status, /techdebt, /review:securityAddy

โ–  MCP & Integrations (4)

TipSource
MCP servers are first-class โ€” Figma, Google Workspace, GitHub, Playwright, proprietary DBs all plug in via .gemini/settings.json โ†’ mcpServersAddy
paste Google Docs / Sheets links directly into prompts once the Workspace MCP is configured โ€” Gemini fetches and summarizes on the spotAddy
ask Gemini to write and spin up a temporary MCP server mid-session when you hit a gap โ€” it generates the server, you register it, and the tool is live for the rest of the sessionAddy
IDE plugins (VS Code / JetBrains) pipe diffs and code context straight into the CLI โ€” skip the copy/paste danceAddy

โ–  Context & Input (5)

TipSource
@./path injects files, directories, images, PDFs, and audio into the prompt โ€” multimodal works out of the boxAddy
--include-directories ../sibling,../shared works across multiple repos in one session โ€” cross-repo reasoning without leaving GeminiAddy
AI-assisted file organization โ€” point Gemini at a messy directory and ask it to classify, rename (using vision), dedupeAddy
multimodal OCR โ€” invoice parsing, UI mockup analysis, audio transcription, chart reading all via @file.png / @file.pdf / @file.mp3Addy
/stats shows token usage โ€” structure long prompts so the stable prefix comes first to benefit from cache hitsAddy

โ–  Safety & Modes (4)

TipSource
--checkpointing snapshots files before every edit ยท /restore rolls back ยท safety net for exploratory refactorsAddy
prefer scoped allowlists (Shell(npm test), WebFetch(domain:*.google.com)) over global --yolo โ€” scoped auto-approval doesn't unlock rm -rf /Taylor
GEMINI_SANDBOX=1 for container / macOS Seatbelt isolation when the session touches untrusted code or dataAddy
restrict $PATH for Gemini CLI so it can't reach unwanted tools โ€” improves safety in CI and shared envs ๐Ÿšซ๐Ÿ‘ถAddy

โ–  Automation & Scripting (4)

TipSource
gemini -p "<prompt>" for headless / CI / scheduled runs ยท pipes through stdin/stdout, no chat UIAddy
GEMINI_SYSTEM_MD=./ci-prompt.md replaces the baked-in system prompt โ€” perfect for scoping CI personas per jobAddy
!cmd shell passthrough for one-shot commands; ! alone enters persistent shell mode โ€” terminal without leaving the sessionAddy
your entire $PATH (Docker, ffmpeg, ImageMagick, gcloud, kubectl) is Gemini's toolkit โ€” CLI tools beat asking the model to re-implement themAddy

โ–  Cost & Observability (3)

TipSource
/stats for token usage and cache-hit insight โ€” catch context bloat before it hits your walletAddy
local telemetry on (telemetry.target: "local") for session-level observability โ€” tool calls, tokens, durations without data leaving the machineAddy
summarizeToolOutput in settings caps tool-call context bloat โ€” long ReadFile / Shell outputs get summarized before being appendedGemini

section divider

How to Use

1. Read the repo like a course โ€” learn what commands, agents, and skills are before trying to use them.
2. Clone this repo and play with the examples. Try /weather-orchestrator, watch @weather-agent run in isolated context, and consent to the weather-svg-creator skill activation so you can see how the pieces connect.
3. Go to your own project and ask Gemini to suggest what best practices from this repo you should add โ€” give it this repo as a reference so it knows what's possible.

section divider

๐Ÿ”” SUBSCRIBE

SourceNameBadge
Redditr/GoogleGeminiAI, r/GeminiAI, r/Bard, r/google, r/googlecloudGemini Team
XGoogle AI, Google DeepMind, Gemini App, Taylor Mullen (Creator of Gemini CLI), Allen Hutchison (Gemini CLI Lead), Jack Wotherspoon (Gemini CLI DevRel), Addy Osmani (Google DevRel), Paige Bailey (AI DevX Lead), Logan Kilpatrick (AI Studio Lead), Sundar Pichai, Demis Hassabis, Jeff Dean, Oriol Vinyals, Koray Kavukcuoglu, Noam Shazeer, Quoc Le, Jack Rae, Denny Zhou, Ankur Bapna, Josh Woodward, Tulsee DoshiGemini Team
YouTubeGoogle DeepMind, Google for Developers, Google AI Developers, Google Cloud TechGemini Team

section divider

Other Repos

Gemini CLI Hooks
Gemini CLI
Hooks
Claude Code Best Practice
Claude Code
Best Practice
Claude Code Hooks
Claude Code
Hooks
Codex CLI Best Practice
Codex CLI
Best Practice
Codex CLI Hooks
Codex CLI
Hooks

If you like my work, buy me a doodh patti ๐Ÿต on

Polar Polar