Slash Command Encoder (Enhanced)
Overview
Creates fast, scriptable /command interfaces for micro-skills, cascades, and agents. This enhanced version includes automatic skill discovery, intelligent command generation, parameter validation, multi-model routing, and command chaining patterns.
Philosophy: Expert Efficiency
Command Line UX for AI: Expert users benefit from fast, precise, scriptable interfaces over natural language when performing repeated operations.
Enhanced Capabilities:
- Auto-Discovery: Scans and catalogs all installed skills automatically
- Intelligent Routing: Commands invoke optimal AI/agent for task
- Parameter Validation: Type-checked, auto-completed parameters
- Command Chaining: Compose commands into pipelines
- Multi-Model Integration: Direct access to Gemini/Codex via commands
Key Principles:
- Fast and unambiguous invocation
- Self-documenting through naming
- Composable and scriptable
- Type-safe parameter handling
- Muscle memory for power users
When to Create Slash Commands
✅ Perfect For:
- Operations performed repeatedly (daily/weekly)
- Workflows that need exact parameters
- Tasks requiring scriptable automation
- Commands that compose into pipelines
- Expert user shortcuts
❌ Don't Use For:
- One-off exploratory tasks
- Operations needing natural language nuance
- Tasks better suited to interactive dialogue
Enhanced Creation Workflow
Step 1: Auto-Discovery Phase
Scan Installed Skills:
# Discovery algorithm
scan_directories:
- ~/.claude/skills/*/SKILL.md
- .claude/skills/*/SKILL.md
extract_metadata:
- name (command base)
- description (help text)
- inputs (parameters)
- outputs (return types)
- integration_points (routing)
Catalog Generation:
discovered_skills:
micro_skills: [extract-data, validate-api, refactor-code, ...]
cascades: [audit-pipeline, code-quality-swarm, ...]
agents: [root-cause-analyzer, code-reviewer, ...]
multi_model: [gemini-megacontext, codex-auto, ...]
Step 2: Command Design (Enhanced)
A. Naming Conventions
Category Prefixes:
# Data operations
/extract-json, /validate-csv, /transform-xml
# Code operations
/lint-python, /test-coverage, /refactor-imports
# Agent invocation
/agent-rca, /agent-reviewer, /agent-architect
# Multi-model
/gemini-search, /codex-auto, /claude-reason
# Workflows
/audit-pipeline, /deploy-prod, /quality-check
Naming Rules:
- Verb-noun pattern:
/validate-api,/extract-data - Agent prefix:
/agent-<specialty> - Model prefix:
/gemini-*,/codex-* - Workflow descriptive:
/audit-pipeline - Max 3 words, hyphenated
B. Parameter Design
Parameter Types:
positional:
- file_path (required, validated)
- target (required, validated)
flags:
--strict: boolean
--format: enum[json, csv, xml]
--output: file_path
options:
--config: json_object
--schema: file_path
--model: enum[claude, gemini, codex]
Validation Schema:
interface CommandParameter {
name: string
type: 'string' | 'number' | 'boolean' | 'file_path' | 'enum'
required: boolean
default?: any
validation?: RegExp | ((value: any) => boolean)
description: string
completion?: () => string[] // Auto-complete options
}
C. Multi-Model Routing
Model Selection Flags:
# Explicit model selection
/analyze src/ --model gemini-megacontext # Large context
/prototype feature.spec --model codex-auto # Rapid prototyping
/reason bug-report.md --model codex-reasoning # Alternative view
/review code.js --model claude # Best reasoning (default)
# Auto-select based on task
/analyze-large-codebase # Auto-routes to gemini-megacontext
/rapid-prototype # Auto-routes to codex-auto
/search-current-info # Auto-routes to gemini-search
Step 3: Command Implementation Structure
Command Definition Template:
command:
name: /command-name
version: 1.0.0
description: |
Brief description of what this command does
category: data | code | agent | workflow | multi-model
parameters:
- name: input
type: file_path
required: true
validation: file_exists
description: Input file to process
- name: --strict
type: boolean
default: false
description: Enable strict validation
- name: --model
type: enum
options: [claude, gemini-megacontext, gemini-search, codex-auto]
default: auto-select
description: AI model to use
routing:
type: micro-skill | cascade | agent | multi-model
target: skill-name | cascade-name | agent-name
model_selection: auto | explicit
binding:
parameter_mapping:
file: ${input}
strictness: ${--strict}
model: ${--model}
output:
format: json | text | file
validation: schema | none
examples:
- command: /command-name input.json --strict
description: Process input.json with strict validation
composition:
chainable: true
pipe_output: stdout
pipe_input: stdin
Step 4: Command Chaining & Composition
Pipeline Patterns:
# Sequential pipeline
/extract data.json | /validate --strict | /transform --format csv > output.csv
# Parallel fan-out
/analyze src/ --parallel [/lint + /security-scan + /test-coverage] | /merge-reports
# Conditional branching
/validate input.json && /deploy-prod || /generate-error-report
# Multi-stage workflow
/audit-pipeline src/ \
--phase theater-detection \
--phase functionality-audit --model codex-auto \
--phase style-audit \
--output report.json
Composition Interface:
interface ChainableCommand {
execute: (input: any) => Promise<CommandResult>
pipe: (next: Command) => ChainableCommand
parallel: (commands: Command[]) => ParallelCommand
conditional: (condition: boolean, ifTrue: Command, ifFalse: Command) => ConditionalCommand
}
Step 5: Auto-Completion & Help
Completion System:
# File path completion
/validate <TAB> # Shows files matching pattern
# Parameter completion
/analyze --<TAB> # Shows available flags
# Model completion
/analyze --model <TAB> # Shows [claude, gemini-megacontext, codex-auto, ...]
# Command discovery
/<TAB> # Shows all available commands by category
Help Generation:
/help command-name
Command: /validate-api
Version: 1.0.0
Category: Data Operations
Description:
Validates API responses against OpenAPI schemas using specialist validation agent
Usage:
/validate-api <file> [--schema <schema_file>] [--strict] [--model <model>]
Parameters:
file Path to API response file (required)
--schema FILE OpenAPI schema file (default: auto-detect)
--strict Enable strict validation mode
--model MODEL AI model [claude|gemini|codex] (default: auto)
Examples:
/validate-api response.json
/validate-api response.json --schema openapi.yaml --strict
/validate-api response.json --model gemini-megacontext
Chains with:
/extract-data → /validate-api → /transform-data
See also:
/validate-csv, /validate-json, /agent-validator
Enhanced Command Templates
1. Data Processing Commands
Template:
command: /process-<datatype>
category: data
routing:
type: micro-skill
target: process-<datatype>
parameters:
- input: file_path (required)
- --format: enum[json, csv, xml]
- --schema: file_path
- --output: file_path
- --model: enum[claude, gemini, codex]
examples:
/extract-json data.json --schema schema.json
/validate-csv data.csv --strict --output report.json
/transform-xml data.xml --format json
Generated Commands:
/extract-json,/extract-csv,/extract-xml/validate-json,/validate-csv,/validate-api/transform-json,/transform-csv,/transform-xml
2. Code Operation Commands
Template:
command: /code-<operation>
category: code
routing:
type: micro