Gemini CLI Tutorial #7 - Custom Commands

| Programming | December 23, 2025 | 5.03 Thousand views | 11:38

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
13:05
The Net Ninja The Net Ninja

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.

3 months ago · 8 points
new p5.js 2 functions: textWeight, textContours, textModel
2:37:21
The Net Ninja The Net Ninja

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.

6 months ago · 8 points

More in Programming

View all
Deploying AI Models with Hugging Face – Hands-On Course
6:53:14
freeCodeCamp.org freeCodeCamp.org

Deploying AI Models with Hugging Face – Hands-On Course

This hands-on tutorial demonstrates how to navigate the Hugging Face ecosystem to deploy AI models, focusing on text generation with GPT-2 using both high-level Pipeline APIs and low-level tokenization workflows. The course covers practical implementation details including subword tokenization mechanics and the platform's three core components: Models, Datasets, and Spaces.

about 4 hours ago · 9 points
Claude Code Tutorial - Build Apps 10x Faster with AI
58:11
Programming with Mosh Programming with Mosh

Claude Code Tutorial - Build Apps 10x Faster with AI

Mosh Hamadani demonstrates how Claude Code enables developers to build production-grade software 10x faster by constructing a full-stack AI-powered support ticket system, emphasizing that AI augments rather than replaces software engineering fundamentals.

1 day ago · 10 points