Back to Skills

fire-patterns

verified

Auto-generated CLI patterns using Google Fire with class-based structure, docstring parsing, and nested classes. Use when building Python CLI applications, creating Fire CLIs, implementing auto-generated commands, designing class-based CLIs, or when user mentions Fire, Google Fire, CLI generation, docstring commands, nested command groups, or Python command-line tools.

View on GitHub

Marketplace

cli-builder

vanman2024/cli-builder

Plugin

cli-builder

development

Repository

vanman2024/cli-builder

plugins/cli-builder/skills/fire-patterns/SKILL.md

Last Verified

January 22, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/vanman2024/cli-builder/blob/main/plugins/cli-builder/skills/fire-patterns/SKILL.md -a claude-code --skill fire-patterns

Installation paths:

Claude
.claude/skills/fire-patterns/
Powered by add-skill CLI

Instructions

# fire-patterns

Provides patterns for building Python CLI applications using Google Fire with automatic command generation from class methods, docstring-based help text, nested class structures for command groups, and rich console output integration.

## Core Patterns

### 1. Class-Based Fire CLI with Docstring Parsing

Fire automatically generates CLI commands from class methods and extracts help text from docstrings:

```python
import fire
from rich.console import Console

console = Console()

class MyCLI:
    """A powerful CLI tool with auto-generated commands"""

    def __init__(self):
        self.version = "1.0.0"
        self.config = {}

    def init(self, template='basic'):
        """Initialize a new project

        Args:
            template: Project template to use (default: basic)
        """
        console.print(f"[green]✓[/green] Initializing project with {template} template...")
        return {"status": "success", "template": template}

    def deploy(self, environment, force=False, mode='safe'):
        """Deploy to specified environment

        Args:
            environment: Target environment (dev, staging, prod)
            force: Force deployment without confirmation (default: False)
            mode: Deployment mode - fast, safe, or rollback (default: safe)
        """
        console.print(f"[cyan]Deploying to {environment} in {mode} mode[/cyan]")
        if force:
            console.print("[yellow]⚠ Force mode enabled - skipping confirmation[/yellow]")
        return {"environment": environment, "mode": mode, "forced": force}

if __name__ == '__main__':
    fire.Fire(MyCLI)
```

**Usage:**
```bash
python mycli.py init --template=react
python mycli.py deploy production --force
python mycli.py deploy staging --mode=fast
python mycli.py --help  # Auto-generated from docstrings
```

### 2. Nested Class Structure for Command Groups

Organize related commands using nested classes:

```python
import fire
from rich.console import Console

cons

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
10692 chars