explainx.ainewsletter3.5k
TrendingNewsPathwaysSkills
Pricing
explainx.ai

Upskill in AI — 16 free pathways, live workshops & bootcamps, and 50+ courses from practitioners. Plus the skills, tools, and MCP servers to practice on.

follow us

custom AI agents

[email protected]

get started

Find your pathTake Free Evaluation

learn

pathways — start freeworkshopsbootcampscoursescertificationsmock testsexplainx universitycorporate traininglearn skills & mcp

discover

skillsmcp serversexplainx mcptoolsagentsllmsdesignsagi trackerranks

company

aboutvisionmissionteaminstructorscommunityhackathonscareers

content

daily AI newsstate of AI — live resultsblogreleasespromptsgeneratorsresource librarydemofor LLMs

solutions

all solutionsdeveloper upskillingmarketing upskillingproduct manager upskillingleadership upskilling

More from us

InfloqInfluencer marketingBgBlurPrivacy-first blurOlly SocialSocial AI copilotCeptoryVideo intelligenceBgRemoverBackground removal

newsletter · weekly

Get AI news, tools, and insights in your inbox.

supportprivacytermsdata rightssubmission guidelines

© 2026 AISOLO Technologies Pvt Ltd

On this page

  • Three prefix types: /, @, and !
  • How slash commands fit a typical workflow
  • Setup, memory, and project context
  • Model, plan, and session control
  • Session, resume, and checkpointing
  • Skills, MCP, extensions, and tools
  • IDE, editor, and TUI customization
  • Custom slash commands (.toml)
  • MCP prompts as slash commands
  • At commands (@): file injection
  • Shell mode (!): passthrough commands
  • Complete built-in slash command reference
  • Four-way comparison: Gemini CLI vs Codex vs Claude Code vs OpenCode
  • Commands worth memorizing first
  • Related explainx.ai guides
  • Summary
← Back to blog

explainx / blog

Gemini CLI Slash Commands: Complete Reference (2026)

Every Gemini CLI slash command—/init, /plan, /compress, custom .toml commands, @file refs, and 50+ built-ins. Workflow guide from official docs.

Jun 11, 2026·11 min read·Yash Thakker
Gemini CLIGoogle CloudSlash CommandsAI CodingDeveloper Tools
go deep
Gemini CLI Slash Commands: Complete Reference (2026)

Gemini CLI is Google's open-source agentic terminal for reading, editing, and running code with Gemini models. Beyond natural-language prompts, it exposes 50+ built-in slash commands, custom .toml commands, @ file injection, and ! shell passthrough—giving you meta-level control over sessions, tools, memory, and workflows without leaving the terminal.

Custom slash commands shipped in July 2025—a highly requested feature that lets teams define reusable prompts in .toml files or expose MCP prompts as slash commands. This article is a complete reference from the official Commands documentation, plus custom-command authoring from the Google Cloud blog.

It is not a replacement for upstream docs. Note: Google announced migration from Gemini CLI to Antigravity CLI for some tiers in 2026—verify your install path and changelog before documenting team runbooks. See our Google Antigravity analysis for context.

For the Anthropic and OpenAI equivalents, see Claude Code commands and Codex slash commands. For open-source multi-provider TUI, see OpenCode slash commands. For editor-parity terminal agent, see Cursor CLI slash commands.

TL;DR

QuestionAnswer
How do I see all commands?Type / in the composer; run /help for full list.
Custom commands?.toml files in ~/.gemini/commands/ or .gemini/commands/
First session in a repo?/init → /memory → /mcp → /skills → /permissions
Long conversation?/stats for usage; /compress to summarize and free context
Attach files?@path/to/file in prompts (git-aware filtering)
Run shell?!git status or toggle shell mode with lone !
Project memory file?GEMINI.md via /init
Sister guides?Claude Code · Codex · OpenCode · Cursor CLI
Weekly digest3.5k readers

Catch up on AI

Curated AI updates on agents, skills, and MCP — delivered to your inbox. Unsubscribe anytime.


Three prefix types: /, @, and !

Gemini CLI uses three command prefixes with different roles:

PrefixRoleExamples
/Meta-level CLI control/model, /plan, /compress, custom /review
@Inject file/directory content into prompt@src/api.ts Explain this module
!Execute shell commands!git status, ! toggles shell mode

Slash commands control the CLI itself. @ and ! are input patterns that shape what reaches the model or your system shell.


How slash commands fit a typical workflow

mermaid
flowchart LR
  A[Setup /init /memory /mcp] --> B[Work /model /plan /compress]
  B --> C[Context @files /ide /directory]
  C --> D[Parallel /agents /shells]
  D --> E[Undo /restore /rewind]
  E --> F[Sessions /resume /clear /quit]

First session in a repo

StepCommandWhat it does
1/initGenerate a GEMINI.md scaffold for project-specific instructions
2/memory showInspect loaded hierarchical memory
3/permissions trustManage folder trust settings
4/mcp listList configured MCP servers and tools
5/skills listDiscover enabled agent skills

During a task

CommandPurpose
/model setChoose and optionally persist active model
/planSwitch to Plan Mode (read-only); view approved plan
/compressReplace chat context with summary to save tokens
/statsSession token usage, tool calls, performance
@<path>Inject file or directory content into prompt
/tools descList available tools with descriptions

Parallel work and subagents

CommandPurpose
/agents listList built-in, local, and remote subagents
/agents enable|disable|configControl subagent behavior
/shellsToggle background shells view for long-running processes

Before you ship

CommandPurpose
/restore [tool_call_id]Revert files to pre-tool state (checkpointing)
/rewindNavigate backward through history; revert chat and/or code
/setup-githubConfigure GitHub Actions for issue triage and PR review

Between sessions

CommandPurpose
/resumeBrowse auto-saved sessions; manage manual checkpoints
/chat save|resume|listAlias for /resume checkpoint subcommands
/clearClear terminal and visible history (Ctrl+L)
/quit or /exitExit; --delete removes session history and temp files

Setup, memory, and project context

CommandPurpose
/initAnalyze directory and generate tailored GEMINI.md
/memory showDisplay concatenated hierarchical memory from all GEMINI.md files
/memory refreshReload memory from global, project, and subdirectory files
/memory listList paths of active GEMINI.md files
/permissions trust [path]Manage folder trust settings
/policies listList active policies grouped by mode
/privacyPrivacy notice and data collection consent
/directory add|showMulti-directory workspace (alias: /dir)
/authChange authentication method

Memory hierarchy: Gemini CLI loads GEMINI.md from global, project/ancestor, and subdirectory locations—similar to CLAUDE.md and MEMORY.md patterns. Codex uses AGENTS.md; Gemini uses GEMINI.md.

Multi-directory: /directory add supports absolute paths, relative paths, and ~ home references. Disabled in restrictive sandbox profiles—use --include-directories at launch instead.


Model, plan, and session control

CommandPurpose
/model manageOpen model configuration dialog
/model set [--persist]Set active model
/planEnter Plan Mode (read-only); disable via general.plan.enabled
/plan copyCopy approved plan to clipboard
/compressSummarize entire chat context to save tokens
/copyCopy last Gemini output to clipboard
/stats [session|model|tools]Detailed usage statistics
/upgradeOpen Gemini Code Assist upgrade page (Google login only)

Plan mode is enabled by default. Use it the same way you'd use /plan in Codex or Claude Code—propose execution before implementation.


Session, resume, and checkpointing

CommandPurpose
/resumeInteractive session browser for auto-saved conversations
/chatAlias for /resume with same subcommands
/chat save <tag>Save manual checkpoint with tag
/chat resume <tag>Resume tagged checkpoint (project-scoped)
/chat listList manual checkpoint tags
/chat delete <tag>Delete saved checkpoint
/chat share [file]Export conversation to Markdown or JSON
/chat debugExport most recent API request as JSON
/restore [tool_call_id]Revert files to pre-tool state
/rewindReview past interactions; revert chat and/or code (Esc Esc)
/clearClear terminal screen and visible history
/quit, /exitExit CLI
/quit --deleteExit and permanently delete session history

Auto-save vs manual checkpoints: Conversations are automatically saved as you chat—run /resume to browse them. Manual /chat save <tag> checkpoints are project-scoped and stored under ~/.gemini/tmp/<project>/.

/restore vs /rewind: /restore reverts file changes from a specific tool call. /rewind navigates conversation history and can revert chat state, code changes, or both.

See Claude Code restore/checkpoint guide for the Anthropic equivalent.


Skills, MCP, extensions, and tools

CommandPurpose
/skills list|enable|disable|reloadManage agent skills
/mcp list|desc|schemaList MCP servers and tools
/mcp enable|disable|reload|authManage MCP server state and OAuth
/extensions list|install|enable|disable|updateManage Gemini CLI extensions
/tools [desc|nodesc]List available tools
/hooks list|enable|disableManage lifecycle hooks
/commands list|reloadList and reload custom .toml slash commands

Run /commands reload after adding or modifying custom commands without restarting the CLI.


IDE, editor, and TUI customization

CommandPurpose
/ide install|enable|disable|statusManage IDE integration
/editorSelect supported editor
/vimToggle Vim mode (saved to ~/.gemini/settings.json)
/settingsOpen settings editor for .gemini/settings.json
/themeChange visual theme
/terminal-setupMultiline input keybindings (VS Code, Cursor, Windsurf)
/docsOpen Gemini CLI documentation in browser
/aboutVersion info for issue filing
/bug [headline]File GitHub issue; customizable via advanced.bugCommand

Custom slash commands (.toml)

Custom commands are Gemini CLI's distinguishing feature—reusable prompts defined in TOML files, announced July 31, 2025 by Google Developer Advocates Jack Wotherspoon and Abhi Patel.

Install latest Gemini CLI

bash
# npx (no global install)
npx @google/gemini-cli

# global npm
npm install -g @google/gemini-cli@latest

Scopes

ScopeDirectoryAvailability
User~/.gemini/commands/All projects for this user
Project.gemini/commands/Current project only (check into Git)

Minimal .toml structure

Only two keys are required: description and prompt.

toml
# ~/.gemini/commands/plan.toml
description = "Investigates and creates a strategic plan to accomplish a task."
prompt = """
Your primary role is that of a strategist, not an implementer.
Your task is to devise a comprehensive strategic plan for: {{args}}

You MUST NOT write, modify, or execute any code.

Present your plan with: Understanding the Goal, Investigation & Analysis,
Proposed Strategic Approach, Verification Strategy, and Anticipated Challenges.
"""

Usage:

bash
/plan How can I make the project more performant?

Template variables

SyntaxPurposeExample
{{args}}User arguments after command name/review 42 → args = 42
!{shell}Inline shell command output in prompt!{git log --pretty=format:"%s" -n 5}

PR review example (from Google Cloud blog)

toml
# .gemini/commands/review.toml
description = "Reviews a pull request based on issue number."
prompt = """
Please provide a detailed pull request review on GitHub issue: {{args}}.

Follow these steps:
1. Use `gh pr view {{args}}` to pull PR information.
2. Use `gh pr diff {{args}}` to view the diff.
3. Understand intent from the PR description.
4. Verify title follows Conventional Commits. Recent commits:
   !{git log --pretty=format:"%s" -n 5}
5. Search the codebase if required.
6. Write a concise review encouraging strong code quality.
7. Use `gh pr comment {{args}} --body {{review}}` to post the review.
"""

Invoke with /review 123.

Namespacing

File path relative to commands/ determines the command name. Path separators become colons:

File pathCommand
.gemini/commands/test.toml/test
.gemini/commands/git/commit.toml/git:commit

Command names are case-sensitive.

After creating commands:

bash
/commands list
/commands reload

MCP prompts as slash commands

Gemini CLI exposes MCP server prompts as slash commands automatically. The MCP prompt name and description become the command name and help text.

MCP prompt arguments support named and positional forms:

bash
/research --topic="quantum computing"
/research quantum computing

This integrates with FastMCP Python servers and any MCP-compliant prompt provider. Reload with /commands reload after MCP server changes.


At commands (@): file injection

PatternPurpose
@path/to/file.txtInject single file content into prompt
@src/my_project/Read directory contents recursively
@README.md What is this project?File reference mid-prompt

Git-aware filtering: By default, git-ignored files (node_modules/, dist/, .env) are excluded. Configure via context.fileFiltering in settings.

Spaces in paths: Escape with backslash: @My\ Documents/file.txt

Uses the read_many_files tool internally. Binary and very large files may be skipped or truncated.


Shell mode (!): passthrough commands

PatternPurpose
!git statusRun single shell command; output shown in terminal
!ls -laExecute and return to Gemini CLI
! (alone)Toggle shell mode—commands run directly until exited

Shell mode sets GEMINI_CLI=1 in the subprocess environment so scripts can detect they're running inside Gemini CLI.

Platform: Linux/macOS uses bash; Windows uses powershell.exe -NoProfile -Command unless ComSpec is overridden.


Complete built-in slash command reference

Every built-in command from the official reference as of June 2026.

CommandPurpose
/aboutVersion info for issue filing
/agents list|reload|enable|disable|configManage subagents
/authChange authentication method
/bug [headline]File GitHub issue
/chatAlias for /resume
/clearClear terminal and visible history (Ctrl+L)
/commands list|reloadManage custom .toml commands
/compressSummarize chat context to save tokens
/copyCopy last output to clipboard
/directory add|showMulti-directory workspace (/dir)
/docsOpen documentation in browser
/editorSelect supported editor
/extensionsInstall, enable, disable, update extensions
/help, /?Display help
/hooks list|enable|disable|enable-all|disable-allManage lifecycle hooks
/ide install|enable|disable|statusIDE integration
/initGenerate GEMINI.md scaffold
/mcp list|desc|schema|enable|disable|reload|authMCP server management
/memory show|refresh|listHierarchical GEMINI.md memory
/model manage|set [--persist]Model configuration
/permissions trust [path]Folder trust settings
/plan, /plan copyPlan Mode (read-only)
/policies listActive policies by mode
/privacyPrivacy notice and consent
/quit, /exit [--delete]Exit CLI
/restore [tool_call_id]Revert file changes from tool call
/rewindNavigate conversation history (Esc Esc)
/resumeSession browser and checkpoints
/settingsEdit .gemini/settings.json
/shells, /bashesBackground shells view
/setup-githubGitHub Actions triage and PR review
/skills list|enable|disable|reloadAgent skills
/stats session|model|toolsUsage statistics
/terminal-setupMultiline input keybindings
/themeVisual theme picker
/tools [desc|nodesc]List available tools
/upgradeGemini Code Assist upgrade page
/vimToggle Vim mode for input

Custom commands: Any .toml in ~/.gemini/commands/ or .gemini/commands/ plus MCP prompts discovered at runtime.


Four-way comparison: Gemini CLI vs Codex vs Claude Code vs OpenCode

TaskGemini CLICodexClaude CodeOpenCode
Project memory/init → GEMINI.md/init → AGENTS.md/init → CLAUDE.md/init → AGENTS.md
Custom commands.toml in .gemini/commands/Skills/pluginsSkills.md in .opencode/commands/
Plan before coding/plan/plan/plancustom cmd + agent: plan
Autonomous target—/goal/goalcustom cmd + agent
Free context/compress/compact/compact/compact
Switch model/model set/model/model + /effort/models
File attachment@path/mention, /ide/ide@path
Shell passthrough!command——!command
Undo file changes/restore, /rewind—/rewind/undo, /redo
Share session/chat share/export/export/share

Full references: Gemini CLI · Codex · Claude Code · OpenCode


Commands worth memorizing first

bash
/init                          # GEMINI.md scaffold
/memory show                   # inspect loaded context
/model set                     # pick the right model
/plan                          # read-only planning mode
/compress                      # free context mid-session
@src/main.ts Explain this file # attach code to prompt
!git status                    # quick shell check
/agents list                   # see subagents
/resume                        # pick up yesterday's thread
/commands reload               # after adding custom .toml

Quick custom command starter

bash
mkdir -p ~/.gemini/commands
cat > ~/.gemini/commands/plan.toml << 'EOF'
description = "Strategic plan only—no implementation."
prompt = "Create a step-by-step plan for: {{args}}. Do NOT write code."
EOF
/commands reload
/plan Refactor the auth module

Related explainx.ai guides

  • Claude Code commands reference — Anthropic CLI counterpart
  • Codex slash commands reference — OpenAI CLI counterpart
  • OpenCode slash commands reference — open-source TUI counterpart
  • Cursor CLI slash commands reference — Cursor terminal counterpart
  • What is MCP? — /mcp and MCP prompts as slash commands
  • What are agent skills? — /skills authoring patterns
  • What is MEMORY.md? — hierarchical memory patterns
  • Goal mode complete guide — /goal on Codex and Claude Code
  • Loop engineering — scheduled and verification loops
  • Google Antigravity vs Gemini CLI — 2026 migration context

Primary sources: Commands — Gemini CLI Docs · Custom slash commands — Google Cloud Blog · Gemini CLI GitHub


Summary

Gemini CLI slash commands span built-in session control (/model, /plan, /compress), custom .toml workflows (/review, /git:commit), MCP prompt integration, and @ / ! input patterns for file injection and shell passthrough. The .toml system—with {{args}} templating and !{shell} injection—is the most extensible custom-command model among the three major agentic CLIs.

Type /help to discover what your build exposes. Treat geminicli.com/docs as source of truth; bookmark this guide alongside the Claude Code, Codex, OpenCode, and Cursor CLI references for cross-platform work.


Command names, custom command syntax, and Antigravity migration status reflect Google documentation and the July 2025 Cloud blog as of June 11, 2026. Re-check the Gemini CLI changelog before documenting internal runbooks.

Yash Thakker

Written by

Yash Thakker

Yash is an AI expert with over 300K learners. Join his workshops →

Related posts

Jun 11, 2026

Claude Code Commands: Complete Slash Command Reference (2026)

Claude Code exposes 90+ slash commands for setup, parallel agents, review, memory, and shipping. This is the complete reference: what each command does, when to use it, and how they fit a typical workflow.

Jun 11, 2026

Codex Slash Commands: Complete CLI Reference (2026)

Codex CLI exposes 40+ slash commands for models, permissions, goals, subagents, review, and session control. This is the complete reference: what each command does, when to use it, and how they fit a typical workflow.

Jun 11, 2026

Cursor CLI Slash Commands: Complete Reference (2026)

Cursor CLI exposes 25+ slash commands for Plan/Ask modes, models, sandbox, MCP, rules, and session control. This is the complete reference from official docs plus how commands fit a typical workflow.