Gemini Custom Slash Commands Skill
Gemini Custom Slash Commands allow you to extend the Gemini CLI with your own reusable workflows. These commands are
defined in .toml files and can execute complex prompts, run shell commands, and read file contents.
{{args}} to pass user input into specific parts of the prompt.!{cmd} and inject their output.@{path}.Commands are defined in TOML files located in:
.gemini/commands/ (Takes precedence, version controlled).~/.gemini/commands/ (Global availability).status.toml -> /statusgit/commit.toml -> /git:commitA command file consists of metadata and the prompt definition.
description = "Brief description of what the command does"
# The prompt sent to the model.
# Use triple quotes """ for multi-line strings.
prompt = """
Instructions for the agent.
...
"""
{{args}})Explicit Injection: Use {{args}} to place the user's input exactly where needed.
prompt = "Explain this concept: {{args}}"
Default Behavior: If {{args}} is NOT present, the user's input is appended to the end of the prompt.
!{cmd})Execute shell commands and insert their output into the prompt.
Security Note: {{args}} inside !{...} is automatically shell-escaped.
prompt = """
Summarize the following git diff:
!{git diff {{args}}}
"""
@{path})Read file or directory contents and insert them into the prompt.
prompt = """
Review this code file:
@{src/main.rs}
"""
# ~/.gemini/commands/explain.toml
description = "Explain a concept simply"
prompt = """
Explain the following concept to a 5-year old:
{{args}}
"""
Usage: /explain quantum physics
# .gemini/commands/review.toml
description = "Review staged changes"
prompt = """
Please review the staged changes in this git repository.
Focus on security and performance.
Changes:
!{git diff --staged}
"""
Usage: /review
# .gemini/commands/analyze-logs.toml
description = "Analyze logs for errors"
prompt = """
Analyze these logs for critical errors:
!{tail -n 50 /var/log/syslog}
"""
Usage: /analyze-logs
daily-brief.toml).description field helps you identify the command in /help.{{args}}: For precise control over where user input goes.!{...} to fetch dynamic data (git status, logs, etc.).This skill provides everything you need to create your own custom Gemini CLI slash commands!