Gemini CLI Tutorial #7 - Custom Commands
TL;DR
This tutorial demonstrates how to extend Gemini CLI by creating custom slash commands stored as TOML files in `.gemini/commands/`, enabling complex automated workflows like UI component generation with integrated testing, git branching, and preview rendering through structured multi-step prompts.
📁 Command Setup & File Structure 2 insights
Create .gemini/commands directory
Store custom command files in `.gemini/commands/` within your project root, with each command defined as a separate TOML file.
Filename determines command name
The TOML filename becomes the slash command (e.g., `component.toml` creates `/component`), requiring a CLI restart to register new commands.
⚙️ Command Configuration & Arguments 2 insights
Required TOML structure
Each file requires a `description` field (shown in CLI autocomplete) and a `prompt` field containing the multi-line instructions sent to the model.
Accessing user input
The `{{args}}` placeholder captures text entered after the command name, enabling dynamic prompts based on user specifications.
🔄 Advanced Workflow Automation 2 insights
Multi-step automated workflows
Commands can chain shell commands, manage git workflows, generate code, create test files, and render previews in a single execution.
Context-aware execution
The example validates clean git state before proceeding, derives kebab-case branch names from descriptions, and only renders components after all tests pass.
▶️ Execution & Validation 2 insights
Autocomplete integration
Custom commands appear in CLI suggestions with descriptions when typing `/`, and support arrow-key history navigation for quick reuse.
Sandbox approval workflow
Each shell command requires user approval (with 'allow always' option), and the model provides a summary of completed actions at the end.
Bottom Line
Create reusable automation workflows by storing detailed prompt templates as TOML files in `.gemini/commands/`, using `{{args}}` for dynamic input to chain shell commands, git operations, and code generation into single slash commands.
More from The Net Ninja
View all
Gemini CLI Tutorial #9 - MCP Servers & Extensions
This tutorial explains how to extend Gemini CLI beyond local codebase interaction using MCP (Model Context Protocol) servers to connect with external APIs like Firebase, and demonstrates how to install Gemini CLI extensions that bundle MCP servers with custom commands and context files.
new p5.js 2 functions: textWeight, textContours, textModel
Dan Schiffman outlines The Coding Train's return to regular content, detailing a sustainable workflow of converting live streams into edited tutorials, dual-path teaching strategies for p5.js 2.0 features like async/await and variable fonts, and a 2026 roadmap involving a studio move to enable physical computing.
More in Programming
View all
Tanstack Start Course Course
TanStack Start is a full-stack React framework powered by TanStack Router that provides SSR and server functions as a lightweight alternative to Next.js. Its isomorphic execution model runs code on both server and client, requiring specific patterns to handle server-only operations safely.
Open Models Coding Essentials – Running LLMs Locally and in the Cloud Course
Andrew Brown tests open-source coding models including Gemma 4, Kimi 2.5, and Qwen across local and cloud deployments to evaluate viable alternatives to proprietary solutions, finding that while some models perform surprisingly well, hardware constraints make cloud hosting the practical choice for most developers.